query-bc64c508d2607d473b775d5bab8894d3
Listing of airports in a 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#>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?localisation_administrative ?localisation_administrativeLabel ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code) WHERE {
?airport (wdt:P31/wdt:P279*) wd:Q62447.
?airport wdt:P17 wd:Q414.
MINUS { ?airport wdt:P576 _:b2. } # remove items with P576 (dissolved, abolished or demolished) as a main property
MINUS { ?airport wdt:P582 _:b3. } # remove items with P582 (end date) as a main property
MINUS {?airport (wdt:P31/wdt:P279*) ?thing .
VALUES ?thing {wd:Q695850 wd:Q2265915 wd:Q1311670 wd:Q7373622 wd:Q782667 wd:Q502074 wd:Q44665966 wd:Q2071567 wd:Q3631092} }
#except those special instances of unnotheworthy aerodromes
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
OPTIONAL { ?airport wdt:P625 ?coord. }
OPTIONAL { ?airport wdt:P239 ?ICAO. }
OPTIONAL { ?airport wdt:P238 ?IATA. }
OPTIONAL { ?airport wdt:P240|wdt:P5699|wdt:P5746|wdt:P5851|wdt:P6120 ?Local_Code. }
OPTIONAL {
?airport wdt:P131* ?localisation_administrative.
?localisation_administrative wdt:P31 ?type.
?type wdt:P279 wd:Q10864048.
}
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA ?localisation_administrative ?localisation_administrativeLabel
ORDER BY ?coord
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?IATA"):::projected
v4("?ICAO"):::projected
v9("?Local_Code"):::projected
v2("?airport"):::projected
v9("?coord"):::projected
v7("?localisation_administrative"):::projected
v4("?thing")
v8("?type")
a2((" "))
a3((" "))
a1((" "))
a4((" "))
c21(["wd:Q10864048"]):::iri
c3(["wd:Q62447"]):::iri
c9(["bd:serviceParam"]):::iri
c5(["wd:Q414"]):::iri
c11(["en,fr,#91;AUTO_LANGUAGE#93;"]):::literal
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P17"--> c5
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P576"--> a2
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P582"--> a3
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P31"--> a4
a4 --"wdt:P279"--> v4
bind3[/VALUES ?thing/]
bind3-->v4
bind30(["wd:Q695850"])
bind30 --> bind3
bind31(["wd:Q2265915"])
bind31 --> bind3
bind32(["wd:Q1311670"])
bind32 --> bind3
bind33(["wd:Q7373622"])
bind33 --> bind3
bind34(["wd:Q782667"])
bind34 --> bind3
bind35(["wd:Q502074"])
bind35 --> bind3
bind36(["wd:Q44665966"])
bind36 --> bind3
bind37(["wd:Q2071567"])
bind37 --> bind3
bind38(["wd:Q3631092"])
bind38 --> bind3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P625".-> v9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P239".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P238".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v2 -."wdt:P6120".-> v9
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P5851"--> v9
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P5746"--> v9
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P5699"--> v9
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P240"--> v9
end
union0r <== or ==> union0l
end
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P131".-> v7
v7 --"wdt:P31"--> v8
v8 --"wdt:P279"--> c21
end
bind6[/"sample(?coord)"/]
v9 --o bind6
bind6 --as--o v9
bind7[/"sample(?Local_Code)"/]
v9 --o bind7
bind7 --as--o v9