SPARQL Compliance¶
What’s in this document?
GraphDB supports the following SPARQL specifications:
SPARQL 1.1 Protocol for RDF¶
SPARQL 1.1 Protocol for RDF defines the means for transmitting SPARQL queries to a SPARQL query processing service, and returning the query results to the entity that requested them.
SPARQL 1.1 Query¶
SPARQL 1.1 Query provides more powerful query constructions compared to SPARQL 1.0. It adds:
Aggregates;
Subqueries;
Negation;
Expressions in the SELECT clause;
Property Paths;
Assignment;
An expanded set of functions and operators.
SPARQL 1.1 Update¶
SPARQL 1.1 Update provides a means to change the state of the database using a query-like syntax. SPARQL Update has similarities to SQL INSERT INTO
, UPDATE WHERE
, and DELETE FROM
behavior. For full details, see the W3C SPARQL Update working group page.
Modification operations on the RDF triples¶
INSERT DATA {...}
: Inserts RDF statements;DELETE DATA {...}
: Removes RDF statements;DELETE {...} INSERT {...} WHERE {...}
: For more complex modifications;LOAD (SILENT) from_iri
: Loads an RDF document identified byfrom_iri
;LOAD (SILENT) from_iri INTO GRAPH to_iri
: Loads an RDF document into the local graph calledto_iri
;CLEAR (SILENT) GRAPH iri
: Removes all triples from the graph identified byiri
;CLEAR (SILENT) DEFAULT
: Removes all triples from the default graph;CLEAR (SILENT) NAMED
: Removes all triples from all named graphs;CLEAR (SILENT) ALL
: Removes all triples from all graphs.
Operations for managing graphs¶
CREATE
: Creates a new graph in stores that support empty graphs;DROP
: Removes a graph and all of its contents;COPY
: Modifies a graph to contain a copy of another;MOVE
: Moves all of the data from one graph into another;ADD
: Reproduces all data from one graph into another.
SPARQL 1.1 Federation¶
SPARQL 1.1 Federation provides extensions to the query syntax for executing distributed queries over any number of SPARQL endpoints. This feature is very powerful, and allows integration of RDF data from different sources using a single query. See more about it here.
Internal SPARQL federation¶
In addition to the standard SPARQL 1.1 Federation to other SPARQL endpoints, GraphDB supports internal federation to other repositories in the same GraphDB instance. The internal SPARQL federation is used in almost the same way as the standard SPARQL federation over HTTP, but since this approach skips all HTTP communication overheads, it is more efficient. See more about it here.
Federated query to a remote password-protected repository¶
You can also use federation to query a remote password-protected GraphDB repository. There are two ways to do this:
By editing the repository configuration
By importing the repository configuration file in the Workbench (does not require stopping GraphDB)
See more about it here.
SPARQL 1.1 Graph Store HTTP Protocol¶
SPARQL 1.1 Graph Store HTTP Protocol provides a means for updating and fetching RDF graph content from a Graph Store over HTTP in the REST style.
URL patterns for this new functionality are provided at¶
<RDF4J_URL>/repositories/<repo_id>/rdf-graphs/service>
(for indirectly referenced named graphs);<RDF4J_URL>/repositories/<repo_id>/rdf-graphs/<NAME>
(for directly referenced named graphs).
Methods supported by these resources and their effects¶
GET
: Fetches statements in the named graph from the repository in the requested format.PUT
: Updates data in the named graph in the repository, replacing any existing data in the named graph with the supplied data. The data supplied with this request is expected to contain an RDF document in one of the supported RDF formats.DELETE
: Deletes all data in the specified named graph in the repository.POST
: Updates data in the named graph in the repository by adding the supplied data to any existing data in the named graph. The data supplied with this request is expected to contain an RDF document in one of the supported RDF formats.
Request headers¶
Accept
: Relevant values forGET
requests are the MIME types of supported RDF formats.Content-Type
: Must specify the encoding of any request data sent to a server. Relevant values are theMIME
types of supported RDF formats.
Supported parameters for requests on indirectly referenced named graphs¶
graph
(optional): Specifies the URI of the named graph to be accessed.default
(optional): Specifies that the default graph to be accessed. This parameter is expected to be present but to have no value.
Note
Each request on an indirectly referenced graph needs to specify precisely one of the above parameters.