[Mulgara-dev] Incorrect datatype for typed literal

Paul Gearon gearon at ieee.org
Tue Apr 29 23:31:46 UTC 2008


On Tue, Apr 29, 2008 at 4:15 PM, Alex Hall <alexhall at revelytix.com> wrote:
> I'm working with typed literals (non-negative integers, specifically) and
> noticed that in certain cases the incorrect datatype URI is stored in the
> stringpool value for a typed literal.  I'm attaching a test file to
> illustrate.  Note that, in the RDF-XML, the literal values for both "0" and
> "1" have datatype xsd:nonNegativeInteger.  If you load the RDF into a
> Mulgara model and query for statements, the datatype for "1" is correct but
> the datatype for "0" has been changed to xsd:integer.  It's been a while
> since I looked at any of the stringpool code.  Can somebody point me in the
> right direction to track this down?

Funnily enough, I've been looking at this very code today. I keep
getting RDF which hasn't declared the XSD namespace, so literals like
"42"^^xsd:int are stored with a URI of "xsd:int" instead of
http://www.w3.org/2001/XMLSchema#int.

Your data is either being stored incorrectly, or read back
incorrectly.  To see how it gets stored, look at
SPObjectFactoryImpl.newSPObject(Node). For numbers, this calls
newSPTypedLiteral(String lexicalForm, URI typeURI), which then goes to
a factory that is found through the type URI (this mapping from URI to
factory is set up in SPTypedLiteralRegistry). The SPObject that gets
created by the mapping will ultimately be used for storing the data.

Storing happens in
XAStringPoolImpl.Phase.findGNode(ObjectPool,SPObject,NodePool) (line
1717). If the SPObject is not found, then it gets written out, and the
newly allocated long is returned.

Anyway, I have to leave, so I'll leave it there. Let me know if you
have more questions.

Paul



More information about the Mulgara-dev mailing list