Jena and BigIntegers (was: Re: DM and R2RML should use same datatype mapping)

For the record: Seems like I am mistaken about support for BigIntegers in Jena/ARQ.

On 2 Nov 2011, at 14:52, Richard Cyganiak wrote:
>> 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.
> 
> I suppose you mean ARQ? No, it indicates some weird bug in that implementation.
> 
> ASK {FILTER (200000/2=100000)} => true
> ASK {FILTER (20000000/2=10000000)} => true
> ASK {FILTER (2000000000/2=1000000000)} => true
> ASK {FILTER (200000000000/2=100000000000)} => true
> ASK {FILTER (20000000000000/2=10000000000000)} => true
> ASK {FILTER (2000000000000000/2=1000000000000000)} => true
> ASK {FILTER (200000000000000000/2=100000000000000000)} => true
> ASK {FILTER (20000000000000000000/2=10000000000000000000)} => ***false***
> ASK {FILTER (2000000000000000000000/2=1000000000000000000000)} => true
> ASK {FILTER (200000000000000000000000/2=100000000000000000000000)} => true
> ASK {FILTER (20000000000000000000000000/2=10000000000000000000000000)} => true
> 
> You might want to report that to the vendor.

I did report it to the vendor, and closer investigation shows that arithmetic is done with java.lang.Longs in this case, and the funny results come from the overflow behaviour (both sides of the comparison are wrong in the same way).

https://issues.apache.org/jira/browse/JENA-153?focusedCommentId=13142306

That's still a bug. XSD requires support for integers up to ±10^16 in a minimally conforming processor, so the supported number range is fine; but the spec also clearly states that unsupported values MUST NOT be quietly changed to supported values.

My reference for claiming that BigIntegers are supported was the Jena documentation:

[[ 
When parsing an xsd:integer the Java value object used will be an Integer, Long or BigInteger depending on the size of the specific value being represented. 
]] 
http://openjena.org/how-to/typedLiterals.html

This information seems to be outdated, or the support does not extend to ARQ.

Best,
Richard

Received on Wednesday, 2 November 2011 17:27:58 UTC