query-8f07ba3bbcb64e808ae83cff42c453e1

rq turtle/ttl

title:English Wikipedia articles about Booker winners and nominees (people) SELECT DISTINCT ?item ?itemLabel ?awardLabel (MAX(?rel) AS ?outcome) ?enwp 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) } ?item wdt:P31 wd:Q5. ?enwp schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?item ?itemLabel ?awardLabel ?enwp 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 bd: <http://www.bigdata.com/rdf#>
#title:English Wikipedia articles about Booker winners and nominees (people)
SELECT DISTINCT ?item ?itemLabel ?awardLabel (MAX(?rel) AS ?outcome) ?enwp WHERE {

  VALUES ?award{wd:Q160082 wd:Q2052291}
 { ?item wdt:P166 ?award. BIND("won" AS ?rel) }
UNION{ ?item wdt:P1411 ?award. BIND("nominated" AS ?rel) }
  ?item wdt:P31 wd:Q5.
  ?enwp schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/>
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?item ?itemLabel ?awardLabel ?enwp
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?award") v5("?enwp"):::projected v3("?item"):::projected v1("?itemLabel"):::projected v6("?outcome") v5("?rel"):::projected c7([https://en.wikipedia.org/]):::iri c9(["bd:serviceParam"]):::iri c4(["wd:Q5"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?award/] bind0-->v2 bind00(["wd:Q160082"]) bind00 --> bind0 bind01(["wd:Q2052291"]) bind01 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P1411"--> v2 bind1[/"'nominated'"/] bind1 --as--o v5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P166"--> v2 bind2[/"'won'"/] bind2 --as--o v5 end union0r <== or ==> union0l end v3 --"wdt:P31"--> c4 v5 --"schema:about"--> v3 v5 --"schema:isPartOf"--> c7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind4[/"max(?rel)"/] v5 --o bind4 bind4 --as--o v6