Skip to content

Commit ac09851

Browse files
committed
EXISTS: scoping restriction
1 parent a1cec38 commit ac09851

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
@@ -8849,16 +8849,27 @@ <h4>Variable Scope</h4>
88498849
<td><code>VALUES varlist { values }</code></td>
88508850
<td><code>v</code> is in-scope if <code>v</code> is in <code>varlist</code></td>
88518851
</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>
88528860
</tbody>
88538861
</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>
88578866
<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>
88598869
<p>In <code>SELECT</code>, the variable <code>v</code> must not be in-scope in the graph
88608870
pattern of the <code>SELECT</code> clause, nor used in another select expression earlier in
8861-
the clause.</p>
8871+
the clause.
8872+
</p>
88628873
</section>
88638874
<section id="convertGraphPattern">
88648875
<h4>Converting Graph Patterns</h4>
@@ -9144,7 +9155,6 @@ <h5>Translate Graph Patterns</h5>
91449155
<p>If the form is <code><a href="#rGroupGraphPattern">GroupGraphPattern</a></code>:</p>
91459156
</blockquote>
91469157
<pre class="code nohighlightBlock">
9147-
Let FS := the empty set
91489158
Let G := the empty pattern, a basic graph pattern which is the empty set.
91499159

91509160
For each element E in the sequence of elements in the GroupGraphPattern
@@ -11198,52 +11208,95 @@ <h3>Grammar</h3>
1119811208
section 6 <a data-cite="xml11#sec-notation">Notation</a>.</p>
1119911209
<p>Notes:</p>
1120011210
<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
1120211213
the keyword '<code>a</code>' which, in line with Turtle and N3, is used
1120311214
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.
1121111233
The <code><a href="#rAdditiveExpression">AdditiveExpression</a></code> grammar rule allows for this by
1121211234
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>,
1121511239
<code><a href="#rDeleteData">DELETE DATA</a></code> and
1121611240
<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
1121911245
<code><a href="#rQuadPattern">QuadPattern</a></code>
1122011246
rules both use rule <code><a href="#rQuads">Quads</a></code>. The rule
1122111247
<code><a href="#rQuadData">QuadData</a></code>, used in
1122211248
<a href="#rInsertData"><code>INSERTDATA</code></a> and
1122311249
<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>,
1122611254
the <code><a href="#rDeleteClause">DeleteClause</a></code> for
1122711255
<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
1123511273
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
1123811285
<a href="#rAggregate">built-in keywords for aggregates</a>
1123911286
or a custom aggregate, which is syntactically a <a href="#rFunctionCall">function
1124011287
call</a>. Aggregate functions may only be used in
1124111288
<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
1124711300
<a href="#rAnnotationBlockPath">annotation syntax</a>
1124811301
is only permitted after a triple when the property position is
1124911302
a simple path (an IRI, the keyword <code>a</code>, or a variable),

0 commit comments

Comments
 (0)