W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2010

LET / BIND / Assignment test cases (ISSUE-57)

From: Lee Feigenbaum <lee@thefigtrees.net>
Date: Tue, 28 Sep 2010 22:45:15 -0400
Message-ID: <4CA2A83B.9010208@thefigtrees.net>
To: SPARQL Working Group <public-rdf-dawg@w3.org>
When last we talked, we decided we wanted to look at the semantics of a 
proposed LET/BIND/Assignment clause before choosing the keyword and 
proceeding with a decision.

Here are a few test cases; I use KW (keyword) below where LET or BIND or 
whatever might go.

Data:

:s :one 1 .
:s :two 2 .


1. Simple

SELECT ?sum ?one ?two {
	?s :one ?one ; :two ?two .
	KW (?sum := ?one + ?two)
}

Result:

?sum	?one	?two
-----------------------
  3 	1	2


2. Calculated value matches existing binding

SELECT ?one {
	?s :one ?one .
	KW (?one := 1)
}

I believe there are two options here from what I've heard

Option 1 ("join semantics") result:

?one
-----
1

Option 2 ("simple semantics") result:

   Error, can't assign to / bind a variable that's elsewhere bindable in 
the same scope


3. Calculated value does not match existing binding

SELECT ?one {
	?s :one ?one .
	KW (?one := 5)
}

I believe there are three options here from what I've heard

Option 1 ("join semantics") result:

?one
-----

Option 2 ("simple semantics") result:

   Error, can't assign to / bind a variable that's elsewhere bindable in 
the same scope

Option 3 ("assignment semantics") result:

?one
-----
5

NOTE: I don't believe _anyone_ is advocating or implements assignment 
semantics like this, but I wanted to include it for completeness.


4. Logical order of assignment/binding

SELECT ?sum {
	KW (?sum := ?one + 1) .
	:s :one ?one .
}

Option 1 ("in place") result:

?sum
----

(no result as ?one has no binding and so the expression is an error)

Option 2 ("end of group") result:

?sum
----
2

(assignments/binds are treated as with FILTERs, they occur logically 
after a group's solution set has been evaluated)


I believe from the thread at 
http://lists.w3.org/Archives/Public/public-rdf-dawg/2010JulSep/0116.html 
that Mulgara implements what I'm calling "simple semantics". Anzo 
(Glitter) implements "join semantics". ARQ implements "simple semantics" 
as well.

Anzo does "end of group" ordering. I think Mulgara does "in place" 
ordering. I'm not sure about ARQ.

Here was the last time we discussed this at a TC:

http://www.w3.org/2009/sparql/meeting/2010-07-06#LET__2f_Assignment

Please discuss if you'd like, and next week I'd like to decide on 
inclusion or not (strong lean towards include last time) and, if we 
choose to include the feature, the semantics based on these options or 
any other options people suggest and the keyword.

Lee
Received on Wednesday, 29 September 2010 02:45:57 GMT

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