com.hp.hpl.jena.datatypes
Interface RDFDatatype

All Known Implementing Classes:
BaseDatatype, Functor.FunctorDatatype, XSDbase64Binary, XSDDatatype, XSDhexBinary

public interface RDFDatatype

Interface on a datatype representation. An instance of this interface is needed to convert typed literals between lexical and value forms.

Version:
$Revision: 1.5 $ on $Date: 2003/08/27 12:54:03 $
Author:
Dave Reynolds

Method Summary
 Object extendedTypeDefinition()
          Returns an object giving more details on the datatype.
 Class getJavaClass()
          If this datatype is used as the cannonical representation for a particular java datatype then return that java type, otherwise returns null.
 String getURI()
          Return the URI which is the label for this datatype
 boolean isEqual(com.hp.hpl.jena.graph.impl.LiteralLabel value1, com.hp.hpl.jena.graph.impl.LiteralLabel value2)
          Compares two instances of values of the given datatype.
 boolean isValid(String lexicalForm)
          Test whether the given string is a legal lexical form of this datatype.
 boolean isValidLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
          Test whether the given LiteralLabel is a valid instance of this datatype.
 boolean isValidValue(Object valueForm)
          Test whether the given object is a legal value form of this datatype.
 Object parse(String lexicalForm)
          Parse a lexical form of this datatype to a value
 String unparse(Object value)
          Convert a value of this datatype out to lexical form.
 

Method Detail

getURI

String getURI()
Return the URI which is the label for this datatype


unparse

String unparse(Object value)
Convert a value of this datatype out to lexical form.


parse

Object parse(String lexicalForm)
             throws DatatypeFormatException
Parse a lexical form of this datatype to a value

Throws:
DatatypeFormatException - if the lexical form is not legal

isValid

boolean isValid(String lexicalForm)
Test whether the given string is a legal lexical form of this datatype.


isValidValue

boolean isValidValue(Object valueForm)
Test whether the given object is a legal value form of this datatype.


isValidLiteral

boolean isValidLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
Test whether the given LiteralLabel is a valid instance of this datatype. This takes into accound typing information as well as lexical form - for example an xsd:string is never considered valid as an xsd:integer (even if it is lexically legal like "1").


isEqual

boolean isEqual(com.hp.hpl.jena.graph.impl.LiteralLabel value1,
                com.hp.hpl.jena.graph.impl.LiteralLabel value2)
Compares two instances of values of the given datatype. This defaults to just testing equality of the java value representation but datatypes can override this. We pass the entire LiteralLabel to allow the equality function to take the xml:lang tag and the datatype itself into account.


getJavaClass

Class getJavaClass()
If this datatype is used as the cannonical representation for a particular java datatype then return that java type, otherwise returns null.


extendedTypeDefinition

Object extendedTypeDefinition()
Returns an object giving more details on the datatype. This is type system dependent. In the case of XSD types this will be an instance of org.apache.xerces.impl.xs.dv.XSSimpleType.



Copyright © 2000, 2001, 2002, 2003, 2004 Hewlett-Packard Development Company, LP