1) Init code:

GenericRuleReasoner reasoner = new GenericRuleReasoner(new
ArrayList<Rule>());
            reasoner.setMode(GenericRuleReasoner.FORWARD);
            mCoreInfModel = ModelFactory.createInfModel(reasoner,
mCoreModel);

2) Statement exits
 (:A :B :C)

3) Rule exists and triggered before

            [ alwaysTrue:
                (:A :B :C)
                -> triggerAction
            ]

4) Now, I am trying to add rules at runtime.

             [ rule2:
                (:X :Y :Z)
                -> triggerAction2
            ]

        InfModel infModel = getCoreInfModel();
        BasicForwardRuleInfGraph infGraph = (BasicForwardRuleInfGraph)
infModel.getGraph();          infGraph.addRule(rule)
        coreInfModel.prepare()

5) add triple (:X :Y :Z)

        val infGraph = infModel.graph as BasicForwardRuleInfGraph
       infGraph.add(triple)

*The problem comes, both "alwaysTrue" and "rule2" triggered.*

*I am expecting only "rule2" is triggered. *

Is there anyway that only "rule2" can be triggered since the updated triple
is only X, Y Z?

Many thanks

Reply via email to