query-10873f41fa6ffc83185ed7652a8740af
subprefectures that are not settlements and do not have P131 select distinct ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q1853398. # is a subprefecture of Guinea filter not exists {?item wdt:P31/wdt:P279* wd:Q486972.} # is not 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#>
#subprefectures that are not settlements and do not have P131
select distinct ?item ?itemLabel
WHERE
{
?item wdt:P31 wd:Q1853398. # is a subprefecture of Guinea
filter not exists {?item wdt:P31/wdt:P279* wd:Q486972.} # is not 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((" "))
c4(["wd:Q486972"]):::iri
c7(["wd:Q1006"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c5(["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
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1v1 --"wdt:P31"--> e1a1
e1a1 --"wdt:P279"--> e1c3
e1v1("?item"):::projected
e1a1((" ")):::projected
e1c3(["wd:Q486972"]):::iri
end
f1--EXISTS--> f1e1
f1 --> v1
f1 --> c2
f1 --> a2
f1 --> c3
f1 --> c4
v1 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c4
v1 --"wdt:P31"--> c5
v1 --"wdt:P17"--> c7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end