Class CastFunction
java.lang.Object
org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.CastFunction
- All Implemented Interfaces:
Function
- Direct Known Subclasses:
BooleanCast,DateCast,DateTimeCast,DecimalCast,DoubleCast,FloatCast,IntegerCastFunction,StringCast
Abstract superclass for
Functions that cast an argument
to an XML Schema datatype.- Author:
- Jeen Broekstra
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Literalconvert(ValueFactory vf, Value v) Convert the supplied value to a literal of the function output datatype.evaluate(ValueFactory valueFactory, Value... args) Evaluate the function over the supplied input arguments, using the suppliedValueFactoryto produce the result.protected abstract CoreDatatype.XSDfinal StringgetURI()protected IRIDeprecated, for removal: This API element is subject to removal in a future version.protected StringReturns a prefixed name representation of the specific datatype that this function returnsprotected abstract booleanisValidForDatatype(String lexicalValue) Verifies that the supplied lexical value is valid for the datatype.protected final ValueExprEvaluationExceptionCreates aValueExprEvaluationExceptionthat signals a type error.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.function.Function
evaluate, mustReturnDifferentResult
-
Constructor Details
-
CastFunction
public CastFunction()
-
-
Method Details
-
getURI
-
evaluate
public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException Description copied from interface:FunctionEvaluate the function over the supplied input arguments, using the suppliedValueFactoryto produce the result.- Specified by:
evaluatein interfaceFunction- Parameters:
valueFactory- aValueFactoryto use for producing the function result.args- the function input arguments.- Returns:
- the function result value.
- Throws:
ValueExprEvaluationException
-
convert
Convert the supplied value to a literal of the function output datatype.- Parameters:
vf- the valueFactory to usev- a value that is not a string-typed literal, and not a literal of the same datatype as the function output datatype.- Returns:
- a literal value of the function output datatype
- Throws:
ValueExprEvaluationException- if an error occurs in conversion.
-
getXsdDatatype
Deprecated, for removal: This API element is subject to removal in a future version.Get the specific XML Schema datatype which this function returns.- Returns:
- an XML Schema datatype IRI
-
getCoreXsdDatatype
-
getXsdName
Returns a prefixed name representation of the specific datatype that this function returns- Returns:
- a prefixed name, e.g. 'xsd:integer'.
-
isValidForDatatype
Verifies that the supplied lexical value is valid for the datatype.- Parameters:
lexicalValue- a lexical value- Returns:
- true if the lexical value is valid for the datatype, false otherwise.
-
typeError
Creates aValueExprEvaluationExceptionthat signals a type error.- Parameters:
arg- the function argument value.cause- root cause throwable. May be null.- Returns:
- a
ValueExprEvaluationExceptionwith a standardized message and wrapped cause.
-