query-7bc0a56aa371a5e8364dd95982b88a4f
airports without 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/>
SELECT DISTINCT ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA ?Local_Code WHERE {
?airport (wdt:P31/wdt:P279*) wd:Q62447.
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
}
}
MINUS { ?airport a wdno:P17.} # exclude airports that aren't physically based in a country
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. }
minus{?airport wdt:P17 [] }.
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA ?Local_Code
ORDER BY ?paysLabel ?coord
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?IATA"):::projected
v5("?ICAO"):::projected
v7("?Local_Code"):::projected
v3("?airport"):::projected
v8("?coord"):::projected
v1("?paysLabel")
v5("?thing")
a2((" "))
a3((" "))
a5((" "))
a1((" "))
a4((" "))
c7(["wdno:P17"]):::iri
c3(["wd:Q62447"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["en,fr,#91;AUTO_LANGUAGE#93;"]):::literal
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P576"--> a2
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P582"--> a3
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P31"--> a4
a4 --"wdt:P279"--> v5
bind3[/VALUES ?thing/]
bind3-->v5
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 minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v3 --"a"--> c7
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;
v3 -."wdt:P625".-> v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P239".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P238".-> v6
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;
v3 -."wdt:P6120".-> v7
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P5851"--> v7
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P5746"--> v7
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P5699"--> v7
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P240"--> v7
end
union0r <== or ==> union0l
end
end
subgraph minus5["MINUS"]
style minus5 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P17"--> a5
end
bind7[/"sample(?coord)"/]
v8 --o bind7
bind7 --as--o v8