Package org.eclipse.rdf4j.rio
Interface DatatypeHandler
-
- All Known Implementing Classes:
DBPediaDatatypeHandler,GeoSPARQLDatatypeHandler,RDFDatatypeHandler,VirtuosoGeometryDatatypeHandler,XMLSchemaDatatypeHandler
public interface DatatypeHandlerAn interface defining methods related to verification and normalization of typed literals and datatype URIs.- Author:
- Peter Ansell
-
-
Field Summary
Fields Modifier and Type Field Description static StringDBPEDIAIdentifier for datatypes defined by DBPedia.static StringGEOSPARQLIdentifier for datatypes defined in the GeoSPARQL vocabulary.static StringRDFDATATYPESIdentifier for datatypes defined in theRDFvocabulary.static StringVIRTUOSOGEOMETRYIdentifier for datatypes defined in the Virtuoso Geometry vocabulary.static StringXMLSCHEMAIdentifier for datatypes defined in theXSDvocabulary.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetKey()A unique key for this datatype handler to identify it in the DatatypeHandlerRegistry.booleanisRecognizedDatatype(IRI datatypeUri)Checks if the given datatype URI is recognized by this datatype handler.LiteralnormalizeDatatype(String literalValue, IRI datatypeUri, ValueFactory valueFactory)Normalize both the datatype URI and the literal value if appropriate, and use the given value factory to generate a literal matching a literal value and datatype URI.booleanverifyDatatype(String literalValue, IRI datatypeUri)Verifies that the datatype URI is valid, including a check on the structure of the literal value.
-
-
-
Field Detail
-
XMLSCHEMA
static final String XMLSCHEMA
Identifier for datatypes defined in theXSDvocabulary.- See Also:
- Constant Field Values
-
RDFDATATYPES
static final String RDFDATATYPES
Identifier for datatypes defined in theRDFvocabulary.- See Also:
- Constant Field Values
-
DBPEDIA
static final String DBPEDIA
Identifier for datatypes defined by DBPedia.- See Also:
- DBPedia Datatypes, Constant Field Values
-
VIRTUOSOGEOMETRY
static final String VIRTUOSOGEOMETRY
Identifier for datatypes defined in the Virtuoso Geometry vocabulary.- See Also:
- Virtuoso Geospatial, Constant Field Values
-
GEOSPARQL
static final String GEOSPARQL
Identifier for datatypes defined in the GeoSPARQL vocabulary.- See Also:
- GeoSPARQL, Constant Field Values
-
-
Method Detail
-
isRecognizedDatatype
boolean isRecognizedDatatype(IRI datatypeUri)
Checks if the given datatype URI is recognized by this datatype handler.- Parameters:
datatypeUri- The datatype URI to check.- Returns:
- True if the datatype is syntactically valid and could be used with
verifyDatatype(String, IRI)andnormalizeDatatype(String, IRI, ValueFactory).
-
verifyDatatype
boolean verifyDatatype(String literalValue, IRI datatypeUri) throws LiteralUtilException
Verifies that the datatype URI is valid, including a check on the structure of the literal value.This method must only be called after verifying that
isRecognizedDatatype(IRI)returns true for the given datatype URI.- Parameters:
literalValue- Literal value matching the given datatype URI.datatypeUri- A datatype URI that matched withisRecognizedDatatype(IRI)- Returns:
- True if the datatype URI is recognized by this datatype handler, and it is verified to be syntactically valid.
- Throws:
LiteralUtilException- If the datatype was not recognized.
-
normalizeDatatype
Literal normalizeDatatype(String literalValue, IRI datatypeUri, ValueFactory valueFactory) throws LiteralUtilException
Normalize both the datatype URI and the literal value if appropriate, and use the given value factory to generate a literal matching a literal value and datatype URI.This method must only be called after verifying that
isRecognizedDatatype(IRI)returns true for the given datatype URI, andverifyDatatype(String, IRI)also returns true for the given datatype URI and literal value.- Parameters:
literalValue- Required literal value to use in the normalization process and to provide the value for the resulting literal.datatypeUri- The datatype URI which is to be normalized. This URI is available in normalized form from the result usingLiteral.getDatatype().valueFactory- TheValueFactoryto use to create the result literal.- Returns:
- A
Literalcontaining the normalized literal value and datatype URI. - Throws:
LiteralUtilException- If the datatype URI was not recognized or verified, or the literal value could not be normalized due to an error.
-
getKey
String getKey()
A unique key for this datatype handler to identify it in the DatatypeHandlerRegistry.- Returns:
- A unique string key.
-
-