Class XMLDatatypeMathUtil


  • public class XMLDatatypeMathUtil
    extends Object
    A utility class for evaluation of extended "mathematical" expressions on RDF literals. They do not work only on numeric literals but also on durations
    Author:
    Thomas Pellissier Tanon
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.rdf4j.model.Literal compute​(org.eclipse.rdf4j.model.Literal leftLit, org.eclipse.rdf4j.model.Literal rightLit, MathExpr.MathOp op)
      Computes the result of applying the supplied math operator on the supplied left and right operand.
      static org.eclipse.rdf4j.model.Literal compute​(org.eclipse.rdf4j.model.Literal leftLit, org.eclipse.rdf4j.model.Literal rightLit, MathExpr.MathOp op, org.eclipse.rdf4j.model.ValueFactory vf)
      Computes the result of applying the supplied math operator on the supplied left and right operand.
    • Constructor Detail

      • XMLDatatypeMathUtil

        public XMLDatatypeMathUtil()
    • Method Detail

      • compute

        public static org.eclipse.rdf4j.model.Literal compute​(org.eclipse.rdf4j.model.Literal leftLit,
                                                              org.eclipse.rdf4j.model.Literal rightLit,
                                                              MathExpr.MathOp op)
                                                       throws ValueExprEvaluationException
        Computes the result of applying the supplied math operator on the supplied left and right operand.
        Parameters:
        leftLit - a datatype literal
        rightLit - a datatype literal
        op - a mathematical operator, as definied by MathExpr.MathOp.
        vf - a ValueFactory used to create the result
        Returns:
        a datatype literal
        Throws:
        ValueExprEvaluationException
      • compute

        public static org.eclipse.rdf4j.model.Literal compute​(org.eclipse.rdf4j.model.Literal leftLit,
                                                              org.eclipse.rdf4j.model.Literal rightLit,
                                                              MathExpr.MathOp op,
                                                              org.eclipse.rdf4j.model.ValueFactory vf)
                                                       throws ValueExprEvaluationException
        Computes the result of applying the supplied math operator on the supplied left and right operand.
        Parameters:
        leftLit - a datatype literal
        rightLit - a datatype literal
        op - a mathematical operator, as definied by MathExpr.MathOp.
        Returns:
        a datatype literal
        Throws:
        ValueExprEvaluationException