Question on variable scope w.r.t. multiple optional blocks

Hello, there.

In the last paragraph of 4.3, (or maybe elsewhere, also), the SPARQL spec 
says
[[
If a new variable is mentioned in an optional block
(snip)
that variable can be mentioned in that block and can not be mentioned
in a subsequent block.
]]
, which sounds too rigid for me.

Putting aside the fact that we need to make clear what "mention" means,
I don't think we need to go so far to prohibit the use of the variable of 
the same name.

We can just restrict the semantic scope of each variable in optional block
to be that block only, unless it is used in parent ancestral block or the 
top level.

Current spec prohibits for example the following query, which seems a sound 
query
to me:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name, ?nick
WHERE (?x foaf:name ?name)
          [(?x foaf:nick ?nick)
           (?x foaf:givenname ?nick)]
          [(?x foaf:nick ?nick)
           (?x  foaf:surname ?nick)]

Does one have to say this like this?:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name, ?nick1, ?nick2
WHERE (?x foaf:name ?name)
          [(?x foaf:nick ?nick1)
           (?x foaf:givenname ?nick1)]
          [(?x foaf:nick ?nick2)
           (?x  foaf:surname ?nick2)]

How  does this sound to you?

Best,
Yoshio Fukushige
fukushige.yoshio@jp.panasonic.com
fuku@w3.org

Received on Tuesday, 14 December 2004 09:30:19 UTC