W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2011

Re: math ops and datatypes

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Mon, 25 Apr 2011 10:26:25 +0100
Message-ID: <4DB53E41.2080509@epimorphics.com>
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 GMT

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