query-5c1619da943b61239d9ead1306e8bdcf

rq turtle/ttl

title:Other awards won by Booker winners (people) SELECT DISTINCT ?item ?itemLabel ?awardLabel ?otherawardLabel (YEAR(?time) AS ?year) WHERE { VALUES ?award{wd:Q160082 wd:Q2052291} ?item wdt:P166 ?award.

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

?item wdt:P31 wd:Q5. ?item p:P166 ?s.?s ps:P166 ?otheraward FILTER(?otheraward NOT IN(wd:Q160082, wd:Q2052291)) OPTIONAL{?s pq:P585 ?time} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?itemLabel ?year

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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:Other awards won by Booker winners (people)
SELECT DISTINCT ?item ?itemLabel ?awardLabel ?otherawardLabel (YEAR(?time) AS ?year) WHERE {
  VALUES ?award{wd:Q160082 wd:Q2052291}
  ?item wdt:P166 ?award.
#UNION{ ?item wdt:P1411 ?award. BIND("nominated" AS ?rel) }
  ?item wdt:P31 wd:Q5.
  ?item p:P166 ?s.?s ps:P166 ?otheraward FILTER(?otheraward NOT IN(wd:Q160082, wd:Q2052291))
  OPTIONAL{?s pq:P585 ?time}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} ORDER BY ?itemLabel ?year

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 v3("?otheraward") v6("?s") v7("?time"):::projected v8("?year") c10(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?otheraward != 'wd:Q160082'?otheraward != 'wd:Q2052291'"]] f0 --> v3 bind1[/VALUES ?award/] bind1-->v4 bind10(["wd:Q160082"]) bind10 --> bind1 bind11(["wd:Q2052291"]) bind11 --> bind1 v5 --"p:direct/P166"--> v4 v5 --"p:direct/P31"--> c5 v5 --"p:P166"--> v6 v6 --"p:statement/P166"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P585".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind2[/"year-from-dateTime(?time)"/] v7 --o bind2 bind2 --as--o v8