Ambiguities in optional scope

Hi! I think that the following query is problematic too. I tried it in 
SPARQLer and gave me strange results and in the SPARQL last draft I cannot 
find a precise answer:

The data is:
++++++++++++++++++++++++++++++++++++++++++++++++++++++
@prefix : <http://ing.utalca.cl/~jperez/research/rdf/> .

_:b1 :titlename  "book1" . 
_:b1 :authorname "author1" .
_:b1 :year       "2006" .
++++++++++++++++++++++++++++++++++++++++++++++++++++++

The query:

PREFIX : <http://ing.utalca.cl/~jperez/research/rdf/>
SELECT *
FROM :sample2.rdf
WHERE {
  ?B :titlename ?N .
  ?B :year ?Y .
  OPTIONAL { ?B :authorname ?N }
}

What is the answer? Again at least two possibilities according to the "scope" 
of optional

1) B=_:b1, N="book1", if one assume that the optional "is applied to" the two 
triple patterns.
2) nothing, if one assume that the optonal "is applied to" the second triple 
pattern.

The ambiguitie starts again in the formal definition of optional, it 
reads "...the second pattern modifies pattern solutions of the first 
pattern..." but here there is no clear what the "first pattern" is. SPARQLer 
gave me solution 1) but I cannot find a rule in the draft that validate this 
behavior. If one consider the following query (I put just the WHERE part)

WHERE {
  ?B :year ?Y .
  OPTIONAL { ?B :authorname ?N }
  ?B :titlename ?N .
}

the solution is not clear... one may assume here that the optional "is applied 
to" just the triple pattern above but again there is no formal validation of 
this in the draft. Here the left associativity rule of the optional keyword 
included in the last draft do not applied because it states that optional is 
left associative considering other optional patterns but nothing about triple 
patters. In this case SPARQLer gave me solution 2).

How can one solve the problem? 
* One posibility is to add a complete set of associative rules: "." keyword is 
left associative, "optional" keyword is left associative, etc. from my point 
of view it may make the specification less readable.
* Other posibility is to think that each complex graph pattern (group graph 
pattern) has a "mandatory part" and several "optional parts". A solution must 
match the complete manatory part, and optional parts only add "information" to 
the solution of the mandatory part if the information exists. The evaluation 
of optional parts is made resursively in the same way.
* Other?

- Jorge

-------------------------------------------------
Este mensaje fue enviado por: http://webmail.utalca.cl

Received on Wednesday, 19 April 2006 14:33:16 UTC