On 19/07/11 14:56, Laurent Pellegrino wrote:
Hi all,
I am currently using a TDB instance with Quadruples (DatasetGraphTDB).
I insert some quads with a literal value which is typed with xsd:long:
Node.createLiteral(Long.toString(myIdWhichIsAJavaLong), null,
XSDDatatype.XSDlong)
At this step if I print the content to the standard output I get something like:
"1900023546"^^http://www.w3.org/2001/XMLSchema#long
Then, I execute a query that return the quadruples that contain the
literal values that were initially typed as xsd:long. When I print the
content to the standard output I get:
"1900023546"^^http://www.w3.org/2001/XMLSchema#integer
Why does the datatype is not the same? Is it an issue?
No - or at least, it shouldn't.
xsd:long is a XSD 64 bit number
xsd:integer is an arbitrary precision
xsd:integer is a more general datatype than xsd:long (xsd:int is the 32
bit XSD integer).
TDB stores numbers (integers, decimals, doubles), and dates and
dateTimes and booleans, as their value, not as their lexical form.
Actually, it encodes them into 56 bits (currently). If the number does
not fit it is stores via the node table and lexical form.
This saves space and makes queries involving FILTERs on values go
faster. Much faster.
See NodeId.inline(Node)
Andy