query-826a2c7bb941cbb03ba25ce42a414f30
Big cities, grouped into map layers by population Big cities, grouped into map layers by population Grandes villes groupées selon la population par niveaux géographiques Big cities, grouped into map layers by population Big cities, grouped into map layers by population Grote steden, gegroepeerd in kaartlagen op bevolkingsomvang Stora städer, grupperade i kartlager efter befolkning Big cities, grouped into map layers by population Big cities, grouped into map layers by population Big cities, grouped into map layers by population
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#>
#defaultView:Map
SELECT DISTINCT ?city ?cityLabel (SAMPLE(?location) AS ?location) (MAX(?population) AS ?population) (SAMPLE(?layer) AS ?layer)
WHERE
{
?city wdt:P31/wdt:P279* wd:Q515;
wdt:P625 ?location;
wdt:P1082 ?population.
FILTER(?population >= 500000).
BIND(
IF(?population < 1000000, "<1M",
IF(?population < 2000000, "1M-2M",
IF(?population < 5000000, "2M-5M",
IF(?population < 10000000, "5M-10M",
IF(?population < 20000000, "10M-20M",
">20M")))))
AS ?layer).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?city ?cityLabel
Query found at
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?city"):::projected
v5("?layer"):::projected
v5("?location"):::projected
v5("?population"):::projected
a1((" "))
c8(["bd:serviceParam"]):::iri
c4(["wd:Q515"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?population >= '500000^^xsd:integer'"]]
f0 --> v5
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
v2 --"wdt:P625"--> v5
v2 --"wdt:P1082"--> v5
bind1[/"if(?population < '1000000^^xsd:integer','<1M',if(?population < '2000000^^xsd:integer','1M-2M',if(?population < '5000000^^xsd:integer','2M-5M',if(?population < '10000000^^xsd:integer','5M-10M',if(?population < '20000000^^xsd:integer','10M-20M','>20M')))))"/]
v5 --o bind1
bind1 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
bind5[/"sample(?location)"/]
v5 --o bind5
bind5 --as--o v5
bind6[/"max(?population)"/]
v5 --o bind6
bind6 --as--o v5
bind7[/"sample(?layer)"/]
v5 --o bind7
bind7 --as--o v5