diff --git a/spec/index.html b/spec/index.html index ed5ad663..81556cbb 100644 --- a/spec/index.html +++ b/spec/index.html @@ -8730,10 +8730,10 @@

Variable Scope

query. The definition below provides a way of determining this from the abstract syntax tree of a query.

Note that a subquery with a projection can hide variables; use of a variable in - FILTER or in MINUS does not cause the variable to be in-scope + `FILTER` or in `MINUS` does not cause the variable to be in-scope outside of those forms.

Let P, P1, and P2 be graph patterns, and E, - E1,..., through En be expressions. A variable v is in-scope if:

+ E1,..., through En be expressions. A variable `v` is in-scope if:

@@ -8742,70 +8742,81 @@

Variable Scope

- + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + +
Basic Graph Pattern (BGP)v occurs in the BGP`v` occurs in the BGP
Pathv occurs in the path`v` occurs in the path
Group { P1 P2 ... }v is in-scope if it is in-scope in one or more of P1, P2, ...Group `{ P1 P2 ... }``v` is in-scope if it is in-scope in one or more of P1, P2, ...
GRAPH term { P }v is term or v is in-scope in P`GRAPH term { P }``v` is `term` or `v` is in-scope in P
{ P1 } UNION { P2 }v is in-scope in P1 or in-scope in P2`{ P1 } UNION { P2 }``v` is in-scope in P1 or in-scope in P2
OPTIONAL {P}v is in-scope in P`OPTIONAL {P}``v` is in-scope in P
SERVICE term {P}v is term or v is in-scope in P`SERVICE term {P}``v` is `term` or `v` is in-scope in P
BIND (expr AS v)v is in-scope`BIND (expr AS v)``v` is in-scope
SELECT .. v .. { P }v is in-scope`SELECT .. v .. { P }``v` is in-scope
SELECT ... (expr AS v)v is in-scope`SELECT ... (expr AS v)``v` is in-scope
GROUP BY (expr AS v)v is in-scope`GROUP BY (expr AS v)``v` is in-scope
SELECT * { P }v is in-scope in P`SELECT * { P }``v` is in-scope in `P`
VALUES v { values }v is in-scope`VALUES v { values }``v` is in-scope
VALUES varlist { values }v is in-scope if v is in varlist`VALUES varlist { values }``v` is in-scope if `v` is in `varlist`
`EXISTS` and `NOT EXISTS` + `v` is in-scope if it is in-scope for the + solution mapping + where the expression containing `EXISTS` or `NOT EXISTS` is applied. +
-

The variable v must not be in-scope at the point of the (expr AS - v) form. The scoping for (expr AS v) applies immediately in - SELECT expressions.

-

In BIND (expr AS v) requires that the variable v is not - in-scope from the preceeding elements in the group graph pattern in which it is used.

-

In SELECT, the variable v must not be in-scope in the graph - pattern of the SELECT clause, nor used in another select expression earlier in - the clause.

+

The variable `v` must not be in-scope at the point of the + `(expr AS v)` form. The scoping for `(expr AS v)` + applies immediately in `SELECT` expressions. +

+

In `BIND (expr AS v)` requires that the variable `v` is not + in-scope from the preceeding elements in the group graph pattern in which it is used. +

+

In `SELECT`, the variable `v` must not be in-scope in the graph + pattern of the `SELECT` clause, nor used in another select expression earlier in + the clause. +

Converting Graph Patterns

@@ -10971,52 +10982,95 @@

Grammar

section 6 Notation.

Notes:

    -
  1. Keywords are matched in a case-insensitive manner with the exception of - the keyword 'a' which, in line with Turtle and N3, is used - in place of the IRI rdf:type - (in full, http://www.w3.org/1999/02/22-rdf-syntax-ns#type).
  2. -
  3. Escape sequences are case sensitive.
  4. -
  5. When tokenizing the input and choosing grammar rules, the longest match is chosen.
  6. -
  7. The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals.
  8. -
  9. There are two entry points into the grammar: QueryUnit for the SPARQL query language - and UpdateUnit for the SPARQL update language.
  10. -
  11. In signed numbers, no white space is allowed between the sign and the number. +
  12. + Keywords are matched in a case-insensitive manner with the exception of + the keyword '`a`' which, in line with Turtle and N3, is used + in place of the IRI `rdf:type` (in full, + http://www.w3.org/1999/02/22-rdf-syntax-ns#type). +
  13. +
  14. + Escape sequences are case sensitive. +
  15. +
  16. + When tokenizing the input and choosing grammar rules, the longest match is chosen. +
  17. +
  18. + The SPARQL grammar is LL(1) when the rules with uppercased names are used as terminals. +
  19. +
  20. + There are two entry points into the grammar: `QueryUnit` for the SPARQL query language + and `UpdateUnit` for the SPARQL update language. +
  21. +
  22. + In signed numbers, no white space is allowed between the sign and the number. The AdditiveExpression grammar rule allows for this by covering the two cases of an expression followed by a signed number. These - produce an addition or subtraction of the unsigned number as appropriate.
  23. -
  24. The tokens INSERT DATA, + produce an addition or subtraction of the unsigned number as appropriate. +
  25. +
  26. + The tokens INSERT DATA, DELETE DATA and DELETE WHERE allow any amount of white space between the words. - The single space version is used in the grammar for clarity.
  27. -
  28. The QuadData and + The single space version is used in the grammar for clarity. +
  29. +
  30. + The QuadData and QuadPattern rules both use rule Quads. The rule QuadData, used in INSERTDATA and DELETE DATA, - must not allow variables in the quad patterns.
  31. -
  32. Blank node syntax is not allowed in DELETE WHERE, - the DeleteClause for - DELETE, - nor in DELETE DATA.
  33. -
  34. Rules for limiting the use of blank node identifiers are given in section 19.6.
  35. -
  36. The number of variables in the variable list of VALUES block - must be the same as the number of each list of associated values in the DataBlock.
  37. -
  38. Variables introduced by AS in a SELECT clause - must not already be in-scope.
  39. -
  40. The variable assigned in a BIND clause must not be already + must not allow variables in the quad patterns. +
  41. +
  42. + Blank node syntax is not allowed in + DELETE WHERE, + in a DeleteClause, + nor in DELETE DATA. +
  43. +
  44. + Rules for limiting the use of blank node identifiers are given in + section 19.6. +
  45. +
  46. + The number of variables in the variable list of VALUES block + must be the same as the number of each list of associated values in the + DataBlock. +
  47. +
  48. + Variables introduced by AS in a SELECT clause + must not already be in-scope. +
  49. +
  50. + The variable assigned in a BIND clause must not be already in-use within the immediately preceding TriplesBlock within a - GroupGraphPattern.
  51. -
  52. Aggregate functions can be one of the + GroupGraphPattern. +
  53. +
  54. + Aggregate functions can be one of the built-in keywords for aggregates - or a custom aggregate, which is syntactically a function - call. Aggregate functions may only be used in + or a custom aggregate, which is syntactically a + function call. + Aggregate functions may only be used in SELECT, HAVING - and ORDER BY clauses.
  55. -
  56. The expression argument of an aggregate function can not contain an aggregate function.
  57. -
  58. Only custom aggregate functions use the DISTINCT keyword - in a function call.
  59. -
  60. A reifier or + and ORDER BY clauses. +
  61. +
  62. + Any variable that is assigned to in the graph pattern of `EXISTS` or `NOT EXISTS` + must not be in-scope. This applies to `BIND`, + variables introduced by `AS` in a `SELECT` clause, + variables introduced by `AS` in `GROUP BY`, + and variables in a `VALUES` clause. +
  63. +
  64. + The expression argument of an aggregate function can not contain an aggregate function. +
  65. +
  66. + Only custom aggregate functions use the DISTINCT keyword + in a function call. +
  67. +
  68. + A reifier or annotation syntax is only permitted after a triple when the property position is a simple path (an IRI, the keyword a, or a variable),