@@ -8849,16 +8849,27 @@ <h4>Variable Scope</h4>
8849
8849
<td><code>VALUES varlist { values }</code></td>
8850
8850
<td><code>v</code> is in-scope if <code>v</code> is in <code>varlist</code></td>
8851
8851
</tr>
8852
+ <tr>
8853
+ <td>`EXISTS` and `NOT EXISTS` filters</td>
8854
+ <td>
8855
+ <code>v</code> is in-scope if it is in-scope for the
8856
+ <a href="#defn_sparqlSolutionMapping">solution mapping</a>
8857
+ where the `FILTER` containing `EXISTS` or `NOT EXISTS` is applied.
8858
+ </td>
8859
+ </tr>
8852
8860
</tbody>
8853
8861
</table>
8854
- <p>The variable <code>v</code> must not be in-scope at the point of the <code>(expr AS
8855
- v)</code> form. The scoping for <code>(expr AS v)</code> applies immediately in
8856
- <code>SELECT</code> expressions.</p>
8862
+ <p>The variable <code>v</code> must not be in-scope at the point of the
8863
+ <code>(expr AS v)</code> form. The scoping for <code>(expr AS v)</code>
8864
+ applies immediately in <code>SELECT</code> expressions.
8865
+ </p>
8857
8866
<p>In <code>BIND (expr AS v)</code> requires that the variable <code>v</code> is not
8858
- in-scope from the preceeding elements in the group graph pattern in which it is used.</p>
8867
+ in-scope from the preceeding elements in the group graph pattern in which it is used.
8868
+ </p>
8859
8869
<p>In <code>SELECT</code>, the variable <code>v</code> must not be in-scope in the graph
8860
8870
pattern of the <code>SELECT</code> clause, nor used in another select expression earlier in
8861
- the clause.</p>
8871
+ the clause.
8872
+ </p>
8862
8873
</section>
8863
8874
<section id="convertGraphPattern">
8864
8875
<h4>Converting Graph Patterns</h4>
@@ -9144,7 +9155,6 @@ <h5>Translate Graph Patterns</h5>
9144
9155
<p>If the form is <code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>:</p>
9145
9156
</blockquote>
9146
9157
<pre class="code nohighlightBlock">
9147
- Let FS := the empty set
9148
9158
Let G := the empty pattern, a basic graph pattern which is the empty set.
9149
9159
9150
9160
For each element E in the sequence of elements in the GroupGraphPattern
@@ -11198,52 +11208,95 @@ <h3>Grammar</h3>
11198
11208
section 6 <a data-cite="xml11#sec-notation">Notation</a>.</p>
11199
11209
<p>Notes:</p>
11200
11210
<ol>
11201
- <li>Keywords are matched in a case-insensitive manner with the exception of
11211
+ <li>
11212
+ Keywords are matched in a case-insensitive manner with the exception of
11202
11213
the keyword '<code>a</code>' which, in line with Turtle and N3, is used
11203
11214
in place of the IRI <code>rdf:type</code>
11204
- (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>
11205
- <li>Escape sequences are case sensitive.</li>
11206
- <li>When tokenizing the input and choosing grammar rules, the longest match is chosen.</li>
11207
- <li>The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.</li>
11208
- <li>There are two entry points into the grammar: <code>QueryUnit</code> for the SPARQL query language
11209
- and <code>UpdateUnit</code> for the SPARQL update language.</li>
11210
- <li>In signed numbers, no white space is allowed between the sign and the number.
11215
+ (in full, <code><a
11216
+ 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>).
11217
+ </li>
11218
+ <li>
11219
+ Escape sequences are case sensitive.
11220
+ </li>
11221
+ <li>
11222
+ When tokenizing the input and choosing grammar rules, the longest match is chosen.
11223
+ </li>
11224
+ <li>
11225
+ The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.
11226
+ </li>
11227
+ <li>
11228
+ There are two entry points into the grammar: <code>QueryUnit</code> for the SPARQL query language
11229
+ and <code>UpdateUnit</code> for the SPARQL update language.
11230
+ </li>
11231
+ <li>
11232
+ In signed numbers, no white space is allowed between the sign and the number.
11211
11233
The <code><a href="#rAdditiveExpression">AdditiveExpression</a></code> grammar rule allows for this by
11212
11234
covering the two cases of an expression followed by a signed number. These
11213
- produce an addition or subtraction of the unsigned number as appropriate.</li>
11214
- <li>The tokens <code><a href="#rInsertData">INSERT DATA</a></code>,
11235
+ produce an addition or subtraction of the unsigned number as appropriate.
11236
+ </li>
11237
+ <li>
11238
+ The tokens <code><a href="#rInsertData">INSERT DATA</a></code>,
11215
11239
<code><a href="#rDeleteData">DELETE DATA</a></code> and
11216
11240
<code><a href="#rDeleteWhere">DELETE WHERE</a></code> allow any amount of white space between the words.
11217
- The single space version is used in the grammar for clarity.</li>
11218
- <li>The <code><a href="#rQuadData">QuadData</a></code> and
11241
+ The single space version is used in the grammar for clarity.
11242
+ </li>
11243
+ <li>
11244
+ The <code><a href="#rQuadData">QuadData</a></code> and
11219
11245
<code><a href="#rQuadPattern">QuadPattern</a></code>
11220
11246
rules both use rule <code><a href="#rQuads">Quads</a></code>. The rule
11221
11247
<code><a href="#rQuadData">QuadData</a></code>, used in
11222
11248
<a href="#rInsertData"><code>INSERTDATA</code></a> and
11223
11249
<a href="#rDeleteData"><code>DELETE DATA</code></a>,
11224
- must not allow variables in the quad patterns.</li>
11225
- <li>Blank node syntax is not allowed in <code><a href="#rDeleteWhere">DELETE WHERE</a></code>,
11250
+ must not allow variables in the quad patterns.
11251
+ </li>
11252
+ <li>
11253
+ Blank node syntax is not allowed in <code><a href="#rDeleteWhere">DELETE WHERE</a></code>,
11226
11254
the <code><a href="#rDeleteClause">DeleteClause</a></code> for
11227
11255
<code>DELETE</code>,
11228
- nor in <code><a href="#rDeleteData">DELETE DATA</a></code>.</li>
11229
- <li>Rules for limiting the use of blank node identifiers are given in <a href="#grammarBNodes">section 19.6</a>.</li>
11230
- <li>The number of variables in the variable list of <code>VALUES</code> block
11231
- must be the same as the number of each list of associated values in the <code>DataBlock</code>.</li>
11232
- <li>Variables introduced by <code>AS</code> in a <code>SELECT</code> clause
11233
- must not already be <a href="#variableScope">in-scope</a>.</li>
11234
- <li>The variable assigned in a <code>BIND</code> clause must not be already
11256
+ nor in <code><a href="#rDeleteData">DELETE DATA</a></code>.
11257
+ </li>
11258
+ <li>
11259
+ Rules for limiting the use of blank node identifiers are given in
11260
+ <a href="#grammarBNodes">section 19.6</a>.
11261
+ </li>
11262
+ <li>
11263
+ The number of variables in the variable list of <code>VALUES</code> block
11264
+ must be the same as the number of each list of associated values in
11265
+ the <code>DataBlock</code>.
11266
+ </li>
11267
+ <li>
11268
+ Variables introduced by <code>AS</code> in a <code>SELECT</code> clause
11269
+ must not already be <a href="#variableScope">in-scope</a>.
11270
+ </li>
11271
+ <li>
11272
+ The variable assigned in a <code>BIND</code> clause must not be already
11235
11273
in-use within the immediately preceding <code><a href="#rTriplesBlock">TriplesBlock</a></code> within a
11236
- <code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>.</li>
11237
- <li>Aggregate functions can be one of the
11274
+ <code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>.
11275
+ </li>
11276
+ <li>
11277
+ Any variable that is assigned to in the graph pattern of `EXISTS` or `NOT EXISTS`
11278
+ must not be <a href="#variableScope">in-scope</a>. This applies to `BIND`,
11279
+ variables introduced by `AS` in a `SELECT` clause,
11280
+ variables introduced by `AS` in `GROUP BY`,
11281
+ and variables in a `VALUES` clause.
11282
+ </li>
11283
+ <li>
11284
+ Aggregate functions can be one of the
11238
11285
<a href="#rAggregate">built-in keywords for aggregates</a>
11239
11286
or a custom aggregate, which is syntactically a <a href="#rFunctionCall">function
11240
11287
call</a>. Aggregate functions may only be used in
11241
11288
<a href="#rSelectClause">SELECT</a>, <a href="#rHavingClause">HAVING</a>
11242
- and <a href="#rOrderClause">ORDER BY</a> clauses.</li>
11243
- <li>The expression argument of an aggregate function can not contain an aggregate function.</li>
11244
- <li>Only custom aggregate functions use the <code>DISTINCT</code> keyword
11245
- in a <a href="#rFunctionCall">function call</a>.</li>
11246
- <li>A <a href="#rReifier">reifier</a> or
11289
+ and <a href="#rOrderClause">ORDER BY</a> clauses.
11290
+ </li>
11291
+ <li>
11292
+ The expression argument of an aggregate function can not contain an aggregate function.
11293
+ </li>
11294
+ <li>
11295
+ Only custom aggregate functions use the <code>DISTINCT</code> keyword
11296
+ in a <a href="#rFunctionCall">function call</a>.
11297
+ </li>
11298
+ <li>
11299
+ A <a href="#rReifier">reifier</a> or
11247
11300
<a href="#rAnnotationBlockPath">annotation syntax</a>
11248
11301
is only permitted after a triple when the property position is
11249
11302
a simple path (an IRI, the keyword <code>a</code>, or a variable),
0 commit comments