Reputation: 339
I'm trying to write a Jena built-in to return a value from an algorithm I have been given and then do a comparison against that value, e.g.,
String rule = "[exRule: (?d rdf:type ex:abc)" +
"<-" +
// ...extract ?a, ?b to use as inputs to the rule
"greaterThan(myBuiltIn(?a, ?b), 1)" + // Is return value greater than 1
"]";
So, first the Jena documentation says that the easiest way to experiment with this is to look at the examples in the builtins directory, however I don't seem to have this in my installation, I'm using Jena 2.6.4 on Windows 7. Where can I find this? Do I need to download it from elsewhere?
Secondly, I'm unsure how to pick up the return value from my builtin. If I simply call myBuiltIn(2, 1)
using hardwired values I know it's being called due to some debug output I've added to the builtin's bodyCall()
method. However, if I pass it to greaterThan()
, then I no longer see this. Is it still being called?
Upvotes: 2
Views: 583
Reputation: 45
@Joshua
I found how to implement this.
First of all, you should create a new class that extend from BaseBuiltin like this http://sadl.sourceforge.net/CustomJenaBuiltins.html
and then add it into builtinRegistry class
Upvotes: 1