Re: Questions on the Sparql [OK?]

Seaborne, Andy wrote:
 > Hy all
 >
 > I'm implementing the Sparql ad I have one questions/sugestions:
 >
 >     At the grammar is possible to find:
 >
 >     %[67] QNAME_NS ::= NCNAME_PREFIX? ':'
 >     %[68] QNAME    ::= NCNAME_PREFIX? ':' NCNAME?
 >
 >     That are just used by
 >
 >     %[4]  PrefixDecl ::= 'PREFIX' QNAME_NS Q_IRI_REF
 >     %[64] QName      ::= QNAME | QNAME_NS
 >
 >     Can't we have?
 >
 >     %[68] QNAME    ::= NCNAME_PREFIX? ':' NCNAME
 >
 >     Certifying that something accepted by QNAME will not be accepted by
 > QNAME_NS

It would take some text like that - the grammar makes it explicit though, 
rather that leaving it to such additional text.  A prefix declaration takes 
NCNAME_PREFIX? ':' which is also a legal prefixed name in SPARQL, which is 
where the QName rule comes from, making a prefixed name with or without a 
non-zero length local part.

 >     or remove the rules 67 and 68 and change the rules 4 and 64 to
 >
 >     %[4]  PrefixDecl ::= 'PREFIX' NCNAME_PREFIX? ':' Q_IRI_REF
 >     %[64] QName      ::= NCNAME_PREFIX? ':' NCNAME?

Unfortunately that allows white space around the ":" which breaks the 
tokenization.  A SPARQL parser is likely to use the fact that a QNAME or 
prefix has a ":" in it, while keywords do not.  That makes token 
classification simple.  A parser does not have to do it that way but we have 
found it works for LL(1) and LALR(1) grammars for common tools.

There is a tool, yacker, that has grammars for various languages based on teh 
BNF from SPARQL:

http://www.w3.org/2005/01/yacker/uploads/SPARQL

There is also a JavaCC grammar which is used to create the BNF in the first place.

http://cvs.sourceforge.net/viewcvs.py/jena/ARQ/Grammar/sparql.jj

 > In the Grammar is not possible to find the WS. But is possible to find
 > a unclear rule for this. Can I sugest to have a grammar having the
 > White Spaces. Probably I can have one in 1 or 2 days for the version
 > of 23 November 2005 and after that mantain a version with them.

In the editors' working draft, white space (WS) is mentioned - it is also 
covered by the various sections before the grammar itself.

It is probably possible to put in white space everywhere it is allowed through 
out the grammar but it would make for an unreadable grammar.

 >
 > Thanks
 > Marcos Rebelo

I hope this responds to your comments - please let us know if it does.  (If 
you place [CLOSED] in the subject line, the scripts will pick it up and 
automatically.)

 Andy

Received on Thursday, 9 February 2006 10:46:36 UTC