query-f11f6721734597f3bd85deaf0ad5f831
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?airport ?airportLabel (MIN(?dist) AS ?distance )
WHERE {
?airport wdt:P238 ?any. # any airport (having an IATA airport code)
?airport wdt:P625 ?airportcoord.
?airport wdt:P17|wdt:P131|wdt:P931 ?loc. # country / territory / transportation hub
?loc wdt:P625 ?loccoord.
BIND(geof:distance(?airportcoord, ?loccoord) AS ?dist)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?airport ?airportLabel
ORDER BY DESC(?distance)
LIMIT 200
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?airport"):::projected
v4("?airportcoord")
v3("?any")
v7("?dist"):::projected
v8("?distance")
v5("?loc")
v6("?loccoord")
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P238"--> v3
v2 --"wdt:P625"--> v4
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;
v2 --"wdt:P931"--> v5
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P131"--> v5
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P17"--> v5
end
union0r <== or ==> union0l
end
v5 --"wdt:P625"--> v6
bind0[/"http://www.opengis.net/def/function/geosparql/distance(?airportcoord,?loccoord)"/]
v4 --o bind0
v6 --o bind0
bind0 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind2[/"min(?dist)"/]
v7 --o bind2
bind2 --as--o v8