query-9abd8017d7991baf4af30eaacf86790a
title:Winners or nominated "for work" when the work is not shown as winning or nominated SELECT ?item ?itemLabel ?workLabel ?awardLabel WHERE { VALUES ?award{wd:Q160082 wd:Q2052291} ?item p:P166|p:P1411 ?s. ?s ps:P166|ps:P1411 ?award . ?item wdt:P31 wd:Q5 . ?s pq:P1686 ?work . MINUS {?work wdt:P166|wdt:P1411 ?award} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY ?itemLabel
Use at
- https://query.wikidata.org/sparql
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:Winners or nominated "for work" when the work is not shown as winning or nominated
SELECT ?item ?itemLabel ?workLabel ?awardLabel WHERE {
VALUES ?award{wd:Q160082 wd:Q2052291}
?item p:P166|p:P1411 ?s. ?s ps:P166|ps:P1411 ?award .
?item wdt:P31 wd:Q5 .
?s pq:P1686 ?work .
MINUS {?work 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;
v2("?award")
v3("?item"):::projected
v1("?itemLabel"):::projected
v4("?s")
v5("?work")
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
v3 --"p:direct/P31"--> c6
v4 --"p:qualifier/P1686"--> v5
subgraph minus1["MINUS"]
style minus1 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