query-ffdab878dc1230bf3550791a4d5822fe

rq turtle/ttl

title:Booker Prize winners and nominees (books) lacking an English Wikipedia article SELECT DISTINCT ?item ?itemLabel ?awardLabel ?rel (YEAR(?time) as ?year) WHERE { hint:Query hint:optimizer "None" . VALUES ?award{wd:Q160082 wd:Q2052291} { ?item p:P166 ?s. ?s ps:P166 ?award. ?s pq:P585 ?time. BIND("won" AS ?rel) }

UNION{ ?item wdt:P1411 wd:Q2052291. BIND("nominated" AS ?rel) }

UNION{?item p:P1411 ?s. ?s ps:P1411 ?award. ?s pq:P1552 wd:Q115010579. ?s pq:P585 ?time. BIND("shortlist" AS ?rel) } UNION{?item p:P1411 ?s. ?s ps:P1411 ?award. ?s pq:P1552 wd:Q115010563. ?s pq:P585 ?time. BIND("longlist" AS ?rel) } MINUS{?item wdt:P31 wd:Q5} OPTIONAL { ?item wdt:P629 ?work . ?work_enwp schema:about ?work ; schema:isPartOf https://en.wikipedia.org/ } OPTIONAL { ?item_enwp schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ } FILTER (!BOUND(?item_enwp) && !BOUND(?work_enwp) ) 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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Booker Prize winners and nominees (books) lacking an English Wikipedia article
SELECT DISTINCT ?item ?itemLabel ?awardLabel ?rel (YEAR(?time) as ?year) WHERE {

  VALUES ?award{wd:Q160082 wd:Q2052291}
 { ?item p:P166 ?s. ?s ps:P166 ?award. ?s pq:P585 ?time. BIND("won" AS ?rel) }
#UNION{ ?item wdt:P1411 wd:Q2052291. BIND("nominated" AS ?rel) }
UNION{?item p:P1411 ?s. ?s ps:P1411 ?award. ?s pq:P1552 wd:Q115010579. ?s pq:P585 ?time. BIND("shortlist" AS ?rel) }
UNION{?item p:P1411 ?s. ?s ps:P1411 ?award. ?s pq:P1552 wd:Q115010563. ?s pq:P585 ?time. BIND("longlist" AS ?rel) }
  MINUS{?item wdt:P31 wd:Q5}
  OPTIONAL { ?item wdt:P629 ?work . ?work_enwp schema:about ?work ; schema:isPartOf <https://en.wikipedia.org/> }
OPTIONAL { ?item_enwp schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> }
  FILTER (!BOUND(?item_enwp) && !BOUND(?work_enwp) )
    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; v4("?award") v5("?item"):::projected v1("?itemLabel"):::projected v2("?item_enwp") v9("?rel"):::projected v6("?s") v7("?time"):::projected v9("?work") v3("?work_enwp") v10("?year") c8(["wd:Q115010563"]):::iri c14([https://en.wikipedia.org/]):::iri c16(["bd:serviceParam"]):::iri c10(["wd:Q5"]):::iri c18(["#91;AUTO_LANGUAGE#93;,en"]):::literal c7(["wd:Q115010579"]):::iri f0[["not bound(?item_enwp)not bound(?work_enwp)"]] f0 --> v2 f0 --> v3 bind1[/VALUES ?award/] bind1-->v4 bind10(["wd:Q160082"]) bind10 --> bind1 bind11(["wd:Q2052291"]) bind11 --> bind1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v5 --"p:P1411"--> v6 v6 --"p:statement/P1411"--> v4 v6 --"p:qualifier/P1552"--> c8 v6 --"p:qualifier/P585"--> v7 bind2[/"'longlist'"/] bind2 --as--o v9 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v5 --"p:P1411"--> v6 v6 --"p:statement/P1411"--> v4 v6 --"p:qualifier/P1552"--> c7 v6 --"p:qualifier/P585"--> v7 bind3[/"'shortlist'"/] bind3 --as--o v9 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v5 --"p:P166"--> v6 v6 --"p:statement/P166"--> v4 v6 --"p:qualifier/P585"--> v7 bind4[/"'won'"/] bind4 --as--o v9 end union0r <== or ==> union0l end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v5 --"p:direct/P31"--> c10 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P629".-> v9 v3 --"schema:about"--> v9 v3 --"schema:isPartOf"--> c14 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."schema:about".-> v5 v2 --"schema:isPartOf"--> c14 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c16 --"wikibase:language"--> c18 end bind6[/"year-from-dateTime(?time)"/] v7 --o bind6 bind6 --as--o v10