Class StringCast

  • All Implemented Interfaces:
    Function
    Direct Known Subclasses:
    StringCast

    public class StringCast
    extends CastFunction
    A Function that tries to cast its argument to an xsd:string.
    Author:
    Arjohn Kampman, Jeen Broekstra
    • Constructor Summary

      Constructors 
      Constructor Description
      StringCast()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.eclipse.rdf4j.model.Literal convert​(org.eclipse.rdf4j.model.ValueFactory valueFactory, org.eclipse.rdf4j.model.Value value)
      Convert the supplied value to a literal of the function output datatype.
      org.eclipse.rdf4j.model.Literal evaluate​(org.eclipse.rdf4j.model.ValueFactory valueFactory, org.eclipse.rdf4j.model.Value... args)
      Evaluate the function over the supplied input arguments, using the supplied ValueFactory to produce the result.
      protected org.eclipse.rdf4j.model.IRI getXsdDatatype()
      Get the specific XML Schema datatype which this function returns.
      protected boolean isValidForDatatype​(String lexicalValue)
      Verifies that the supplied lexical value is valid for the datatype.
    • Constructor Detail

      • StringCast

        public StringCast()
    • Method Detail

      • evaluate

        public org.eclipse.rdf4j.model.Literal evaluate​(org.eclipse.rdf4j.model.ValueFactory valueFactory,
                                                        org.eclipse.rdf4j.model.Value... args)
                                                 throws ValueExprEvaluationException
        Description copied from interface: Function
        Evaluate the function over the supplied input arguments, using the supplied ValueFactory to produce the result.
        Specified by:
        evaluate in interface Function
        Overrides:
        evaluate in class CastFunction
        Parameters:
        valueFactory - a ValueFactory to use for producing the function result.
        args - the function input arguments.
        Returns:
        the function result value.
        Throws:
        ValueExprEvaluationException
      • convert

        protected org.eclipse.rdf4j.model.Literal convert​(org.eclipse.rdf4j.model.ValueFactory valueFactory,
                                                          org.eclipse.rdf4j.model.Value value)
                                                   throws ValueExprEvaluationException
        Description copied from class: CastFunction
        Convert the supplied value to a literal of the function output datatype.
        Specified by:
        convert in class CastFunction
        Parameters:
        valueFactory - the valueFactory to use
        value - 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

        protected org.eclipse.rdf4j.model.IRI getXsdDatatype()
        Description copied from class: CastFunction
        Get the specific XML Schema datatype which this function returns.
        Specified by:
        getXsdDatatype in class CastFunction
        Returns:
        an XML Schema datatype IRI
      • isValidForDatatype

        protected boolean isValidForDatatype​(String lexicalValue)
        Description copied from class: CastFunction
        Verifies that the supplied lexical value is valid for the datatype.
        Specified by:
        isValidForDatatype in class CastFunction
        Parameters:
        lexicalValue - a lexical value
        Returns:
        true if the lexical value is valid for the datatype, false otherwise.