[rules-users] enabling rules based on interval events

Jaroslav Pullmann jaroslav.pullmann at fit.fraunhofer.de
Fri Oct 29 06:51:21 EDT 2010



Wolfgang,
  thank you for providing a concrete solution. Beside using an external reference
time event or an updated fact (Tick) I thought of relying on the automatic event
expiration - forcing the event to expire (@expires) at the end of its @duration.
Although this simplifies testing for existence of an appropriate interval event,
it prevents any historic reasoning on this intervals.

I hoped the internal scheduler used to clean up expired events would provide hints on
the implicit life-cycle of an event (with stages like "scheduled", "ongoing", "past",
"expired") and thus its relation to the continuous clock time in opposite to other concrete
events.

  Cheers
    Jaro










Wolfgang Laun wrote:
> You can set up a periodic timer to update a Tick( currentTime ) and use 
> this Tick fact in your rule:
> 
> rule "Set Tick"
>      timer(int:0s 1s)
> when
>      $tick : Tick()
> then
>      modify( $tick ){ setCurrentTime( ... ) }
> end
> 
> rule "tst"
> when
>      $ongoing: IntervalEvent( id == "foo",  $s: msecstart, $d : msecdur ) )
>     Tick( currentTime >= $s && <= ($s+$d) )
> then
> ...
> end
> 
> On 28 October 2010 16:22, Jaroslav Pullmann 
> <jaroslav.pullmann at fit.fraunhofer.de 
> <mailto:jaroslav.pullmann at fit.fraunhofer.de>> wrote:
> 
>     Dear all,
> 
>      I am wondering whether and how the rule activation might be
>     contextualized
>      in respect to the existence of a time slot signalled via interval
>     events (with a
>      non-null duration). The static rule attributes (date-effective,
>     date-expires) are
>      not applicable here, neither is the temporal operator "during",
>     which requires
>      the existence of an explicit second event. The following approach
>     demonstrates the
>      case but does not work (return value restrictions are not allowed
>     to invoke time-
>      dependent functions):
> 
>       rule "active time slot"
>         when
>                    // partial condition met when there is a
>     "live"/ongoing IntervalEvent "foo"
>               $system : System()
>               $ongoing: IntervalEvent( id == "foo",
>     $system.currentTimeMillis <= ( msecstart + msecdur ) )
>              ... further patterns
>         then
>               ...
>         end
> 
>      Many thanks for your suggestions!
>        Jaro
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


-- 
Jaroslav Pullmann
Web Compliance Center - Fraunhofer FIT
Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
Phone: +49-2241-142623    Fax: +49-2241-142065



More information about the rules-users mailing list