query-5617b457791629b71d1215b2cee55968

rq turtle/ttl

23:49, 18 February 2019 (UTC)) talk (MartinPoulterThe MINUS clause here seems to have no effect. Yet when I try this with a given language (filter for LANG(?title)="en" and also for LANG(?itemLabel)="en") it works, and only gets books with an English title but no English label. PS Now fixed by replacing MINUS{} with FILTER {NOT EXISTS{}}. I must not understand how MINUS works. Books with a title in a given language but not a label in that language

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?lang ?title WHERE {
?item wdt:P31/wdt:P279* wd:Q571 ; # Q571 for book
      wdt:P1476 ?title .
  BIND(LANG(?title) as ?lang) FILTER (?lang != "und")
FILTER (NOT EXISTS{ ?item rdfs:label ?itemLabel. FILTER(lang(?itemLabel) = ?lang) })
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v1("?itemLabel") v5("?lang"):::projected v4("?title"):::projected a1((" ")) c5(["wd:Q571"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["?itemLabel = ?lang"]] e0f0 --> e0v1 e0f0 --> e0v2 e0v3 --"rdfs:label"--> e0v1 e0v3("?item"):::projected e0v1("?itemLabel"):::projected e0v2("?lang"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> v5 f0 --> v3 f0 --> c1 f1[["?itemLabel = ?lang"]] f1 --> v1 f1 --> v5 v3 --"rdfs:label"--> v1 f2[["?lang != 'und'"]] f2 --> v5 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 v3 --"wdt:P1476"--> v4 bind3[/"?title"/] v4 --o bind3 bind3 --as--o v5