Sorry I replied to the wrong message, doh! So here it is again.

I've thought about some callback mechanism that is executed when a rule is no longer true, the problem I have is which variable changed to make the rule no longer true and how do I expose the bound variables to the user, especially if the rule is no longer  true due to a retraction, and ofcourse I need to figure our the DRL syntax that makes sense.

I've thought about doing it as a sort of logical closure, so you have to declare the data:
insertLogicalClosure( new LogicalClosure() {
execute() {.......}
} )

Not sure how to make the data accessible, maybe the user should have to populate the map. Anyway idea is in the same way that a logical insert is executed when the rule is true, the logical closure/method is executed.

So if someone has some time and fun, maybe they would work on this and submit a patch :)

Claudio Rainoldi wrote:
Hi everyone,
isn'it there a way to find when a rule isn't more active.
For example if i have this rule:
rule "light 2 on"
dialect "java"
Light (name=="0/0/2", actualvalue=="1");
System.out.println("luce 2 on");
when someone turn on the light 2 i discover that the rule is fired using an Agenda Event Listener and the method afterActivationFired;
But when someone turn off the ligth isn't there a similar way to discover that the rule "light 2 on" isn't more active.
My only solution is to use the dual rule:
rule "light 2 on_dual"
dialect "java"
not (Light (name=="0/0/2", actualvalue=="1"));
System.out.println("luce 2 off");
Isn't there a more sample way to do this?
Thanks in advance.

_______________________________________________ rules-users mailing list