query-41ec30712a102ebc0b26f92d7c574b7c
Die 15 Klassen für kreisefreie Städte des jeweiligen Bundeslandes mit Anzahl der kreisfreien Städte
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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?class ?classLabel ?stateLabel (COUNT(?city) AS ?urbanDistricts) WHERE{
?class wdt:P279 wd:Q22865 .
?class wdt:P1001 ?state .
?city p:P31 ?instanceBlock .
?instanceBlock v:P31 ?class FILTER NOT EXISTS {?instanceBlock pq:P582 ?end} .
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;
v6("?city"):::projected
v4("?class"):::projected
v3("?end")
v2("?instanceBlock")
v5("?state")
v1("?stateLabel"):::projected
v7("?urbanDistricts")
c10(["de"]):::literal
c8(["bd:serviceParam"]):::iri
c3(["wd:Q22865"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:qualifier/P582"--> e0v2
e0v2("?end"):::projected
e0v1("?instanceBlock"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
v2 --"p:qualifier/P582"--> v3
v4 --"p:direct/P279"--> c3
v4 --"p:direct/P1001"--> v5
v6 --"p:P31"--> v2
v2 --"p:statement/P31"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind2[/"count(?city)"/]
v6 --o bind2
bind2 --as--o v7