query-ba0dad8d4899598b0b70f5e04089c53a
Cities in Africa by country
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#>
SELECT DISTINCT ?continentLabel ?country ?countryLabel ?city ?cityLabel ?population ?coords ?elevation_above_sea_level ?area WHERE {
{
SELECT ?country ?continent WHERE {
?country wdt:P31 wd:Q6256 .
?country wdt:P30 ?continent .
FILTER(?continent = wd:Q15).
}
}
?city wdt:P31/wdt:P279* wd:Q486972 .
?city wdt:P17 ?country .
?city wdt:P1082 ?population .
FILTER(?population >= 10000).
OPTIONAL { ?city wdt:P625 ?coords .}
OPTIONAL { ?city wdt:P2044 ?elevation_above_sea_level .}
OPTIONAL { ?city wdt:P2046 ?area .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "bg, en, [AUTO_LANGUAGE]" }
} ORDER BY ?countryLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?area"):::projected
v5("?city"):::projected
v3("?continent")
v6("?coords"):::projected
v4("?country"):::projected
v1("?countryLabel"):::projected
v7("?elevation_above_sea_level"):::projected
v2("?population"):::projected
a1((" "))
c7(["wd:Q486972"]):::iri
c16(["bg, en, #91;AUTO_LANGUAGE#93;"]):::literal
c14(["bd:serviceParam"]):::iri
c4(["wd:Q6256"]):::iri
f0[["?population >= '10000^^xsd:integer'"]]
f0 --> v2
f1[["?continent = 'wd:Q15'"]]
f1 --> v3
v4 --"wdt:P31"--> c4
v4 --"wdt:P30"--> v3
v5 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c7
v5 --"wdt:P17"--> v4
v5 --"wdt:P1082"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P625".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P2044".-> v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P2046".-> v8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end