query-0404861bc0b5daf7f175d1cc54dc7fcd

rq turtle/ttl

find a string in the description that isn't in the label

SELECT ?search ?item ?itemLabel ?itemDescription ?instanceof ?instanceofLabel WHERE { VALUES ?text { "UNIQ" } BIND ( CONCAT(?text, ' hasdescription:en -inlabel:"', ?text, '"') as ?search ) SERVICE wikibase:mwapi # max. 10000 { bd:serviceParam wikibase:api "Search" . bd:serviceParam wikibase:endpoint "www.wikidata.org" . bd:serviceParam mwapi:srnamespace "0" . bd:serviceParam mwapi:srsearch ?search . ?item wikibase:apiOutputItem mwapi:title. } FILTER EXISTS { ?item schema:description ?desc . FILTER( lang(?desc)="en" && CONTAINS( ?desc, ?text) ) } OPTIONAL {?item wdt:P31 wd:instanceof } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .} } ORDER BY deSC(?check_text)

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# find a string in the description that isn't in the label

SELECT 
  ?search 
  ?item ?itemLabel ?itemDescription 
  ?instanceof ?instanceofLabel
WHERE
{
   VALUES ?text { "UNIQ" }
   BIND ( CONCAT(?text, ' hasdescription:en -inlabel:"', ?text, '"') as ?search  ) 
   SERVICE wikibase:mwapi  # max. 10000
   {
     bd:serviceParam wikibase:api "Search" .
     bd:serviceParam wikibase:endpoint "www.wikidata.org" .
     bd:serviceParam mwapi:srnamespace "0" .
     bd:serviceParam mwapi:srsearch ?search .
     ?item wikibase:apiOutputItem mwapi:title.
   }
   FILTER EXISTS {   ?item schema:description ?desc . 
                     FILTER( lang(?desc)="en" && CONTAINS( ?desc, ?text) ) 
                  }
   OPTIONAL {?item wdt:P31 wd:instanceof }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .}
}
ORDER BY deSC(?check_text)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?check_text") v2("?desc") v4("?item"):::projected v5("?search"):::projected v5("?text") c8(["www.wikidata.org"]):::literal c10(["0"]):::literal c4(["bd:serviceParam"]):::iri c15(["wd:instanceof"]):::iri c6(["Search"]):::literal c18(["#91;AUTO_LANGUAGE#93;,en"]):::literal c13(["mwapi:title"]):::iri f0[[" "]] subgraph f0e0["Exists Clause"] e0f0[["?desc = 'en'contains(?desc,?text)"]] e0f0 --> e0v1 e0f0 --> e0v2 e0v3 --"schema:description"--> e0v1 e0v1("?desc"):::projected e0v3("?item"):::projected e0v2("?text"):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> v5 f0 --> v4 f0 --> c2 f1[["?desc = 'en'contains(?desc,?text)"]] f1 --> v2 f1 --> v5 v4 --"schema:description"--> v2 bind2[/VALUES ?text/] bind2-->v5 bind20(["UNIQ"]) bind20 --> bind2 bind3[/"concat(?text,' hasdescription:en -inlabel:"',?text,'"')"/] v5 --o bind3 bind3 --as--o v5 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c4 --"mwapi:api"--> c6 c4 --"mwapi:endpoint"--> c8 c4 --"mwapi:srnamespace"--> c10 c4 --"mwapi:srsearch"--> v5 v4 --"mwapi:apiOutputItem"--> c13 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P31".-> c15 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c4 --"mwapi:language"--> c18 end