org.eclipse.rdf4j.query.algebra.evaluation.util

## Class QueryEvaluationUtil

- java.lang.Object
- - org.eclipse.rdf4j.query.algebra.evaluation.util.QueryEvaluationUtil

-     public class QueryEvaluationUtil
      extends Object

  Author:
    Arjohn Kampman

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryEvaluationUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `compare(Value leftVal, Value rightVal, Compare.CompareOp operator)`
    `static boolean` | `compare(Value leftVal, Value rightVal, Compare.CompareOp operator, boolean strict)`
    `static boolean` | `compareLiterals(Literal leftLit, Literal rightLit, Compare.CompareOp operator)` Compares the supplied `Literal` arguments using the supplied operator, using strict (minimally-conforming) SPARQL 1.1 operator behavior.
    `static boolean` | `compareLiterals(Literal leftLit, Literal rightLit, Compare.CompareOp operator, boolean strict)` Compares the supplied `Literal` arguments using the supplied operator.
    `static boolean` | `compatibleArguments(Literal arg1, Literal arg2)` Checks whether the supplied two literal arguments are 'argument compatible' according to the SPARQL definition.
    `static boolean` | `getEffectiveBooleanValue(Value value)` Determines the effective boolean value (EBV) of the supplied value as defined in the SPARQL specification: The EBV of any literal whose type is xsd:boolean or numeric is false if the lexical form is not valid for that datatype (e.g.
    `static boolean` | `isPlainLiteral(Literal l)`
    `static boolean` | `isPlainLiteral(Value v)` Checks whether the supplied value is a "plain literal".
    `static boolean` | `isSimpleLiteral(Literal l)` Checks whether the supplied literal is a "simple literal".
    `static boolean` | `isSimpleLiteral(Value v)` Checks whether the supplied value is a "simple literal".
    `static boolean` | `isStringLiteral(Literal l)` Checks whether the supplied literal is a "string literal".
    `static boolean` | `isStringLiteral(Value v)` Checks whether the supplied literal is a "string literal".

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### QueryEvaluationUtil

          public QueryEvaluationUtil()

  - ### Method Detail

    - #### getEffectiveBooleanValue

          public static boolean getEffectiveBooleanValue(Value value)
                                                  throws ValueExprEvaluationException

      Determines the effective boolean value (EBV) of the supplied value as defined in the SPARQL specification:
      - The EBV of any literal whose type is xsd:boolean or numeric is false if the lexical form is not valid for that datatype (e.g. "abc"^^xsd:integer).
      - If the argument is a typed literal with a datatype of xsd:boolean, the EBV is the value of that argument.
      - If the argument is a plain literal or a typed literal with a datatype of xsd:string, the EBV is false if the operand value has zero length; otherwise the EBV is true.
      - If the argument is a numeric type or a typed literal with a datatype derived from a numeric type, the EBV is false if the operand value is NaN or is numerically equal to zero; otherwise the EBV is true.
      - All other arguments, including unbound arguments, produce a type error.
      Parameters:
        `value` - Some value.
      Returns:
        The EBV of `value`.
      Throws:
        `ValueExprEvaluationException` - In case the application of the EBV algorithm results in a type error.

    - #### compare

          public static boolean compare(Value leftVal,
                                        Value rightVal,
                                        Compare.CompareOp operator)
                                 throws ValueExprEvaluationException

      Throws:
        `ValueExprEvaluationException`

    - #### compare

          public static boolean compare(Value leftVal,
                                        Value rightVal,
                                        Compare.CompareOp operator,
                                        boolean strict)
                                 throws ValueExprEvaluationException

      Throws:
        `ValueExprEvaluationException`

    - #### compareLiterals

          public static boolean compareLiterals(Literal leftLit,
                                                Literal rightLit,
                                                Compare.CompareOp operator)
                                         throws ValueExprEvaluationException

      Compares the supplied `Literal` arguments using the supplied operator, using strict (minimally-conforming) SPARQL 1.1 operator behavior.
      Parameters:
        `leftLit` - the left literal argument of the comparison.
        `rightLit` - the right literal argument of the comparison.
        `operator` - the comparison operator to use.
      Returns:
        `true` if execution of the supplied operator on the supplied arguments succeeds, `false` otherwise.
      Throws:
        `ValueExprEvaluationException` - if a type error occurred.

    - #### compareLiterals

          public static boolean compareLiterals(Literal leftLit,
                                                Literal rightLit,
                                                Compare.CompareOp operator,
                                                boolean strict)
                                         throws ValueExprEvaluationException

      Compares the supplied `Literal` arguments using the supplied operator.
      Parameters:
        `leftLit` - the left literal argument of the comparison.
        `rightLit` - the right literal argument of the comparison.
        `operator` - the comparison operator to use.
        `strict` - boolean indicating whether comparison should use strict (minimally-conforming) SPARQL 1.1 operator behavior, or extended behavior.
      Returns:
        `true` if execution of the supplied operator on the supplied arguments succeeds, `false` otherwise.
      Throws:
        `ValueExprEvaluationException` - if a type error occurred.

    - #### isPlainLiteral

          public static boolean isPlainLiteral(Value v)

      Checks whether the supplied value is a "plain literal". A "plain literal" is a literal with no datatype and optionally a language tag.
      See Also:
        RDF Literal Documentation

    - #### isPlainLiteral

          public static boolean isPlainLiteral(Literal l)

    - #### isSimpleLiteral

          public static boolean isSimpleLiteral(Value v)

      Checks whether the supplied value is a "simple literal". A "simple literal" is a literal with no language tag nor datatype.
      See Also:
        SPARQL Simple Literal Documentation

    - #### isSimpleLiteral

          public static boolean isSimpleLiteral(Literal l)

      Checks whether the supplied literal is a "simple literal". A "simple literal" is a literal with no language tag and the datatype `XSD.STRING`.
      See Also:
        SPARQL Simple Literal Documentation

    - #### isStringLiteral

          public static boolean isStringLiteral(Value v)

      Checks whether the supplied literal is a "string literal". A "string literal" is either a simple literal, a plain literal with language tag, or a literal with datatype xsd:string.
      See Also:
        SPARQL Functions on Strings Documentation

    - #### compatibleArguments

          public static boolean compatibleArguments(Literal arg1,
                                                    Literal arg2)

      Checks whether the supplied two literal arguments are 'argument compatible' according to the SPARQL definition.
      Parameters:
        `arg1` - the first argument
        `arg2` - the second argument
      Returns:
        true iff the two supplied arguments are argument compatible, false otherwise
      See Also:
        SPARQL Argument Compatibility Rules

    - #### isStringLiteral

          public static boolean isStringLiteral(Literal l)

      Checks whether the supplied literal is a "string literal". A "string literal" is either a simple literal, a plain literal with language tag, or a literal with datatype xsd:string.
      See Also:
        SPARQL Functions on Strings Documentation

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.