Closed WolfgangFahl closed 2 years ago
Wikidata SPARQL query showing the 10 most populated cities of the world using the million city class Q1637706 for selection
# Ten Largest cities of the world
# WF 2021-08-23
# see also http://wiki.bitplan.com/index.php/PyLoDStorage#Examples
# see also https://github.com/WolfgangFahl/pyLoDStorage/issues/46
SELECT DISTINCT ?city ?cityLabel ?population ?country ?countryLabel
WHERE {
VALUES ?cityClass { wd:Q1637706}.
?city wdt:P31 ?cityClass .
?city wdt:P1082 ?population .
?city wdt:P17 ?country .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY DESC(?population)
LIMIT 10
city | cityLabel | population | country | countryLabel |
---|---|---|---|---|
Value(uri:'http://www.wikidata.org/entity/Q1353') | Value(literal:'Delhi') | Value(literal:'26495000') | Value(uri:'http://www.wikidata.org/entity/Q668') | Value(literal:'India') |
Value(uri:'http://www.wikidata.org/entity/Q8686') | Value(literal:'Shanghai') | Value(literal:'24870895') | Value(uri:'http://www.wikidata.org/entity/Q148') | Value(literal:"People's Republic of China") |
Value(uri:'http://www.wikidata.org/entity/Q956') | Value(literal:'Beijing') | Value(literal:'21710000') | Value(uri:'http://www.wikidata.org/entity/Q148') | Value(literal:"People's Republic of China") |
Value(uri:'http://www.wikidata.org/entity/Q1354') | Value(literal:'Dhaka') | Value(literal:'16800000') | Value(uri:'http://www.wikidata.org/entity/Q902') | Value(literal:'Bangladesh') |
Value(uri:'http://www.wikidata.org/entity/Q1156') | Value(literal:'Mumbai') | Value(literal:'15414288') | Value(uri:'http://www.wikidata.org/entity/Q668') | Value(literal:'India') |
Value(uri:'http://www.wikidata.org/entity/Q8660') | Value(literal:'Karachi') | Value(literal:'14910352') | Value(uri:'http://www.wikidata.org/entity/Q843') | Value(literal:'Pakistan') |
Value(uri:'http://www.wikidata.org/entity/Q8673') | Value(literal:'Lagos') | Value(literal:'14862000') | Value(uri:'http://www.wikidata.org/entity/Q1033') | Value(literal:'Nigeria') |
Value(uri:'http://www.wikidata.org/entity/Q406') | Value(literal:'Istanbul') | Value(literal:'14657434') | Value(uri:'http://www.wikidata.org/entity/Q43') | Value(literal:'Turkey') |
Value(uri:'http://www.wikidata.org/entity/Q1490') | Value(literal:'Tokyo') | Value(literal:'14049146') | Value(uri:'http://www.wikidata.org/entity/Q17') | Value(literal:'Japan') |
Value(uri:'http://www.wikidata.org/entity/Q16572') | Value(literal:'Guangzhou') | Value(literal:'14043500') | Value(uri:'http://www.wikidata.org/entity/Q148') | Value(literal:"People's Republic of China") |
use an example from pyLodStorage such as: