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
ConstructorsModifierConstructorDescriptionprotectedAbstractFunction(int theNumReqArgs, String... theURIs) protectedAbstractFunction(AbstractFunction theFunction) protectedAbstractFunction(com.google.common.collect.Range<Integer> theNumReqArgs, String... theURIs) protectedAbstractFunction(List<com.complexible.stardog.plan.filter.Expression> theExpressions, int theNumReqArgs, String... theURIs) Create a new AbstractFunctionprotectedAbstractFunction(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 TypeMethodDescriptionstatic final booleanassertArrayLiteral(Value theValue) Assert that the literal is an array literal.protected final booleanassertBNode(Value theValue) Assert that the value is a BNodeprotected final booleanassertDecimalLiteral(Value theValue) Assert that the literal is a decimal literal.static final booleanassertIntegerLiteral(Value theValue) Assert that the literal is an integer literal.protected final booleanAssert that the value is a URIstatic final booleanassertLiteral(Value theValue) Assert that the value is a literalprotected final booleanassertLiteral(Value theValue, Predicate<Datatype> theDatatypeChecker) protected final booleanassertNumericLiteral(Value theValue) Assert that the literal is a numeric literalstatic final booleanassertPathLiteral(Value theValue) protected booleanassertRequiredArgs(int theArgs) Validate that the arguments passed to the function match the expected numberprotected final booleanassertSimpleLiteral(Value theValue) Assert that the value is a simple literalprotected final booleanassertStatement(Value theValue) Assert that the value is aStatementstatic final booleanassertStringLiteral(Value theValue) Assert that the value is a String literalprotected final booleanassertTypedLiteral(Value theValue, Datatype theDatatype) Assert that the literal has the provided datatypebooleancom.complexible.stardog.plan.filter.expr.ValueOrErrorevaluate(com.complexible.stardog.plan.filter.expr.ValueOrError... theValues) Directly evaluate the function for the given argumentsfinal com.complexible.stardog.plan.filter.expr.ValueOrErrorevaluate(com.complexible.stardog.plan.filter.ValueSolution theArgs) com.complexible.stardog.plan.filter.expr.ValueOrErrorDirectly evaluate the function for the given argumentsfinal StringgetName()Return the string that uniquely identifies thisExpression, which should be a fully qualified URI.getNames()Return all the strings that uniquely identifies thisFunction.com.google.common.collect.Range<Integer> inthashCode()protected abstract com.complexible.stardog.plan.filter.expr.ValueOrErrorinternalEvaluate(Value... theArgs) Evaluate the functionvoidtoString()Methods inherited from class com.complexible.stardog.plan.filter.AbstractExpression
getArg, getArgs, getArgsCount, getFirstArg, getSecondArg, getThirdArg, replaceArgMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.complexible.stardog.plan.filter.Expression
accept, couldRaiseError, getArgs, getCategory, replaceArgMethods inherited from interface com.complexible.stardog.plan.filter.functions.Function
copy, getDescription, initialize, isDeterministic
-
Constructor Details
-
AbstractFunction
-
AbstractFunction
-
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
-
-
Method Details
-
setArgs
- Specified by:
setArgsin interfacecom.complexible.stardog.plan.filter.Expression- Overrides:
setArgsin classcom.complexible.stardog.plan.filter.AbstractExpression
-
equals
- Overrides:
equalsin classcom.complexible.stardog.plan.filter.AbstractExpression
-
hashCode
public int hashCode()- Overrides:
hashCodein classcom.complexible.stardog.plan.filter.AbstractExpression
-
toString
- Overrides:
toStringin classcom.complexible.stardog.plan.filter.AbstractExpression
-
getName
Return the string that uniquely identifies thisExpression, which should be a fully qualified URI. This URI is what is used to reference thisExpressionin a SPARQL query. -
getNames
Return all the strings that uniquely identifies thisFunction. A function may have different names in different namespaces. -
getRequiredArgCount
-
evaluate
public final com.complexible.stardog.plan.filter.expr.ValueOrError evaluate(com.complexible.stardog.plan.filter.ValueSolution theArgs) - Specified by:
evaluatein interfacecom.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
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
Assert that the value is a URI- Parameters:
theValue- the value- Returns:
- true iff the value as a URI
-
assertStatement
Assert that the value is aStatement- Parameters:
theValue- the value- Returns:
- true iff the value as a statement
-
assertBNode
Assert that the value is a BNode- Parameters:
theValue- the value- Returns:
- true iff the value is a BNode
-
assertLiteral
Assert that the value is a literal- Parameters:
theValue- the value- Returns:
- true iff the value is a Literal
-
assertStringLiteral
Assert that the value is a String literal- Parameters:
theValue- the value- Returns:
- true if the value is a String literal
-
assertTypedLiteral
Assert that the literal has the provided datatype- Parameters:
theValue- the value- Returns:
- true if the value has the provided datatype
-
assertNumericLiteral
Assert that the literal is a numeric literal- Parameters:
theValue- the value- Returns:
- true if the value is a numeric literall
-
assertDecimalLiteral
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
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
Assert that the literal is an array literal.- Parameters:
theValue- the value- Returns:
- true if the value is a array literal
-
assertPathLiteral
-
assertSimpleLiteral
Assert that the value is a simple literal- Parameters:
theValue- the value- Returns:
- true if the value is a integer literal
-
assertLiteral
-