You could assert what is known as a control fact(s) which would disable the other 
threshold-detecting rules once one rule has been fired and a notification has been 
sent. You would also have to come up with rules which retract the control facts for 
example when a "normal" situation has been reached again.  The application you are 
developing sounds a bit like an example in the book "Expert Systems Principles and 
Programming" by Giarrantano & Riley (ISBN 0-534-95053-1) which I have found most 
illuminating when learning declarative programming.
/ regards,
Mikael
----- Original Message ----- 
From: "John Barr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 18, 2002 11:27 PM
Subject: Re: JESS: appropriate use of 'if' function?


> I only want one notification no matter how many thresholds are exceeded in a 
> data set.  How can this be done using three separate rules?
> 
> Thanks,
> John
> 
> 
> >From: "x xu" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: JESS: appropriate use of 'if' function?
> >Date: Thu, 18 Apr 2002 14:12:14 -0700 (PDT)
> >
> >Why not use three seperate rules for each threshold?
> >
> >--- John Barr <[EMAIL PROTECTED]> wrote:
> > >
> > > (defrule notify-with-reason
> > >     (thresholds (RPM ?RPM-threshold)
> > >                 (Temperature ?Temperature-threshold)
> > >                 (Pressure ?Pressure-threshold))
> > >     (data-set (RPM ?RPM-value)
> > >               (Temperature ?Temperature-value)
> > >               (Pressure ?Pressure-value))
> > >     (test (or (> ?RPM-value ?RPM-threshold)
> > >               (> ?Temperature-value
> > > ?Temperature-threshold)
> > >               (> ?Pressure-value
> > > ?Pressure-threshold)))
> > > =>
> > >     (bind ?reason-code 0)
> > >     (if (> ?RPM-value ?RPM-threshold)
> > >         then (bind ?reason-code (bit-or ?reason-code
> > > 1)))
> > >     (if (> ?Temperature-value
> > > ?Temperature-threshold)
> > >         then (bind ?reason-code (bit-or ?reason-code
> > > 2)))
> > >     (if (> ?Pressure-value ?Pressure-threshold)
> > >         then (bind ?reason-code (bit-or ?reason-code
> > > 4)))
> > >     (printout t "THRESHOLD EXCEEDED, REASON CODE IS
> > > " ?reason-code crlf))
> > >
> > > (reset)
> >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Tax Center - online filing with TurboTax
> >http://taxes.yahoo.com/
> >
> >--------------------------------------------------------------------
> >To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> >in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> >(use your own address!) List problems? Notify [EMAIL PROTECTED]
> >--------------------------------------------------------------------
> >
> 
> 
> _________________________________________________________________
> Join the world's largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 
> 



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to