query-52acdd2fee69c639feaaf67e25684647

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA ?Local_Code WHERE {
?airport (wdt:P31/wdt:P279*) wd:Q62447.
?airport wdt:P17 wd:Q236.
MINUS { ?airport wdt:P576 _:b2. }                                # remove items with P576 (dissolved, abolished or demolished) as a main property
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q695850. }               # exclude military airports
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q1311670. }              # exclude railways stations
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q7373622. }              # exclude Royal Air Force
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q502074. }               # exclude héliports
MINUS { ?airport wdt:P31/wdt:P279* wd:Q2265915.}                 # exclude vol à voile/gliders
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q44665966. }             # exclude  airports being build
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q782667. }               # exclude motorways where plane can land
MINUS { ?airport wdt:P582 _:b3. }                                # remove items with P582 (end date) as a main property
MINUS { ?airport a wdno:P17.}                                    # exclude airports that aren't physically based in a country
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL { ?airport wdt:P625 ?coord. }
OPTIONAL { ?airport wdt:P239 ?ICAO. }
OPTIONAL { ?airport wdt:P238 ?IATA. }
OPTIONAL { ?airport wdt:P240 ?FAA_USA. }
OPTIONAL { ?airport wdt:P5699 ?Code_Transport_Canada. }
OPTIONAL { ?airport wdt:P5746 ?DGAC. }
OPTIONAL { ?airport wdt:P5851 ?russ. }
OPTIONAL { ?airport wdt:P6120 ?FAArg. }
  bind(if(bound(?FAA_USA),?FAA_USA,"") as ?1)
  bind(if(bound(?Code_Transport_Canada),?Code_Transport_Canada,"") as ?2) 
  bind(if(bound(?DGAC),?DGAC,"") as ?3) 
  bind(if(bound(?russ),?russ,"") as ?4)
  bind(if(bound(?FAArg),?FAArg,"") as ?5)
  bind(concat(?1,"; ",?2,"; ",?3,"; ",?4,"; ",?5) as ?Local_Code)  
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA ?Local_Code
ORDER BY ?coord

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?1") v11("?2") v12("?3") v13("?4") v14("?5") v6("?Code_Transport_Canada") v7("?DGAC") v5("?FAA_USA") v9("?FAArg") v4("?IATA"):::projected v3("?ICAO"):::projected v15("?Local_Code"):::projected v2("?airport"):::projected v16("?coord"):::projected v8("?russ") a2((" ")) a10((" ")) a1((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) a8((" ")) a9((" ")) c9(["wd:Q7373622"]):::iri c11(["wd:Q2265915"]):::iri c16(["wdno:P17"]):::iri c3(["wd:Q62447"]):::iri c5(["wd:Q236"]):::iri c18(["bd:serviceParam"]):::iri c8(["wd:Q1311670"]):::iri c7(["wd:Q695850"]):::iri c10(["wd:Q502074"]):::iri c13(["wd:Q782667"]):::iri c12(["wd:Q44665966"]):::iri c20(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v2 --"wdt:P17"--> c5 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P576"--> a2 end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c7 end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a4 a4 --"wdt:P279"--> c8 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a5 a5 --"wdt:P279"--> c9 end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a6 a6 --"wdt:P279"--> c10 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a7 a7 --"wdt:P279"--> c11 end subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a8 a8 --"wdt:P279"--> c12 end subgraph minus7["MINUS"] style minus7 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a9 a9 --"wdt:P279"--> c13 end subgraph minus8["MINUS"] style minus8 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P582"--> a10 end subgraph minus9["MINUS"] style minus9 stroke-width:6px,fill:pink,stroke:red; v2 --"a"--> c16 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c18 --"wikibase:language"--> c20 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P625".-> v16 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P239".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P238".-> v4 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P240".-> v5 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P5699".-> v6 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P5746".-> v7 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P5851".-> v8 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P6120".-> v9 end bind10[/"if(bound(?FAA_USA),?FAA_USA,'')"/] v5 --o bind10 bind10 --as--o v10 bind11[/"if(bound(?Code_Transport_Canada),?Code_Transport_Canada,'')"/] v6 --o bind11 bind11 --as--o v11 bind12[/"if(bound(?DGAC),?DGAC,'')"/] v7 --o bind12 bind12 --as--o v12 bind13[/"if(bound(?russ),?russ,'')"/] v8 --o bind13 bind13 --as--o v13 bind14[/"if(bound(?FAArg),?FAArg,'')"/] v9 --o bind14 bind14 --as--o v14 bind15[/"concat(?1,'; ',?2,'; ',?3,'; ',?4,'; ',?5)"/] v10 --o bind15 v11 --o bind15 v12 --o bind15 v13 --o bind15 v14 --o bind15 bind15 --as--o v15 bind17[/"sample(?coord)"/] v16 --o bind17 bind17 --as--o v16