Abstract

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.

Introduction

A SPARQL service description lists the features of a SPARQL service made available via the [[[SPARQL12-QUERY]]]. 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.

Terminology

When this document uses the words MUST, SHOULD 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:

SPARQL Service
Any implementation conforming to the [[[SPARQL12-PROTOCOL]]] (this document's use of "SPARQL Service" is the same as "SPARQL Protocol service" as defined in the SPARQL 1.2 Protocol) [[SPARQL12-PROTOCOL]].
SPARQL endpoint
The URI at which a SPARQL Service listens for requests from clients.

Accessing a Service Description

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 use content negotiation if available in other RDF representations.

Service Description Vocabulary

SPARQL Service Description Namespace and OWL Ontology

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.

Properties

sd:endpoint

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.

type: owl:InverseFunctionalProperty
domain: sd:Service

sd:feature

Relates an instance of sd:Service with a resource representing a supported feature.

domain: sd:Service
range: sd:Feature

sd: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.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:EntailmentRegime

sd:entailmentRegime

Relates a named graph description with a resource representing an entailment regime used for basic graph pattern matching over that graph.

domain: sd:NamedGraph
range: sd:EntailmentRegime

sd: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.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:EntailmentProfile

sd: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.

domain: sd:NamedGraph
range: sd:EntailmentProfile

sd: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.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:Function

sd: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.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:Aggregate

sd:languageExtension

Relates an instance of sd:Service to a resource representing an implemented extension to the SPARQL Query or Update language.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:Feature

sd:supportedLanguage

Relates an instance of sd:Service to a SPARQL language (e.g. Query and Update) that it implements.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:Language

sd: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.

subPropertyOf: sd:feature
domain: sd:Service
range: sd:Feature

sd:defaultDataset

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.

type: owl:InverseFunctionalProperty
domain: sd:Service
range: sd:Dataset

sd: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.

domain: sd:Service
range: sd:GraphCollection

sd: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.

domain: sd:Service
range: <http://www.w3.org/ns/formats/Format>

sd: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.

domain: sd:Service
range: <http://www.w3.org/ns/formats/Format>

sd:defaultGraph

Relates an instance of sd:Dataset to the description of its default graph.

domain: sd:Dataset
range: sd:Graph

sd: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.

domain: sd:GraphCollection
range: sd:NamedGraph

sd: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.

domain: sd:NamedGraph

sd:graph

Relates a named graph to its graph description.

domain: sd:NamedGraph
range: sd:Graph

Classes

sd:Service

An instance of sd:Service represents a SPARQL service made available via the SPARQL Protocol.

type: rdfs:Class

sd:Feature

An instance of sd:Feature represents a feature 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.

type: rdfs:Class

sd:Language

An instance of sd:Language represents one of the SPARQL languages, including specific configurations providing particular features or extensions. This document defines three instances of sd:Language: sd:SPARQL10Query, sd:SPARQL11Query, and sd:SPARQL11Update.

type: rdfs:Class
subClassOf: sd:Feature

sd:Function

An instance of sd:Function represents a function that may be used in a SPARQL SELECT expression or a FILTER, HAVING, GROUP BY, ORDER BY, or BIND clause.

type: rdfs:Class
subClassOf: sd:Feature

sd:Aggregate

An instance of sd:Aggregate represents 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.

type: rdfs:Class
subClassOf: sd:Feature

sd:EntailmentRegime

An instance of sd:EntailmentRegime represents an entailment regime used in basic graph pattern matching (as described by SPARQL 1.2 Query Language). URIs for commonly used entailment regimes are defined by Unique URIs for Semantic Web Entailment Regimes.

type: rdfs:Class
subClassOf: sd:Feature

sd:EntailmentProfile

An instance of sd:EntailmentProfile represents a profile 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.

type: rdfs:Class
subClassOf: sd:Feature

sd:GraphCollection

An instance of sd:GraphCollection represents a collection of zero or more named graph descriptions. Each named graph description belonging to an sd:GraphCollection MUST be linked with the sd:namedGraph predicate.

type: rdfs:Class

sd:Dataset

An instance of sd:Dataset represents a RDF Dataset 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.

type: rdfs:Class
subClassOf: sd:GraphCollection

sd:Graph

An instance of sd:Graph represents the description of an RDF graph.

This document does not define properties with domain sd:Graph. Instead, such instances may be described using other appropriate vocabularies (see example below).

type: rdfs:Class

sd:NamedGraph

An instance of sd:NamedGraph represents a named graph having a name (via sd:name) and an optional graph description (via sd:graph).

type: rdfs:Class

Instances

sd:SPARQL10Query

sd:SPARQL10Query is an sd:Language representing the SPARQL 1.0 Query Language.

type: sd:Language

sd:SPARQL11Query

sd:SPARQL11Query is an sd:Language representing the [[[SPARQL11-QUERY]]].

type: sd:Language

sd:SPARQL11Update

sd:SPARQL11Update is an sd:Language representing the [[[SPARQL11-UPDATE]]] language.

type: sd:Language

sd:SPARQL12Query

sd:SPARQL12Query is an sd:Language representing the [[[SPARQL12-QUERY]]].

type: sd:Language

sd:SPARQL12Update

sd:SPARQL12Update is an sd:Language representing the [[[SPARQL12-UPDATE]]] language.

type: sd:Language

sd:DereferencesURIs

sd:DereferencesURIs, 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.

type: sd:Feature

sd:UnionDefaultGraph

sd:UnionDefaultGraph, 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.

type: sd:Feature

sd:RequiresDataset

sd:RequiresDataset, 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).

type: sd:Feature

sd:EmptyGraphs

sd:EmptyGraphs, 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.)

type: sd:Feature

sd:BasicFederatedQuery

sd:BasicFederatedQuery, 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]]].

type: sd:Feature

Other Instances

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:

Example (Informative)

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 both the 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.

RDF/XML Service Description

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#SPARQL11Query"/>
    <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>

Turtle Service Description

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#> .

[] a sd:Service ;
    sd:endpoint <http://www.example/sparql/> ;
    sd:supportedLanguage sd:SPARQL11Query ;
    sd:resultFormat <http://www.w3.org/ns/formats/RDF_XML>, <http://www.w3.org/ns/formats/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 .

Conformance

A SPARQL service conformant with this specification:

  1. MUST return RDF content when the service endpoint URL is accessed as described in section 2 Accessing a Service Description.
  2. The RDF content returned from dereferencing a service endpoint URL <service-endpoint-URL> MUST include at least one triple matching:
    ?service sd:endpoint <service-endpoint-URL> .
  3. The RDF content returned MUST make use of the vocabulary defined in this document in accordance with the usage specified in section 3 Service Description Vocabulary.

Privacy Considerations

TODO

Security Considerations

TODO

Internationalization Considerations

TODO

Change Log

TODO