Skip to content

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Comment on lines +10429 to +10431
Copy link
Member

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) to Value Insertion?

Suggested change
<!-- ValuesInsertion -->
<section>
<h3>Values Insertion and `EXISTS`</h3>
<!-- ValueInsertion -->
<section>
<h3>Value Insertion and `EXISTS`</h3>

Copy link
Contributor Author

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.

<p>The following sections contain draft of material for a revised
"`exists`" operation.
</p>
Comment on lines +10432 to +10434
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>The following sections contain draft of material for a revised
"`exists`" operation.
</p>
<p>This section contains draft material for a revised
"`exists`" operation.
</p>

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Extend the "in-scope" rules to include the variables in-scope from the current row:</p>
<p>Extend the "in-scope" rules to include the variables that are in-scope for the current row:</p>

<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)`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Define the Projection Expression Variable Remapping `ProjectMap(P,PV)`
Define the Projection Expression Variable Remapping `ProjectMap(P, PV)`

</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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(e.g. bottom-up or top-down).
(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.
</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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is not affected by the values insertion operation because it is renamed apart.
is not affected by the value insertion operation because it is renamed apart.

</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, μ)`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If, as I suggested above, Values Insertion is being changed to Value Insertion, then ValuesInsert should likewise be changed to ValueInsert

Suggested change
Define the Values Insertion function `ValuesInsert(X, μ)`
Define the Value Insertion function `ValueInsert(X, μ)`

</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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exists(X) = false otherwise</pre>
Otherwise, exists(X) = false.</pre>

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Down
Loading