-
Notifications
You must be signed in to change notification settings - Fork 0
Definitions for Values Insertion #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10425,7 +10425,152 @@ <h3>Evaluation Semantics</h3> | |||||||||||||
eval(D(G), Slice(L, start, length)) = Slice(eval(D(G), L), start, length) | ||||||||||||||
</pre> | ||||||||||||||
</div> | ||||||||||||||
|
||||||||||||||
<!-- ValuesInsertion --> | ||||||||||||||
<section> | ||||||||||||||
<h3>Values Insertion and `EXISTS`</h3> | ||||||||||||||
<p>The following sections contain draft of material for a revised | ||||||||||||||
"`exists`" operation. | ||||||||||||||
</p> | ||||||||||||||
Comment on lines
+10432
to
+10434
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a DRAFT pull request. These are process notes. They will be removed. |
||||||||||||||
<p> | ||||||||||||||
Background: <a href="https://github.com/w3c/sparql-dev/blob/main/SEP/SEP-0007/sep-0007.md">SPARQL CG SEP-0007</a> | ||||||||||||||
</p> | ||||||||||||||
|
||||||||||||||
<section> | ||||||||||||||
<h4>Syntax Restriction</h4> | ||||||||||||||
<p><i>Additional [[[#sparqlGrammar]]] note:</i></p> | ||||||||||||||
<blockquote> | ||||||||||||||
Any variable that is assigned to in the graph pattern of `EXISTS`/`NOT EXISTS` must not be in-scope. | ||||||||||||||
This applies to `BIND`, variables introduced by `AS` in a `SELECT` clause, variables in a `VALUES` | ||||||||||||||
clause, and variables introduced by `AS` in `GROUP BY`. | ||||||||||||||
</blockquote> | ||||||||||||||
<p>Extend the "in-scope" rules to include the variables in-scope from the current row:</p> | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
<table style="border-collapse: collapse; border-color: #000000; border-spacing:5px; border-width: 1px"> | ||||||||||||||
<tbody> | ||||||||||||||
<tr> | ||||||||||||||
<th>Syntax Form</th> | ||||||||||||||
<th>In-scope variables</th> | ||||||||||||||
</tr> | ||||||||||||||
<tr> | ||||||||||||||
<td>`EXISTS` and `NOT EXISTS` filters </td> | ||||||||||||||
<td><code>v</code> is in-scope if it is in-scope for the pattern to which the `FILTER` is applied. | ||||||||||||||
</td> | ||||||||||||||
</tr> | ||||||||||||||
</tbody> | ||||||||||||||
</table> | ||||||||||||||
<p class="note"> | ||||||||||||||
This restriction means that <a href="#defn_valuesinsertion">values inserted</a> | ||||||||||||||
do not conflict with values assigned to variables with the pattern. | ||||||||||||||
</p> | ||||||||||||||
</section> | ||||||||||||||
|
||||||||||||||
<section> | ||||||||||||||
<h4>Remapping</h4> | ||||||||||||||
<p> | ||||||||||||||
Remapping ensures that a variable name used inside a project expression, | ||||||||||||||
but which is not part of the results of the evaluation of the project expression, | ||||||||||||||
does not coincide with a variable mentioned anywhere else in the | ||||||||||||||
algebra expression of a query. | ||||||||||||||
</p> | ||||||||||||||
<p> | ||||||||||||||
Renaming these variables does not change the results of evaluating | ||||||||||||||
the project expresssion. | ||||||||||||||
</p> | ||||||||||||||
<div class="defn"> | ||||||||||||||
<b>Definition: <span id="defn_projmap" name="defn_projmap">Projection Expression Variable Remapping</span></b> | ||||||||||||||
<p> | ||||||||||||||
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 | ||||||||||||||
`<a href="#sparqlQueryVariables">V</a>`, | ||||||||||||||
the set of all variables, to `V` where: | ||||||||||||||
</p> | ||||||||||||||
<pre>F(v) = v1 if v is in PV, where v1 is a fresh variable | ||||||||||||||
F(v) = v if v is not in PV</pre> | ||||||||||||||
<p> | ||||||||||||||
Define the Projection Expression Variable Remapping `ProjectMap(P,PV)` | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
</p> | ||||||||||||||
<pre>ProjectMap(Project(A, PV)) = Project(A1, PV) | ||||||||||||||
where A1 is the result of applying F | ||||||||||||||
to every variable mentioned in A. | ||||||||||||||
</pre> | ||||||||||||||
<p> | ||||||||||||||
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. | ||||||||||||||
</p> | ||||||||||||||
</div> | ||||||||||||||
|
||||||||||||||
<p>This process is applied throughout the graph pattern of <code>EXISTS</code>:</p> | ||||||||||||||
|
||||||||||||||
<div class="defn"> | ||||||||||||||
<b>Definition: <span id="defn_varrename" name="defn_varrename">Variable Remapping</span></b> | ||||||||||||||
<p> | ||||||||||||||
For any algebra expression `X`, define the Variable Remapping `PrjMap(X)` | ||||||||||||||
of algebra expression `X`: | ||||||||||||||
</p> | ||||||||||||||
<pre>PrjMap(X) = replace all project operations Project(P, PV) | ||||||||||||||
with ProjectMap(P, PV) for each projection in X.</pre> | ||||||||||||||
</div> | ||||||||||||||
<p> | ||||||||||||||
The outcome of `PrjMap` is independent of the order of replacement | ||||||||||||||
(e.g. bottom-up or top-down). | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
Replacements may happen several times, depending on recursive order | ||||||||||||||
but each time a replacement is made, the variable not used anywhere else. | ||||||||||||||
</p> | ||||||||||||||
|
||||||||||||||
<p class="note"> | ||||||||||||||
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. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
</p> | ||||||||||||||
</section> | ||||||||||||||
|
||||||||||||||
<section> | ||||||||||||||
<h4>Values Insertion</h4> | ||||||||||||||
<div class="defn"> | ||||||||||||||
<div> | ||||||||||||||
<b>Definition: <span id="defn_valuesinsertion" name="defn_valuesinsertion">Values Insertion</span></b> | ||||||||||||||
<p> | ||||||||||||||
Define the Values Insertion function `ValuesInsert(X, μ)` | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If, as I suggested above,
Suggested change
|
||||||||||||||
</p> | ||||||||||||||
<pre>Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1 | ||||||||||||||
|
||||||||||||||
Replace each occurence of `Y` in X where `Y` is one of | ||||||||||||||
<a href="#sparqlTranslateBasicGraphPatterns">Basic Graph Pattern</a>, | ||||||||||||||
<a href="#sparqlTranslatePathExpressions">Property Path Expression</a>, | ||||||||||||||
<a href="#sparqlTranslateGraphPatterns">`Graph(Var, pattern)`</a>, | ||||||||||||||
<a href="#https://www.w3.org/TR/sparql12-query/#sparqlTranslateGraphPatterns">Inline Data</a> | ||||||||||||||
with `join(Y, Table(μ))`.</pre> | ||||||||||||||
|
||||||||||||||
</div> | ||||||||||||||
<p>@@ rename as ???correllate</p> | ||||||||||||||
</div> | ||||||||||||||
|
||||||||||||||
<div class="example"> | ||||||||||||||
<p> | ||||||||||||||
Examples | ||||||||||||||
</p> | ||||||||||||||
</div> | ||||||||||||||
</section> | ||||||||||||||
|
||||||||||||||
<section> | ||||||||||||||
<h4>Evaluation of EXISTS</h4> | ||||||||||||||
<div class="defn"> | ||||||||||||||
<b>Definition: <span id="x-defn_evalExists" name="x-defn_evalExists">Evaluation of Exists</span></b> | ||||||||||||||
<p> | ||||||||||||||
Let `μ` be the current solution mapping for a filter, and `X` a graph pattern, | ||||||||||||||
define the Evaluation of Exists `exists(X)` | ||||||||||||||
</p> | ||||||||||||||
<pre>exists(X) = true | ||||||||||||||
if eval( D(G), ValuesInsert(PrjMap(X), μ) ) | ||||||||||||||
is a non-empty solution sequence. | ||||||||||||||
exists(X) = false otherwise</pre> | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The style here is that for function definition, with each case being aligned. It is not running text. |
||||||||||||||
</div> | ||||||||||||||
</section> | ||||||||||||||
</section> | ||||||||||||||
<!-- ValuesInsertion --> | ||||||||||||||
|
||||||||||||||
</section> | ||||||||||||||
|
||||||||||||||
<section id="sparqlBGPExtend"> | ||||||||||||||
<h3>Extending SPARQL Basic Graph Matching</h3> | ||||||||||||||
<p>The overall SPARQL design can be used for queries which assume a more elaborate form of | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Values Insertion
reads very oddly to me. Can this be changed (throughout) toValue Insertion
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is inserting multiple values.