Skip to content

Commit fd7b58f

Browse files
committed
EXISTS: scoping restriction
1 parent 853a268 commit fd7b58f

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
@@ -8781,16 +8781,27 @@ <h4>Variable Scope</h4>
87818781
<td><code>VALUES varlist { values }</code></td>
87828782
<td><code>v</code> is in-scope if <code>v</code> is in <code>varlist</code></td>
87838783
</tr>
8784+
<tr>
8785+
<td>`EXISTS` and `NOT EXISTS` filters</td>
8786+
<td>
8787+
<code>v</code> is in-scope if it is in-scope for the
8788+
<a href="#defn_sparqlSolutionMapping">solution mapping</a>
8789+
where the `FILTER` containing `EXISTS` or `NOT EXISTS` is applied.
8790+
</td>
8791+
</tr>
87848792
</tbody>
87858793
</table>
8786-
<p>The variable <code>v</code> must not be in-scope at the point of the <code>(expr AS
8787-
v)</code> form. The scoping for <code>(expr AS v)</code> applies immediately in
8788-
<code>SELECT</code> expressions.</p>
8794+
<p>The variable <code>v</code> must not be in-scope at the point of the
8795+
<code>(expr AS v)</code> form. The scoping for <code>(expr AS v)</code>
8796+
applies immediately in <code>SELECT</code> expressions.
8797+
</p>
87898798
<p>In <code>BIND (expr AS v)</code> requires that the variable <code>v</code> is not
8790-
in-scope from the preceeding elements in the group graph pattern in which it is used.</p>
8799+
in-scope from the preceeding elements in the group graph pattern in which it is used.
8800+
</p>
87918801
<p>In <code>SELECT</code>, the variable <code>v</code> must not be in-scope in the graph
87928802
pattern of the <code>SELECT</code> clause, nor used in another select expression earlier in
8793-
the clause.</p>
8803+
the clause.
8804+
</p>
87948805
</section>
87958806
<section id="convertGraphPattern">
87968807
<h4>Converting Graph Patterns</h4>
@@ -9078,7 +9089,6 @@ <h5>Translate Graph Patterns</h5>
90789089
<p>If the form is <code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>:</p>
90799090
</blockquote>
90809091
<pre class="code nohighlight">
9081-
Let FS := the empty set
90829092
Let <var>G</var> := the empty pattern, a basic graph pattern which is the empty set.
90839093

90849094
For each element <var>E</var> in the sequence of elements in the GroupGraphPattern
@@ -11150,52 +11160,95 @@ <h3>Grammar</h3>
1115011160
section 6 <a data-cite="xml11#sec-notation">Notation</a>.</p>
1115111161
<p>Notes:</p>
1115211162
<ol>
11153-
<li>Keywords are matched in a case-insensitive manner with the exception of
11163+
<li>
11164+
Keywords are matched in a case-insensitive manner with the exception of
1115411165
the keyword '<code>a</code>' which, in line with Turtle and N3, is used
1115511166
in place of the IRI <code>rdf:type</code>
11156-
(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>
11157-
<li>Escape sequences are case sensitive.</li>
11158-
<li>When tokenizing the input and choosing grammar rules, the longest match is chosen.</li>
11159-
<li>The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.</li>
11160-
<li>There are two entry points into the grammar: <code>QueryUnit</code> for the SPARQL query language
11161-
and <code>UpdateUnit</code> for the SPARQL update language.</li>
11162-
<li>In signed numbers, no white space is allowed between the sign and the number.
11167+
(in full, <code><a
11168+
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>).
11169+
</li>
11170+
<li>
11171+
Escape sequences are case sensitive.
11172+
</li>
11173+
<li>
11174+
When tokenizing the input and choosing grammar rules, the longest match is chosen.
11175+
</li>
11176+
<li>
11177+
The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.
11178+
</li>
11179+
<li>
11180+
There are two entry points into the grammar: <code>QueryUnit</code> for the SPARQL query language
11181+
and <code>UpdateUnit</code> for the SPARQL update language.
11182+
</li>
11183+
<li>
11184+
In signed numbers, no white space is allowed between the sign and the number.
1116311185
The <code><a href="#rAdditiveExpression">AdditiveExpression</a></code> grammar rule allows for this by
1116411186
covering the two cases of an expression followed by a signed number. These
11165-
produce an addition or subtraction of the unsigned number as appropriate.</li>
11166-
<li>The tokens <code><a href="#rInsertData">INSERT DATA</a></code>,
11187+
produce an addition or subtraction of the unsigned number as appropriate.
11188+
</li>
11189+
<li>
11190+
The tokens <code><a href="#rInsertData">INSERT DATA</a></code>,
1116711191
<code><a href="#rDeleteData">DELETE DATA</a></code> and
1116811192
<code><a href="#rDeleteWhere">DELETE WHERE</a></code> allow any amount of white space between the words.
11169-
The single space version is used in the grammar for clarity.</li>
11170-
<li>The <code><a href="#rQuadData">QuadData</a></code> and
11193+
The single space version is used in the grammar for clarity.
11194+
</li>
11195+
<li>
11196+
The <code><a href="#rQuadData">QuadData</a></code> and
1117111197
<code><a href="#rQuadPattern">QuadPattern</a></code>
1117211198
rules both use rule <code><a href="#rQuads">Quads</a></code>. The rule
1117311199
<code><a href="#rQuadData">QuadData</a></code>, used in
1117411200
<a href="#rInsertData"><code>INSERTDATA</code></a> and
1117511201
<a href="#rDeleteData"><code>DELETE DATA</code></a>,
11176-
must not allow variables in the quad patterns.</li>
11177-
<li>Blank node syntax is not allowed in <code><a href="#rDeleteWhere">DELETE WHERE</a></code>,
11202+
must not allow variables in the quad patterns.
11203+
</li>
11204+
<li>
11205+
Blank node syntax is not allowed in <code><a href="#rDeleteWhere">DELETE WHERE</a></code>,
1117811206
the <code><a href="#rDeleteClause">DeleteClause</a></code> for
1117911207
<code>DELETE</code>,
11180-
nor in <code><a href="#rDeleteData">DELETE DATA</a></code>.</li>
11181-
<li>Rules for limiting the use of blank node identifiers are given in <a href="#grammarBNodes">section 19.6</a>.</li>
11182-
<li>The number of variables in the variable list of <code>VALUES</code> block
11183-
must be the same as the number of each list of associated values in the <code>DataBlock</code>.</li>
11184-
<li>Variables introduced by <code>AS</code> in a <code>SELECT</code> clause
11185-
must not already be <a href="#variableScope">in-scope</a>.</li>
11186-
<li>The variable assigned in a <code>BIND</code> clause must not be already
11208+
nor in <code><a href="#rDeleteData">DELETE DATA</a></code>.
11209+
</li>
11210+
<li>
11211+
Rules for limiting the use of blank node identifiers are given in
11212+
<a href="#grammarBNodes">section 19.6</a>.
11213+
</li>
11214+
<li>
11215+
The number of variables in the variable list of <code>VALUES</code> block
11216+
must be the same as the number of each list of associated values in
11217+
the <code>DataBlock</code>.
11218+
</li>
11219+
<li>
11220+
Variables introduced by <code>AS</code> in a <code>SELECT</code> clause
11221+
must not already be <a href="#variableScope">in-scope</a>.
11222+
</li>
11223+
<li>
11224+
The variable assigned in a <code>BIND</code> clause must not be already
1118711225
in-use within the immediately preceding <code><a href="#rTriplesBlock">TriplesBlock</a></code> within a
11188-
<code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>.</li>
11189-
<li>Aggregate functions can be one of the
11226+
<code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>.
11227+
</li>
11228+
<li>
11229+
Any variable that is assigned to in the graph pattern of `EXISTS` or `NOT EXISTS`
11230+
must not be <a href="#variableScope">in-scope</a>. This applies to `BIND`,
11231+
variables introduced by `AS` in a `SELECT` clause,
11232+
variables introduced by `AS` in `GROUP BY`,
11233+
and variables in a `VALUES` clause.
11234+
</li>
11235+
<li>
11236+
Aggregate functions can be one of the
1119011237
<a href="#rAggregate">built-in keywords for aggregates</a>
1119111238
or a custom aggregate, which is syntactically a <a href="#rFunctionCall">function
1119211239
call</a>. Aggregate functions may only be used in
1119311240
<a href="#rSelectClause">SELECT</a>, <a href="#rHavingClause">HAVING</a>
11194-
and <a href="#rOrderClause">ORDER BY</a> clauses.</li>
11195-
<li>The expression argument of an aggregate function can not contain an aggregate function.</li>
11196-
<li>Only custom aggregate functions use the <code>DISTINCT</code> keyword
11197-
in a <a href="#rFunctionCall">function call</a>.</li>
11198-
<li>A <a href="#rReifier">reifier</a> or
11241+
and <a href="#rOrderClause">ORDER BY</a> clauses.
11242+
</li>
11243+
<li>
11244+
The expression argument of an aggregate function can not contain an aggregate function.
11245+
</li>
11246+
<li>
11247+
Only custom aggregate functions use the <code>DISTINCT</code> keyword
11248+
in a <a href="#rFunctionCall">function call</a>.
11249+
</li>
11250+
<li>
11251+
A <a href="#rReifier">reifier</a> or
1119911252
<a href="#rAnnotationBlockPath">annotation syntax</a>
1120011253
is only permitted after a triple when the property position is
1120111254
a simple path (an IRI, the keyword <code>a</code>, or a variable),

0 commit comments

Comments
 (0)