[rules-users] temporal operator "includes" not working

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jul 22 01:59:39 EDT 2011


Interval-based events must have a property for their duration (in ms), not
the end time.

@duration(duration)
duration : long

-W

2011/7/22 Neelesh Deo Dani <neeleshdev at yahoo.co.in>

> Hi,
> I've following event declarations and rule:
>
> declare Event
>     @role(event)
>     @timestamp(datetime)
>     datetime : Date
>     name : String
> end
>
> declare Contest
>     @role(event)
>     @timestamp (startTimestamp)
>     startTimestamp : Date
>     endTimestamp : Date
> end
>
> rule "Contest"
> no-loop
> when
>     $e : Event(name == "event1")
>     $contest : Contest(this includes $e)
> then
>     System.out.println("rule Contest fired");
> end
>
> The timestamps with Event and Contest objects are set as follows (before
> insert in state-full session):
>
>            // for Contest object
>            Calendar c = Calendar.getInstance();
>             c.set(2011, 7, 1);
>             contestType.set(contest, "startTimestamp", new
> Date(c.getTimeInMillis()));
>             c.set(2011, 7, 31);
>             contestType.set(contest, "endTimestamp", new
> Date(c.getTimeInMillis()));
>
>             // for Event object
>              c.set(2011, 7, 3);
>              eventType.set(event, "datetime", new
> Date(c.getTimeInMillis()));
>
> The condition "this includes $e" in LHS doesn't get evaluated to true and
> RHS doesn't get executed.
>
> If I change it to "$contest.startTimestamp before $e, $contest.endTimestamp
> after $e"  which has the same meaning then it works fine.
> Please help in resolving the issue.
>
> Thanks & Regards,
> Neelesh
>
>
>
> _______________________________________________
> 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/20110722/a5d61c2a/attachment.html 


More information about the rules-users mailing list