Skip to content

Instantly share code, notes, and snippets.

@northernjamie
Created July 23, 2018 07:31
Show Gist options
  • Save northernjamie/edbe5ebc0c64d4ad672b3b299a656939 to your computer and use it in GitHub Desktop.
Save northernjamie/edbe5ebc0c64d4ad672b3b299a656939 to your computer and use it in GitHub Desktop.
Example of geosparql on the NHS PublishMyData platform. Medical organisations with 5km of Alder Hey Children's Hospital
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
prefix unit: <http://qudt.org/vocab/unit#>
SELECT DISTINCT ?name ?loc ?geo ?selhosp
WHERE {
?loc rdfs:label ?name .
?loc geo:hasGeometry ?geo .
<http://opendata.nhs.uk/id/organisation/nacs/RBS25> geo:hasGeometry ?selhosgeo ;
rdfs:label ?selhosp .
?geo geof:nearby (?selhosgeo 5 <http://qudt.org/vocab/unit#Kilometer>).
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment