RE: Definition of FilteredBasicGraphPattern in SPARQL grammar

-------- 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 UTC