query-40f37c6dcb813f2fcab585b92b5cb62c

rq turtle/ttl

City populations Let’s look at the second question for now. It’s fairly simple to write a query that lists all cities along with their population and country, ordered by country:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?country ?city ?population
WHERE
{
  ?miasto wdt:P31/wdt:P279* wd:Q515;
        wdt:P17 ?kraj;
        wdt:P1082 ?populacja.
}
ORDER BY ?kraj

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?kraj") v2("?miasto") v3("?populacja") a1((" ")) c3(["wd:Q515"]):::iri v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v2 --"wdt:P17"--> v1 v2 --"wdt:P1082"--> v3