W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2004

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

From: Yoshio FUKUSHIGE <fuku@w3.org>
Date: Tue, 14 Dec 2004 18:30:16 +0900
Message-ID: <002401c4e1bf$859c6980$f1e41b85@steelball>
To: <public-rdf-dawg@w3.org>

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:21 GMT