query-3829ab27e8d14ffdef332a390b100c42

rq turtle/ttl

Get airports which do have an ICAO set, or do have an ICAO set to select ?item where { ?item wdt:P31/wdt:P279* wd:Q1248784. { ?item wdt:P239 ?icao . } # item must have a valid ICAO code UNION # and/or { ?item p:P239 [rdf:type wdno:P239] . } # item has a P239 of
}

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX p: <http://www.wikidata.org/prop/>
# Get airports which do have an ICAO set, or do have an ICAO set to <no value>
select ?item where {
  ?item wdt:P31/wdt:P279* wd:Q1248784.
  { ?item wdt:P239 ?icao . }                                 # item must have a valid ICAO code
  UNION                                                      # and/or
  { ?item p:P239 [rdf:type wdno:P239] . }                    # item has a P239 of <no value>        
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?icao") v1("?item"):::projected a1((" ")) a2((" ")) c3(["wd:Q1248784"]):::iri c6(["p:novalue/P239"]):::iri v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; a2 --"a"--> c6 v1 --"p:P239"--> a2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P239"--> v2 end union0r <== or ==> union0l end