virajpu / androjena

Automatically exported from code.google.com/p/androjena
0 stars 0 forks source link

New rule set update method #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I'm developing a semantic and rule-based system with androJena.

First, I create a generic rule reasoner fed by the set of microOWL rules, that 
is used to create an inference model using a OWL-based schema + data:

    GenericRuleReasoner reasoner = new  GenericRuleReasoner(microOWLrules);
    reasoner.setOWLTranslation(true);
    reasoner.setTransitiveClosureCaching(true);
    InfModel localInfModel = ModelFactory.createInfModel(reasoner, schemaAndData); 

The rule set is dynamic, that is, 3rd parties can add new rules to the existing 
rule set. This is done by means of

    reasoner.addRules(rules); 

Within this context, I'm facing several questions.

Rule set update
---------------
Once "reasoner.addRules(rules);" has been executed I checked that the new rules 
are not yet activated (that is, executed). To do so (that is, to execute those 
rules) I tried some of the available reasoner methods:

    inferenceModel.reset();
    inferenceModel.rebind();
    inferenceModel.prepare();
    reasoner.bindSchema(inferenceModel); 

But no one of these methods do "activate" the new rules. The only way to get 
this "new-rules-activation" is to create again an inference model overwriting 
the original one:

    inferenceModel = ModelFactory.createInfModel(reasoner, schemaAndData); 

Is this how androJena should work?
Any other way to get this "new-rules-activation" done?

Thank you very much for your help!
Josué

Original issue reported on code.google.com by josue...@gmail.com on 22 May 2012 at 3:01

GoogleCodeExporter commented 8 years ago
Hi Josué,
all questions like "how do I ... with androjena?" should be directed to the 
(extremenly wider) Jena community first of all, as androjena is just a porting 
and it mirrors exactly the API and implementation of the original Jena library.
Regarding your question, it seems that the GenericRuleReasoner doesn't support 
dynamic addition of forward rules, see this answer from Dave Reynolds (one of 
the Jena creators and main committers): 
http://tech.dir.groups.yahoo.com/group/jena-dev/message/46790
As Dave says, probably the best solution is to add a backward rule with 
FBRuleInfGraph#addBRules.
For further documentation, please refer to the general purpose rule engine docs 
at http://jena.apache.org/documentation/inference/#rules, and the jena javadocs 
at http://jena.apache.org/documentation/javadoc/jena/index.html
Hope this helps,
bye!
lorenzo

Original comment by loreca...@gmail.com on 31 May 2012 at 5:08