Created
February 27, 2018 10:29
-
-
Save byteofprash/0a3435e59c7c5e4e60615e74747c3322 to your computer and use it in GitHub Desktop.
A spraql query to get the lat long of certain cities
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
## Sparql Query to get the lat long of certain cities | |
SELECT DISTINCT ?countryLabel ?label ?lat ?long WHERE { | |
{?city rdf:type dbo:City} UNION {?city rdf:type dbo:PopulatedPlace} | |
?city rdfs:label ?label ; | |
geo:lat ?lat ; | |
geo:long ?long ; | |
dbo:country ?country ; | |
rdfs:label ?name . | |
?country rdfs:label ?countryLabel . | |
FILTER (lang(?label) = 'en' and lang(?countryLabel) = 'en') | |
FILTER (regex(?countryLabel,"Germany") or regex(?countryLabel,"Austria") or regex(?countryLabel,"France") or regex(?countryLabel,"Italy")) | |
FILTER (regex(?label, "Berlin") or regex(?label, "Munich") or | |
regex(?label, "Dusseldorf") or | |
regex(?label, "Frankfurt") or | |
regex(?label, "Cologne") or | |
regex(?label, "Hamburg") or | |
regex(?label, "Stuttgart")) | |
} |
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
## Sparql Query to get the lat long of certain cities | |
SELECT DISTINCT ?countryLabel ?label ?lat ?long WHERE { | |
{?city rdf:type dbo:City} UNION {?city rdf:type dbo:PopulatedPlace} | |
?city rdfs:label ?label ; | |
geo:lat ?lat ; | |
geo:long ?long ; | |
dbo:country ?country ; | |
rdfs:label ?name . | |
?country rdfs:label ?countryLabel . | |
FILTER (lang(?label) = 'en' and lang(?countryLabel) = 'en') | |
FILTER (regex(?countryLabel,"Germany") or regex(?countryLabel,"Austria") or regex(?countryLabel,"France") or regex(?countryLabel,"Italy")) | |
FILTER (regex(?label, "Berlin") or regex(?label, "Munich") or | |
regex(?label, "Dusseldorf") or | |
regex(?label, "Frankfurt") or | |
regex(?label, "Cologne") or | |
regex(?label, "Hamburg") or | |
regex(?label, "Stuttgart")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment