W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > September 2007

Re: Syntax error in algebra example

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Thu, 27 Sep 2007 17:00:32 +0100
Message-ID: <46FBD3A0.7020201@hp.com>
To: Richard Newman <rnewman@franz.com>
CC: public-rdf-dawg-comments@w3.org

Richard Newman wrote:
>    12.2.2 has a minor error.
> ----
> Example: group consisting of a basic graph pattern, a filter and an  
> optional graph pattern:
> { ?s :p1 ?v1} FILTER (?v1 < 3 ) OPTIONAL {?s :p2 ?v2} }
> Filter( ?v1 < 3 ,
>    LeftJoin( BGP(?s :p1 ?v1), BGP(?s :p2 ?v2), true) ,
>    )
> ----

Fixed, thank you.

>    Count the number of {s and }s.
>    While I'm on the topic of 12.2.x, the algebra mapping algorithm in  
> 12.2.1 is somewhat unclear, and contains at least one error:
> ----
> for each algebra sub-expression SA:
>     If SA is an OPTIONAL,
>        If SA is of the form OPTIONAL(Filter(F, A))
>             G := LeftJoin(G, A, F)
>        else
>             G := LeftJoin(G, A, true)
>     Otherwise for expression SA, G := Join(G, SA)
> ----
>    in the 'else' clause, 'A' is out of scope, so this doesn't make  
> any sense.

Yes - changed to  "G := LeftJoin(G, SA, true)"

>    In a more general sense: it would probably aid the clarity of the  
> document if the DAWG tried to write an AST -> Algebra converter using  
> only the document as a reference, rather than writing the document  
> with the experience of having written the code. I'm writing such a  
> thing for the first time, and the document is not as clear as I would  
> like.

I can say that the doc was written before I implemented.

>    It would also be helpful in 12.2.2 to provide concrete (syntax,  
> AST, algebra) triples, rather than only (syntax, algebra) pairs. At  
> present I am having to basically guess the AST that the DAWG had in  
> mind when writing this section.

The grammar rules give the abstract syntax and do define a parse tree. 
Inventing another notation to capture that would be confusing as to its status 
with respect to the SPARQL concrete syntax.

Eric has provided the yacker tool


that prints out parse information which uses (I think) yapp (which is an LALR 
Perl-based parser generator).


>    Regards,
> -R

Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England
Received on Thursday, 27 September 2007 16:00:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:52 GMT