According to the docs:
http://jena.apache.org/documentation/notes/typed-literals.html

These are all available as static member variables from
com.hp.hpl.jena.datatypes.xsd.XSDDatatype<http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/datatypes/xsd/XSDDatatype.html>
.

Of these types, the following are registered as the default type to use to
represent certain Java classes:
  Java class xsd type   Float float  Double double  Integer int  Long long
Short short  Byte byte  BigInteger integer  BigDecimal decimal  Boolean
Boolean  String string

This is what I am seeing for xsd:short and xsd:byte.  I'm puzzled by the
type from getValue.

CODE:

System.out.println( "RDFDatatype: " + literal.getDatatype().toString() );
System.out.println( "Datatype URI: " + literal.getDatatypeURI() );
System.out.println( "getValue java class: " +
((Literal)literal).getValue().getClass()
);

OUTPUT:

RDFDatatype: Datatype[http://www.w3.org/2001/XMLSchema#byte -> class
java.lang.Byte]
Datatype URI: http://www.w3.org/2001/XMLSchema#byte
getValue java class: class java.lang.Integer
RDFDatatype: Datatype[http://www.w3.org/2001/XMLSchema#short -> class
java.lang.Short]
Datatype URI: http://www.w3.org/2001/XMLSchema#short
getValue java class: class java.lang.Integer

So, is the expected behavior?

Thanks,
Tim

Reply via email to