add cart choropleth column cross cube error file folder geo help home lock obs poi rdf remove search slice spreadsheet success table unlock warning

[this is a icon-] developer tool

SPARQL 1.1 Query: Results

Edit query
Query results
s p_blank o_blank geosparql: Geometry geosparql: asWKT MULTIPOLYGON (((0.5660386434830924 51.587993542532715, 0.5680168436664018 51.58666964008723, 0.5646586769185337 51.58387327678163, 0.5545257622594901 51.57931232228159, 0.5494303337607777 51.57742746304975, 0.5456599438755015 51.57522674461654, 0.5426674163397902 51.57118424711804, 0.5421640433591612 51.56793231078829, 0.543624405391265 51.56702829619477, 0.5414481040530543 51.56593686304752, 0.5415713987186338 51.56434413019671, 0.539642278685964 51.559890925470036, 0.5396517509280986 51.55868828230879, 0.5379920674329166 51.55465910900095, 0.5391073201479626 51.55173185127519, 0.5417209404979386 51.5484906116116, 0.544241782513359 51.54633414769852, 0.5433068670368516 51.54454398714409, 0.5439204587259318 51.54168327940019, 0.5435193975691527 51.53862782311187, 0.542614419536797 51.53706095184458, 0.5426764588498162 51.5347059560485, 0.5380977059448295 51.53368718986806, 0.535216702153015 51.53117010007345, 0.5333070982784576 51.53095233458925, 0.528626150337332 51.53185196082976, 0.5263406827810707 51.53271062987611, 0.5227408382646629 51.532826769269775, 0.5167602075755021 51.529985520658954, 0.5132204362907853 51.531870030141945, 0.5115606776977193 51.53401638393822, 0.5092383854929882 51.535550929964636, 0.509480421380599 51.53646490405604, 0.5077054189865786 51.53903996617388, 0.5065003966144284 51.544774859417416, 0.5087661895268614 51.55206517399016, 0.5127024526079209 51.55475455846514, 0.5141357995270734 51.55673211133467, 0.5172096502209789 51.55842176212543, 0.5179151242141254 51.56171259636439, 0.5196776464082533 51.5646506856642, 0.523175978277094 51.56455846903504, 0.522713981402002 51.56606579601497, 0.5231411296210179 51.57375217145605, 0.5248170013702487 51.57516317164506, 0.5249215699499787 51.584124464035014, 0.526647766680935 51.58554876340706, 0.5265068062411169 51.58878128527914, 0.5229437437205942 51.58901522483434, 0.5234532933129019 51.59008077744432, 0.5499305546306918 51.58903690244958, 0.5567661487367189 51.58787203321681, 0.5660386434830924 51.587993542532715)))
SPARQL API: The Basics

The most flexible way to access the data is by using SPARQL, a query language, analagous to SQL for relational databases, for retrieving and manipulating data from graph databases like ours. We support SPARQL 1.1 query syntax. Many online tutorials are available.

To submit a SPARQL query from your code, you issue an HTTP GET or POST to our endpoint:, with the query itself as a url-encoded parameter called query.

For example, to run the following simple SPARQL query and get the results as JSON:

SELECT * WHERE {?s ?p ?o} LIMIT 10

Option 1: POST (recommended)

Issue a POST to the endpoint, with the query in the body, and an Accept header of sparql-results+json:

Accept: application/sparql-results+json
Content-Type: application/x-www-form-urlencoded


Option 2: GET

Issue a GET to the following URL (note the .json extension - see the formats section for more detail on this):


Scroll down to the end of this page for examples of both of these methods in a few different languages.

Results formats

As with other aspects of our API, to get the data in different formats, you can use either (a) a format extension or (b) an HTTP Accept header. Available result formats depend on the type of SPARQL query. There are four main forms:

SELECT queries return tabular results, and the formats available reflect this:

Format Extensions Accept Headers
XML .xml application/xml,
JSON .json application/json,
Text .txt, .text text/plain
CSV .csv text/csv

CONSTRUCT and DESCRIBE queries return graph data, so the results are available in the same formats as our resource APIs:

Format Extensions Accept Headers
RDF/XML .rdf application/rdf+xml
N-triples .nt, .txt, .text application/n-triples,
Turtle .ttl text/turtle
JSON-LD .json application/ld+json,

ASK queries return a boolean result:

Format Extensions Accept Headers
XML .xml application/xml,
JSON .json application/json,
Text .txt, .text text/plain
Results pagination

We accept page and per_page parameters for paginating the results of SELECT queries (we automatically modify your query to apply LIMIT and OFFSET clauses). For other query types (i.e. DESCRIBE, CONSTRUCT, ASK), pagination like this doesn’t make so much sense, so these parameters are ignored.

For requests made through the website (i.e. HTML format), the page size is defaulted to 20. For requests to our sparql endpoint for data formats (i.e. non-HTML), there will be no defaults for these parameters (i.e. results are unlimited. For performance reasons we generally advise LIMITing your query if possible).

Parameter Substitution

You can parameterise your SPARQL by including %{tokens} in your queries, and providing values for the tokens in the request parameters.

Note that the following tokens are reserved and cannot be used as parameters for substitution:

  • controller
  • action
  • page
  • per_page
  • id
  • commit
  • utf8
  • query
Cross Origin Resource Sharing

Our servers are configured to allow access from all domains. This means that if you’re writing JavaScript to request data from our server in to a web page hosted on another domain, your browser should check this header and allow it.

If you need to support very old browsers, you can additionally pass a callback parameter and the results will be wrapped in that function. For example:

This help topic on the jQuery website has more details.


Using cURL

Here’s a couple of examples running a query using the widely available cURL command line program.

Request the results as XML, using a POST:

curl -X POST -H "Accept: application/sparql-results+xml" -d "query=SELECT%20*%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%20LIMIT%2010"

Request the results as JSON, using a GET:

curl -X GET -H "Accept: application/sparql-results+json"*%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%20LIMIT%2010

Using JavaScript

This example HTML page uses jQuery to issue a POST to our SPARQL endpoint, requesting the results as JSON.

<!DOCTYPE html>
	<script src=''></script>
<script type='text/javascript'>

	var query = 'SELECT * WHERE {?s ?p ?o} LIMIT 10';
	var url = '';
		method: 'POST',
		dataType: 'json',
		url: url,
		data: {query: query},
		success: function(data) {
			alert('success: ' + data.results.bindings.length + ' results');