[rules-users] Checking in one rule the "result" of another rule

Edson Tirelli ed.tirelli at gmail.com
Sun Jan 31 10:16:19 EST 2010


    Usually, trying to artificially control or detect the rules execution to
use as part of other "business rules" is not a good thing. In my opinion, I
think you should step back and give a new look at the problem. What is your
requirement? Rules (in forward chaining systems) react to the working memory
state, and when the state is detected, they fire new actions that will
usually change the state, possibly (re)activating new rules, and so on.

    My advice to you is to try to rewrite your rules (1, 2, 3 or as many as
you need) based on the state of the working memory. There are several
reasons for the paradigm to work like that, but just as one example, if in
the future you have a new rule X that causes a change of state similar to
rules 1 and 2, your rule 3 will continue to work just fine, since it is
based on state and not "hard coded" as dependent of other rules.

    This is obviously a general recommendation. We would need more details
about what kind of rules you are trying to model in order to better help
you.

    Edson

2010/1/31 orchid <maya.pollack at gmail.com>

>
> Hi All,
> I have "rule1" and "rule2", very simple rules. I would like in "rule3" to
> check one of the following:
> "rule1" AND "rule2" (i.e. if both rule1 and rule2 were fired)
> "rule1" OR "rule2" (rule1 or rule2 was fired)
>
> How can I achieve this? Does the "extends" keyword might help here?
>
> I achieved that buy defining a list, to which rule1 and rule2 in the RHS
> inserted some value. In rule3 I checked the values of that list. I would
> like to ask if there are some prettier solutions.
>
> Thanks in advance.
> Any help would be appreciated.
> --
> View this message in context:
> http://n3.nabble.com/Checking-in-one-rule-the-result-of-another-rule-tp179837p179837.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100131/c8aea8a1/attachment.html 


More information about the rules-users mailing list