query-0c5ef28c93bb8ead19fe853a61f3cdb0

rq turtle/ttl

title:Booker winners and nominees (book) not in English Wikipedia but in other Wikipedias SELECT DISTINCT ?item ?itemLabel ?awardLabel ?rel ?langname ?wp WHERE { hint:Query hint:optimizer "None" . VALUES ?award{wd:Q160082 wd:Q2052291} { ?item wdt:P166 ?award. BIND("won" AS ?rel) } UNION{ ?item wdt:P1411 ?award. BIND("nominated" AS ?rel) } MINUS{?item wdt:P31 wd:Q5} MINUS{?enwp schema:about ?item ; schema:isPartOf https://en.wikipedia.org/} ?wp schema:about ?item; schema:inLanguage ?langcode . OPTIONAL { ?language wdt:P218 ?langcode; rdfs:label ?langlabel FILTER(lang(?langlabel) = "en") } # Convert short code to full language name BIND(COALESCE(?langlabel, ?langcode) AS ?langname) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?itemLabel

Use at

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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Booker winners and nominees (book) not in English Wikipedia but in other Wikipedias
SELECT DISTINCT ?item ?itemLabel ?awardLabel ?rel ?langname ?wp WHERE {

  VALUES ?award{wd:Q160082 wd:Q2052291}
 { ?item wdt:P166 ?award. BIND("won" AS ?rel) }
UNION{ ?item wdt:P1411 ?award. BIND("nominated" AS ?rel) }
  MINUS{?item wdt:P31 wd:Q5}
  MINUS{?enwp schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/>}
    ?wp schema:about ?item; schema:inLanguage ?langcode .
OPTIONAL { ?language wdt:P218 ?langcode; rdfs:label ?langlabel FILTER(lang(?langlabel) = "en") } # Convert short code to full language name
  BIND(COALESCE(?langlabel, ?langcode) AS ?langname)
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?award") v6("?enwp") v4("?item"):::projected v1("?itemLabel"):::projected v8("?langcode") v2("?langlabel") v10("?langname"):::projected v9("?language") v6("?rel"):::projected v7("?wp"):::projected c8([https://en.wikipedia.org/]):::iri c13(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?award/] bind0-->v3 bind00(["wd:Q160082"]) bind00 --> bind0 bind01(["wd:Q2052291"]) bind01 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P1411"--> v3 bind1[/"'nominated'"/] bind1 --as--o v6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P166"--> v3 bind2[/"'won'"/] bind2 --as--o v6 end union0r <== or ==> union0l end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P31"--> c5 end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v6 --"schema:about"--> v4 v6 --"schema:isPartOf"--> c8 end v7 --"schema:about"--> v4 v7 --"schema:inLanguage"--> v8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v9 -."wdt:P218".-> v8 v9 --"rdfs:label"--> v2 end bind5[/"?langlabel?langcode"/] v2 --o bind5 v8 --o bind5 bind5 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end