diff --git a/spec/index.html b/spec/index.html index 3eabcac0..bfb76631 100644 --- a/spec/index.html +++ b/spec/index.html @@ -4694,6 +4694,15 @@
+ A SPARQL expression is evaluated + with respect to a solution mapping + and in the context of an RDF dataset + with an active graph. + The result of such an evaluation is either + an RDF term or + an [=error=]. +
SPARQL provides a subset of the functions and operators defined by XPath and XQuery Functions and Operators. @@ -10048,16 +10057,18 @@
Filter(expr, Ω, |D|, |G|) = { μ in Ω | expr(μ) is an expression that has an - [=effective boolean value=] of true }
-Filter(expr, Ω, |D|, |G|) = + { μ in Ω | + |expr|(μ, |D|, |G|) is an RDF term |t| + such that EBV(|t|) is `"true"^^xsd:boolean` }
multiplicity( μ | Filter(expr, Ω, |D|, |G|) ) = multiplicity( μ | Ω )
-
- Note that evaluating an exists(pattern)
expression uses the dataset |D| and
- active graph |G|. See the evaluation of filter.
-
+ + where, for every solution mapping μ, + |expr|(μ, |D|, |G|) is the result of + evaluating expression |expr| + with respect to μ, in the context of dataset |D| with active graph |G|. +
Definition: Join
@@ -10077,29 +10088,46 @@Definition: Diff
-Let Ω1 and Ω2 be multisets of solution mappings and expr be an - expression. We define:
-Diff(Ω1, Ω2, expr) = { μ | μ in Ω1 such that ∀ μ' in - Ω2, either μ and μ' are not compatible or μ and μ' are compatible and - expr(merge(μ, μ')) does not have an [=effective boolean value=] of true }
-multiplicity( μ | Diff(Ω1, Ω2, expr) ) = +
Let Ω1 and Ω2 be multisets of solution mappings, + expr be an expression, + |D| be a dataset, + and |G| be the active graph. + We define:
+Diff(Ω1, Ω2, expr, |D|, |G|) + = { μ in Ω1 | for every μ' in Ω2, + any of the following conditions holds:
+}
+multiplicity( μ | Diff(Ω1, Ω2, expr, |D|, |G|) ) = multiplicity( μ | Ω1 )
++ where, for every solution mapping μ, + |expr|(μ, |D|, |G|) is the result of + evaluating expression |expr| + with respect to μ, in the context of dataset |D| with active graph |G|. +
The evaluation of expr(merge(μ, μ')) does not have an - [=effective boolean value=] of true if it evaluates to false or if it raises an error.
Diff is used internally for the definition of LeftJoin.
Definition: LeftJoin
-Let Ω1 and Ω2 be multisets of solution mappings and expr be an - expression. We define:
-LeftJoin(Ω1, Ω2, expr) = Filter(expr, Join(Ω1, - Ω2)) ∪ Diff(Ω1, Ω2, expr)
-multiplicity( μ | LeftJoin(Ω1, Ω2, expr) ) = - multiplicity( μ | Filter(expr, Join(Ω1, Ω2)) ) + +
Let Ω1 and Ω2 be multisets of solution mappings, + expr be an expression, + |D| be a dataset, + and |G| be the active graph. + We define:
+LeftJoin(Ω1, Ω2, expr, |D|, |G|) = Filter(expr, Join(Ω1, + Ω2), |D|, |G|) ∪ Diff(Ω1, Ω2, expr, |D|, |G|)
+multiplicity( μ | LeftJoin(Ω1, Ω2, expr, |D|, |G|) ) = + multiplicity( μ | Filter(expr, Join(Ω1, Ω2), |D|, |G|) ) + multiplicity( μ | Diff(Ω1, Ω2, - expr) )
+ expr, |D|, |G|) )P
.
Definition: Extend
-Let μ be a solution mapping, Ω a multiset of solution mappings, var a variable - and expr be an expression, then we define:
-Extend(μ, var, expr) = μ ∪ { (var, value) | var not in dom(μ) and value = expr(μ) }
-Extend(μ, var, expr) = μ if var not in dom(μ) and expr(μ) is an error
-Extend is undefined if var in dom(μ).
-Extend(Ω, var, expr) = { Extend(μ, var, expr) | μ in Ω }
+Let μ be a solution mapping, Ω a multiset of solution mappings, + var be a variable, + expr be an expression, + |D| be a dataset, + and |G| be the active graph. + We define:
+Extend(Ω, var, expr, |D|, |G|) = { |Extend|(μ, var, expr, |D|, |G|) | μ in Ω },
+where, for every solution mapping μ,
+|Extend|(μ, var, expr, |D|, |G|) = μ ∪ { (var, |expr|(μ, |D|, |G|)) } + if var not in dom(μ) and + |expr|(μ, |D|, |G|) is an RDF term,
+|Extend|(μ, var, expr, |D|, |G|) = μ + if var not in dom(μ) and + |expr|(μ, |D|, |G|) is an [=error=],
+|Extend|(μ, var, expr, |D|, |G|) is undefined + if var in dom(μ), and
+|expr|(μ, |D|, |G|) is the result of + evaluating expression |expr| + with respect to μ, in the context of dataset |D| with active graph |G|. +
+Write [ x | C ] for a sequence of elements where C is a condition on x.
Definition: Evaluation of LeftJoin
-eval( |D|(|G|), LeftJoin(P1, P2, |F|) ) = LeftJoin( eval(|D|(|G|), P1), eval(|D|(|G|), P2), |F| ) +eval( |D|(|G|), LeftJoin(P1, P2, |F|) ) = LeftJoin( eval(|D|(|G|), P1), eval(|D|(|G|), P2), |F|, |D|, |G| )
Note that if eval(|D|(|G|), Ai) is an error, it is ignored.
Definition: Evaluation of Extend
+Definition: Evaluation of Extend
-eval( |D|(|G|), Extend(|P|, |var|, |expr|) ) = Extend( eval(|D|(|G|), |P|), |var|, |expr| ) +eval( |D|(|G|), Extend(|P|, |var|, |expr|) ) = Extend( eval(|D|(|G|), |P|), |var|, |expr|, |D|, |G| )