query-0d2c50c72c1559106d34eccc3ca35d5a
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select distinct ?item ?itemLabel ?iata ?icao ?countryLabel ?ms_Sitelink ?linkcount where {
{select ?item ?ms_Sitelink WHERE {
{?item wdt:P238 ?iata .}
UNION
{?item wdt:P239 ?icao .}
?ms_Sitelink schema:about ?item; schema:isPartOf <https://ms.wikipedia.org/> .
filter not exists { ?enSitelink schema:about ?item; schema:isPartOf <https://en.wikipedia.org/> .}
} group by ?item ?ms_Sitelink } optional {?item wdt:P17 ?country.}
optional {?item wdt:P238 ?iata .}
optional {?item wdt:P239 ?icao .}
optional {?item wikibase:sitelinks ?linkcount. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} order by ?linkcount ?country ?ms_Sitelink
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?country")
v4("?enSitelink")
v6("?iata"):::projected
v7("?icao"):::projected
v5("?item"):::projected
v1("?linkcount"):::projected
v3("?ms_Sitelink"):::projected
c3([https://en.wikipedia.org/]):::iri
c10(["bd:serviceParam"]):::iri
c6([https://ms.wikipedia.org/]):::iri
c12(["en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"schema:about"--> e0v2
e0v1 --"schema:isPartOf"--> e0c3
e0v1("?enSitelink"):::projected
e0v2("?item"):::projected
e0c3([https://en.wikipedia.org/]):::iri
end
f0--EXISTS--> f0e0
f0 --> v4
f0 --> c1
f0 --> v5
f0 --> c2
f0 --> c3
v4 --"schema:about"--> v5
v4 --"schema:isPartOf"--> c3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P239"--> v7
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P238"--> v6
end
union0r <== or ==> union0l
end
v3 --"schema:about"--> v5
v3 --"schema:isPartOf"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P17".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P238".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P239".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wikibase:sitelinks".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end