An RDF Literal.
In RDF2003 literals can be typed. If typed then the literal comprises a
datatype, a lexical form and a value (together with an optional xml:lang
string). Old style literals have no type and are termed "plain" literals.
Implementations of this interface should be able to support both plain
and typed literals. In the case of typed literals the primitive accessor methods
such as getInt() determine if the literal value can be coerced to an appropriate
java wrapper class. If so then the class is unwrapped to extract the primitive
value returned. If the coercion fails then a runtime DatatypeFormatException is
thrown.
In the case of plain literals then the primitve accessor methods duplicate
the behvaiour of jena1. The literal is internally stored in lexical form but
the accessor methods such as getInt will attempt to parse the lexical form
and if successful will return the primitive value.
Object (i.e. non-primitive) values are supported. In the case of typed literals
then a global TypeMapper registry determines what datatype representation to
use for a given Object type. In the case of plain literals then the object
will be stored in the lexical form given by its toString method.
Factory objects, provided by the application, are needed in that case to covert
the lexical form back into the appropriate object type.
author: bwm and der version: $Name: $ $Revision: 1.16 $ $Date: 2008/01/02 12:05:46 $ |