I don’t think that’s possible with a function. You can’t really access much other than the arguments. I believe that you can do what you’re looking for with a custom property function but they are significantly more complex. I’m still working working out all the details of how it’s done but I’d be happy to have someone else asking questions on how it’s done do help me figure it out.
I meant, what are you trying to accomplish with your function? If you can explain what your goal is someone might be able to suggest a better way to get there.
There is an example in the stardog-examples repo under the pfExample branch. I’m guessing that the reason it’s not in the main branch is that unlike custom functions property functions give you a lot of access and there is a lot of room to mess things up. It’s not exactly a secret that it’s there so I hope no one minds my pointing out but I will repeat the warning one more time, property functions are a loaded gun pointed at your foot. Proceed with caution.
I can’t think of a way to do exactly what you’re asking for but can you step back one level higher and explain why you need to evaluate functions this way?
Ok, I think there may be a way but it's completely hackish and I encourage you to include more details about why you need that functionality because I suspect that there is a much better way to accomplish what you're looking to do but for the sake of giving as complete an answer as possible here goes.....
The above query doesn't quite make sense but I think I get what you're after. You want to execute the ?formula of ?s with whatever arguments are listed on ?s
Assume you have the following data
:myEval1 :formula "a + b" ;
:a 1 ;
:b 2 .
:myEval2 :formula "a * b * c" ;
:a 1 ;
:b 2 ;
:c 3 .
:a a :Arg .
:b a :Arg .
:c a :Arg .
You could write a function that takes the first argument as the function and the second argument a comma separated dictionary of arguments and evaluate it with a query that looks like this
select myFunc(?formula, ?args) where {
{
select ?s (group_concat(concat(str(?p), '=', str(?o)); separator=',') as ?args) where { ?s ?p ?o . ?p a :Arg } group by ?s
}
?s :formula ?formula
}
the inputs to the function should look like this
function args
a + b http://api.stardog.com/a=1,http://api.stardog.com/b=2
a * b * c http://api.stardog.com/a=1,http://api.stardog.com/b=2,http://api.stardog.com/c=3
Your function would need to be able to parse the argument string and evaluate the function. You might also be able to use an aggregate function.