query-3c34d141511b5cb16db986ad0868de89
settlements that are also subprefectures and do not have P131 select distinct ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q1853398. # is a subprefecture of Guinea ?item wdt:P31/wdt:P279* wd:Q486972. # is a settlement ?item wdt:P17 wd:Q1006 # is in Guinea filter not exists {?item wdt:P131 [].} # does not have a P131 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
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#>
#settlements that are also subprefectures and do not have P131
select distinct ?item ?itemLabel
WHERE
{
?item wdt:P31 wd:Q1853398. # is a subprefecture of Guinea
?item wdt:P31/wdt:P279* wd:Q486972. # is a settlement
?item wdt:P17 wd:Q1006 # is in Guinea
filter not exists {?item wdt:P131 [].} # does not have a P131
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
a1((" "))
a2((" "))
c5(["wd:Q486972"]):::iri
c7(["wd:Q1006"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q1853398"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P131"--> e0a1
e0v1("?item"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
v1 --"wdt:P131"--> a1
v1 --"wdt:P31"--> c3
v1 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c5
v1 --"wdt:P17"--> c7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end