query-2130776be3bbae53912aaec02fd454eb
German states with number of urban districts
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(?city) AS ?count) WHERE{
?class wdt:P279 wd:Q22865 .
?city wdt:P31 ?class .
?class wdt:P131 ?state
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?class ?classLabel ?stateLabel
ORDER BY ?stateLabel ?classLabel ?cityLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?city"):::projected
v3("?cityLabel")
v4("?class"):::projected
v2("?classLabel"):::projected
v7("?count")
v6("?state")
v1("?stateLabel"):::projected
c8(["de"]):::literal
c6(["bd:serviceParam"]):::iri
c2(["wd:Q22865"]):::iri
v4 --"wdt:P279"--> c2
v5 --"wdt:P31"--> v4
v4 --"wdt:P131"--> v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
bind1[/"count(?city)"/]
v5 --o bind1
bind1 --as--o v7