I haven't seen it personally, but I can imagine a situation where it would be useful.  Say you're reading temperatures, with readings retracted after a given time.  If you wanted a rule that meant "find a reading above 10 if there's never been a reading above 20" you'd use the pattern below.

Maybe a better example would be alerting aircraft delays at an airport.  This wasn't a requirement for the system I worked on, but say you wanted to mark all delays over a given threshold at one level of severity, but bump all delays to another level of severity if one goes over another threshold. (Meaning, "Ger yer house in order now!") That would use this pattern as well:

when
  d: Delay(duration > 10)
  not Delay(duration > 20)
then
  d.setSeverity("meh");
end


when
  d: Delay(duration > 10)
  Delay(duration >= 20)
then
  d.setSeverity("DOH!");
end

--- On Thu, 3/24/11, Wolfgang Laun <wolfgang.laun@gmail.com> wrote:

From: Wolfgang Laun <wolfgang.laun@gmail.com>
Subject: [rules-dev] An odd couple of patterns
To: "Rules Dev List" <rules-dev@lists.jboss.org>
Date: Thursday, March 24, 2011, 12:07 PM

Has anybody ever seen a situation where a couple of patterns such as

   Fact( field >= 10 )
   not Fact( field > 20 )

was appropriate? This does not match Facts where field isn't between 10 and 20, and so it would seem to be the same as

   Fact( field >= 10 && <= 20 )

but actually it doesn't match any such Fact whenever any other Fact with field > 20 is around.

Cheers
Wolfgang

-----Inline Attachment Follows-----

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