URI PatternEach item in the store has its own URI based on its unique identifier: http://api.talis.com/stores/{storename}/services/sparql
|
| URI Pattern | Method | Request Body | Semantics | Capability required |
|---|---|---|---|---|
| /services/sparql | GET | Retrieve a simple query form | None | |
| /services/sparql?query= | GET | Perform a SPARQL search | None | |
| POST | application/x-www-form-urlencoded parameters | Perform a SPARQL search | None |
Request Parameters
| Parameter | Required? | Description | Values |
|---|---|---|---|
| query | Yes | The SPARQL query to perform | A SPARQL query |
| output | No | Specify the output format | See below |
| callback | No | Specify the callback function for a JSONP request | A JSONP callback function |
Additional Options & Restrictions
Specifying the Data Set
The SPARQL service associated with a platform store uses a fixed default (background) graph. The contents of this graph is the contents of the Metabox.
The service does not support specifying the dataset in either the protocol (using default-graph-uri and named-graph-uri parameters) or within the SPARQL query itself (using FROM and FROM NAMED).
The Store Multisparql Service does provide some additional options for querying multiple graphs.
Output Formats
The following table summarizes the different output formats supported by the SPARQL service. The output types can be selected using Content Negotiation using either the Accept header or the output parameter. The Sparql Service also supports javascript (jsonp) output (see the JSONP Javascript Output section below).
| SPARQL Query Type | Output Param Value | Mime Type | Schema |
|---|---|---|---|
| SELECT | xml | application/sparql-results+xml | SPARQL Query Results XML Format |
| json | application/sparql-results+json | Serializing SPARQL Query Results in JSON Format | |
| ASK | xml | application/sparql-results+xml | SPARQL Query Results XML Format |
| json | application/sparql-results+json | Serializing SPARQL Query Results in JSON Format | |
| CONSTRUCT | xml or rdf | application/rdf+xml | RDF/XML Syntax |
| json | application/json | RDF/JSON Syntax | |
| ntriples | text/plain | N-Triples | |
| turtle | text/turtle | Turtle | |
| DESCRIBE | xml or rdf | application/rdf+xml | RDF/XML Syntax |
| json | application/json | RDF/JSON Syntax | |
| ntriples | text/plain | N-Triples | |
| turtle | text/turtle | Turtle |
Note: for backwards compatibility, where the text/turtle media type is listed, the deprecated application/x-turtle media type is also supported, though it is given a lower weighting during Content Negotiation
JSONP (Javascript) Output
| Output Param Value | Accept Header | Callback | Output Format |
|---|---|---|---|
| json | application/javascript | {valid javascript identifier} | JSONP with mime-type application/javascript |
| {NOT json, e.g., xml} | application/javascript | {valid javascript identifier} | XML format depending on the query type - see Output Formats section above. (Because output overrides the Accept header and callback) |
| json | */* | {valid javascript identifier} | JSONP with mime-type application/javascript |
| */* | {valid javascript identifier} | JSONP with mime-type application/javascript | |
| {valid javascript identifier | JSONP with mime-type application/javascript ("If no Accept header field is present, then it is assumed that the client accept all media types") | ||
| json | {valid javascript identifier} | JSONP with mime-type application/javascript | |
| application/javascript | {valid javascript identifier} | JSONP with mime-type application/javascript | |
| json | JSON format (see table in Output Formats section above). This is the case if callback is either empty or doesn't exist. | ||
| Is set e.g., application/xml (NOT application/javascript OR */* OR no header) | {valid javascript identifier} | XML format depending on the query type - see Output Formats section above. (Because no output parameter is set and the Accept header does not include javascript.) |
Restrictions on Query Times
The SPARQL service endpoint enforces a maximum execution time for all SPARQL queries. This is to ensure that long-running queries do not degrade the service for other users. Queries that exceed the maximum allowable time will be terminated and a 500 Internal Server error response returned.
SPARQL Extensions
The SPARQL service endpoint includes support for some extensions to the SPARQL query language. The full list of SPARQL Extensions are documented separately.
Further Reading
The official SPARQL protocol specification has additional information on specifying queries, response formats and error conditions.

© Talis Systems Ltd. 2011 Content is available under