query-639987a2e118f367a3e21061e367b7e1
District classes for states
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 ?class ?classLabel ?stateLabel (COUNT(?rural) AS ?count) WHERE {
?class wdt:P279 wd:Q106658 .
?class wdt:P1001 ?state .
?rural wdt:P31 ?class .
FILTER NOT EXISTS {?rural wdt:P576 ?dissolved}
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?class ?classLabel ?stateLabel
ORDER BY ?stateLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?class"):::projected
v6("?count")
v3("?dissolved")
v2("?rural"):::projected
v5("?state")
v1("?stateLabel"):::projected
c3(["wd:Q106658"]):::iri
c9(["de"]):::literal
c7(["bd:serviceParam"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P576"--> e0v2
e0v2("?dissolved"):::projected
e0v1("?rural"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
v2 --"wdt:P576"--> v3
v4 --"wdt:P279"--> c3
v4 --"wdt:P1001"--> v5
v2 --"wdt:P31"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind2[/"count(?rural)"/]
v2 --o bind2
bind2 --as--o v6