Skip to content

Commit 2364961

Browse files
committed
EXISTS: scoping restriction
1 parent 753e340 commit 2364961

File tree

1 file changed

+87
-34
lines changed

1 file changed

+87
-34
lines changed

spec/index.html

Lines changed: 87 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8796,16 +8796,27 @@ <h4>Variable Scope</h4>
87968796
<td><code>VALUES varlist { values }</code></td>
87978797
<td><code>v</code> is in-scope if <code>v</code> is in <code>varlist</code></td>
87988798
</tr>
8799+
<tr>
8800+
<td>`EXISTS` and `NOT EXISTS` filters</td>
8801+
<td>
8802+
<code>v</code> is in-scope if it is in-scope for the
8803+
<a href="#defn_sparqlSolutionMapping">solution mapping</a>
8804+
where the `FILTER` containing `EXISTS` or `NOT EXISTS` is applied.
8805+
</td>
8806+
</tr>
87998807
</tbody>
88008808
</table>
8801-
<p>The variable <code>v</code> must not be in-scope at the point of the <code>(expr AS
8802-
v)</code> form. The scoping for <code>(expr AS v)</code> applies immediately in
8803-
<code>SELECT</code> expressions.</p>
8809+
<p>The variable <code>v</code> must not be in-scope at the point of the
8810+
<code>(expr AS v)</code> form. The scoping for <code>(expr AS v)</code>
8811+
applies immediately in <code>SELECT</code> expressions.
8812+
</p>
88048813
<p>In <code>BIND (expr AS v)</code> requires that the variable <code>v</code> is not
8805-
in-scope from the preceeding elements in the group graph pattern in which it is used.</p>
8814+
in-scope from the preceeding elements in the group graph pattern in which it is used.
8815+
</p>
88068816
<p>In <code>SELECT</code>, the variable <code>v</code> must not be in-scope in the graph
88078817
pattern of the <code>SELECT</code> clause, nor used in another select expression earlier in
8808-
the clause.</p>
8818+
the clause.
8819+
</p>
88098820
</section>
88108821
<section id="convertGraphPattern">
88118822
<h4>Converting Graph Patterns</h4>
@@ -9093,7 +9104,6 @@ <h5>Translate Graph Patterns</h5>
90939104
<p>If the form is <code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>:</p>
90949105
</blockquote>
90959106
<pre class="code nohighlight">
9096-
Let FS := the empty set
90979107
Let <var>G</var> := the empty pattern, a basic graph pattern which is the empty set.
90989108

90999109
For each element <var>E</var> in the sequence of elements in the GroupGraphPattern
@@ -11175,52 +11185,95 @@ <h3>Grammar</h3>
1117511185
section 6 <a data-cite="xml11#sec-notation">Notation</a>.</p>
1117611186
<p>Notes:</p>
1117711187
<ol>
11178-
<li>Keywords are matched in a case-insensitive manner with the exception of
11188+
<li>
11189+
Keywords are matched in a case-insensitive manner with the exception of
1117911190
the keyword '<code>a</code>' which, in line with Turtle and N3, is used
1118011191
in place of the IRI <code>rdf:type</code>
11181-
(in full, <code><a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</a></code>).</li>
11182-
<li>Escape sequences are case sensitive.</li>
11183-
<li>When tokenizing the input and choosing grammar rules, the longest match is chosen.</li>
11184-
<li>The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.</li>
11185-
<li>There are two entry points into the grammar: <code>QueryUnit</code> for the SPARQL query language
11186-
and <code>UpdateUnit</code> for the SPARQL update language.</li>
11187-
<li>In signed numbers, no white space is allowed between the sign and the number.
11192+
(in full, <code><a
11193+
href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</a></code>).
11194+
</li>
11195+
<li>
11196+
Escape sequences are case sensitive.
11197+
</li>
11198+
<li>
11199+
When tokenizing the input and choosing grammar rules, the longest match is chosen.
11200+
</li>
11201+
<li>
11202+
The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.
11203+
</li>
11204+
<li>
11205+
There are two entry points into the grammar: <code>QueryUnit</code> for the SPARQL query language
11206+
and <code>UpdateUnit</code> for the SPARQL update language.
11207+
</li>
11208+
<li>
11209+
In signed numbers, no white space is allowed between the sign and the number.
1118811210
The <code><a href="#rAdditiveExpression">AdditiveExpression</a></code> grammar rule allows for this by
1118911211
covering the two cases of an expression followed by a signed number. These
11190-
produce an addition or subtraction of the unsigned number as appropriate.</li>
11191-
<li>The tokens <code><a href="#rInsertData">INSERT DATA</a></code>,
11212+
produce an addition or subtraction of the unsigned number as appropriate.
11213+
</li>
11214+
<li>
11215+
The tokens <code><a href="#rInsertData">INSERT DATA</a></code>,
1119211216
<code><a href="#rDeleteData">DELETE DATA</a></code> and
1119311217
<code><a href="#rDeleteWhere">DELETE WHERE</a></code> allow any amount of white space between the words.
11194-
The single space version is used in the grammar for clarity.</li>
11195-
<li>The <code><a href="#rQuadData">QuadData</a></code> and
11218+
The single space version is used in the grammar for clarity.
11219+
</li>
11220+
<li>
11221+
The <code><a href="#rQuadData">QuadData</a></code> and
1119611222
<code><a href="#rQuadPattern">QuadPattern</a></code>
1119711223
rules both use rule <code><a href="#rQuads">Quads</a></code>. The rule
1119811224
<code><a href="#rQuadData">QuadData</a></code>, used in
1119911225
<a href="#rInsertData"><code>INSERTDATA</code></a> and
1120011226
<a href="#rDeleteData"><code>DELETE DATA</code></a>,
11201-
must not allow variables in the quad patterns.</li>
11202-
<li>Blank node syntax is not allowed in <code><a href="#rDeleteWhere">DELETE WHERE</a></code>,
11227+
must not allow variables in the quad patterns.
11228+
</li>
11229+
<li>
11230+
Blank node syntax is not allowed in <code><a href="#rDeleteWhere">DELETE WHERE</a></code>,
1120311231
the <code><a href="#rDeleteClause">DeleteClause</a></code> for
1120411232
<code>DELETE</code>,
11205-
nor in <code><a href="#rDeleteData">DELETE DATA</a></code>.</li>
11206-
<li>Rules for limiting the use of blank node identifiers are given in <a href="#grammarBNodes">section 19.6</a>.</li>
11207-
<li>The number of variables in the variable list of <code>VALUES</code> block
11208-
must be the same as the number of each list of associated values in the <code>DataBlock</code>.</li>
11209-
<li>Variables introduced by <code>AS</code> in a <code>SELECT</code> clause
11210-
must not already be <a href="#variableScope">in-scope</a>.</li>
11211-
<li>The variable assigned in a <code>BIND</code> clause must not be already
11233+
nor in <code><a href="#rDeleteData">DELETE DATA</a></code>.
11234+
</li>
11235+
<li>
11236+
Rules for limiting the use of blank node identifiers are given in
11237+
<a href="#grammarBNodes">section 19.6</a>.
11238+
</li>
11239+
<li>
11240+
The number of variables in the variable list of <code>VALUES</code> block
11241+
must be the same as the number of each list of associated values in
11242+
the <code>DataBlock</code>.
11243+
</li>
11244+
<li>
11245+
Variables introduced by <code>AS</code> in a <code>SELECT</code> clause
11246+
must not already be <a href="#variableScope">in-scope</a>.
11247+
</li>
11248+
<li>
11249+
The variable assigned in a <code>BIND</code> clause must not be already
1121211250
in-use within the immediately preceding <code><a href="#rTriplesBlock">TriplesBlock</a></code> within a
11213-
<code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>.</li>
11214-
<li>Aggregate functions can be one of the
11251+
<code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>.
11252+
</li>
11253+
<li>
11254+
Any variable that is assigned to in the graph pattern of `EXISTS` or `NOT EXISTS`
11255+
must not be <a href="#variableScope">in-scope</a>. This applies to `BIND`,
11256+
variables introduced by `AS` in a `SELECT` clause,
11257+
variables introduced by `AS` in `GROUP BY`,
11258+
and variables in a `VALUES` clause.
11259+
</li>
11260+
<li>
11261+
Aggregate functions can be one of the
1121511262
<a href="#rAggregate">built-in keywords for aggregates</a>
1121611263
or a custom aggregate, which is syntactically a <a href="#rFunctionCall">function
1121711264
call</a>. Aggregate functions may only be used in
1121811265
<a href="#rSelectClause">SELECT</a>, <a href="#rHavingClause">HAVING</a>
11219-
and <a href="#rOrderClause">ORDER BY</a> clauses.</li>
11220-
<li>The expression argument of an aggregate function can not contain an aggregate function.</li>
11221-
<li>Only custom aggregate functions use the <code>DISTINCT</code> keyword
11222-
in a <a href="#rFunctionCall">function call</a>.</li>
11223-
<li>A <a href="#rReifier">reifier</a> or
11266+
and <a href="#rOrderClause">ORDER BY</a> clauses.
11267+
</li>
11268+
<li>
11269+
The expression argument of an aggregate function can not contain an aggregate function.
11270+
</li>
11271+
<li>
11272+
Only custom aggregate functions use the <code>DISTINCT</code> keyword
11273+
in a <a href="#rFunctionCall">function call</a>.
11274+
</li>
11275+
<li>
11276+
A <a href="#rReifier">reifier</a> or
1122411277
<a href="#rAnnotationBlockPath">annotation syntax</a>
1122511278
is only permitted after a triple when the property position is
1122611279
a simple path (an IRI, the keyword <code>a</code>, or a variable),

0 commit comments

Comments
 (0)