diff --git a/spec/index.html b/spec/index.html index 2369ddde..3a7641f6 100644 --- a/spec/index.html +++ b/spec/index.html @@ -8421,6 +8421,171 @@

SPARQL Query

one query level in the tree.

+
+

Algebraic Syntax

+

To define the evaluation semantics of a SPARQL query, + the abstract syntax tree of the SPARQL query string + (as defined by the SPARQL grammar) + is first translated into a syntax that resembles the + SPARQL algebra. + This section defines the expressions that can be formed in this algebraic syntax, + and the translation of SPARQL query strings into this algebraic syntax is then defined + in Section .

+

An + algebraic query expression + is defined recursively as follows:

+ +

The notion of an + algebraic property path expression, + as used in the previous definition, + is defined recursively as follows:

+ +

Translation to the SPARQL Algebra

This section defines the process of converting graph patterns and solution modifiers in a @@ -8758,9 +8923,10 @@

Collect FILTER Elements
Translate Property Path Expressions
-

The following table gives the translation of property paths expressions from SPARQL - syntax to terms in the SPARQL algebra. This applies to all elements of a property path - expression recursively.

+

The following table gives the translation + of property path expressions in SPARQL query strings + into algebraic property path expressions. + This applies to all elements of a property path expression recursively.

The next step after this one translates certain forms to triple patterns, and these are converted later to basic graph patterns by adjacency (without intervening group pattern delimiters @@ -8769,114 +8935,116 @@

Translate Property Path Expressions
patterns and these are aggregated into basic graph patterns.

Notes:

-

We introduce the following symbols:

- - - + + - + - + - + - + - - + - + - + - + - +
Syntax Form (path)Algebra (path)Syntax Form (path)Algebraic Form (path)
irilink(iri)link(iri)
^pathinv(path)inv(path)
!(:iri1|...|:irin)NPS({:iri1 ... :irin})NPS({:iri1 ... :irin})
!(^:iri1|...|^:irin)inv(NPS({:iri1 ... :irin}))inv( NPS({:iri1 ... :irin}) )
!(:iri1|...|:irii|^:irii+1|...|^:irim) alt(NPS({:iri1 ...:irii}),
-     inv(NPS({:irii+1, ..., :irim})) +
alt( NPS({:iri1 ...:irii}),
+     inv(NPS({:irii+1, ..., :irim})) )
path1 / path2seq(path1, path2)seq(path1, path2)
path1 | path2alt(path1, path2)alt(path1, path2)
path*ZeroOrMorePath(path)ZeroOrMorePath(path)
path+OneOrMorePath(path)OneOrMorePath(path)
path?ZeroOrOnePath(path)ZeroOrOnePath(path)
Translate Property Path Patterns
-

The previous step translated property path - expressions. This step translates property path - patterns, which are a subject end point, property path expression and object end - point, into triple patterns or wraps in a general algebra operation for path - evaluation.

+

The previous step translated property path expressions. + This step translates property path patterns, + which are a subject end point, a property path expression, and an object end + point. + This step assumes that the property path expression + of the property path pattern is already given in the form of an + algebraic property path expression. + The result of this step may be triple patterns and + algebraic query expressions + of the form Path(...).

Notes:

- + - - + + - - + + - - + + - - + +
Algebra (path)Algebraic Form (path) Translation
X link(iri) YX iri Y|x| link(|iri|) |y||x| |iri| |y|
X inv(iri) YY iri X|x| inv(|iri|) |y||y| |iri| |x|
X seq(P, Q) YX P ?V . ?V Q Y|x| seq(ppe1, ppe2) |y||x| ppe1 |var| . |var| ppe2 |y|
X P YPath(X, P, Y)|x| |ppe| |y|Path(|x|, |ppe|, |y|)
+
+ I assume that the translation rules in this table are meant to be applied recursively, + but the section doesn't say anything about that. In particular, for the + "|x| seq(ppe1, ppe2) |y|" + case: ppe1 and ppe2 in the resulting translation + may still be arbitrary algebraic property path expressions and, thus, + the translation should be applied again for each of the two resulting property path patterns + (i.e., for "|x| ppe1 |var|" and for "|var| ppe2 |y|").

Examples of the whole path translation process (?_V is a fresh variable):

@@ -8893,7 +9061,7 @@
Translate Property Path Patterns
?s :p* ?o
- Path(?s, ZeroOrMorePath(link(:p)), ?o) + Path(?s, ZeroOrMorePath(link(:p)), ?o)
@@ -8901,7 +9069,7 @@
Translate Property Path Patterns
:list rdf:rest*/rdf:first ?member
- Path(:list, ZeroOrMorePath(link(rdf:rest)), ?_V) .
+ Path(:list, ZeroOrMorePath(link(rdf:rest)), ?_V) .
?_V rdf:first ?member
@@ -10295,6 +10463,9 @@

Evaluation Semantics

  • |L| : a solution sequence
  • |F| : an expression
  • +
    + The definitions in this section do not cover the cases in which + |A| is a sequence or a multiset of solution mappings.

    Definition: Evaluation of a Basic Graph Pattern

    eval( |D|(|G|), |BGP| ) = multiset of solution mappings