ILOG dynamic ruleset

431 views Asked by At
public void executeRules(IlrRule[] rules){
       IlrRuleset rulesetNew = new IlrRuleset();
       IlrContext ctxt = new IlrContext(rulesetNew);
       IlrTask task = ruleset.getTask("ExecFlow#exe");
       IlrRuleTaskRunner runner = ctxt.getRuleTaskRunner(task);
       runner.setActiveRules(rules);
       int fired = 0;
       runner.runInitialActions();
       fired += runner.runBody();
       runner.runFinalActions();

}

How we can create a dynamic ruleset from group of rules? this group is a dynamic. I am using IBM ODM 8.0.1

3

There are 3 answers

0
Slimen Belhajali On BEST ANSWER

All Java implementation are disappeared, we used irl language, this is the solution :

We defined the scope and we select the rules dynamically

scope= {exe.R05,exe.R04,exe.R03}

body = dynamicselect() {
    return selectedFunction(context.getRuleset().allRules);
}
0
AudioBubble On
body = dynamicselect() {    
    return selectedFunction(context.getRuleset().allRules);    
}

Is sufficient to custom the rules which you like to executed.

0
Justin Phillips On

Just be careful with dynamic selects. If you have a lot of rules, it can increase the execution time of the rule set significantly.