query-50d4237982da55f780baefce2fea6b89
The 107 independent cities of Germany with state and population
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#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?city ?key ?cityLabel ?population ?popdate ?classLabel ?stateLabel WHERE{
?class wdt:P279 wd:Q22865 .
?city wdt:P31 ?class .
?class wdt:P131 ?state .
?city wdt:P439 ?key .
?city p:P1082 ?pop .
?pop v:P1082 ?population .
?pop wikibase:rank wikibase:PreferredRank .
?pop pq:P585 ?popdate
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
ORDER BY ?stateLabel DESC(?population)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?city"):::projected
v3("?class")
v6("?key"):::projected
v7("?pop")
v8("?popdate"):::projected
v2("?population"):::projected
v5("?state")
v1("?stateLabel"):::projected
c14(["de"]):::literal
c9(["wikibase:PreferredRank"]):::iri
c2(["wd:Q22865"]):::iri
c12(["bd:serviceParam"]):::iri
v3 --"p:direct/P279"--> c2
v4 --"p:direct/P31"--> v3
v3 --"p:direct/P131"--> v5
v4 --"p:direct/P439"--> v6
v4 --"p:P1082"--> v7
v7 --"p:statement/P1082"--> v2
v7 --"wikibase:rank"--> c9
v7 --"p:qualifier/P585"--> v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end