W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > October 2006

RE: Definition of FilteredBasicGraphPattern in SPARQL grammar

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Thu, 26 Oct 2006 18:49:07 +0100
Message-ID: <86FE9B2B91ADD04095335314BE6906E884DA91@sdcexc04.emea.cpqcorp.net>
To: "Arjohn Kampman" <arjohn.kampman@aduna-software.com>
Cc: <public-rdf-dawg-comments@w3.org>

-------- Original Message --------
> From: Arjohn Kampman <>
> Date: 26 October 2006 16:48
> 
> It took me quite some time to understand the production rule for
> FilteredBasicGraphPattern in the SPARQL grammar, due to the
> recursiveness of the definition. I think this production rule
> in combination with BlockOfTriples can be reformulated to one of the
> following, much simpler, definitions:
> 
> FilteredBasicGraphPattern ::=
>          ( (TriplesSameSubject|Constraint) '.'? )*
> 
> As far as I can see, there is only one difference between these rules
> and the rules from the grammar: The rules from the grammar allow
> multiple dots after TriplesSameSubject blocks and zero or one dot
after
> Constraint blocks, whereas the above rule only allows zero or one dot
> after both blocks. Alternatively, the above rule can be slightly
> modified to allow multiple dots after (both) blocks.
> 
> --
> Arjohn Kampman, Senior Software Engineer
> Aduna - Guided Exploration
> www.aduna-software.com

Arjohn,

Thanks for the observation.

[22] BlockOfTriples ::=
	TriplesSameSubject ( '.' TriplesSameSubject? )*

should be 

[22'] BlockOfTriples ::=
	TriplesSameSubject ( '.' BlockOfTriples? )?

TriplesSameSubject can not be empty so BlockOfTriples can't be.
More recursion I'm afraid - it's the way that "must see before" is
handled in the grammar.

It used to be based on:
http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/
[28]    	Triples  	  ::=    	Triples1 ( '.' Triples?
)?

(I'm hoping to find time to work through the grammar and remove the
recursion where possible - sometimes it is just the easiest way to
approach the problem though.)

> FilteredBasicGraphPattern ::=
>          ( (TriplesSameSubject|Constraint) '.'? )*

allows ?s ?p ?o ?s1 ?p ?o as '.' is completely optional.

By the way - the grammar is being changed around here to move
constraints out into groups.

I just applied the equivalent of [22'], after having added multiple
adjacent dots tests to the test suite as "parse error expected" tests,
and the grammar passes.

The development test suite is under
http://www.w3.org/2001/sw/DataAccess/tests/data/SyntaxDev/

Manifests uses an extended vocabulary to merge manifests and to mark
syntax and bad syntax test cases.

	Andy
Received on Thursday, 26 October 2006 17:49:22 GMT

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