query-1f61d403a2be950c42396cece9bf8d42

rq turtle/ttl

title:Books winning or nominated when the author is not shown as winning or nominated SELECT ?item ?itemLabel ?awardLabel ?authorLabel WHERE { VALUES ?award{wd:Q160082 wd:Q2052291} ?item p:P166|p:P1411 ?s. ?s ps:P166|ps:P1411 ?award . MINUS{ ?item wdt:P31 wd:Q5 } ?item wdt:P50 ?author . MINUS {?author wdt:P166|wdt:P1411 ?award} 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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Books winning or nominated when the author is not shown as winning or nominated
SELECT ?item ?itemLabel ?awardLabel ?authorLabel WHERE {
  VALUES ?award{wd:Q160082 wd:Q2052291}
?item p:P166|p:P1411 ?s. ?s ps:P166|ps:P1411 ?award .
MINUS{ ?item wdt:P31 wd:Q5 }
?item wdt:P50 ?author .
MINUS {?author wdt:P166|wdt:P1411 ?award}
    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; v5("?author") v2("?award") v3("?item"):::projected v1("?itemLabel"):::projected v4("?s") c11(["bd:serviceParam"]):::iri c6(["wd:Q5"]):::iri c13(["#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 --"p:P1411"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:P166"--> v4 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v4 --"p:statement/P1411"--> v2 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v4 --"p:statement/P166"--> v2 end union1r <== or ==> union1l end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P31"--> c6 end v3 --"p:direct/P50"--> v5 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v5 --"p:direct/P1411"--> v2 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v5 --"p:direct/P166"--> v2 end union2r <== or ==> union2l end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end