query-58b3be36bdebdd881169d674844f3d98

rq turtle/ttl

Airports with more than 1 coordinates

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?coord1 ?coord2 ?distance ?rank1 ?rank2 WHERE {
   {
SELECT DISTINCT ?item ?coord1 ?coord2 ?rank1 ?rank2 WHERE {
    ?item  (wdt:P31/wdt:P279*) wd:Q62447.

    ?item p:P625 ?stat1 . ?stat1 ps:P625 ?coord1 . ?stat1 wikibase:rank ?rank1 . 
    ?item p:P625 ?stat2 . ?stat2 ps:P625 ?coord2 . ?stat2 wikibase:rank ?rank2 . 
    filter ( str(?stat1)  < str(?stat2) ) . # not the same
    filter ( str(?rank1)  = str(?rank2) ) . # are the same
} 
}  BIND(geof:distance(?coord1, ?coord2) as ?distance)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en,[AUTO_LANGUAGE]". }
}
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?coord1"):::projected v8("?coord2"):::projected v9("?distance"):::projected v6("?item"):::projected v1("?itemLabel"):::projected v2("?rank1"):::projected v3("?rank2"):::projected v4("?stat1") v5("?stat2") a1((" ")) c8(["bd:serviceParam"]):::iri c10(["da,en,#91;AUTO_LANGUAGE#93;"]):::literal c3(["wd:Q62447"]):::iri f0[["str(?rank1) = str(?rank2)"]] f0 --> v2 f0 --> v3 f1[["str(?stat1) < str(?stat2)"]] f1 --> v4 f1 --> v5 v6 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v6 --"p:P625"--> v4 v4 --"p:statement/P625"--> v7 v4 --"wikibase:rank"--> v2 v6 --"p:P625"--> v5 v5 --"p:statement/P625"--> v8 v5 --"wikibase:rank"--> v3 bind2[/"http://www.opengis.net/def/function/geosparql/distance(?coord1,?coord2)"/] v7 --o bind2 v8 --o bind2 bind2 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end