- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Mon, 25 Apr 2011 10:26:25 +0100
- To: public-rdf-dawg@w3.org
On 25/04/11 05:45, Lee Feigenbaum wrote:
> Could someone take a moment and walk me through the relevant spec text
> that tells me what the result of the following should be?
>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> SELECT (datatype("1"^^xsd:int + "1"^^xsd:int) AS ?datatype)
> {}
>
>
> Lee
>
Alegbra:
(project (?datatype)
(extend ((?datatype (datatype (+ "1"^^xsd:int "1"^^xsd:int))))
empty BGP)))
empty BGP:
{} => One row, no columns.
extend:
Evaluate the expression from the inside:
"1"^^xsd:int + "1"^^xsd:int
http://www.w3.org/TR/rdf-sparql-query/#OperatorMapping
numeric numeric => op:numeric-add(A, B)
http://www.w3.org/TR/xpath-functions/#op.numeric
op:operation(xs:integer, xs:integer)
is the closest operation so promote xsd:int to xsd:integer:
"1"^^xsd:int => "1"^^xsd:integer
then op:numeric-add
"2"^^xsd:integer
datatype("2"^^xsd:integer) ==> xsd:integer
AS ?datatype
==>
New column ?datatype
Value: xsd:integer
Andy
Received on Monday, 25 April 2011 09:26:52 UTC