query-17735b91296e318dd19bde3540c7fad5
List of cities named after elected officials by populationHi, I am trying to find the largest city that's named after an elected official, and I have a preliminary query that seems to work (I am very new at this):
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 ?cityLabel ?countryLabel ?population ?namedLabel ?officeLabel
WHERE
{
?city wdt:P31 wd:Q515 .
?city wdt:P138 ?named .
?city wdt:P1082 ?population .
?city wdt:P17 ?country .
?named wdt:P39 ?office .
?office wdt:P31 wd:Q294414
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")
v4("?country")
v3("?named")
v5("?office")
v1("?population"):::projected
c9(["bd:serviceParam"]):::iri
c2(["wd:Q515"]):::iri
c7(["wd:Q294414"]):::iri
c11(["en"]):::literal
v2 --"wdt:P31"--> c2
v2 --"wdt:P138"--> v3
v2 --"wdt:P1082"--> v1
v2 --"wdt:P17"--> v4
v3 --"wdt:P39"--> v5
v5 --"wdt:P31"--> c7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end