@@ -10472,7 +10472,7 @@ <h3>Evaluation Semantics</h3>
10472
10472
<section>
10473
10473
<h3>Values Insertion and `EXISTS`</h3>
10474
10474
<div class="ednote">
10475
- <p>The following subsections contain draft of material for a revised
10475
+ <p>The following subsections contain draft material for a revised
10476
10476
"`exists`" operation.
10477
10477
</p>
10478
10478
<p>
@@ -10487,7 +10487,10 @@ <h4>Syntax Restriction</h4>
10487
10487
This applies to `BIND`, variables introduced by `AS` in a `SELECT` clause, variables in a `VALUES`
10488
10488
clause, and variables introduced by `AS` in `GROUP BY`.
10489
10489
</blockquote>
10490
- <p>Extend the "in-scope" rules to include the variables in-scope from the current row:</p>
10490
+ <p>
10491
+ Extend the "in-scope" rules to include the possible
10492
+ variables that are in-scope for the current row:
10493
+ </p>
10491
10494
<table style="border-collapse: collapse; border-color: #000000; border-spacing:5px; border-width: 1px">
10492
10495
<tbody>
10493
10496
<tr>
@@ -10501,10 +10504,15 @@ <h4>Syntax Restriction</h4>
10501
10504
</tr>
10502
10505
</tbody>
10503
10506
</table>
10504
- <p class="note">
10505
- This restriction means that <a href="#defn_valuesinsertion">values inserted</a>
10506
- do not conflict with values assigned to variables within the pattern.
10507
- </p>
10507
+ <div class="note">
10508
+ <p>
10509
+ This restriction means that <a href="#defn_valuesinsertion">values inserted</a>
10510
+ do not conflict with values assigned to variables within the pattern.
10511
+ </p>
10512
+ <p>
10513
+ This operation is performed as part of query parsing.
10514
+ </p>
10515
+ </div>
10508
10516
</section>
10509
10517
<section>
10510
10518
<h4>Remapping</h4>
@@ -10529,7 +10537,7 @@ <h4>Remapping</h4>
10529
10537
<pre>F(v) = v1 if v is in PV, where v1 is a fresh variable
10530
10538
F(v) = v if v is not in PV</pre>
10531
10539
<p>
10532
- Define the Projection Expression Variable Remapping `ProjectMap(P,PV)`
10540
+ Define the Projection Expression Variable Remapping `ProjectMap(P, PV)`
10533
10541
</p>
10534
10542
<pre>ProjectMap(Project(A, PV)) = Project(A1, PV)
10535
10543
where A1 is the result of applying F
@@ -10557,39 +10565,88 @@ <h4>Remapping</h4>
10557
10565
Replacements may happen several times, depending on recursive order
10558
10566
but each time a replacement is made, the variable not used anywhere else.
10559
10567
</p>
10560
-
10561
- <p class="note">
10562
- A variable inside a project expression that is not in the variables projected
10563
- is not affected by the values insertion operation because it is renamed apart.
10564
- </p>
10568
+
10569
+ <div class="note">
10570
+ <p>
10571
+ A variable inside a project expression that is not in the variables projected
10572
+ is not affected by the values insertion operation because it is renamed apart.
10573
+ </p>
10574
+ <p>
10575
+ This operation is as part of the <a href="#sparqlQuery">translation to the SPARQL
10576
+ algebra</a>.
10577
+ </p>
10578
+ </div>
10565
10579
</section>
10566
10580
<section>
10567
10581
<h4>Values Insertion</h4>
10582
+ <p>
10583
+ Alternative 1: rewrite the algebra during
10584
+ <a href="#sparqlQuery">translation to the SPARQL algebra</a>
10585
+ to include a function that evaluates to the current row.
10586
+ </p>
10587
+
10568
10588
<div class="defn">
10569
10589
<div>
10570
- <b>Definition: <span id="defn_valuesinsertion " name="defn_valuesinsertion ">Values Insertion </span></b>
10590
+ <b>Definition: <span id="defn_correlate " name="defn_correlate ">Values In Scope </span></b>
10571
10591
<p>
10572
- Define the Values Insertion function `ValuesInsert(X, μ)`
10592
+ Define the function `BindingInScope()`.
10593
+ Evaluation of `BindingInScope()` results in a table of one row,
10594
+ being the current binding of the enclosing filter.
10573
10595
</p>
10574
- <pre>Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10596
+ </div>
10597
+ </div>
10575
10598
10599
+ <div class="defn">
10600
+ <div>
10601
+ <b>Definition: Access to the current binding</b>
10602
+ <p>
10603
+ During <a href="#sparqlQuery">translation to the SPARQL algebra</a>
10604
+ </p>
10605
+ <pre>
10576
10606
Replace each occurence of `Y` in X where `Y` is one of
10577
10607
<a href="#sparqlTranslateBasicGraphPatterns">Basic Graph Pattern</a>,
10578
10608
<a href="#sparqlTranslatePathExpressions">Property Path Expression</a>,
10579
10609
<a href="#sparqlTranslateGraphPatterns">`Graph(Var, pattern)`</a>,
10580
10610
<a href="#https://www.w3.org/TR/sparql12-query/#sparqlTranslateGraphPatterns">Inline Data</a>
10581
- with `join(Y, Table(μ))`.</pre>
10582
-
10611
+ with `join(Y, BindingInScope())`.</pre>
10612
+ </div>
10613
+ <div class="note">
10614
+ c.f. section <a href="#sparqlTranslateGraphPatterns">Translate Graph Patterns</a>
10615
+ where an empty basic graph pattern start any
10616
+ <a href="#rGroupGraphPattern">GroupGraphPattern</a>.
10617
+ It happens before the <a href="#sparqlSimplification">simplification step</a>.
10583
10618
</div>
10584
- <p>@@ rename as ???correllate</p>
10585
10619
</div>
10586
10620
10587
10621
<div class="example">
10588
10622
<p>
10589
10623
Examples
10590
10624
</p>
10591
10625
</div>
10626
+
10627
+ <p>
10628
+ Alternative 2: rewrite the algebra during execution. This corresponds to the
10629
+ <a href="https://github.com/w3c/sparql-dev/blob/main/SEP/SEP-0007/sep-0007.md">original SEP-0007 proposal</a>.
10630
+ </p>
10631
+ <div class="defn">
10632
+ <div>
10633
+ <b>Definition: <span id="defn_valuesinsertion" name="defn_valuesinsertion">Values Insertion</span></b>
10634
+ <p>
10635
+ Define the Values Insertion function `ValuesInsert(X, μ)`
10636
+ </p>
10637
+ <pre>Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10638
+
10639
+ Replace each occurence of `Y` in X where `Y` is one of
10640
+ <a href="#sparqlTranslateBasicGraphPatterns">Basic Graph Pattern</a>,
10641
+ <a href="#sparqlTranslatePathExpressions">Property Path Expression</a>,
10642
+ <a href="#sparqlTranslateGraphPatterns">`Graph(Var, pattern)`</a>,
10643
+ <a href="#https://www.w3.org/TR/sparql12-query/#sparqlTranslateGraphPatterns">Inline Data</a>
10644
+ with `join(Y, Table(μ))`.</pre>
10645
+
10646
+ </div>
10647
+ </div>
10592
10648
</section>
10649
+
10593
10650
<section>
10594
10651
<h4>Evaluation of EXISTS</h4>
10595
10652
<div class="defn">
@@ -10599,7 +10656,7 @@ <h4>Evaluation of EXISTS</h4>
10599
10656
define the Evaluation of Exists `exists(X)`
10600
10657
</p>
10601
10658
<pre>exists(X) = true
10602
- if eval( D(G), ValuesInsert (PrjMap(X), μ) )
10659
+ if eval( D(G), ValuesInScope (PrjMap(X)) , μ)
10603
10660
is a non-empty solution sequence.
10604
10661
exists(X) = false otherwise</pre>
10605
10662
</div>
0 commit comments