SPARQL 1.1 Service Description (original) (raw)

1 Introduction

A SPARQL service description lists the features of a SPARQL service made available via the SPARQL 1.1 Protocol for RDF [SPROT]. 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.

1.1 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 SPARQL 1.1 Protocol for RDF (this document's use of "SPARQL Service" is the same as "SPARQL Protocol service" as defined in the SPARQL 1.1 Protocol) [SPROT].

SPARQL endpoint

The URI at which a SPARQL Service listens for requests from clients.

2 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 [RDFA], and SHOULD use content negotiation [CONNEG] if available in other RDF representations.

3 Service Description Vocabulary

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

3.2 Properties

3.2.1 sd:endpoint

Relates an instance of sd:Service to a SPARQL endpoint that implements the SPARQL Protocol service [SPROT] for the service. The object of the sd:endpoint property is an IRI.

type: owl:InverseFunctionalProperty
domain: sd:Service

3.2.2 sd:feature

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

domain: sd:Service
range: sd:Feature

3.2.3 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

3.2.4 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

3.2.5 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.1 Entailment Regimes [SPARQLENT].

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

3.2.6 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

3.2.8 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

3.2.9 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

3.2.10 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

3.2.11 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

3.2.12 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

3.2.13 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

3.2.16 sd:defaultGraph

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

domain: sd:Dataset
range: sd:Graph

3.2.17 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

3.2.18 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

3.2.19 sd:graph

Relates a named graph to its graph description.

domain: sd:NamedGraph
range: sd:Graph

3.3 Classes

3.3.1 sd:Service

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

type: rdfs:Class

3.3.2 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

3.3.3 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

3.3.5 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

3.3.7 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 [OWL2PROF].

type: rdfs:Class
subClassOf: sd:Feature

3.3.8 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

3.3.9 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

3.3.10 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

3.3.11 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

3.4 Instances

3.4.4 sd:DereferencesURIs

sd:DereferencesURIs, when used as the object of the sd:feature property, indicates that a SPARQL service will dereference [AWWW] 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

3.4.5 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

3.4.7 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.1 Update.)

type: sd:Feature

4 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.1 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.

4.1 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

<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="" title="undefined" rel="noopener noreferrer">http://rdfs.org/ns/void#"> sd:Service <sd:endpoint rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.example/sparql/"/> <sd:supportedLanguage rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/sparql-service-description#SPARQL11Query"/> <sd:resultFormat rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/formats/RDF_XML"/> <sd:resultFormat rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/formats/Turtle"/> <sd:feature rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/sparql-service-description#DereferencesURIs"/> <sd:defaultEntailmentRegime rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/entailment/RDFS"/> sd:extensionFunction <sd:Function rdf:about="" title="undefined" rel="noopener noreferrer">http://example.org/Distance"/> sd:defaultDataset sd:Dataset sd:defaultGraph sd:Graph <void:triples rdf:datatype="100" title="undefined" rel="noopener noreferrer">http://www.w3.org/2001/XMLSchema#integer">100 sd:namedGraph sd:NamedGraph <sd:name rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.example/named-graph"/> <sd:entailmentRegime rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/entailment/OWL-RDF-Based"/> <sd:supportedEntailmentProfile rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/ns/owl-profile/RL"/> sd:graph sd:Graph <void:triples rdf:datatype="2000" title="undefined" rel="noopener noreferrer">http://www.w3.org/2001/XMLSchema#integer">2000

4.2 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 [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 .

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