query-ad0fc9fa9d07dae16a38cc340d593d54

rq turtle/ttl

National flags ordered by populationI don’t know why this simple query always times out. Any idea why? It should return a list of countries, sorted by decreasing population, with their national flags.

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 ?country ?countryLabel ?flag ?population

WHERE {
    ?country wdt:P31 wd:Q6256;
             wdt:P1082 ?population.

    ?flag wdt:P31 wd:Q186516;
          wdt:P1001 ?country.

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

ORDER BY DESC(?population)
LIMIT 10

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?country"):::projected v3("?flag"):::projected v1("?population"):::projected c7(["bd:serviceParam"]):::iri c4(["wd:Q186516"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q6256"]):::iri v2 --"wdt:P31"--> c2 v2 --"wdt:P1082"--> v1 v3 --"wdt:P31"--> c4 v3 --"wdt:P1001"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end