Ordnance Survey SPARQL Endpoint
I just wanted to quick mention one feature of the Ordnance Survey linked data SPARQL endpoints that I think it pretty neat. Go to the SPARQL endpoint and try one of the queries from my last four blogs posts. In this post I’ll got with the following simple query (recall this query gets the name, lat, long, gss code and unit_id for all districts in Great Britain):
select ?name ?lat ?long ?gss ?unit_id
where
{
?x <http://www.w3.org/2000/01/rdf-schema#label> ?name .
?x <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat .
?x <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long .
?x <http://data.ordnancesurvey.co.uk/ontology/admingeo/gssCode> ?gss .
?x <http://data.ordnancesurvey.co.uk/ontology/admingeo/hasUnitID> ?unit_id .
?x a <http://data.ordnancesurvey.co.uk/ontology/admingeo/District> .
}
You will notice that on hitting the query button that a box will appear that says “Request” and a rather long URL will appear:
You can now use this URL to issue a GET request in PHP, Javascript etc. and use these output within a web application just as you would with any API call. To see this working in a simple way copy the long URL you get from your SPARQL query and at the command line (if running something UNIXy) type:
curl LONG_URL
where LONG_URL is your long URL. You should now see the JSON response from that GET request.
Happy SPARQLing…