Re: Concerning LET or AS

I made a couple of mistakes in my previous text.

Please allow me to withdraw that text and try again.

The errors were:
1) I missed the { } around the subselect
2) my modification to rule 43 lost the SubSelect expansion
3) Removed too many '(' ')' in rewrite rule

I made some modifications for clarity too.

Also as a very minor comment, rule [43] etc combined with the gramar 
rules from SPARQL 1.0 do not seem to expand to the example query 
immediately above.

I take the intent of rule 43 to be:

GroupGraphPattern  ::=  '{' ( SubSelect | GroupGraphPatternSub )+ '}'

(Without the +, the rule matches either a single subselect or a SPARQL 
1.0 body,
but not a combination of both.)

Here is modified text:

===============================

'LET' is specified as a macro-expansion, in terms of subselect queries.
In the FPWD of Query 1.1 we modify rule 43 for GroupGraphPattern as follows:

[43*] GroupGraphPattern ::= '{' GroupGraphPatternLetSub '}'

[A] GroupGraphPatternLetSub ::= ( GroupGraphPatternLetSub LetExpr '.'? 
)? GroupGraphPatternNoLetSub

[B] LetExpr ::= 'LET' '('  Var ':=' Expression  ( ','  Var ':=' 
Expression )* ')'

[C] GroupGraphPatternNoLetSub ::= ( SubSelect | GroupGraphPatternSub )+

Rules [A] and [B] are interpreted by rewriting queries involving LET
into queries not involving LET.
We will use phi(x) to be the rewritten query of x.
For clarity of exposition we will expand the two alternative readings of 
[A] as
[A.1] GroupGraphPatternLetSub ::= GroupGraphPatternNoLetSub
[A.2] GroupGraphPatternLetSub ::=  GroupGraphPatternLetSub LetExpr '.'? 
GroupGraphPatternNoLetSub
Expressions matching rule [A.1] are not rewritten.

If x matches rule B, then:

phi(x) = 'SELECT'  * '(' Expression 'AS' Var ')' ( '(' Expression 'AS' 
Var ')' )*

(with the variables matching respectively).

If x matches rule A.2  with y matching GroupGraphPatternLetSub on the 
R.H.S.,
z matching LetExpr, and w matching  GroupGraphPatternNoLetSub then

phi(x) =
'{' phi(z)
   'WHERE' '{'
       phi(y)
   '}'
'}'
w

After this rewrite is applied to all instances matching rules [A] and 
[B], the rewritten query does not involve 'LET' and its meaning is as 
given in
the rest of the specification.
======================

Received on Wednesday, 4 November 2009 06:44:19 UTC