I have made some new built-ins for Jena. I would like to create a library where I can put all of them.
How can I do that ? And how can I create my rules in this case ? Need I to import some files in the rule file?
I have made some new built-ins for Jena. I would like to create a library where I can put all of them.
How can I do that ? And how can I create my rules in this case ? Need I to import some files in the rule file?
Please note that, as this question is extremely broad, my answer is merely a set of suggestions towards an overall design. First, we'll begin with how Jena does it.
Apache Jena stores its rule files as classpath resources within its distribution jars.
jena-core
has a package (directory) calledetc
in which it stores several rules files. The reasoners that Jena has implemented are effectively just theGenericRuleReasoner
with a specific rule set. For example,FBRuleReasoner#loadRules()
method is used to retrieve the ruleset that this reasoner will utilize. You should look at where it is called from in order to figure out how you would use such a paradigm.In your system, I'd suggest constructing your own implementation of
ReasonerFactory
(let's call itMyReasonerFactory
). InMyReasonerFactory
, you could have a static initialization block that will register theBuiltin
s for your domain-specific reasoner. When someone callsReasonerFactory#create(Resource)
, you can load your rules from the classpath and then create aGenericRuleReasoner
that utilizes those rules.Some pseudo-code (that may not compile) follows: