[
https://issues.apache.org/jira/browse/JENA-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401277#comment-13401277
]
Andy Seaborne commented on JENA-270:
------------------------------------
Each ExprFunction{0,1,2,3,N} has variations of eval(....) for calling it needs.
zero args for ExprFunction0, one for ExprFunction1, two for ExprFunction2,
and N for the varadic ExprFunctionN. It makes writing common cases of fixed
number of arguments a little cleaner.
But all calls as functions in ARQ are "late" -- the arguments are expressions.
Expr.eval(binding, env), and an expr can be a variable or expression. The
evaluation proceeds bottom up (inner expressions evaluated before outer ones =
bottom up).
In E_Call there are 2 argument expression->value points, evalSpecail or the
usual machinery that ends up in eval(args). Either will work.
To implement it here (and it does not need to change), the code can call
.eval(binding, env) and you can pass null for binding because binding already
used to calculate the values of the args so no variables, and no reason to
touch teh binding.
I've put in an implementation as an example. Tested locally, without
evalSpecial active, but evalSpecial is a better route so left as the proper
implementation which allows special forms.
> Support dynamic function invocation in ARQ
> ------------------------------------------
>
> Key: JENA-270
> URL: https://issues.apache.org/jira/browse/JENA-270
> Project: Apache Jena
> Issue Type: New Feature
> Components: ARQ
> Affects Versions: ARQ 2.9.2
> Reporter: Rob Vesse
> Assignee: Rob Vesse
> Labels: call, dynamic, functions, sparql
> Fix For: ARQ 2.9.2
>
>
> Per my suggestion to the SPARQL Working Group I am proposing a new built in
> CALL() which can be used in SPARQL queries for dynamic function invocation.
> CALL with no argument returns null
> CALL with some arguments evaluates the first argument, sees if the result is
> a URI (if not errors) and if so tries to generate a function from it and
> invoke it with the arguments to that invocation being the remaining arguments
> to CALL
> I have implemented a prototype implementation of this in the ARQ language
> which I have committed to Trunk, others with more knowledge of expression and
> function evaluation in ARQ may have suggestions on how to improve the
> implementation
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira