query-b342d01035f5eeb35d11b82c8900521b
Human settlements in Bulgaria
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#>
#human settlement , grouped into map layers by population
#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:Q486972;
wdt:P17 wd:Q219;
wdt:P625 ?location;
wdt:P1082 ?population.
FILTER(?population >= 0).
BIND(
IF(?population < 10, "<10",
IF(?population < 100, "10-100",
IF(?population < 1000, "100-1000",
IF(?population < 10000, "1000-10000",
IF(?population < 100000, "10000-100000",
">1000000")))))
AS ?layer).
SERVICE wikibase:label { bd:serviceParam wikibase:language "bg". }
}
GROUP BY ?city ?cityLabel
Query found at
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((" "))
c4(["wd:Q486972"]):::iri
c10(["bd:serviceParam"]):::iri
c6(["wd:Q219"]):::iri
c12(["bg"]):::literal
f0[["?population >= '0^^xsd:integer'"]]
f0 --> v5
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
v2 --"wdt:P17"--> c6
v2 --"wdt:P625"--> v5
v2 --"wdt:P1082"--> v5
bind1[/"if(?population < '10^^xsd:integer','<10',if(?population < '100^^xsd:integer','10-100',if(?population < '1000^^xsd:integer','100-1000',if(?population < '10000^^xsd:integer','1000-10000',if(?population < '100000^^xsd:integer','10000-100000','>1000000')))))"/]
v5 --o bind1
bind1 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
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