java.lang.Object
org.apache.jena.datatypes.BaseDatatype
- All Implemented Interfaces:
RDFDatatype
- Direct Known Subclasses:
AdhocDatatype,FunctorDatatype,RDFDirLangString,RDFhtml,RDFjson,RDFLangString,XMLLiteralType,XMLLiteralTypeARP1,XSDDatatype
Base level implementation of datatype from which real implementations
can inherit.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPair object used to encode both lexical form and datatype for a typed literal with unknown datatype. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncannonicalise(Object value) Cannonicalise a java Object value to a normal form.final booleanSame URI, same datatype.Returns an object giving more details on the datatype.intgetHashCode(LiteralLabel lit) Default implementation of getHashCode() delegates to the default from the literal label.Class<?>Returns the java class which is used to represent value instances of this datatype.getURI()Return the URI which is the label for this datatypefinal inthashCode()The hash code of a datatype is the hash code of its URI.booleanisEqual(LiteralLabel litLabel1, LiteralLabel litLabel2) Compares two instances of values of the given datatype.booleanTest whether the given string is a legal lexical form of this datatype.booleanTest whether the given LiteralLabel is a valid instance of this datatype.booleanisValidValue(Object valueForm) Test whether the given object is a legal value form of this datatype.booleanlangTagCompatible(LiteralLabel value1, LiteralLabel value2) Helper function to compare language tag valuesnormalizeSubType(Object value, RDFDatatype dt) Normalization.Parse a lexical form of this datatype to a valuetoString()Display formatConvert a value of this datatype out to lexical form.
-
Constructor Details
-
BaseDatatype
Constructor.- Parameters:
uri- the URI label to use for this datatype
-
-
Method Details
-
getURI
Return the URI which is the label for this datatype- Specified by:
getURIin interfaceRDFDatatype
-
unparse
Convert a value of this datatype out to lexical form.- Specified by:
unparsein interfaceRDFDatatype
-
parse
Parse a lexical form of this datatype to a value- Specified by:
parsein interfaceRDFDatatype- Throws:
DatatypeFormatException- if the lexical form is not legal
-
isValid
Test whether the given string is a legal lexical form of this datatype.- Specified by:
isValidin interfaceRDFDatatype
-
isValidLiteral
Test whether the given LiteralLabel is a valid instance of this datatype. This takes into account 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").- Specified by:
isValidLiteralin interfaceRDFDatatype
-
isValidValue
Test whether the given object is a legal value form of this datatype.- Specified by:
isValidValuein interfaceRDFDatatype
-
isEqual
Compares two instances of values of the given datatype. This default requires value and datatype equality.- Specified by:
isEqualin interfaceRDFDatatype
-
getHashCode
Default implementation of getHashCode() delegates to the default from the literal label.- Specified by:
getHashCodein interfaceRDFDatatype
-
langTagCompatible
Helper function to compare language tag values -
getJavaClass
Returns the java class which is used to represent value instances of this datatype.- Specified by:
getJavaClassin interfaceRDFDatatype
-
cannonicalise
Cannonicalise a java Object value to a normal form. Primarily used in cases such as xsd:integer to reduce the Java object representation to the narrowest of the Number subclasses to ensure that indexing of typed literals works.- Specified by:
cannonicalisein interfaceRDFDatatype
-
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 oforg.apache.xerces.impl.xs.psvi.XSTypeDefinition.- Specified by:
extendedTypeDefinitionin interfaceRDFDatatype
-
normalizeSubType
Normalization. If the value is narrower than the current data type (e.g. value is xsd:date but the time is xsd:datetime) returns the narrower type for the literal. If the type is narrower than the value then it may normalize the value (e.g. set the mask of an XSDDateTime) Currently only used to narrow gener XSDDateTime objects to the minimal XSD date/time type.- Specified by:
normalizeSubTypein interfaceRDFDatatype- Parameters:
value- the current object valuedt- the currently set data type- Returns:
- a narrower version of the datatype based on the actual value range
-
toString
Display format -
equals
Same URI, same datatype. See RDF 1.1 Concepts and Abstract Syntax - 3.3 Literals and RDF 1.1 Concepts and Abstract Syntax - 5. Datatypes -
hashCode
public final int hashCode()The hash code of a datatype is the hash code of its URI.
-