Hi,
See below.
"executing a rule" is really two parts: LHS pattern matching (which
can't be stopped for a given RuleBase) and execution of the RHS (which
can be controlled by the agenda and truth maintenance).
I hope my time away hasn't led to me giving wrong advice.
Mike
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Thierry B
Sent: 21 January 2009 12:53
To: rules-users(a)lists.jboss.org
Subject: RE: [rules-users] Run a set of rules in a group B from a rule
in agroup A
Hello,
So if I've well understand :
- before calling fireAllRules(), Drools know for all rules (from any
group)
definied in DRL files, those which all patterns in the LHS of a rule are
matched, and those rules are placed on a agenda.
At which moment exactly, Drools verified from a rule that all of its
pattern
in the LHS are matched, if it's before callling fireAllRules() ?
>> Yes, LHS is evaluated on workingMemory.insert(o). A call to
fireAllRules() executes the activations on the agenda (i.e. RHS queued
as a consequence of LHS being matched on workingMemory.insert(o)).
- And fireAllRules() permit to execute all rules that are placed on
agenda
>> Yes
- When using setFocus() from a java class or a rule, we can control the
order of rules to specify to execute rules from group B, and group C...
> I believe so.
- So it's not possible to tell Drools that we don't want to execute a
group
of rules if a rule A is not matched : in that group of rules : those
which
all paterns match LHS will be inevitably executed.
>> Wrong. The rules won't be executed (read as activations -
RHS -
won't be run) but you can't stop the LHS being evaluated.
All these points that I said, are exact?
Thanks :-)
Anstis, Michael (M.) wrote:
Please accept that my knowledge is based on 4.x and there might be
other
alternatives in 5.
Rules are not "ran" but their patterns (LHS) evaluated as facts
(objects) are inserted into Working Memory. When all patterns in the
LHS
of a rule are matched activations are placed on the agenda for
execution
of the consequence (RHS) when fireAllRules() is called (or other
mechanisms to run what is on the agenda are invoked; such as
RuleFlow).
So you could have rules in Group A cause Group B to receive the
focus
but it is the RHS's execution order you control and not the pattern
matching - which will happen for Group A and Group B when facts are
inserted into WM.
Look at Agenda Groups and RuleFlow. This should help.
With kind regards,
Mike
--
View this message in context:
http://www.nabble.com/Run-a-set-of-rules-in-a-group-B-from-a-rule-in-a-g
roup-A-tp21580767p21582595.html
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users