2

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?

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
PaulN
  • 329
  • 2
  • 6
  • 13
  • So, after actually reading and understanding the documentation I've figured out how to do this. Maybe there's a lesson there! – PaulN Aug 29 '12 at 07:56
  • 2
    Could you post the results of your work? Your question comes up early in a Google search for Jena builtins, and people would benefit from your experience! – Joshua Taylor Jul 08 '13 at 14:20

1 Answers1

1

@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

neenutna
  • 35
  • 2
  • 9