@@ -10429,7 +10429,7 @@ <h3>Evaluation Semantics</h3>
10429
10429
<section>
10430
10430
<h3>Values Insertion and `EXISTS`</h3>
10431
10431
<div class="ednote">
10432
- <p>The following subsections contain draft of material for a revised
10432
+ <p>The following subsections contain draft material for a revised
10433
10433
"`exists`" operation.
10434
10434
</p>
10435
10435
<p>
@@ -10458,10 +10458,15 @@ <h4>Syntax Restriction</h4>
10458
10458
</tr>
10459
10459
</tbody>
10460
10460
</table>
10461
- <p class="note">
10462
- This restriction means that <a href="#defn_valuesinsertion">values inserted</a>
10463
- do not conflict with values assigned to variables within the pattern.
10464
- </p>
10461
+ <div class="note">
10462
+ <p>
10463
+ This restriction means that <a href="#defn_valuesinsertion">values inserted</a>
10464
+ do not conflict with values assigned to variables within the pattern.
10465
+ </p>
10466
+ <p>
10467
+ This operation is performed as part of query parsing.
10468
+ </p>
10469
+ </div>
10465
10470
</section>
10466
10471
<section>
10467
10472
<h4>Remapping</h4>
@@ -10514,39 +10519,88 @@ <h4>Remapping</h4>
10514
10519
Replacements may happen several times, depending on recursive order
10515
10520
but each time a replacement is made, the variable not used anywhere else.
10516
10521
</p>
10517
-
10518
- <p class="note">
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
- </p>
10522
+
10523
+ <div class="note">
10524
+ <p>
10525
+ A variable inside a project expression that is not in the variables projected
10526
+ is not affected by the values insertion operation because it is renamed apart.
10527
+ </p>
10528
+ <p>
10529
+ This operation is as part of the <a href="#sparqlQuery">translation to the SPARQL
10530
+ algebra</a>.
10531
+ </p>
10532
+ </div>
10522
10533
</section>
10523
10534
<section>
10524
10535
<h4>Values Insertion</h4>
10536
+ <p>
10537
+ Alternative 1: rewrite the algebra during
10538
+ <a href="#sparqlQuery">translation to the SPARQL algebra</a>
10539
+ to include a function that evaluates to the current row.
10540
+ </p>
10541
+
10525
10542
<div class="defn">
10526
10543
<div>
10527
- <b>Definition: <span id="defn_valuesinsertion " name="defn_valuesinsertion ">Values Insertion </span></b>
10544
+ <b>Definition: <span id="defn_correlate " name="defn_correlate ">Values In Scope </span></b>
10528
10545
<p>
10529
- Define the Values Insertion function `ValuesInsert(X, μ)`
10546
+ Define the function `BindingInScope()`.
10547
+ Evaluation of `BindingInScope()` results in a table of one row,
10548
+ being the current binding of the enclosing filter.
10530
10549
</p>
10531
- <pre>Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10550
+ </div>
10551
+ </div>
10532
10552
10553
+ <div class="defn">
10554
+ <div>
10555
+ <b>Definition: Access to the current binding</b>
10556
+ <p>
10557
+ During <a href="#sparqlQuery">translation to the SPARQL algebra</a>
10558
+ </p>
10559
+ <pre>
10533
10560
Replace each occurence of `Y` in X where `Y` is one of
10534
10561
<a href="#sparqlTranslateBasicGraphPatterns">Basic Graph Pattern</a>,
10535
10562
<a href="#sparqlTranslatePathExpressions">Property Path Expression</a>,
10536
10563
<a href="#sparqlTranslateGraphPatterns">`Graph(Var, pattern)`</a>,
10537
10564
<a href="#https://www.w3.org/TR/sparql12-query/#sparqlTranslateGraphPatterns">Inline Data</a>
10538
- with `join(Y, Table(μ))`.</pre>
10539
-
10565
+ with `join(Y, BindingInScope())`.</pre>
10566
+ </div>
10567
+ <div class="note">
10568
+ c.f. section <a href="#sparqlTranslateGraphPatterns">Translate Graph Patterns</a>
10569
+ where an empty basic graph pattern start any
10570
+ <a href="#rGroupGraphPattern">GroupGraphPattern</a>.
10571
+ It happens before the <a href="#sparqlSimplification">simplification step</a>.
10540
10572
</div>
10541
- <p>@@ rename as ???correllate</p>
10542
10573
</div>
10543
10574
10544
10575
<div class="example">
10545
10576
<p>
10546
10577
Examples
10547
10578
</p>
10548
10579
</div>
10580
+
10581
+ <p>
10582
+ Alternative 2: rewrite the algebra during execution. This corresponds to the
10583
+ <a href="https://github.com/w3c/sparql-dev/blob/main/SEP/SEP-0007/sep-0007.md">original SEP-0007 proposal</a>.
10584
+ </p>
10585
+ <div class="defn">
10586
+ <div>
10587
+ <b>Definition: <span id="defn_valuesinsertion" name="defn_valuesinsertion">Values Insertion</span></b>
10588
+ <p>
10589
+ Define the Values Insertion function `ValuesInsert(X, μ)`
10590
+ </p>
10591
+ <pre>Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10592
+
10593
+ Replace each occurence of `Y` in X where `Y` is one of
10594
+ <a href="#sparqlTranslateBasicGraphPatterns">Basic Graph Pattern</a>,
10595
+ <a href="#sparqlTranslatePathExpressions">Property Path Expression</a>,
10596
+ <a href="#sparqlTranslateGraphPatterns">`Graph(Var, pattern)`</a>,
10597
+ <a href="#https://www.w3.org/TR/sparql12-query/#sparqlTranslateGraphPatterns">Inline Data</a>
10598
+ with `join(Y, Table(μ))`.</pre>
10599
+
10600
+ </div>
10601
+ </div>
10549
10602
</section>
10603
+
10550
10604
<section>
10551
10605
<h4>Evaluation of EXISTS</h4>
10552
10606
<div class="defn">
@@ -10556,7 +10610,7 @@ <h4>Evaluation of EXISTS</h4>
10556
10610
define the Evaluation of Exists `exists(X)`
10557
10611
</p>
10558
10612
<pre>exists(X) = true
10559
- if eval( D(G), ValuesInsert (PrjMap(X), μ) )
10613
+ if eval( D(G), ValuesInScope (PrjMap(X)) , μ)
10560
10614
is a non-empty solution sequence.
10561
10615
exists(X) = false otherwise</pre>
10562
10616
</div>
0 commit comments