Mismatch with multiple OPTIONAL and grammar?

While writing a parser for sparql-p, I ran into a situation with 
OPTIONs that is unclear in the spec (5.1) and grammar.

The following rules (rule 20 in particular):

[20] GraphPattern ::= FilteredBasicGraphPattern (GraphPatternNotTriples '.'? GraphPattern )? 
[21] FilteredBasicGraphPattern ::=  BlockOfTriples? (Constraint '.'? FilteredBasicGraphPattern )?

Seem to allow for the following pattern:

patternA OPTIONAL { patternB } patternC OPTIONAL { patternD }

The main difference from the OPTIONAL examples is the juxtaposition of 
patternC in-between the patterns.  If this is by design, it's not clear whether this 
should be interpreted as

{patternA} UNION {patternC} OPTIONAL {patternB} OPTIONAL {patternD}

or

{patternA. patternC} OPTIONAL {patternB} OPTIONAL {patternD}


Perhaps it's just my misunderstanding of how multiple OPTIONALs are meant 
to appear within a GraphPattern

Chimezie Ogbuji
Lead Systems Analyst
Thoracic and Cardiovascular Surgery
Cleveland Clinic Foundation
9500 Euclid Avenue/ W26
Cleveland, Ohio 44195
Office: (216)444-8593
ogbujic@ccf.org

Received on Monday, 8 May 2006 13:04:19 UTC