query-90643b468b9ae7b5e464af9ada03cc31
TODO
Use at
- https://query.wikidata.org/sparql
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 ?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 [].} #minus any end dated codes
# ?item2 wdt:P238 ?code . #Second with code IATA
?item2 p:P238 ?statement2. #we replace the ?item2 wdt:P238 ?code . bit by getting the P238 property statement
?statement2 ps:P238 ?code. #get the IATA code assicated with the property statement
minus { ?statement2 pq:P582 [].} #minus any end dated codes
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 {?item1 wdt:P31/wdt:P279* wd:Q502074.} # exclude héliports
minus {?item1 wdt:P576 ?date} # exclude destructed airports
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 {?item2 wdt:P31/wdt:P279* wd:Q502074.} # exclude héliports
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")
v2("?item1"):::projected
v3("?item2"):::projected
v4("?nature1")
v5("?statement1")
v6("?statement2")
a2((" "))
a3((" "))
a1((" "))
a4((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
a10((" "))
a11((" "))
c9(["wd:Q7373622"]):::iri
c3(["wd:Q1248784"]):::iri
c13(["bd:serviceParam"]):::iri
c8(["wd:Q1311670"]):::iri
c7(["wd:Q695850"]):::iri
c15(["fr,en"]):::literal
c10(["wd:Q502074"]):::iri
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"--> a2
end
v3 --"p:P238"--> v6
v6 --"p:statement/P238"--> v1
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v6 --"p:qualifier/P582"--> a3
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a4
a4 --"p:direct/P279"--> c7
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a5
a5 --"p:direct/P279"--> c8
end
subgraph minus5["MINUS"]
style minus5 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a6
a6 --"p:direct/P279"--> c9
end
subgraph minus6["MINUS"]
style minus6 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a7
a7 --"p:direct/P279"--> c10
end
subgraph minus7["MINUS"]
style minus7 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P576"--> v7
end
subgraph minus8["MINUS"]
style minus8 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:direct/P31"--> a8
a8 --"p:direct/P279"--> c7
end
subgraph minus9["MINUS"]
style minus9 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:direct/P31"--> a9
a9 --"p:direct/P279"--> c8
end
subgraph minus10["MINUS"]
style minus10 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:direct/P31"--> a10
a10 --"p:direct/P279"--> c9
end
subgraph minus11["MINUS"]
style minus11 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:direct/P31"--> a11
a11 --"p:direct/P279"--> c10
end
subgraph minus12["MINUS"]
style minus12 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