Last active
September 25, 2016 14:36
-
-
Save StudioLE/c1e5fbb5358d72e8cfb5cdb65a564acf to your computer and use it in GitHub Desktop.
Wikidata Graph: Connect places by architectural style in city
This file contains hidden or 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
| # Wikidata Query Service at: | |
| # https://query.wikidata.org/ | |
| #defaultView:Graph | |
| SELECT ?place ?placeLabel ?location ?style ?styleLabel ?instanceLabel | |
| # SELECT ?style ?styleLabel (count(*) as ?count) | |
| WHERE { | |
| wd:Q84 wdt:P625 ?loc . # Geo-coords of Newcastle upon Tyne: Q1425428; London:Q84 | |
| SERVICE wikibase:around { | |
| ?place wdt:P625 ?location . # Places with Geo-coords | |
| bd:serviceParam wikibase:center ?loc . | |
| bd:serviceParam wikibase:radius "5" . # Within radius 5 km around center | |
| } | |
| ?place wdt:P149 ?style . # Has architectural style | |
| OPTIONAL { | |
| ?place wdt:P31 ?instance . # Optionally include the instance of | |
| } | |
| SERVICE wikibase:label { | |
| bd:serviceParam wikibase:language "en" . | |
| } | |
| BIND(geof:distance(?loc, ?location) as ?dist) # Calculate distance in km | |
| } | |
| # GROUP BY ?style ?styleLabel | |
| ORDER BY ?dist # Order by distance | |
| LIMIT 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment