It's worth thinking about it differently. A rule does not fail. It just defines 
the conditions under which it will activate.

If you wish to perform an action whether the condition is true or false, you 
have 2 options:

A positive and a negative condition:
when 
        test(a == "b")
then
        ...
when 
        test(a != "b")
then
        …

A condition which is always true:
when
        test()
then
        if (a.equals("b")) {
                ...
        } else {
                ...
        }

To be honest whether you write 1 or 2 rules should not be a 'business' 
decision. Why does anybody think there should not be 2 rules?

It's probably worth considering what you're trying to achieve. Does logging of 
a fact value really need to be part of a rule?

For instance, if you're actually just looking for an audit trail, you can have 
a WorkingMemoryEventListener, which can listen for all of the fact insertions, 
updates and retractions. It can log them all as they happen. Combined with an 
AgendaEventListener, you can log what rules have activated and what the values 
of facts were at the time. Use an asynchronous logger and this will have very 
little impact on rules processing performance.

Alternatively if the business are writing rules, and only wish to write the 
positive match, then maybe you can create a DSL which generates the both the 
positive and negative rules behind the scenes.

A few ideas there for you to try...

Steve




On 17 Aug 2012, at 15:49, Rana <ven12...@yahoo.com> wrote:

> That's what our Business doesn't want me to do to write negative rules. In
> this way there will be 2 rules to be written for 1 business rule.
> 
> Thanks.
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/modify-and-update-is-not-working-in-the-rule-file-tp4019158p4019250.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to