Package com.complexible.stardog.plan.filter.functions

# Class AbstractFunction

java.lang.Object
com.complexible.stardog.plan.filter.AbstractExpression
com.complexible.stardog.plan.filter.functions.AbstractFunction

All Implemented Interfaces:
  `Copyable<com.complexible.stardog.plan.filter.Expression>`, `com.complexible.stardog.plan.filter.Expression`, `Function`

public abstract class AbstractFunction extends com.complexible.stardog.plan.filter.AbstractExpression implements Function

Abstract stub implementation of a Function. Checks that the arguments to the function meet the expected number of arguments before evaluating the function.

Since:
  0.1
Version:
  6.0
Author:
  Michael Grove

- ## Field Summary

  ### Fields inherited from class com.complexible.stardog.plan.filter.AbstractExpression

  `mArgs`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractFunction(int theNumReqArgs, String... theURIs)`
  `protected`
  `AbstractFunction(AbstractFunction theFunction)`
  `protected`
  `AbstractFunction(com.google.common.collect.Range<Integer> theNumReqArgs, String... theURIs)`
  `protected`
  `AbstractFunction(List<com.complexible.stardog.plan.filter.Expression> theExpressions, int theNumReqArgs, String... theURIs)`
  Create a new AbstractFunction
  `protected`
  `AbstractFunction(List<com.complexible.stardog.plan.filter.Expression> theExpressions, com.google.common.collect.Range<Integer> theRange, String... theURIs)`
  Create a new AbstractFunction

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static final boolean`
  `assertArrayLiteral(Value theValue)`
  Assert that the literal is an array literal.
  `protected final boolean`
  `assertBNode(Value theValue)`
  Assert that the value is a BNode
  `protected final boolean`
  `assertDecimalLiteral(Value theValue)`
  Assert that the literal is a decimal literal.
  `static final boolean`
  `assertIntegerLiteral(Value theValue)`
  Assert that the literal is an integer literal.
  `protected final boolean`
  `assertIRI(Value theValue)`
  Assert that the value is a URI
  `static final boolean`
  `assertLiteral(Value theValue)`
  Assert that the value is a literal
  `protected final boolean`
  `assertLiteral(Value theValue, Predicate<Datatype> theDatatypeChecker)`
  `protected final boolean`
  `assertNumericLiteral(Value theValue)`
  Assert that the literal is a numeric literal
  `static final boolean`
  `assertPathLiteral(Value theValue)`
  `protected boolean`
  `assertRequiredArgs(int theArgs)`
  Validate that the arguments passed to the function match the expected number
  `protected final boolean`
  `assertSimpleLiteral(Value theValue)`
  Assert that the value is a simple literal
  `protected final boolean`
  `assertStatement(Value theValue)`
  Assert that the value is a `Statement`
  `static final boolean`
  `assertStringLiteral(Value theValue)`
  Assert that the value is a String literal
  `protected final boolean`
  `assertTypedLiteral(Value theValue, Datatype theDatatype)`
  Assert that the literal has the provided datatype
  `boolean`
  `equals(Object o)`
  `com.complexible.stardog.plan.filter.expr.ValueOrError`
  `evaluate(com.complexible.stardog.plan.filter.expr.ValueOrError... theValues)`
  Directly evaluate the function for the given arguments
  `final com.complexible.stardog.plan.filter.expr.ValueOrError`
  `evaluate(com.complexible.stardog.plan.filter.ValueSolution theArgs)`
  `com.complexible.stardog.plan.filter.expr.ValueOrError`
  `evaluate(Value... theValues)`
  Directly evaluate the function for the given arguments
  `final String`
  `getName()`
  Return the string that uniquely identifies this `Expression`, which should be a fully qualified URI.
  `final List<String>`
  `getNames()`
  Return all the strings that uniquely identifies this `Function`.
  `com.google.common.collect.Range<Integer>`
  `getRequiredArgCount()`
  `int`
  `hashCode()`
  `protected abstract com.complexible.stardog.plan.filter.expr.ValueOrError`
  `internalEvaluate(Value... theArgs)`
  Evaluate the function
  `void`
  `setArgs(List<com.complexible.stardog.plan.filter.Expression> theArgs)`
  `String`
  `toString()`

  ### Methods inherited from class com.complexible.stardog.plan.filter.AbstractExpression

  `getArg, getArgs, getArgsCount, getFirstArg, getSecondArg, getThirdArg, replaceArg`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.complexible.stardog.plan.filter.Expression

  `accept, couldRaiseError, getArgs, getCategory, replaceArg`

  ### Methods inherited from interface com.complexible.stardog.plan.filter.functions.Function

  `copy, getDescription, initialize, isDeterministic`

- ## Constructor Details

  - ### AbstractFunction

    protected AbstractFunction(int theNumReqArgs, String... theURIs)

  - ### AbstractFunction

    protected AbstractFunction(com.google.common.collect.Range<Integer> theNumReqArgs, String... theURIs)

  - ### AbstractFunction

    protected AbstractFunction(List<com.complexible.stardog.plan.filter.Expression> theExpressions, int theNumReqArgs, String... theURIs)
    Create a new AbstractFunction
    Parameters:
      `theNumReqArgs` - the number of required arguments.
      `theURIs` - the URIs of the function. These are the URI's which identify this function in a SPARQL query.

  - ### AbstractFunction

    protected AbstractFunction(List<com.complexible.stardog.plan.filter.Expression> theExpressions, com.google.common.collect.Range<Integer> theRange, String... theURIs)
    Create a new AbstractFunction
    Parameters:
      `theRange` - the range of valid #'s of arguments to the function.
      `theURIs` - the URIs of the function. These are the URI's which identify this function in a SPARQL query.

  - ### AbstractFunction

    protected AbstractFunction(AbstractFunction theFunction)

- ## Method Details

  - ### setArgs

    public void setArgs(List<com.complexible.stardog.plan.filter.Expression> theArgs)
    Specified by:
      `setArgs` in interface `com.complexible.stardog.plan.filter.Expression`
    Overrides:
      `setArgs` in class `com.complexible.stardog.plan.filter.AbstractExpression`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `com.complexible.stardog.plan.filter.AbstractExpression`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `com.complexible.stardog.plan.filter.AbstractExpression`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `com.complexible.stardog.plan.filter.AbstractExpression`

  - ### getName

    public final String getName()
    Return the string that uniquely identifies this `Expression`, which should be a fully qualified URI. This URI is what is used to reference this `Expression` in a SPARQL query.
    Specified by:
      `getName` in interface `Function`
    Returns:
      the URI

  - ### getNames

    public final List<String> getNames()
    Return all the strings that uniquely identifies this `Function`. A function may have different names in different namespaces.
    Specified by:
      `getNames` in interface `Function`
    Returns:
      all aliases of this `Function`
    See Also:
      - `Function.getName()`

  - ### getRequiredArgCount

    public com.google.common.collect.Range<Integer> getRequiredArgCount()

  - ### evaluate

    public final com.complexible.stardog.plan.filter.expr.ValueOrError evaluate(com.complexible.stardog.plan.filter.ValueSolution theArgs)
    Specified by:
      `evaluate` in interface `com.complexible.stardog.plan.filter.Expression`

  - ### evaluate

    public com.complexible.stardog.plan.filter.expr.ValueOrError evaluate(com.complexible.stardog.plan.filter.expr.ValueOrError... theValues)
    Directly evaluate the function for the given arguments
    Parameters:
      `theValues` - the arguments to the function
    Returns:
      the return value of the function

  - ### evaluate

    public com.complexible.stardog.plan.filter.expr.ValueOrError evaluate(Value... theValues)
    Directly evaluate the function for the given arguments
    Parameters:
      `theValues` - the arguments to the function
    Returns:
      the return value of the function

  - ### internalEvaluate

    protected abstract com.complexible.stardog.plan.filter.expr.ValueOrError internalEvaluate(Value... theArgs)
    Evaluate the function
    Parameters:
      `theArgs` - the arguments to the function
    Returns:
      the return value of the function

  - ### assertRequiredArgs

    protected boolean assertRequiredArgs(int theArgs)
    Validate that the arguments passed to the function match the expected number
    Parameters:
      `theArgs` - the arguments to validate

  - ### assertIRI

    protected final boolean assertIRI(Value theValue)
    Assert that the value is a URI
    Parameters:
      `theValue` - the value
    Returns:
      true iff the value as a URI

  - ### assertStatement

    protected final boolean assertStatement(Value theValue)
    Assert that the value is a `Statement`
    Parameters:
      `theValue` - the value
    Returns:
      true iff the value as a statement

  - ### assertBNode

    protected final boolean assertBNode(Value theValue)
    Assert that the value is a BNode
    Parameters:
      `theValue` - the value
    Returns:
      true iff the value is a BNode

  - ### assertLiteral

    public static final boolean assertLiteral(Value theValue)
    Assert that the value is a literal
    Parameters:
      `theValue` - the value
    Returns:
      true iff the value is a Literal

  - ### assertStringLiteral

    public static final boolean assertStringLiteral(Value theValue)
    Assert that the value is a String literal
    Parameters:
      `theValue` - the value
    Returns:
      true if the value is a String literal

  - ### assertTypedLiteral

    protected final boolean assertTypedLiteral(Value theValue, Datatype theDatatype)
    Assert that the literal has the provided datatype
    Parameters:
      `theValue` - the value
    Returns:
      true if the value has the provided datatype

  - ### assertNumericLiteral

    protected final boolean assertNumericLiteral(Value theValue)
    Assert that the literal is a numeric literal
    Parameters:
      `theValue` - the value
    Returns:
      true if the value is a numeric literall

  - ### assertDecimalLiteral

    protected final boolean assertDecimalLiteral(Value theValue)
    Assert that the literal is a decimal literal. The datatype of the literal should be xsd:decimal or another type derived from xsd:decimal.
    Parameters:
      `theValue` - the value
    Returns:
      true if the value is a decimal literal

  - ### assertIntegerLiteral

    public static final boolean assertIntegerLiteral(Value theValue)
    Assert that the literal is an integer literal. The datatype of the literal should be xsd:integer or another type derived from xsd:integer.
    Parameters:
      `theValue` - the value
    Returns:
      true if the value is a integer literal

  - ### assertArrayLiteral

    public static final boolean assertArrayLiteral(Value theValue)
    Assert that the literal is an array literal.
    Parameters:
      `theValue` - the value
    Returns:
      true if the value is a array literal

  - ### assertPathLiteral

    public static final boolean assertPathLiteral(Value theValue)

  - ### assertSimpleLiteral

    protected final boolean assertSimpleLiteral(Value theValue)
    Assert that the value is a simple literal
    Parameters:
      `theValue` - the value
    Returns:
      true if the value is a integer literal

  - ### assertLiteral

    protected final boolean assertLiteral(Value theValue, Predicate<Datatype> theDatatypeChecker)