query-b8b51e2529cec266d42f1339ba23638c
Countings airports have on their soil + their most up to date population of the country. Idem but with a date set : eg in year 2000, these numbers were x airports for y population. currently countries, of how many civilian airports they currentHello, I'd like a count per all 21:38, 29 January 2020 (UTC)) talk (BouzinacThanks ! 01:44, 30 January 2020 (UTC)) talk (Dipsacus fullonum are in use for airports, so it tests that neither are defined. It relays on the best current population number having preferred rang. I wouldn't count too much on the accuracy of either airport count or population. --(P576)dissolved, abolished or demolished date and (P582)end time Here is for the first part – current airports and population. It seems both
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 ?country ?countryLabel ?no_of_airports ?population
WHERE
{
{
SELECT ?country (COUNT(?airport) AS ?no_of_airports)
WHERE
{
?airport wdt:P17 ?country.
?airport wdt:P31/wdt:P279* wd:Q1248784.
OPTIONAL { ?airport (wdt:P582|wdt:P576) ?endtime. }
FILTER(!BOUND(?endtime))
}
GROUP BY ?country
}
?country wdt:P1082 ?population.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?airport")
v3("?country"):::projected
v1("?endtime")
v4("?no_of_airports"):::projected
v5("?population"):::projected
a1((" "))
c4(["wd:Q1248784"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not bound(?endtime)"]]
f0 --> v1
v2 --"wdt:P17"--> v3
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 -."wdt:P576".-> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P582"--> v1
end
union0r <== or ==> union0l
end
end
bind2[/"count(?airport)"/]
v2 --o bind2
bind2 --as--o v4
v3 --"wdt:P1082"--> v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end