Skip to content

Commit f852c60

Browse files
committed
Add 'row in scope' approach
1 parent 0f7b66d commit f852c60

File tree

1 file changed

+76
-19
lines changed

1 file changed

+76
-19
lines changed

spec/index.html

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10429,7 +10429,7 @@

Evaluation Semantics

1042910429
1043010430

Values Insertion and `EXISTS`

1043110431
10432-

The following subsections contain draft of material for a revised

10432+

The following subsections contain draft material for a revised

1043310433
"`exists`" operation.
1043410434

1043510435

@@ -10444,7 +10444,10 @@

Syntax Restriction

1044410444
This applies to `BIND`, variables introduced by `AS` in a `SELECT` clause, variables in a `VALUES`
1044510445
clause, and variables introduced by `AS` in `GROUP BY`.
1044610446
10447-

Extend the "in-scope" rules to include the variables in-scope from the current row:

10447+

10448+
Extend the "in-scope" rules to include the possible
10449+
variables that are in-scope for the current row:
10450+

1044810451
1044910452
1045010453
@@ -10458,10 +10461,15 @@

Syntax Restriction

1045810461
1045910462
1046010463
10461-

10462-
This restriction means that values inserted
10463-
do not conflict with values assigned to variables within the pattern.
10464-

10464+
10465+

10466+
This restriction means that values inserted
10467+
do not conflict with values assigned to variables within the pattern.
10468+

10469+

10470+
This operation is performed as part of query parsing.
10471+

10472+
1046510473
1046610474
1046710475

Remapping

@@ -10486,7 +10494,7 @@

Remapping

1048610494
F(v) = v1 if v is in PV, where v1 is a fresh variable
1048710495
F(v) = v if v is not in PV
1048810496

10489-
Define the Projection Expression Variable Remapping `ProjectMap(P,PV)`
10497+
Define the Projection Expression Variable Remapping `ProjectMap(P, PV)`
1049010498

1049110499
ProjectMap(Project(A, PV)) = Project(A1, PV) 
1049210500
where A1 is the result of applying F
@@ -10514,39 +10522,88 @@

Remapping

1051410522
Replacements may happen several times, depending on recursive order
1051510523
but each time a replacement is made, the variable not used anywhere else.
1051610524

10517-
10518-

10519-
A variable inside a project expression that is not in the variables projected
10520-
is not affected by the values insertion operation because it is renamed apart.
10521-

10525+
10526+
10527+

10528+
A variable inside a project expression that is not in the variables projected
10529+
is not affected by the values insertion operation because it is renamed apart.
10530+

10531+

10532+
This operation is as part of the translation to the SPARQL
10533+
algebra.
10534+

10535+
1052210536
1052310537
1052410538

Values Insertion

10539+

10540+
Alternative 1: rewrite the algebra during
10541+
10542+
to include a function that evaluates to the current row.
10543+

10544+
1052510545
1052610546
10527-
Definition: defn_valuesinsertion" name="defn_valuesinsertion">Values Insertion
10547+
Definition: defn_correlate" name="defn_correlate">Values In Scope
1052810548

10529-
Define the Values Insertion function `ValuesInsert(X, μ)`
10549+
Define the function `BindingInScope()`.
10550+
Evaluation of `BindingInScope()` results in a table of one row,
10551+
being the current binding of the enclosing filter.
1053010552

10531-
Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10553+
10554+
1053210555

10556+
10557+
10558+
Definition: Access to the current binding
10559+

10560+
10561+

10562+
1053310563
Replace each occurence of `Y` in X where `Y` is one of
1053410564
1053510565
1053610566
1053710567
10538-
with `join(Y, Table(μ))`.
10539-
10568+
with `join(Y, BindingInScope())`.
10569+
10570+
10571+
10572+
where an empty basic graph pattern start any
10573+
10574+
It happens before the simplification step.
1054010575
10541-

@@ rename as ???correllate

1054210576
1054310577

1054410578
1054510579

1054610580
Examples
1054710581

1054810582
10583+
10584+

10585+
Alternative 2: rewrite the algebra during execution. This corresponds to the
10586+
10587+

10588+
10589+
10590+
Definition: Values Insertion
10591+

10592+
Define the Values Insertion function `ValuesInsert(X, μ)`
10593+

10594+
Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10595+
10596+
Replace each occurence of `Y` in X where `Y` is one of
10597+
10598+
10599+
10600+
10601+
with `join(Y, Table(μ))`.
10602+
10603+
10604+
1054910605
10606+
1055010607
1055110608

Evaluation of EXISTS

1055210609
@@ -10556,7 +10613,7 @@

Evaluation of EXISTS

1055610613
define the Evaluation of Exists `exists(X)`
1055710614

1055810615
exists(X) = true 
10559-
if eval( D(G), ValuesInsert(PrjMap(X), μ) )
10616+
if eval( D(G), ValuesInScope(PrjMap(X)), μ)
1056010617
is a non-empty solution sequence.
1056110618
exists(X) = false otherwise
1056210619

0 commit comments

Comments
 (0)