query-afe5f8cbd296a9b5e35d8f120b76b141
Timing out query 11:51, 29 December 2020 (UTC) 💛●✒️●💬 BouzinacHello ; could you help me build out that query ? It should be around 6k items but refuses to work. Thanks !
Use at
- https://query.wikidata.org/sparql
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 rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?airport ?airportLabel ?country ?countryLabel WHERE {
?airport (wdt:P31/wdt:P279*) wd:Q62447.#any aerodromes
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,de,kk". }
optional {?airport wdt:P239|wdt:P238|wdt:P240|wdt:P5699|wdt:P5746|wdt:P5851|wdt:P6120 ?code.}#any airport code
filter(!Bound(?code)).#who does not have any airport code
FILTER NOT EXISTS { ?airport p:P239 [rdf:type wdno:P239].} #we do not want the ?item if ICAO has a <no value>
MINUS {?airport wdt:P576 [].} # remove items with P576 (dissolved, abolished or demolished) as a main property
MINUS {?airport wdt:P582 [].} # 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
MINUS {?airport (wdt:P31/wdt:P279*) (wd:Q695850 wd:Q2265915 wd:Q1311670 wd:Q7373622 wd:Q782667 wd:Q502074 wd:Q44665966 wd:Q2071567).}
#except those special instances of unnotheworthy aerodromes
OPTIONAL {?airport wdt:P17 ?country. }
} order by ?countryLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?airport"):::projected
v3("?code")
v4("?country"):::projected
v1("?countryLabel"):::projected
a3((" "))
a4((" "))
a2((" "))
a1((" "))
a13((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
a10((" "))
a11((" "))
a12((" "))
c30(["wd:Q2071567"]):::iri
c26(["wd:Q7373622"]):::iri
c24(["wd:Q2265915"]):::iri
c2(["p:novalue/P239"]):::iri
c20(["p:novalue/P17"]):::iri
c6(["wd:Q62447"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en,fr,de,kk"]):::literal
c8(["bd:serviceParam"]):::iri
c25(["wd:Q1311670"]):::iri
c22(["wd:Q695850"]):::iri
c28(["wd:Q502074"]):::iri
c27(["wd:Q782667"]):::iri
c31(["rdf:nil"]):::iri
c29(["wd:Q44665966"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0a1 --"a"--> e0c2
e0v1 --"p:P239"--> e0a1
e0v1("?airport"):::projected
e0a1((" ")):::projected
e0c2(["p:novalue/P239"]):::iri
end
f0--EXISTS--> f0e0
f0 --> a1
f0 --> c1
f0 --> c2
f0 --> v2
f0 --> c3
a1 --"a"--> c2
v2 --"p:P239"--> a1
f1[["not bound(?code)"]]
f1 --> v3
v2 --"p:direct/P31"--> a2
a2 --"p:direct/P279"--> c6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
subgraph union4[" Union "]
subgraph union4l[" "]
style union4l fill:#abf,stroke-dasharray: 3 3;
subgraph union5[" Union "]
subgraph union5l[" "]
style union5l fill:#abf,stroke-dasharray: 3 3;
v2 -."p:direct/P6120".-> v3
end
subgraph union5r[" "]
style union5r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P5851"--> v3
end
union5r <== or ==> union5l
end
end
subgraph union4r[" "]
style union4r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P5746"--> v3
end
union4r <== or ==> union4l
end
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P5699"--> v3
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P240"--> v3
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P238"--> v3
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"p:direct/P239"--> v3
end
union0r <== or ==> union0l
end
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P576"--> a3
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P582"--> a4
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v2 --"a"--> c20
end
subgraph minus5["MINUS"]
style minus5 stroke-width:6px,fill:pink,stroke:red;
a5 --"rdf:first"--> c22
a5 --"rdf:rest"--> a6
a6 --"rdf:first"--> c24
a6 --"rdf:rest"--> a7
a7 --"rdf:first"--> c25
a7 --"rdf:rest"--> a8
a8 --"rdf:first"--> c26
a8 --"rdf:rest"--> a9
a9 --"rdf:first"--> c27
a9 --"rdf:rest"--> a10
a10 --"rdf:first"--> c28
a10 --"rdf:rest"--> a11
a11 --"rdf:first"--> c29
a11 --"rdf:rest"--> a12
a12 --"rdf:first"--> c30
a12 --"rdf:rest"--> c31
v2 --"p:direct/P31"--> a13
a13 --"p:direct/P279"--> a5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P17".-> v4
end