query-3ff87c2fc2d9cd42d9189630ee94f948

rq turtle/ttl

TODO

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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?code ?item1 ?nature1Label ?item1Label ?date1 ?item2  ?item2Label WHERE {
  ?item1 wdt:P31/wdt:P279* wd:Q1248784. 
#  ?item1 wdt:P238 ?code .        #oddly, we don't need this - see a couple of rows below
  ?item1 wdt:P31 ?nature1.        #What kind of airport, aérodrome is it?
  ?item1 p:P238 ?statement1.        #we replace the ?item1 wdt:P238 ?code . bit by getting the P238 property statement
  ?statement1 ps:P238 ?code.          #get the IATA code assicated with the property statement
  minus { ?statement1 pq:P582 ?date1.} #minus any row where there is an end date for the property statement (and hence which is associated with the code value)
  ?item2 wdt:P238 ?code .         #Second with code IATA
  FILTER ( ?item1 != ?item2 )     #Only différents elements
  minus {?item1 wdt:P31/wdt:P279* wd:Q695850.}      # exclude military airports
  minus {?item1 wdt:P31/wdt:P279* wd:Q1311670.}     # exclude railways stations
  minus {?item1 wdt:P31/wdt:P279* wd:Q7373622.}     # exclude Royal Air Force
  minus {?item2 wdt:P31/wdt:P279* wd:Q695850.}      # exclude military airports
  minus {?item2 wdt:P31/wdt:P279* wd:Q1311670.}     # exclude railways stations
  minus {?item2 wdt:P31/wdt:P279* wd:Q7373622.}     # exclude Royal Air Force
  minus {?item1 wdt:P576 ?date}                     # exclude destructed airports
  minus {?item2 wdt:P576 ?date}                     # exclude destructed airports
  SERVICE wikibase:label { bd:serviceParam wikibase:language  "fr,en". } #récupérer le libellé en français si possible sinon en anglais
  }
ORDER BY ?code #trier les résultats selon le code AITA

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?code"):::projected v7("?date") v6("?date1"):::projected v2("?item1"):::projected v3("?item2"):::projected v4("?nature1") v5("?statement1") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) a7((" ")) c10(["wd:Q7373622"]):::iri c3(["wd:Q1248784"]):::iri c13(["bd:serviceParam"]):::iri c9(["wd:Q1311670"]):::iri c8(["wd:Q695850"]):::iri c15(["fr,en"]):::literal f0[["?item1 != ?item2"]] f0 --> v2 f0 --> v3 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v2 --"p:direct/P31"--> v4 v2 --"p:P238"--> v5 v5 --"p:statement/P238"--> v1 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v5 --"p:qualifier/P582"--> v6 end v3 --"p:direct/P238"--> v1 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c8 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> a3 a3 --"p:direct/P279"--> c9 end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> a4 a4 --"p:direct/P279"--> c10 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P31"--> a5 a5 --"p:direct/P279"--> c8 end subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P31"--> a6 a6 --"p:direct/P279"--> c9 end subgraph minus7["MINUS"] style minus7 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P31"--> a7 a7 --"p:direct/P279"--> c10 end subgraph minus8["MINUS"] style minus8 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P576"--> v7 end subgraph minus9["MINUS"] style minus9 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P576"--> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end