[ 
https://issues.apache.org/jira/browse/JENA-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047175#comment-14047175
 ] 

Andy Seaborne edited comment on JENA-733 at 6/29/14 5:40 PM:
-------------------------------------------------------------

Indeed - SPARQL part is not affecting the situation.

Short example:

{noformat}
 Model m = ModelFactory.createDefaultModel();
        Literal litLong = m.createTypedLiteral(1L) ;
        Literal litInt = m.createTypedLiteral(1) ;
        Class<?> litLongJClass = litLong.getDatatype().getJavaClass();
        Class<?> litIntJClass = litInt.getDatatype().getJavaClass();

        Class<?> isLongJVClass = litLong.getValue().getClass();
        Class<?> isIntJVClass =  litInt.getValue().getClass();

        System.out.printf("Long:\n") ;
        System.out.printf("datatype.getJavaClass:  %s\n", litLongJClass) ;
        System.out.printf("literal.getValue class: %s\n", isLongJVClass) ;
        System.out.printf("Integer:\n") ;
        System.out.printf("datatype.getJavaClass:  %s\n", litIntJClass) ;
        System.out.printf("literal.getValue class: %s\n", isIntJVClass) ;
{noformat}


was (Author: andy.seaborne):
Indeed - SPARQL part is not affecting the situation.

Short example:

{noformat}
public class LongIntTest {
    public static void main(String[] args) {
        Model m = ModelFactory.createDefaultModel();
        Literal lit0 = m.createTypedLiteral(1L) ;
        Class<?> shouldBe0 = lit0.getDatatype().getJavaClass();
        Class<?> is0 = lit0.getValue().getClass();
        System.out.printf("datatype.getJavaClass:  %s\n", shouldBe0) ;
        System.out.printf("literal.getValue class: %s\n", is0) ;
    }
}
{noformat}

> 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: RDF API
>    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)

Reply via email to