[rules-users] Limiting rule evaluation--not firing

ljnelson ljnelson at gmail.com
Thu Mar 17 18:04:29 EDT 2011


Hello; I am aware of the fundamental difference between inserting facts--and
evaluating them against all the rules in the rule base--and firing
rules--i.e., executing only certain rules' consequences.

I understand that ruleflow-group and agenda-group and activation-group can
all be employed to govern which rules' consequences are fired at
fireAllRules() time.

My question (which has been asked by many others in different ways, yet not
answered as far as I can tell on the mailing list to anyone's satisfaction)
is: is there any construct that can be used when it is known up front that
only certain rules will match?  That is, is there any way to limit rule
evaluation?

For example, I have a series of surveys that all use the same KnowledgeBase
to govern the flow of the user through the survey.  But once I've asked a
given question, then I know right then and there which rules have a chance
of taking effect.

I've already put them in their own agenda-group, and I already switch focus
to that agenda group prior to fact insertion, so that by the time I call
fireAllRules() I've made it so that--say--ten rules' consequences are the
only ones (out of hundreds) that could possibly fire in this given session.

But unless I'm radically misunderstanding something, each time I insert a
fact, it is evaluated against all the hundreds of rules, even when several
hundred of those rules don't have any chance of having their consequences
firing.

I even understand (I think) why this is.  If I were, for example, to
subsequently pop the agenda group that I had set focus to, then "MAIN" would
be selected, and for those activations to fire the inserted fact would have
had to have been evaluated against all the rules, including those whose
agenda group is "MAIN".

But I guess what I'm wondering is: can I somehow turn this off?  Can I, in
other words, partition the KnowledgeBase itself?  Can I effectively tell
Drools, during this stateless session, don't even bother trying to match
facts against rules 1-10, just try rules 11-14?

Thanks,
Laird

--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Limiting-rule-evaluation-not-firing-tp2695533p2695533.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list