com.hp.hpl.jena.sparql.function.user
Class UserDefinedFunction

java.lang.Object
  extended by com.hp.hpl.jena.sparql.function.user.UserDefinedFunctionDefinition
      extended by com.hp.hpl.jena.sparql.function.user.UserDefinedFunction
All Implemented Interfaces:
Function

public class UserDefinedFunction
extends UserDefinedFunctionDefinition
implements Function

Represents a user defined function


Field Summary
 
Fields inherited from class com.hp.hpl.jena.sparql.function.user.UserDefinedFunctionDefinition
warnOnUnusedVariable
 
Constructor Summary
UserDefinedFunction(String url, Expr e, List<Var> argList)
          Creates a user defined function
UserDefinedFunction(UserDefinedFunctionDefinition def)
          Creates a new user defined function
 
Method Summary
 void build(String uri, ExprList args)
          Builds the expression substituting the arguments given into the base expression to yield the actual expression to evaluate
 NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env)
          Executes the function
 Expr getActualExpr()
          Gets the actual expression that was built for the function, assuming build(String, ExprList) has been called
 
Methods inherited from class com.hp.hpl.jena.sparql.function.user.UserDefinedFunctionDefinition
getArgList, getBaseExpr, getUri, newFunctionInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDefinedFunction

public UserDefinedFunction(UserDefinedFunctionDefinition def)
Creates a new user defined function

Parameters:
def - Function Definition

UserDefinedFunction

public UserDefinedFunction(String url,
                           Expr e,
                           List<Var> argList)
Creates a user defined function

Parameters:
url - Function URL
e - Expression
argList - Arguments
Method Detail

build

public void build(String uri,
                  ExprList args)
Builds the expression substituting the arguments given into the base expression to yield the actual expression to evaluate

Specified by:
build in interface Function
args - The parsed arguments
Throws:
ExprBuildException - Thrown if an expression cannot be generated

exec

public NodeValue exec(Binding binding,
                      ExprList args,
                      String uri,
                      FunctionEnv env)
Executes the function

Specified by:
exec in interface Function
Parameters:
binding - The current solution
args - A list of unevaluated expressions
uri - The name of this
env - The execution context
Returns:
NodeValue - a value

getActualExpr

public Expr getActualExpr()
Gets the actual expression that was built for the function, assuming build(String, ExprList) has been called

Returns:
Expression if built, null otherwise


Licenced under the Apache License, Version 2.0