query-479af956867f2a0fbbd2f26d05297362

rq turtle/ttl

08:05, 6 June 2017 (UTC)) talk (Bunyk and other cities of Ukraine? --(Q1899)Kyiv for (Q515)city (P31)instance of of any subclass of it? Or should I add (P31)instance of , but also (Q515)city (P31)instance of . How to update query so it selects not only items that are (Q515)city (P279)subclass of , which finally (Q200209)cities of Ukraine (P279)subclass of , which (Q5124045)city with special status (P31)instance of ? Looks like it is only (Q515)city (P31)instance of in results. Is it not (Q1899)Kyiv And I don't see 08:36, 6 June 2017 (UTC)) talk (d1g. SELECT DISTINCT and ?city wdt:P31/wdt:P279* wd:Q515

Use at

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 DISTINCT ?item ?cityLabel ?countryLabel ?population
WHERE
{
    ?city wdt:P31/wdt:P279* wd:Q515 . # changed
    ?city wdt:P17 wd:Q212 .
    ?city wdt:P17 ?country .
    ?city wdt:P1082 ?population .
    FILTER (?population >= 1000000)
    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 a1((" ")) c6(["wd:Q212"]):::iri c9(["bd:serviceParam"]):::iri c4(["wd:Q515"]):::iri c11(["en"]):::literal f0[["?population >= '1000000^^xsd:integer'"]] f0 --> v1 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c4 v2 --"wdt:P17"--> c6 v2 --"wdt:P17"--> v3 v2 --"wdt:P1082"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end