Hi,
I was wondering if it's possible to pick up just a few rules from a drl file
to create the RuleExecutionSet. Something like:
rules.drl ===>
...
rule "r1"
...
end
rule "r2"
...
end
...
=============
RunRules.java ===>
...
List<String> rulesToRun = new ArrayList<String>();
rulesToTun.add("r1");
RuleExecutionSet ruleExecutionSet =
ruleSetProvider.createRuleExecutionSet(ruleFileName, null, rulesToRun);
ruleAdministrator.registerRuleExecutionSet("test.drl", ruleExecutionSet,
null);
...
=============
I haven't found anything like that in the documentation. I'd really like
that otherwsie I'll have to split the rules through many different files,
which will be a bit of a havoc to unit test...
thanks in advance!
best regards,
--
Lucas de Oliveira Arantes
Show replies by date
You could consider Agenda Groups.
You could either bunch groups of rules into discrete sets or have each
rule in its own Agenda Group.
You would then use workingMemory.setFocus(...) before calling
fireAllRules().
This is based upon 4.x and so could be different in 5 (which I haven't
had time to look at fully).
With kind regards,
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Lucas de
Oliveira
Sent: 19 March 2009 15:21
To: rules-users(a)lists.jboss.org
Subject: [rules-users] running a small set of rules from a drl
file.
Hi,
I was wondering if it's possible to pick up just a few rules
from a drl file to create the RuleExecutionSet. Something like:
rules.drl ===>
...
rule "r1"
...
end
rule "r2"
...
end
...
=============
RunRules.java ===>
...
List<String> rulesToRun = new ArrayList<String>();
rulesToTun.add("r1");
RuleExecutionSet ruleExecutionSet =
ruleSetProvider.createRuleExecutionSet(ruleFileName, null, rulesToRun);
ruleAdministrator.registerRuleExecutionSet("test.drl",
ruleExecutionSet, null);
...
=============
I haven't found anything like that in the documentation. I'd
really like that otherwsie I'll have to split the rules through many
different files, which will be a bit of a havoc to unit test...
thanks in advance!
best regards,
--
Lucas de Oliveira Arantes
Thanks Mike!
I'll give it a try.
cheers!
--
Lucas de Oliveira Arantes