query-186d156a33ae99ff964ccc6608cc6949
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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?item ?itemLabel ?fr_article ?Wfr ?en_article ?Wen ?iata ?icao WHERE {
?item wdt:P31/wdt:P279* wd:Q1248784. # item must be an instance of an airport, or an instance that is a subclass of an airport
?item wdt:P17 wd:Q142 . # ?item has country = France
optional {?item wdt:P238 ?iata .} # item may have a P238 (IATA) value
optional {?item wdt:P239 ?icao .} # item may have a P239 (ICAO) value
optional {?Wen schema:about ?item; # item may have a sitelink
schema:isPartOf <https://en.wikipedia.org/>; # the sitelink points to en.wikipedia
schema:name ?en_article.} # and has an article name
optional {?Wfr schema:about ?item; # item may have a sitelink
schema:isPartOf <https://fr.wikipedia.org/>; # the sitelink points to fr.wikipedia
schema:name ?fr_article.} # and has an article name
minus {?item wdt:P31 wd:Q695850.} # exclude military airports
bind(coalesce(?en_article,?fr_article) as ?article) # create ?article if there is an EN or FR wikipedia article
filter(bound(?article)) # select only if there is an ?article
bind(coalesce(?iata,?icao) as ?code) # create ?code if there is an ICAO or IATA code
# filter(bound(?code)) # select only if there is an ?code
minus {?item wdt:P576 ?date} # remove items with P576 (dissolved, abolished or demolished) as a main property
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr" } . #this bit gets labels for Qid values
} order by ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?Wen"):::projected
v8("?Wfr"):::projected
v10("?article")
v10("?code")
v11("?date")
v7("?en_article"):::projected
v9("?fr_article"):::projected
v4("?iata"):::projected
v5("?icao"):::projected
v3("?item"):::projected
v1("?itemLabel"):::projected
a1((" "))
c12([https://fr.wikipedia.org/]):::iri
c10([https://en.wikipedia.org/]):::iri
c3(["wd:Q1248784"]):::iri
c16(["bd:serviceParam"]):::iri
c18(["#91;AUTO_LANGUAGE#93;,fr"]):::literal
c13(["wd:Q695850"]):::iri
c5(["wd:Q142"]):::iri
f0[["bound(?article)"]]
f0 --> v10
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v3 --"wdt:P17"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P238".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P239".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v6 -."schema:about".-> v3
v6 --"schema:isPartOf"--> c10
v6 --"schema:name"--> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v8 -."schema:about".-> v3
v8 --"schema:isPartOf"--> c12
v8 --"schema:name"--> v9
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P31"--> c13
end
bind2[/"?en_article?fr_article"/]
v7 --o bind2
v9 --o bind2
bind2 --as--o v10
bind3[/"?iata?icao"/]
v4 --o bind3
v5 --o bind3
bind3 --as--o v10
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v3 --"wdt:P576"--> v11
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
end