Store Sparql Service
From n² wiki
This is the Platform API documentation for the basic SPARQL service associated with a Platform Store.
Contents |
[edit] URI Pattern
Each item in the store has its own URI based on its unique identifier:
http://api.talis.com/stores/{storename}/services/sparql
[edit] Resource Operations
| 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 |
[edit] Request Parameters
| Parameter | Required? | Description | Values |
|---|---|---|---|
| query | Yes | The SPARQL query to perform | A SPARQL query |
| output | No | Specify the output format | See below |
[edit] Additional Options & Restrictions
[edit] 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.
[edit] 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.
| 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
[edit] 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.
[edit] 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.
[edit] Further Reading
The official SPARQL protocol specification has additional information on specifying queries, response formats and error conditions.
Read the n2 SPARQL page for additional pointers to resources and some useful SPARQL recipes.

