[rules-users] temporal operator "includes" not working
Neelesh Deo Dani
neeleshdev at yahoo.co.in
Fri Jul 22 00:17:59 EDT 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110722/4e260b59/attachment.html
More information about the rules-users
mailing list