You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Benno Willoweit (JIRA)" <ji...@apache.org> on 2014/06/29 14:03:24 UTC
[jira] [Comment Edited] (JENA-733) Long typed literals in query
results are returned as integers
[ https://issues.apache.org/jira/browse/JENA-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047107#comment-14047107 ]
Benno Willoweit edited comment on JENA-733 at 6/29/14 12:02 PM:
----------------------------------------------------------------
Hi,
I did a bit of debugging with attached sources (sorry, should have done this straightaway) and found that this is not an ARQ problem. Actually, when creating a typed long literal in Jena you end up with an Integer object in the model if the number fits in the integer range. At line 467 in {{com.hp.hpl.jena.datatypes.xsd.XSDDatatype}} there is a static function {{suitableInteger(long number)}} which casts the value to an int if it fits into a 4 bytes and returns the integer wrapper class. So this is obviously done on purpose but it's not consistent with what {{literal.getDatatype()}} returns. And I honestly think it's a bad feature :)
For the record, my testing sample (eclipse project) is on bitbucket: https://kolchose0711@bitbucket.org/kolchose0711/jenalongint.git
was (Author: willow):
Hi,
I did a bit of debugging with attached sources (sorry, should have done this straightaway) and found that this is not an ARQ problem. Actually, when creating a typed long literal in Jena you end up with an Integer object in the model if the number fits in the integer range. At line 467 in {{com.hp.hpl.jena.datatypes.xsd.XSDDatatype}} there is a static function {{suitableInteger(long number)}} which casts the value to an int if it fits into a 4 byte signed value and returns the Integer wrapper class. So this obviously done on purpose but it's not consistent with what {{literal.getDatatype()}} returns. And I honestly think it's a bad feature :)
For the record, my testing sample (eclipse project) is on bitbucket: https://kolchose0711@bitbucket.org/kolchose0711/jenalongint.git
> Long typed literals in query results are returned as integers
> --------------------------------------------------------------
>
> Key: JENA-733
> URL: https://issues.apache.org/jira/browse/JENA-733
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Affects Versions: Jena 2.11.2
> Reporter: Benno Willoweit
> Priority: Minor
>
> This is my first bug report ever so I hope I get this right. When retrieving query results with ARQ, long values are returned as Integers:
> {{QuerySulution qs;}}
> {{Literal l = qs.getLiteral("myVar");}}
> {{l.getDatatype().getJavaClass(); //returns java.lang.Long which is correct}}
> {{l.getValue(); //returns a java.lang.Integer object but it should return a java.lang.Long object according to the docs}}
> I have this problem with ARQ 2.11.2 which does not exist in the "affects version" drop down.
--
This message was sent by Atlassian JIRA
(v6.2#6252)