[rules-users] enabling rules based on interval events

Wolfgang Laun wolfgang.laun at gmail.com
Thu Oct 28 13:14:20 EDT 2010


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> 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
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101028/84f06f3e/attachment.html 


More information about the rules-users mailing list