query-b4c31f036d822f500b232b14f3c5a3e3

rq turtle/ttl

Avoid duplication - geo coordsHi everyone, I'm trying to work with the query editor to improve my skills (i'm still at very base level, though :)). I was trying to extract a list of airports, with their IATA and ICAO codes, their municipality and, the most important item, geo coordinates. Now, this is the query i was able to write:

Use at

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 ?item ?itemLabel ?iata ?icao ?coord ?LocationLabel WHERE {
  ?item wdt:P31 wd:Q1248784.
  ?item wdt:P238 ?iata.
  OPTIONAL { 
      ?item wdt:P239 ?icao;
            wdt:P931 ?Location;
            wdt:P625 ?coord.
            }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?iata
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?Location") v5("?coord"):::projected v1("?iata"):::projected v3("?icao"):::projected v2("?item"):::projected c2(["wd:Q1248784"]):::iri c8(["bd:serviceParam"]):::iri c10(["en"]):::literal v2 --"wdt:P31"--> c2 v2 --"wdt:P238"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P239".-> v3 v2 --"wdt:P931"--> v4 v2 --"wdt:P625"--> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end