Datatypes
Class Datatype

java.lang.Object
  |
  +--Datatypes.Datatype
Direct Known Subclasses:
AnySimpleType

public abstract class Datatype
extends java.lang.Object

This is a Java implementation of the datatyping model employed by RDF 1.1. The Java class hierarchy is expected to mirror the RDF subClassOf relations between the datatypes, and the top level concrete datatype classes define a native Java type which is used by all subclasses, to allow for native comparision of hierarchically related values. This is in line with the RDF datatyping model where the class extension of each datatype is its value space and each subordinate datatype must have a value space that is a proper subset of its superordinates -- even though its lexical space and lexical to value mapping need not be compatible.


Field Summary
protected  java.lang.Object nativeValue
           
 
Constructor Summary
Datatype()
           
 
Method Summary
static int compare(java.lang.String uriX, java.lang.String lformX, java.lang.String uriY, java.lang.String lformY)
          Compares the values denoted by two typed literals, returning 0 if they are equal, a value less than zero if the first is less than the second, and a value greater than zero if the first is greater than the second.
 int compareTo(Datatype value)
          Compares itself to the specified value, returning 0 if they are equal, , a value less than zero if less than the specified value, and a value greater than zero if greater than the specified value.
static boolean equal(java.lang.String uriX, java.lang.String lformX, java.lang.String uriY, java.lang.String lformY)
          Compares the values denoted by two typed literals, returning true if they are equal or false if they are not equal.
 boolean equals(Datatype value)
          Compares itself to the specified value, returning true if they are equal or false if they are not equal.
abstract  boolean isValidForm(java.lang.String lform)
          Returns true if lexical form is valid, else returns false.
abstract  java.lang.String lexicalForm()
          Returns a valid lexical form (string representation) of the value.
static java.lang.String lookup(java.lang.String uri)
          Retrieves Java class name associated with specified datatype URI
static void register(java.lang.String uri, java.lang.String classname)
          Registers datatype Java class name under datatype URI
abstract  void setValue(java.lang.String lform)
          Sets the value corresponding to the specified lexical form
static Datatype value(java.lang.String uri, java.lang.String lform)
          Creates new datatype value instance of specified datatype, initialized to the value denoted by the lexical form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nativeValue

protected java.lang.Object nativeValue
Constructor Detail

Datatype

public Datatype()
Method Detail

register

public static final void register(java.lang.String uri,
                                  java.lang.String classname)
Registers datatype Java class name under datatype URI


lookup

public static final java.lang.String lookup(java.lang.String uri)
                                     throws UnknownDatatype
Retrieves Java class name associated with specified datatype URI

UnknownDatatype

value

public static final Datatype value(java.lang.String uri,
                                   java.lang.String lform)
                            throws InvalidLexicalForm,
                                   UnknownDatatype,
                                   java.lang.ClassNotFoundException,
                                   java.lang.InstantiationException,
                                   java.lang.IllegalAccessException
Creates new datatype value instance of specified datatype, initialized to the value denoted by the lexical form.

InvalidLexicalForm
UnknownDatatype
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

compare

public static final int compare(java.lang.String uriX,
                                java.lang.String lformX,
                                java.lang.String uriY,
                                java.lang.String lformY)
                         throws InvalidLexicalForm,
                                UnknownDatatype,
                                InvalidComparison,
                                java.lang.ClassNotFoundException,
                                java.lang.InstantiationException,
                                java.lang.IllegalAccessException
Compares the values denoted by two typed literals, returning 0 if they are equal, a value less than zero if the first is less than the second, and a value greater than zero if the first is greater than the second. Throws InvalidComparison if datatypes cannot be compared (i.e. one is not a subClassOf the other) or if either datatype does not support ordinal comparision of values. This Datatype implementation requires that subtypes employ the same underlying native Java type as the root concrete datatype class, though allowing additional constraints on the value space and any lexical space and lexical to value mapping whatsoever, so that native comparisons can be made between values of hierarchically related datatypes.

InvalidLexicalForm
UnknownDatatype
InvalidComparison
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

equal

public static final boolean equal(java.lang.String uriX,
                                  java.lang.String lformX,
                                  java.lang.String uriY,
                                  java.lang.String lformY)
                           throws InvalidLexicalForm,
                                  UnknownDatatype,
                                  InvalidComparison,
                                  java.lang.ClassNotFoundException,
                                  java.lang.InstantiationException,
                                  java.lang.IllegalAccessException
Compares the values denoted by two typed literals, returning true if they are equal or false if they are not equal. Throws NonComparableDatatypes if datatypes cannot be compared (i.e. one is not a subClassOf the other).

InvalidLexicalForm
UnknownDatatype
InvalidComparison
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

compareTo

public int compareTo(Datatype value)
              throws InvalidComparison
Compares itself to the specified value, returning 0 if they are equal, , a value less than zero if less than the specified value, and a value greater than zero if greater than the specified value. Throws InvalidComparison if the datatypes of the values cannot be compared (i.e. one is not a subclass of the other) or if no compareTo() method is defined for the datatype class.

InvalidComparison

equals

public boolean equals(Datatype value)
               throws InvalidComparison
Compares itself to the specified value, returning true if they are equal or false if they are not equal. Throws InvalidComparison if the datatypes of the values cannot be compared (i.e. one is not a subclass of the other) or if no equals() method is defined for the datatype class.

InvalidComparison

lexicalForm

public abstract java.lang.String lexicalForm()
Returns a valid lexical form (string representation) of the value.


setValue

public abstract void setValue(java.lang.String lform)
                       throws InvalidLexicalForm
Sets the value corresponding to the specified lexical form

InvalidLexicalForm

isValidForm

public abstract boolean isValidForm(java.lang.String lform)
Returns true if lexical form is valid, else returns false.