Last active
June 22, 2019 12:47
-
-
Save knbknb/580c6a1a11eefe69304699499f76650a to your computer and use it in GitHub Desktop.
Wikidata: Search for Company/Banks Headquarters
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
# see https://stackoverflow.com/questions/56539793/wikidata-sparql-get-company-entities-and-the-location-of-their-headquarters | |
SELECT ?item ?itemLabel ?web ?isin ?hqLabel ?hqloc ?hqCountry ?hqCountryLabel ?inception | |
WHERE { #values ?item {wd:Q74687} | |
# for debugging | |
?item p:P31/ps:P31/wdt:P279* wd:Q783794. | |
OPTIONAL{?item wdt:P856 ?web.} | |
# get website | |
OPTIONAL{?item wdt:P946 ?isin.} | |
# get ISIN | |
OPTIONAL{?item wdt:P571 ?inception.} # get inception date | |
OPTIONAL{?item p:P159 ?hqStmt. # get HQ statement | |
?hqStmt ps:P159 ?hq. # get HQ item | |
?hqStmt pq:P625 ?hqloc. # get HQ coordinate location qualifier | |
optional {?hq wdt:P17 ?hqCountry} # optional, the country of the HQ | |
} | |
?article schema:about ?item . | |
?article schema:inLanguage "en" . | |
?article schema:isPartOf <https://en.wikipedia.org/>. | |
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } | |
LIMIT 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment