SPARQL Endpoint
Source: data.gov.uk (2018-02-26)

Housing Supply Net additions - Census Adjustment. Housing Supply - Census Adjustement

JavaScript is disabled, so you're missing out on some features.

From March 2025, you will only be able to access the Energy Performance Certificates and the Index of Multiple Deprivation tools. All other datasets will no longer be supported. Fill out our survey (https://forms.office.com/e/F1hxFb71JJ) to let us know how this affects you.

Ministry of Housing, Communities & Local Government

open data
- Atlas (/atlas)
- Data (/data_home)
- Search (/data/search)
- Data Cart (/cart)
Explore

All datasets

By theme

By organisation

Tools

Your data cart

SPARQL Query

Vocabularies

Dereference URI

Cube utilities

Help

[this is a icon-] developer tool

SPARQL 1.1 Query: Endpoint

An endpoint that allows you to query the data store using the SPARQL 1.1 language.

Preview Try the beta of our improved SPARQL editor. (/sparql-beta)

Enter Query

html json csv xml text n-triples Turtle rdf/xml json xml text

Validate URIs

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 (http://www.w3.org/TR/sparql11-query/) query syntax. Many online tutorials (http://www.cambridgesemantics.com/semantic-university/sparql-by-example) are available.

To submit a SPARQL query from your code, you issue an HTTP GET or POST to our endpoint:http://opendatacommunities.org/sparql, 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:

POST http://opendatacommunities.org/sparql HTTP/1.1 Host: opendatacommunities.org Accept: application/sparql-results+json Content-Type: application/x-www-form-urlencoded query=SELECT+%2A+WHERE+%7B%3Fs+%3Fp+%3Fo%7D+LIMIT+10

Option 2: GET

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

GET http://opendatacommunities.org/sparql.json?query=SELECT+%2A+WHERE+%7B%3Fs+%3Fp+%3Fo%7D+LIMIT+10

Scroll down to the end of this page for examples (#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:

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

ASK queries return a boolean result:

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 (https://learn.jquery.com/ajax/working-with-jsonp/) on the jQuery website has more details.

Examples

Using cURL

Here’s a couple of examples running a query using the widely available cURL (http://curl.haxx.se/) command line program.

Request the results as XML, using a POST:

Request the results as JSON, using a GET:

Using JavaScript

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

Linked Open Data from DLUHC. News (http://news.opendatacommunities.org) | Apps (http://apps.opendatacommunities.org) | Contact: xxx@xxx.xx (mailto:xxx@xxx.xx)

This site uses cookies (/policy#cookies), respects your privacy (/policy#privacy) and works hard to be accessible to everyone (/policy#accessibility).

Powered by PublishMyData ©2010-2026 TPXimpact (https://tpximpact.com).