about OPTIONAL blocks

in the current editor's draft v1.174 specified grammar the OPTIONAL 
keyword is also allowed in front of an optional block specified by [] 
(square brackets) and well as a constraints expression:

[7]     OptionalGraphPattern   ::=   'optional' PatternElement | '[' 
GraphPattern ']'
[8]     GraphPattern                  ::=   GraphAndPattern ('union' 
GraphAndPattern)*
[9]     GraphAndPattern           ::=   PatternElement+
[10]   PatternElement              ::=   TriplePattern | 
GroupGraphPattern | SourceGraphPattern | OptionalGraphPattern | 'and'? 
Expression

making legal queries like:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox
WHERE  ( ?x foaf:name  ?name )
        OPTIONAL [ ( ?x  foaf:mbox  ?mbox ) ]
OPTIONAL
	AND ( ?x =~ /foo/ )

which is clearly redundancy for the the second triple-pattern, and 
wrong(?) for the constraints clause.

what about getting rid of the OPTIONAL keyword and only allow clearly 
marked optional blocks?

I would prefer to have optional blocks (or one/more triple-patterns 
and/or constraints) expressed using [] (square brackets) - which would 
reduce the above [7] production to:

[7]     OptionalGraphPattern   ::=   '[' GraphPattern ']'

or if you wish to OPTIONAL just a triple-pattern, not sure the simply 
s/PatternElement/TriplePattern/ in [7] would make the trick - which 
might make the grammar ambiguous.

did this issue come up already in the recent grammar discussions or 
people implementing OPTIONALs?

Yours

Alberto

-
Alberto Reggiori, Senior Partner, R&D @Semantics S.R.L.
www.asemantics.com Milan Office

Received on Wednesday, 26 January 2005 11:21:21 UTC