Interface Function
-
- All Superinterfaces:
Copyable<com.complexible.stardog.plan.filter.Expression>,com.complexible.stardog.plan.filter.Expression
- All Known Subinterfaces:
Aggregate
- All Known Implementing Classes:
AbstractFunction
public interface Function extends com.complexible.stardog.plan.filter.ExpressionThis is the extension point for 17.6 (Extensible Value Testing) of the SPARQL spec.
For implementations of Function to be visible to the query parser and engine, they must be registered via the JDK
To use the example from the SPARQL spec, if the Function is used in a queryServiceLoader. Create a file calledcom.complexible.stardog.plan.filter.functions.Functionin theMETA-INF/servicesdirectory. The contents of this file should be all of the *fully-qualified* class names for the custom Functions. Then if a jar containing theMETA-INF/servicesdirectory and the implementations for the Functions is included on the classpath, Stardog will pick up the implementations on startup.aGeo:distance(?axLoc, ?ayLoc, ?bxLoc, ?byLoc), its signature is as follows:{code xsd:double aGeo:distance (numeric x1, numeric y1, numeric x2, numeric y2) }Whenevaluateis called, it will be provided fourvaluesvia theValueSolution, which are the current values for the parameters,x1,y1,x2, andy2.- Since:
- 0.1
- Version:
- 3.0
- Author:
- Michael Grove
- See Also:
FunctionRegistry, Extension Functions
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Functioncopy()Create a deep copy of the object which does not share any references with the original.default java.lang.StringgetDescription()Return a description of the function suitable to be included in user manual.java.lang.StringgetName()Return the string that uniquely identifies thisExpression, which should be a fully qualified URI.java.util.List<java.lang.String>getNames()Return all the strings that uniquely identifies thisFunction.default voidinitialize()Initialize this function.default booleanisDeterministic()Returnstrueif the function result is uniquely determined by its inputs orfalseif the function may return different results for the same inputs.
-
-
-
Method Detail
-
getName
java.lang.String 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.- Returns:
- the URI
-
getNames
java.util.List<java.lang.String> getNames()
Return all the strings that uniquely identifies thisFunction. A function may have different names in different namespaces.- Returns:
- all aliases of this
Function - See Also:
getName()
-
getDescription
default java.lang.String getDescription()
Return a description of the function suitable to be included in user manual.- Returns:
- description of the function
-
initialize
default void initialize()
Initialize this function. In the case of a pure function, this is a no-op. However, in some cases, a function needs to keep some global state during query execution for it to work correctly.initializeshould prepare the function for execution by either clearing or otherwise preparing it's state for (re)execution.
-
copy
Function copy()
Create a deep copy of the object which does not share any references with the original.
-
isDeterministic
default boolean isDeterministic()
Returnstrueif the function result is uniquely determined by its inputs orfalseif the function may return different results for the same inputs. If the function has no inputs then every invocation should always return the same value for it to be deterministic, e.g.PI(), whereas a function likeUUID()is not deterministic.- Returns:
trueif the function is deterministic
-
-