This document describes SPARQL service description, a method for discovering, and vocabulary for describing SPARQL services made available via the [[[SPARQL12-PROTOCOL]]]. These descriptions provide a mechanism by which a client or end user can discover information about the SPARQL service such as supported extension functions and details about the available dataset.
This specification is published by the RDF Star Working Group as part of the update of specifications for format and errata.
A SPARQL service description lists the features of a SPARQL service made available via the [[[SPARQL12-PROTOCOL]]]. This document describes both a method for discovering a service description from a specific SPARQL service and an RDF schema for encoding such descriptions in RDF.
When this document uses the words MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY, and the words appear as emphasized text, they must be interpreted as described in [[RFC2119]].
The following terms are also in use throughout this document:
This specification makes use of the following namespaces:
formathttp://www.w3.org/ns/formats/owlhttp://www.w3.org/2002/07/owl#rdfshttp://www.w3.org/2000/01/rdf-schema#sdhttp://www.w3.org/ns/sparql-service-description#sparqlhttp://www.w3.org/ns/sparql#SPARQL services made available via the SPARQL Protocol SHOULD return a service description document at the service endpoint when dereferenced using the HTTP GET operation without any query parameter strings provided. This service description MUST be made available in an RDF serialization, MAY be embedded in (X)HTML by way of [[[RDFa-core]]], and SHOULD be made available using [[[RFC9110#content.negotiation|content negotiation]]] if available in other RDF representations.
If a SPARQL service cannot make a service description available at the service endpoint, the response to an HTTP GET request of the service endpoint SHOULD indicate the location where a service description can be retrieved via a `Link` HTTP header [[RFC8288]] using the [[[RFC8631#section-4.2|`service-desc` Link Relation Type]]].
The SPARQL service description namespace IRI is:
http://www.w3.org/ns/sparql-service-description#
The prefix used in this document for this namespace is sd.
An RDF encoding of the Service Description ontology is available by HTTP content negotiation from the namespace IRI.
sd:endpointsd:endpoint is an owl:InverseFunctionalProperty that relates an instance of sd:Service to a SPARQL endpoint that implements the SPARQL
Protocol service for the service. The object of the sd:endpoint property is an IRI.
The rdfs:domain of sd:endpoint is sd:Service.
sd:featuresd:feature relates an instance of sd:Service with a resource representing a supported feature.
The rdfs:domain of sd:feature is sd:Service.
The rdfs:range of sd:feature is sd:Feature.
sd:defaultEntailmentRegimesd:defaultEntailmentRegime relates an instance of sd:Service with a resource representing an entailment regime used for basic graph pattern matching. This property is
intended for use when a single entailment regime by default applies to all graphs in the default dataset of the service. In situations where a different entailment regime applies to a
specific graph in the dataset, the sd:entailmentRegime property should be used to indicate this fact in the description of that graph.
sd:defaultEntailmentRegime is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:defaultEntailmentRegime is sd:Service.
The rdfs:range of sd:defaultEntailmentRegime is sd:EntailmentRegime.
sd:entailmentRegimesd:entailmentRegime relates a named graph description with a resource representing an entailment regime used for basic graph pattern matching over that graph.
The rdfs:domain of sd:entailmentRegime is sd:NamedGraph.
The rdfs:range of sd:entailmentRegime is sd:EntailmentRegime.
sd:defaultSupportedEntailmentProfilesd:defaultSupportedEntailmentProfile relates an instance of sd:Service with a resource representing a supported profile of the default entailment regime (as declared by sd:defaultEntailmentRegime). Entailment profiles are discussed more in SPARQL 1.2 Entailment Regimes [[SPARQL12-ENTAILMENT]].
Note that this specification does not make any conformance requirements on the compatibility of an advertised entailment profile with the advertised entailment regime in a service description. Providing a reasonable combination of values to the sd:entailmentRegime/sd:defaultEntailmentRegime and sd:supportedEntailmentProfile/sd:defaultSupportedEntailmentProfile properties is up to the creator of a service description.
sd:defaultSupportedEntailmentProfile is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:defaultSupportedEntailmentProfile is sd:Service.
The rdfs:range of sd:defaultSupportedEntailmentProfile is sd:EntailmentProfile.
sd:supportedEntailmentProfilesd:supportedEntailmentProfile relates a named graph description with a resource representing a supported profile of the entailment regime (as declared by sd:entailmentRegime) used for basic graph pattern matching over that graph.
The rdfs:domain of sd:supportedEntailmentProfile is sd:NamedGraph.
The rdfs:range of sd:supportedEntailmentProfile is sd:EntailmentProfile.
sd:extensionFunctionsd:extensionFunction relates an instance of sd:Service to a function that may be used in a SPARQL SELECT expression or a FILTER, HAVING, GROUP BY, ORDER BY, or BIND clause.
sd:extensionFunction is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:extensionFunction is sd:Service.
The rdfs:range of sd:extensionFunction is sd:Function.
sd:extensionAggregatesd:extensionAggregate relates an instance of sd:Service to an aggregate that may be used in a SPARQL aggregate query (for instance in a HAVING clause or SELECT expression) besides the standard list of
supported aggregates COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT, and SAMPLE.
sd:extensionAggregate is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:extensionAggregate is sd:Service.
The rdfs:range of sd:extensionAggregate is sd:Aggregate.
sd:languageExtensionsd:languageExtension relates an instance of sd:Service to a resource representing an implemented extension to the SPARQL Query or Update language.
sd:languageExtension is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:languageExtension is sd:Service.
The rdfs:range of sd:languageExtension is sd:Feature.
sd:supportedLanguagesd:supportedLanguage relates an instance of sd:Service to a SPARQL language (e.g. Query and Update) that it implements.
sd:supportedLanguage is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:supportedLanguage is sd:Service.
The rdfs:range of sd:supportedLanguage is sd:Language.
sd:supportedVersionsd:supportedVersion relates an instance of sd:Service to a SPARQL language version that it supports.
This property is related to the sd:supportedLanguage property, as the combination of language and version will indicate a specific feature set supported by the service.
For example, when a service description indicates support for the sd:SPARQLQuery language and sparql:version-1.2-basic version, support for SPARQL 1.2 Query [[SPARQL12-QUERY]] with RDF 1.2 Basic conformance is indicated.
sd:supportedVersion is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:supportedVersion is sd:Service.
sd:propertyFeaturesd:propertyFeature relates an instance of sd:Service to a resource representing an implemented feature that extends the SPARQL Query or Update language and that is
accessed by using the named property.
sd:propertyFeature is a rdfs:subPropertyOf of sd:feature.
The rdfs:domain of sd:propertyFeature is sd:Service.
The rdfs:range of sd:propertyFeature is sd:Feature.
sd:defaultDatasetsd:defaultDataset is an owl:InverseFunctionalProperty that
relates an instance of sd:Service to a description of the
default dataset available when no explicit dataset is specified in the query, update request, or
via protocol parameters.
The rdfs:domain of sd:defaultDataset is sd:Service.
The rdfs:range of sd:defaultDataset is sd:Dataset.
sd:availableGraphssd:availableGraphs relates an instance of sd:Service to a description of the graphs which are allowed in the construction of a dataset via the SPARQL Protocol, with
FROM/FROM NAMED clauses in a query, or with USING/USING NAMED in an update request, if the service limits the scope of dataset construction.
The rdfs:domain of sd:availableGraphs is sd:Service.
The rdfs:range of sd:availableGraphs is sd:GraphCollection.
sd:resultFormatsd:resultFormat relates an instance of sd:Service to a format that is supported for serializing query results.
URIs for commonly used serialization formats are defined by Unique URIs for File Formats. For formats that do not have an
existing URI, the <http://www.w3.org/ns/formats/media_type> and <http://www.w3.org/ns/formats/preferred_suffix> properties defined in that document SHOULD be used to describe the format.
The rdfs:domain of sd:resultFormat is sd:Service.
The rdfs:range of sd:resultFormat is format:Format.
sd:inputFormatsd:inputFormat relates an instance of sd:Service to a format that is supported for parsing RDF input; for example, via a SPARQL 1.2 Update LOAD statement, or when URIs are dereferenced in FROM/FROM NAMED/USING/USING NAMED clauses (see also sd:DereferencesURIs below).
URIs for commonly used serialization formats are defined by Unique URIs for File Formats. For formats that do not have an
existing URI, the <http://www.w3.org/ns/formats/media_type> and <http://www.w3.org/ns/formats/preferred_suffix> properties defined in that document SHOULD be used to describe the format.
The rdfs:domain of sd:inputFormat is sd:Service.
The rdfs:range of sd:inputFormat is format:Format.
sd:defaultGraphsd:defaultGraph relates an instance of sd:Dataset to the description of its default graph.
The rdfs:domain of sd:defaultGraph is sd:Dataset.
The rdfs:range of sd:defaultGraph is sd:Graph.
sd:namedGraphsd:namedGraph relates an instance of sd:GraphCollection (or its subclass sd:Dataset) to the description of one of
its named graphs. The description of such a named graph MUST include the sd:name property
and MAY include the sd:graph property.
The rdfs:domain of sd:namedGraph is sd:GraphCollection.
The rdfs:range of sd:namedGraph is sd:NamedGraph.
sd:namesd:name relates a named graph to the name by which it may be referenced in a FROM/FROM NAMED clause. The object of the sd:name property is an IRI.
The rdfs:domain of sd:name is sd:NamedGraph.
sd:graphsd:graph relates a named graph to its graph description.
The rdfs:domain of sd:graph is sd:NamedGraph.
The rdfs:range of sd:graph is sd:Graph.
sd:Servicesd:Service is the rdfs:Class of SPARQL services made available via the SPARQL Protocol.
sd:Featuresd:Feature is the rdfs:Class of features of a SPARQL service. Specific types of features include functions,
aggregates, languages, and entailment regimes and profiles.
This document defines five instances of sd:Feature: sd:DereferencesURIs, sd:UnionDefaultGraph, sd:RequiresDataset, sd:EmptyGraphs,
and sd:BasicFederatedQuery (as well as several sd:Languages which are sd:Feature instances via subclassing).
sd:Languagesd:Language is the rdfs:Class of the SPARQL languages (Query or Update).
The combination of a sd:Language with a version indicates a specific service configuration providing particular features or extensions.
The previous version of this specification [[SPARQL11-SERVICE-DESCRIPTION]] defined sd:Language as indicating both a language and a version.
This has been changed so that sd:Language now only represents languages. A service's supported versions of the language is now specified using the sd:supportedVersion property.
The previously-defined sd:Language instances which include a version number are preserved below for backwards compatibility.
This document defines five instances of sd:Language: sd:SPARQL10Query, sd:SPARQL11Query, sd:SPARQL11Update, sd:SPARQLQuery, and sd:SPARQLUpdate.
sd:Language is a rdfs:subClassOf of sd:Feature.
sd:Functionsd:Function is the rdfs:Class of functions that may be used in a SPARQL SELECT expression or a FILTER, HAVING, GROUP BY, ORDER BY, or BIND clause.
sd:Function is a rdfs:subClassOf of sd:Feature.
sd:Aggregatesd:Aggregate is the rdfs:Class aggregates that may be used in a SPARQL aggregate query (for instance in a HAVING clause or SELECT expression) besides the standard list of
supported aggregates COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT, and SAMPLE.
sd:Aggregate is a rdfs:subClassOf of sd:Feature.
sd:EntailmentRegimesd:EntailmentRegime is the rdfs:Class of entailment regimes used in basic graph pattern matching (as described in [[[SPARQL-QUERY#sparqlBGPExtend]]]).
URIs for commonly used entailment regimes are defined by Unique URIs for Semantic Web Entailment Regimes.
sd:EntailmentRegime is a rdfs:subClassOf of sd:Feature.
sd:EntailmentProfilesd:EntailmentProfile is the rdfs:Class of profiles of an entailment regime. An entailment profile MAY impose restrictions on what constitutes valid RDF with respect to entailment. URIs for commonly used entailment profiles are defined by Unique URIs for OWL 2 Profiles.
sd:EntailmentProfile is a rdfs:subClassOf of sd:Feature.
sd:GraphCollectionsd:GraphCollection is the rdfs:Class of collections of zero or more named graph descriptions. Each named graph description belonging
to an sd:GraphCollection MUST be linked with the sd:namedGraph predicate.
sd:Datasetsd:Dataset is the rdfs:Class of RDF Datasets, comprised of a default graph and
zero or more named graphs.
The default graph of an sd:Dataset MUST be linked with the sd:defaultGraph predicate.
sd:Dataset is a rdfs:subClassOf of sd:GraphCollection.
sd:Graphsd:Graph is the rdfs:Class of RDF graphs.
This document does not define properties with domain sd:Graph. Instead, such instances may be described using other appropriate vocabularies (see
example below).
sd:NamedGraphsd:NamedGraph is the rdfs:Class of graphs having a name in a sd:Dataset or sd:GraphCollection (via sd:name) and an optional graph
description (via sd:graph).
sd:SPARQL10Querysd:SPARQL10Query is a sd:Language representing the SPARQL 1.0 Query Language.
sd:SPARQL11Querysd:SPARQL11Query is a sd:Language representing the [[[SPARQL11-QUERY]]].
sd:SPARQL11Updatesd:SPARQL11Update is a sd:Language representing the [[[SPARQL11-UPDATE]]] language.
sd:SPARQLQuerysd:SPARQLQuery is a sd:Language representing the [[[SPARQL12-QUERY]]].
Relevant supported versions are:
sparql:version-1.2sparql:version-1.2-basicsparql:version-1.1sparql:version-1.0sd:SPARQLUpdatesd:SPARQLUpdate is a sd:Language representing the [[[SPARQL12-UPDATE]]] language.
Relevant supported versions are:
sparql:version-1.2sparql:version-1.2-basicsparql:version-1.1sd:DereferencesURIssd:DereferencesURIs is a sd:Feature which, when used as the object of the sd:feature property, indicates that a SPARQL service will dereference [[WEBARCH]] URIs used in FROM/FROM NAMED
and USING/USING NAMED clauses and use the resulting RDF in the dataset during query evaluation.
sd:UnionDefaultGraphsd:UnionDefaultGraph is a sd:Feature which, when used as the object of the sd:feature property, indicates that the default graph of the dataset used during query and
update evaluation (when an explicit dataset is not specified) is comprised of the union of all the named graphs in that dataset.
sd:RequiresDatasetsd:RequiresDataset is a sd:Feature which, when used as the object of the sd:feature property, indicates that the SPARQL service requires an explicit dataset declaration
(based on either FROM/FROM NAMED clauses in a query, USING/USING NAMED clauses in an update, or the appropriate SPARQL Protocol
parameters).
sd:EmptyGraphssd:EmptyGraphs is a sd:Feature which, when used as the object of the sd:feature property, indicates that the underlying graph store supports empty graphs. A graph store
that supports empty graphs MUST NOT remove graphs that are left empty after triples are removed from them. (See 3.1 Graph Update in SPARQL 1.2 Update.)
sd:BasicFederatedQuerysd:BasicFederatedQuery is a sd:Feature which, when used as the object of the sd:feature property, indicates that the SPARQL service supports basic federated query using
the SERVICE keyword as defined by [[[SPARQL12-FEDERATED-QUERY]]].
Apart from the instances listed above, custom extensions and other documents may define further instance URIs usable within service descriptions; the following documents also list instance URIs that may be used with some of the properties defined in the previous sections:
sd:EntailmentRegime usable with the properties sd:defaultEntailmentRegime and sd:entailmentRegime)sd:EntailmentProfile usable with the properties sd:defaultSupportedEntailmentProfile and sd:supportedEntailmentProfile)format:Format usable with the properties sd:resultFormat and
sd:inputFormat)The following HTTP traces illustrate the retrieval of a service description from the SPARQL endpoint http://www.example/sparql/.
This RDF describes a SPARQL service available at the URL http://www.example/sparql/ that supports the SPARQL 1.2 Query language. The service will dereference URLs used in
FROM/FROM NAMED clauses, supports the SPARQL Results XML, RDF/XML, and Turtle serialization formats, supports the http://example.org/Distance extension function, and has a dataset with a default
graph and one named graph, both described using the VoID vocabulary [[?VOID]]. The default graph contains 100 triples and supports RDFS entailment while the graph named
http://www.example/named-graph contains 2000 triples and supports OWL2 RL entailment.
Given the HTTP request:
GET /sparql/ HTTP/1.1 Host: www.example
the SPARQL service responds with an RDF/XML encoded service description (no content negotiation or RDFa encoding is used):
HTTP/1.1 200 OK
Date: Fri, 09 Oct 2009 17:31:12 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/rdf+xml
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sd="http://www.w3.org/ns/sparql-service-description#"
xmlns:prof="http://www.w3.org/ns/owl-profile/"
xmlns:void="http://rdfs.org/ns/void#">
<sd:Service>
<sd:endpoint rdf:resource="http://www.example/sparql/"/>
<sd:supportedLanguage rdf:resource="http://www.w3.org/ns/sparql-service-description#SPARQLQuery"/>
<sd:supportedVersion rdf:resource="http://www.w3.org/ns/sparql#version-1.2"/>
<sd:supportedVersion rdf:resource="http://www.w3.org/ns/sparql#version-1.2-basic"/>
<sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/SPARQL_Results_XML"/>
<sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/RDF_XML"/>
<sd:resultFormat rdf:resource="http://www.w3.org/ns/formats/Turtle"/>
<sd:feature rdf:resource="http://www.w3.org/ns/sparql-service-description#DereferencesURIs"/>
<sd:defaultEntailmentRegime rdf:resource="http://www.w3.org/ns/entailment/RDFS"/>
<sd:extensionFunction>
<sd:Function rdf:about="http://example.org/Distance"/>
</sd:extensionFunction>
<sd:defaultDataset>
<sd:Dataset>
<sd:defaultGraph>
<sd:Graph>
<void:triples rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">100</void:triples>
</sd:Graph>
</sd:defaultGraph>
<sd:namedGraph>
<sd:NamedGraph>
<sd:name rdf:resource="http://www.example/named-graph"/>
<sd:entailmentRegime rdf:resource="http://www.w3.org/ns/entailment/OWL-RDF-Based"/>
<sd:supportedEntailmentProfile rdf:resource="http://www.w3.org/ns/owl-profile/RL"/>
<sd:graph>
<sd:Graph>
<void:triples rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2000</void:triples>
</sd:Graph>
</sd:graph>
</sd:NamedGraph>
</sd:namedGraph>
</sd:Dataset>
</sd:defaultDataset>
</sd:Service>
</rdf:RDF>
Given the HTTP request:
GET /sparql/ HTTP/1.1 Host: www.example Accept: text/turtle
the SPARQL service responds with a Turtle encoded service description:
HTTP/1.1 200 OK
Date: Fri, 09 Oct 2009 17:31:12 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: text/turtle
PREFIX sd: <http://www.w3.org/ns/sparql-service-description#>
PREFIX ent: <http://www.w3.org/ns/entailment/>
PREFIX prof: <http://www.w3.org/ns/owl-profile/>
PREFIX void: <http://rdfs.org/ns/void#>
PREFIX sparql: <http://www.w3.org/ns/sparql#>
PREFIX format: <http://www.w3.org/ns/formats/>
[] a sd:Service ;
sd:endpoint <http://www.example/sparql/> ;
sd:supportedLanguage sd:SPARQLQuery ;
sd:supportedVersion sparql:version-1.2, sparql:version-1.2-basic ;
sd:resultFormat format:SPARQL_Results_XML, format:RDF_XML, format:Turtle ;
sd:extensionFunction <http://example.org/Distance> ;
sd:feature sd:DereferencesURIs ;
sd:defaultEntailmentRegime ent:RDFS ;
sd:defaultDataset [
a sd:Dataset ;
sd:defaultGraph [
a sd:Graph ;
void:triples 100
] ;
sd:namedGraph [
a sd:NamedGraph ;
sd:name <http://www.example/named-graph> ;
sd:entailmentRegime ent:OWL-RDF-Based ;
sd:supportedEntailmentProfile prof:RL ;
sd:graph [
a sd:Graph ;
void:triples 2000
]
]
] .
<http://example.org/Distance> a sd:Function .
Given the HTTP request:
GET /sparql/ HTTP/1.1 Host: www.example Accept: text/turtle
the SPARQL service responds with an HTTP message containing a `Link` header of type `service-desc`,
pointing to the location of the service description at http://www.example/sparql-service-description:
HTTP/1.1 200 OK Date: Fri, 09 Oct 2009 17:31:12 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3 Link: </sparql-service-description>; rel="service-desc" Connection: close Content-Type: text/turtle # Response body for the GET /sparql/ request. This is not the service description.
A SPARQL service conformant with this specification:
The returned RDF content for a service with endpoint <service-endpoint-URL>:
By its nature, a service description exposes details of the service being described. Through the use of terms defined in this document (or in conjunction with terms defined elsewhere), a service description may reveal details of the service's software, configuration, extensions, and dataset. These details may be useful to consumers of the service description, but they also risk exposing information that could reveal data meant to be private. Care must be taken by system implementors and those responsible for configuring SPARQL services in deciding what and how much data to include in a service description.
The data revealed in a service description may risk exposing information that could be used to exploit software vulnerabilities, or pursue other unintended outcomes. As described in , care must be taken in deciding what and how much data to include in a service description.
Some aspects of a service description may be computed on-the-fly (for example, a dataset description which includes a list of all named graphs and their corresponding sizes). This may cause additional use of CPU resources along with associated secondary issues such as denial of service.
TODO