-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logic to check Wikidata parents and exclude subsidiaries with ide…
…ntical IATA codes #1439
- Loading branch information
Showing
3 changed files
with
35 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
# SPARQL query for extracting airline data from Wikidata | ||
# Execute at https://query.wikidata.org/ and download results as CSV | ||
|
||
SELECT (?airline as ?entity) ?airlineLabel ?iata ?icao ?callsign ?countryLabel ?countryIso | ||
SELECT (?airline as ?entity) ?airlineLabel ?iata ?icao ?parentIata ?parentIcao ?callsign ?countryLabel ?countryIso | ||
(xsd:date(?start) AS ?startDate) (xsd:date(?end) AS ?endDate) # format as ISO dates | ||
WHERE | ||
{ | ||
?airline wdt:P31 wd:Q46970 . # instance of airline | ||
?airline wdt:P229 ?iata . # IATA code not optional | ||
OPTIONAL{?airline wdt:P230 ?icao .} | ||
OPTIONAL{?airline wdt:P749 ?parent . | ||
?parent wdt:P229 ?parentIata . | ||
?parent wdt:P230 ?parentIcao } | ||
OPTIONAL{?airline wdt:P571 ?start .} | ||
OPTIONAL{?airline wdt:P576 ?end .} | ||
OPTIONAL { ?airline wdt:P17 ?country . | ||
?country wdt:P297 ?countryIso } | ||
OPTIONAL{?airline wdt:P432 ?callsign .} | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | ||
} | ||
|