Copyright © 2005 Free University of Bozen-Bolzano, Faculty of Computer Science, KRDB Research Centre.
This document reflects the best effort of the editors to formalise the SPARQL semantics and incorporates input from various members of the WG, but is not yet endorsed by the WG as a whole.
This is a live document and is subject to change without notice. See also the change log.
See also: DAWG Working Group
Definition 1 (RDF graphs)
We call RDFT the set of RDF terms, namely the union of all RDF URI
references with the set of all literals in their canonical representation and
with all the bnode names; the canonical representation of a literal is a chosen
representative of all the literals associated to the same value, if the literal is non
ill-typed, otherwise it is the literal itself. RDF graphs are defined in the standard
way.
Definition 2 (Pattern Solution)
A pattern solution (aka variable substitution) is a partial function from a finite
subset, possibly empty, of the query variables alphabet to RDFT; optionally, we
may consider pattern solutions mapping to RDFT without bnodes.
Definition 3 (Answer Set)
An answer set is a set of pattern solutions. An answer set is non-redundant if
it does not contain any redundant tuple.
A tuple S
AS is redundant in an answer set AS if L(AS) - the logical
translation of the answer set - is logically equivalent to L(AS \ {S}) - the logical
translation of the answer set diminished by the tuple.
The logic translation L(AS) of an answer set AS is a closed existential predicate
logic formula, where URIs and literals (in their canonical representation) are
constants and blank nodes are existential variables, and the body is a conjunction of
atomic formulae of some predicate R in correspondence with each solution S
AS.
This correspondence is built as follows:
otherwise.
Definition 4 (RDF Merge)
The RDF merge
<G1...Gn> of a sequence of graphs <G1...Gn> (i.e., a dataset)
is the ordered merge union of the graphs, where repeated bnodes are substituted
with fresh ones, by keeping the names of the bnodes coming first in the sequence
order. Note that, w.r.t. the standard definition of RDF merge, if any of the
graphs contains variables, then those are not renamed (i.e., variables are treated
as URIs).
Definition 5 (Basic Graph Pattern)
A basic graph pattern is a finite RDF graph where query variables are allowed
to label nodes and edges, in alternative to elements of RDFT. Variables may be
annotated with a set of elements of RDFT- to restrict the possible assignments
of variables.
Definition 6 (Answer Set of a BGP query)
Given an RDF graph G and a basic graph pattern query Q, the answer set (resp.
non-redundant answer set) of Q for G is the maximum set (resp. maximum
non-redundant set) of pattern solutions such that for each such S:
(G
Q) [S]
is a semantically well defined logical implication relation among
RDF graphs, namely either simple entailment, or RDF entailment, or
RDFS entailment, or OWL-DL entailment, or OWL-Full entailment.
Lemma 1
Definition 7 (SPARQL Algebra - still informal)
A SPARQL query expression constructs an answer set from an RDF graph, by
combining basic steps of the form of basic query patterns - constructing answer sets
from the RDF graph - with higher level algebraic operators which transform answer
sets. Algebraic operators are:
Optionally, a Construct operator may at the end transform an answer set in an RDF graph.