W3C home > Mailing lists > Public > public-sparql-dev@w3.org > October to December 2014

Re: typing and overflow

From: Rob Vesse <rvesse@dotnetrdf.org>
Date: Wed, 29 Oct 2014 16:28:52 -0700
To: <public-sparql-dev@w3.org>
Message-ID: <D076C49F.3F4E6%rvesse@dotnetrdf.org>
John

See Section 17.3 (Operator Mapping) of the SPARQL 1.1 Query specification -
http://www.w3.org/TR/sparql11-query/#operandDataTypes - where it says the
following:

SPARQL follows XPath's scheme for numeric type promotions and subtype
substitution for arguments to numeric operators. The XPath Operator Mapping
<http://www.w3.org/TR/xpath20/#mapping>  rules for numeric operands
(xsd:integer, xsd:decimal, xsd:float, xsd:double, and types derived from a
numeric type) apply to SPARQL operators as well (see XML Path Language
(XPath) 2.0 <http://www.w3.org/TR/xpath20/>  [XPATH20
<http://www.w3.org/TR/sparql11-query/#XPATH20> ] for definitions of numeric
type promotions <http://www.w3.org/TR/xpath20/#promotion>  and subtype
substitution <http://www.w3.org/TR/xpath20/#dt-subtype-substitution> )

I.e. SPARQL defers to the XPath rules for type promotion and operator

I am not sure that XPath has anything specific to say about overflows since
often the range of the XSD types are significantly broader than their
namesakes in any given programming language.  For example xsd:integer
represents all integers whereas integers in a given programming language
usually have some upper bounds.  In my experience most implementations
typically use the biggest such appropriate native type internally for
calculations.

There is some mention of numeric overflow in the XPath specification but I
can't see anything specific about the circumstances in which it should
occur.

Rob

From:  John Yates <john.yates@sparqlcity.com>
Date:  Tuesday, 28 October 2014 04:59
To:  <public-sparql-dev@w3.org>
Cc:  Arthur Keen <arthur.keen@sparqlcity.com>
Subject:  typing and overflow
Resent-From:  <public-sparql-dev@w3.org>
Resent-Date:  Wed, 29 Oct 2014 21:06:55 +0000

> Coming from the world of statically typed languages I am trying figure out
> whether SPARQL specifies a model of type determination within expressions.  C
> and C++ have a set of integral promotions and a rule that - in the absence of
> a prototype - float gets promoted to double.  Those rules then imply the
> boundaries at which overflow checking occurs.
> 
> Does SPARQL have anything analogous?  Does SPARQL acknowledge overflow?  Where
> would I find such notions specified?
> 
> /john
>>> 
> 
> SPARQLcity reshapes the world of big data.
> Immediately gain knowledge from NoSQL databases.
Received on Wednesday, 29 October 2014 23:29:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:52 UTC