Skip to content

Instantly share code, notes, and snippets.

@trolleway
Created May 11, 2018 09:56
Show Gist options
  • Save trolleway/bc84f7c3b6c7ceaf148f744ac4a3b016 to your computer and use it in GitHub Desktop.
Save trolleway/bc84f7c3b6c7ceaf148f744ac4a3b016 to your computer and use it in GitHub Desktop.
#Largest cities per administrative entity of Russia
SELECT DISTINCT ?city ?cityLabel ?population ?country ?countryLabel ?loc WHERE {
{
SELECT (MAX(?population) AS ?population) ?country WHERE {
?city wdt:P31/wdt:P279* wd:Q515 .
?city wdt:P1082 ?population .
?city wdt:P131 ?country .
?country wdt:P17 wd:Q159 .
}
GROUP BY ?country
ORDER BY DESC(?population)
}
?city wdt:P31/wdt:P279* wd:Q515 .
?city wdt:P1082 ?population .
?city wdt:P131 ?country .
?city wdt:P625 ?loc .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru" .
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment