Re: DM and R2RML should use same datatype mapping

* Richard Cyganiak <richard@cyganiak.de> [2011-10-31 00:09+0000]
> On 30 Oct 2011, at 23:11, Eric Prud'hommeaux wrote:
> > A tool which uses e.g. floats or ints to manipulate the graph defined by R2RML would have to qualify its conformance by the version of the database to which it was connected (e.g. "offers R2RML for MySQL 5.01, but not Oracle 11G").
> 
> Neither floats nor ints are sufficient to represent xsd:decimal even if we consider only xsd:decimals restricted to 18 digits.

True, and that does raise the bar for implementation. However, floating point and integer types are very commonly used in SQL and can be very simply implemented.


> Any programming language these days has some sort of arbitrary-precision decimal type in a readily available library. That is sufficient for conformance with any SQL 2008 conforming implementation of DECIMAL, regardless of how many digits it uses.
> 
> > General compatibility with R2RML over any database can only be preserved if you don't use native types at any step of the e.g. query answering process.
> 
> I have no idea what you're trying to say here.

As you point out above, one needs to use arbitrary-precision decimals and not native datatypes to implement the arbitrary precision required by R2RML.
Some programs, e.g. Jena, use efficient native types for integers and arbitrary-precision only for decimals.


> > Applying the unbounded precision support to DM would mean that FeDeRate would no longer be an implementation (it uses Jena to parse and execute queries which I believe uses java native types)
> 
> You may want to check that again. Jena uses BigDecimal to represent xsd:decimal.

The query
  ASK {FILTER (20000000000000000000/2=10000000000000000000)}
at <http://sparql.org/sparql.html> indicates that ARC supports up to, but no more than, 18 digit integers.


> > and SWObjects would have an even harder time as it is intended to connect multiple databases with potentially different maximum precisions.
> 
> I don't understand the problem. When you query the DB you get back some value. Then you stuff that value into a BigDecimal.
> 
> I don't understand how knowing that you're never going to see a decimal longer than 18 digits simplifies an implementation. It's not like it's particularly hard to write arbitrary-precision code.

True, but do the use cases motivate raising the bar to that extent? Can we motivate Jena abandoning native integers?


> As far as I can see, the text in R2RML works fine, is easy to implement, easy to test, and meets user expectations. I have seen no evidence yet that changing the text would benefit users or implementers, and I have seen no argument being made why R2RML and DM should differ. As far as I can tell, you're trying to solve an imaginary problem.

I don't foresee many implementations of arbitrary precision for integers and floats and I don't see much motivation for that. Further, it makes more sense to define the lexical values in terms of the XSD canonical types rather than via a recipe which some popular databases (e.g. MySQL) don't support. 


> Best,
> Richard

-- 
-ericP

Received on Monday, 31 October 2011 03:39:47 UTC