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

Neelesh Deo Dani neeleshdev at yahoo.co.in
Fri Jul 22 04:55:43 EDT 2011


Thanks Wolfgang! It worked.

--- On Fri, 22/7/11, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

From: Wolfgang Laun <wolfgang.laun at gmail.com>
Subject: Re: [rules-users] temporal operator "includes" not working
To: "Rules Users List" <rules-users at lists.jboss.org>
Date: Friday, 22 July, 2011, 11:29 AM

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





-----Inline Attachment Follows-----

_______________________________________________
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/569ddcac/attachment.html 


More information about the rules-users mailing list