On 05/06/13 15:11, Joshua TAYLOR wrote:
Hi all, a colleague is looking at ways of dynamically adding rules to an rule reasoner, and has had no luck to date. A message from the androJena mailing list from May 2012 athttp://code.google.com/p/androjena/issues/detail?id=13 describes the problem very clearly. A reply mentions a post by Dave Reynolds at http://tech.dir.groups.yahoo.com/group/jena-dev/message/46790 but I don't have access to that message since I'm not a group member. Does anyone have a copy of that available? Thanks in advance, //JT
It was: On Mon, 2011-02-14 at 22:18 +0000, Andrew Crapo wrote: > > I create an instance of GenericRuleReasoner, passing a rule list to > the constructor and call bindSchema to give the reasoner an OntModel. > I then create an InfModel with this code: > > infModel = ModelFactory.createInfModel(reasoner, dataModel); > > where dataModel is an OntModel with additional instance data. If > certain conditions are met, I wish to add some rules to possibly draw > additional inferences but without rebinding as I wish to apply the new > rules to the triples in the current infModel. I am doing this by > calling addRules and passing it a list of additional rules. However, > the new rules appear to not have any affect. Am I missing a step? addRules is a method on the reasoner, changing that won't change existing inference models, just affects future InfModels created with that reasoner. There's no support for dynamically adding forward rules to a running InfModel, it would require a complete rebind anyway. It *is* possible to add backward rules to a running InfModel, see FBRuleInfGraph#addBRules I guess it would also be possible to create a new InfModel with just the new rules and wrap it over the top of the existing InfModel but addBRules seems more likely to be the way to go. Dave
