[rules-users] Understanding Fusion temporal reasoning

Chris Richmond crichmond at referentia.com
Tue Sep 29 15:38:26 EDT 2009


Ok..will do.  

 

BTW.is the newgroup problem happening again?  I posted this question about 3
times over the last week as well as some others, and I don't mind that
people can't help all the time at all, but I know there was a problem before
and I posted this again today because iI never received any responses for
like a week and that doesn't happen, usuallly someone mentions something.  

Thanks,

Chris

 

  _____  

From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Tuesday, September 29, 2009 9:21 AM
To: Rules Users List
Subject: Re: [rules-users] Understanding Fusion temporal reasoning

 


   Chris,

   Someone found a bug a couple days ago that might be affecting you too.
What happens if you write:

declare NumReading

    @role( event )

    @expires( 10s )

end


   ?

   Edson



2009/9/29 Chris Richmond <crichmond at referentia.com>

Hello,

 

I am trying to make a rule to delay firing until a certain amount of time
has passed without another event being received.  I have set up a loop that
goes every 10 seconds in my main application that takes readings and injects
them into the ReadingStream. These are like sensor readings. 

 

 I have a thread started at initialization that is basically calling
fireUntilHalt() and I never call halt until shutdown, and that seams to be
working fine.

 

So basically any time an out of spec reading in my Reading object (<15) is
received, I want to wait to see if a FollowUpReading is not received in the
next 5 seconds, before I fire the results(The second rule below).  The first
rule is there just to verify I am indeed detecting NumReadings with values <
15 being injected and that works fine.   Now at this point in my appication
I am *never* inserting a FollowUpReading object/event, so I would expect the
2nd rule to fire all the time, however the strange thing is that it only
fires the first time I receive a reading out of spec. I see rule one fire,
then the seond time, but after that any subsequent out of spec readings
received(I know they are out of spec, because rule 1 still fires when
received) but rule 2 never fires again.  It only ever fires one time!   This
is very confusing.  These ar the only 2 rules and the only two object types
being inserted to the stream. Know that rule 2 *can* fire because it does
once and only once.  Why won't it fire beyond the first time, even though I
never insert the FollowUpReading() ?

 

Thanks,


Chris

 

declare NumReading

    @role( event )

end

 

declare FollowUpReading

      @role(event)

end

 

 

rule "Determine out of spec reading"

when

      $n : NumReading($r:reading < 15) from entry-point "ReadingStream";

then

      System.err.println("Fire off a follow up reading for device: " + $n);

end

 

 

rule "Missed degrading confirmation reading" 

when

      $n : NumReading($r:reading < 15) from entry-point "ReadingStream";

      not (FollowUpReading(this after[0s, 5s] $n))

then

      System.err.println("No good reading received for: " + $n);

end

 

 


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




-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090929/3f1f08fd/attachment.html 


More information about the rules-users mailing list