Hi all,
I'm building a system that instantiates small, in-memory rule reasoners, and
uses each reasoner very briefly to get a small set of inferences. It does this
repeatedly and frequently. In other words, it instantiates many different
reasoners over time, and uses each one to handle a distinct problem..
Each reasoner involves a default model of only a few dozen triples, used with a
GenericRuleReasoner that loads 50-100 forward rules, created in a very normal
way:
Model contextData = FileManager.get().loadModel(contextPath, "N3");
List rules = Rule.rulesFromURL("file:C:/test.rule");
Reasoner reasoner = new GenericRuleReasoner(rules);
reasoner.setParameter(ReasonerVocabulary.PROPruleMode, "forward");
Infmodel inf = ModelFactory.createInfModel(reasoner, contextData);
Typically, the reasoning will add roughly 10 triples and sometimes will delete
a few triples. I use about 10 calls to inf.listStatements to retrieve the
inferred triples, and then I'm done with that reasoner.
These reasoning problems are all independent of one another, so no opportunity
for reuse of the contextData . However, the GenericRuleReasoner is reused.
Naturally, since we want to support many and frequent reasoning processes like
the above, we are concerned about the overhead (speed and memory, with speed
the more important of the two). I don't really have any idea how much
bookkeeping and infrastructure is instantiated with the creation of a model or
Infmodel. I would appreciate comments or pointers that may shed light on this.
I've read through the various comments on performance in
https://jena.apache.org/documentation/inference, but they don't address my
situation. I'm concerned primarily about the overhead associated with *creating
new models and reasoners*, since my system does that so often.
Thanks!
David Martin
AI Lab
Nuance Communications