W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > November 2009

Re: Concerning LET or AS

From: Jeremy Carroll <jeremy@topquadrant.com>
Date: Tue, 03 Nov 2009 14:51:40 -0800
Message-ID: <4AF0B3FC.2080006@topquadrant.com>
To: public-rdf-dawg-comments@w3.org
CC: Holger Knublauch <holger@topquadrant.com>, Jeremy Carroll <jcarroll@topquadrant.com>
off list Steve and Lee encouraged me to be clearer about what I thought 
LET as a keyword means.

Here is my attempt at specifying it (based on the WG Wiki page).
Please note that I am not responsible for TopQuadrant's SPARQL work; 
Holger is our expert, and we tend to be dependent on Andy's implementation.
So, I am happy with any corrections from Andy.

It is not important how the word LET is spelt (i.e. as far as I know, 
TopQuadrant has no particular attachment to 'LET' rather than 'BIND' for 
example).

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

In the FPWD of Query 1.1 we modify rule 43 for GroupGraphPattern as follows:

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

[A] GroupGraphPatternLetSub ::= ( GroupGraphPatternLetSub Let '.'? )? 
GroupGraphPatternSub

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

Rules [43*] [A] and [B] are interpreted by rewriting queries involving 
LET into queries
not involving LET.
We will use phi(x) to be the written query of x.

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 then

phi(x) =
phi(Let)
'WHERE' '{'
     phi(GroupGraphPatternLetSub)
'}'
GroupGraphPatternSub

The rest of the specification then applies.
==================

(Note this is a fine recipe for implementing as well).
Specifically, this prohibits forward references.
Being a macro expansion into a declarative form, this is declarative.

Jeremy
Received on Tuesday, 3 November 2009 22:52:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 November 2009 22:52:13 GMT