query-d2fbf255dd2adaf0747ce52a5a529788
German Bundesländer (Q1221156) and their Cities (Q515)I need a list of german cities sorted by Bundesland (state, Q1221156). The result of my query is only 20 items. Is there a better way to query cities by bundesland?
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 ?state ?stateLabel ?city ?cityLabel WHERE {
?state wdt:P31 wd:Q1221156;
wdt:P150 ?city.
?city (wdt:P31/(wdt:P279*)) wd:Q515.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY (?stateLabel) (?cityLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?city"):::projected
v2("?cityLabel"):::projected
v3("?state"):::projected
v1("?stateLabel"):::projected
a1((" "))
c7(["bd:serviceParam"]):::iri
c5(["wd:Q515"]):::iri
c2(["wd:Q1221156"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v3 --"wdt:P31"--> c2
v3 --"wdt:P150"--> v4
v4 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end