query-296a94c29d6e0de056485da2ba087cab
Cities by population SELECT ?item ?cityLabel ?countryLabel ?population WHERE { ?city wdt:P31 wd:Q515 . # is a city ?city wdt:P17 ?country . # show me country ?city wdt:P17 wd:Q212 . # let is be Ukraine ?city wdt:P1082 ?population . # and get me population FILTER (?population >= 1000000) # remove cities with population less than one million SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?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#>
# Cities by population
SELECT ?item ?cityLabel ?countryLabel ?population
WHERE
{
?city wdt:P31 wd:Q515 . # is a city
?city wdt:P17 ?country . # show me country
?city wdt:P17 wd:Q212 . # let is be Ukraine
?city wdt:P1082 ?population . # and get me population
FILTER (?population >= 1000000) # remove cities with population less than one million
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?population)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?city")
v3("?country")
v1("?population"):::projected
c5(["wd:Q212"]):::iri
c8(["bd:serviceParam"]):::iri
c3(["wd:Q515"]):::iri
c10(["en"]):::literal
f0[["?population >= '1000000^^xsd:integer'"]]
f0 --> v1
v2 --"wdt:P31"--> c3
v2 --"wdt:P17"--> v3
v2 --"wdt:P17"--> c5
v2 --"wdt:P1082"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end