[rules-users] When-becomes-true semantics

Allan Terry aterry at teknowledge.com
Tue Apr 21 18:42:14 EDT 2009


I am looking for the following semantics:
Lets say I have a Boiler class with location, temperature, and pressure 
fields.
I write a rule like When Boiler(temperature > 240) then ....

I want the rule to trigger when its condition becomes true, not when it 
is true in all cases.  I don't want it to trigger again if the facts 
change but the condition is still true.  The actions may have adverse
consequences if fired too freely.

Example:
Event with temperature set to 250.  Rule should fire
Another event for the same boiler with temperature = 270. Rule is still 
true, should not fire
Now set its temperature to 100.  Rule should not fire
Set temperature to 260.  It has become true again and should fire.

Multiple clauses should not change things. When the entire condition 
becomes true, the action is activated.  The facts tested in the various 
clauses will vary with time, but as long as the condition remains true, 
the action should not be triggered with each change.

I tried this with one class and one event which I repeatedly modified.
It fires when a new value satisfies the condition, whether or 
not it was true before.  

Interestingly, this worked for classes with a single field, but as soon 
as I added multiple fields I started getting the "is true" semantics.

If that isn't native semantics for RETE, is there a reasonable approach I
could take to layer it on, considering I want all my rules to act this way?

thanks, Allan








More information about the rules-users mailing list