diff --git a/spec/index.html b/spec/index.html index 39d9604..ef694e8 100644 --- a/spec/index.html +++ b/spec/index.html @@ -8781,16 +8781,27 @@
VALUES varlist { values }
v
is in-scope if v
is in varlist
v
is in-scope if it is in-scope for the
+ solution mapping
+ where the `FILTER` containing `EXISTS` or `NOT EXISTS` is applied.
+ The variable v
must not be in-scope at the point of the (expr AS
- v)
form. The scoping for (expr AS v)
applies immediately in
- SELECT
expressions.
The variable v
must not be in-scope at the point of the
+ (expr AS v)
form. The scoping for (expr AS v)
+ applies immediately in SELECT
expressions.
+
In BIND (expr AS v)
requires that the variable v
is not
- in-scope from the preceeding elements in the group graph pattern in which it is used.
In SELECT
, the variable v
must not be in-scope in the graph
pattern of the SELECT
clause, nor used in another select expression earlier in
- the clause.
Expand abbreviations for IRIs and triple patterns given in Section .
FILTER
ElementsFILTER
expressions apply to the whole group graph pattern in which they
@@ -8875,13 +8887,120 @@
FILTER
ElementsThe set of filter expressions FS
is used
later.
prepare(EXISTS{P})
+ +@@ Scoping rule already done (grammar note).
+ Prepare FILTER for exists.
+
+ During translation to the SPARQL algebra +
++Replace each occurence of `Y` in X where `Y` is one of + Basic Graph Pattern, + Property Path Expression, + Graph(Var, pattern), + Inline Data + with join(Y, BindingInScope()) .+
+ One way to provide `BindingInScope` is to change `eval` to also have the current row + as an argument or a "null" token. . Normally this the "null" token. This would be set in + eval-filter. +
++ Another way is to have a global (to the execution) variable. In eval-exists, the + old value is recorded, the global set to the new value, and reset on exit - this forms a + stack for nested EXISTS. +
+
+ Modifing `eval` is better prepartion for other correlted operations.
+ A current-row stack in EXISTS isless intrusive.
+
+ For a projection algebra operation #sparqlProjection `Project(A, PV)` acting on algreg express `A` and with set of variables `PV`, define + a partial mapping `F` from + `V`, + the set of all variables, to `V` where: +
+F(v) = v1 if v is in PV, where v1 is a fresh variable +F(v) = v if v is not in PV+
+ Define the Projection Expression Variable Remapping `ProjectMap(P, PV)` +
+ProjectMap(Project(A, PV)) = Project(A1, PV) + where A1 is the result of applying F + to every variable mentioned in A.+
+ The Projection Expression Variable Remapping yields an algrebra expression that + evaluates to the same results as the Project argument. No variable of `ProjectMap(Project(A, PV))` + that is not in `PV` is mentioned anywhere else in the algebra expression for the query. +
+This process is applied throughout the graph pattern of EXISTS
:
+ For any algebra expression `X`, define the Variable Remapping `PrjMap(X)` + of algebra expression `X`: +
+PrjMap(X) = replace all project operations Project(P, PV) + with ProjectMap(P, PV) for each projection in X.+
+ The outcome of `PrjMap` is independent of the order of replacement + (e.g. bottom-up or top-down). + Replacements may happen several times, depending on recursive order + but each time a replacement is made, the variable not used anywhere else. +
+ ++ A variable inside a project expression that is not in the variables projected + is not affected by the values insertion operation because it is renamed apart. +
++ This operation is as part of the translation to the SPARQL + algebra. +
+The following table gives the translation @@ -9078,7 +9197,6 @@
If the form is GroupGraphPattern
:
-Let FS := the empty set Let G := the empty pattern, a basic graph pattern which is the empty set. For each element E in the sequence of elements in the GroupGraphPattern @@ -9139,14 +9257,17 @@Filters of Group
Some groups of one graph pattern become Join(|Z|, |A|), where |Z| is the empty basic graph +
+ @@ Move out of the general `translate()` process and + perform once after top level translation only +
+Some groups of one graph pattern become + Join(|Z|, |A|), where |Z| is the empty basic graph pattern (which is the empty set). These are replaced by |A|. The empty graph pattern |Z| is the identity for join:
Replace Join(Z, A) by A -Replace Join(A, Z) by A -+Replace Join(A, Z) by A
Definition: Evaluation of Filter
+ +@@ Make current μ available. Or use current language in Exist. + Long term: change eval() to be arity three - 3rd argument is "current row". + editors note. +
+eval( |D|(|G|), Filter(|F|, |P|) ) = Filter( |F|, eval(|D|(|G|), |P|), |D|(|G|) )
'substitute' is a filter function in support of the evaluation of @@ -10469,6 +10596,9 @@
Definition: Evaluation of Exists
+ +@@ Update
+Let μ be the current solution mapping for a filter and |P| a graph pattern:
The value exists(|P|), given |D|(|G|) is true if and only if eval( |D|(|G|), substitute(|P|, μ)) is @@ -10593,6 +10723,7 @@Evaluation Semantics
The overall SPARQL design can be used for queries which assume a more elaborate form of @@ -10946,52 +11077,95 @@
Notes:
a
' which, in line with Turtle and N3, is used
in place of the IRI rdf:type
- (in full, http://www.w3.org/1999/02/22-rdf-syntax-ns#type
).QueryUnit
for the SPARQL query language
- and UpdateUnit
for the SPARQL update language.http://www.w3.org/1999/02/22-rdf-syntax-ns#type
).
+ QueryUnit
for the SPARQL query language
+ and UpdateUnit
for the SPARQL update language.
+ AdditiveExpression
grammar rule allows for this by
covering the two cases of an expression followed by a signed number. These
- produce an addition or subtraction of the unsigned number as appropriate.INSERT DATA
,
+ produce an addition or subtraction of the unsigned number as appropriate.
+ INSERT DATA
,
DELETE DATA
and
DELETE WHERE
allow any amount of white space between the words.
- The single space version is used in the grammar for clarity.QuadData
and
+ The single space version is used in the grammar for clarity.
+ QuadData
and
QuadPattern
rules both use rule Quads
. The rule
QuadData
, used in
INSERTDATA
and
DELETE DATA
,
- must not allow variables in the quad patterns.DELETE WHERE
,
+ must not allow variables in the quad patterns.
+ DELETE WHERE
,
the DeleteClause
for
DELETE
,
- nor in DELETE DATA
.VALUES
block
- must be the same as the number of each list of associated values in the DataBlock
.AS
in a SELECT
clause
- must not already be in-scope.BIND
clause must not be already
+ nor in DELETE DATA
.
+ VALUES
block
+ must be the same as the number of each list of associated values in
+ the DataBlock
.
+ AS
in a SELECT
clause
+ must not already be in-scope.
+ BIND
clause must not be already
in-use within the immediately preceding TriplesBlock
within a
- GroupGraphPattern
.GroupGraphPattern
.
+ DISTINCT
keyword
- in a function call.DISTINCT
keyword
+ in a function call.
+ a
, or a variable),