query-605af5e3f7f4714621ced805d497fec4
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel WHERE {
?item wdt:P17 wd:Q953. # must have P17=Zambia
?item wdt:P17 wd:Q916. # must have P17=Angola
FILTER NOT EXISTS {?item wdt:P17 ?P17. # must not have a P17 value where...
FILTER(?P17 NOT IN (wd:Q916, wd:Q953)) } # ...the P17 value is not in the wd:Q916, wd:Q953 list
# add more specific clauses here
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]" . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?P17")
v2("?item"):::projected
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;"]):::literal
c2(["wd:Q953"]):::iri
c1(["wd:Q916"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?P17 != 'wd:Q916'?P17 != 'wd:Q953'"]]
e0f0 --> e0v1
e0v2 --"wdt:P17"--> e0v1
e0v1("?P17"):::projected
e0v2("?item"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> c3
f1[["?P17 != 'wd:Q916'?P17 != 'wd:Q953'"]]
f1 --> v1
v2 --"wdt:P17"--> v1
v2 --"wdt:P17"--> c2
v2 --"wdt:P17"--> c1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end