Not sure--Drools 5 temporal reasoning looks like it would be the answer.
Only problem is that I need a solution now, so I am stuck with Drools 4.
This did give me some ideas though. I created myself a class called
TemporalReasoner. This has a few methods, namely to roll a date (so I can
tell it x amount of time from now), and then compare it to another date.
So in my rule, lets say I have a fact CreditCard with property
expiration:Date (speaking uml-ishly for "a property named 'expiration' of
type Date"):
rule "Fires when expiration less than today"
when
$c: CreditCard($expires : expirationDate)
eval(new TemporalReasoner(Calendar.getInstance()).lessThan($expires))
then
// do something for when credit card is still valid
end
Now, I'm still generally a noob with BRs, so I'm not sure how this will
affect performance. Any advice?
Thanks,
David
On Thu, Jan 29, 2009 at 3:50 AM, Anstis, Michael (M.) <manstis1(a)ford.com>wrote:
Hi,
I wonder whether Drools 5 "Complex Event Processing Support (Temporal
Reasoning)" might be what you're looking for?
http://blog.athico.com/2008/07/drools-50-m1-new-and-noteworthy.html
With kind regards,
Mike
------------------------------
*From:* rules-users-bounces(a)lists.jboss.org [mailto:
rules-users-bounces(a)lists.jboss.org] *On Behalf Of *David Siefert
*Sent:* 29 January 2009 09:40
*To:* Rules Users List
*Subject:* [rules-users] Working with dates in rules
Hi-
I'm wondering how it would be possible to compare a part of a date in the
lhs condition of a rule in a Drool. In other words, I need to compare a
date to see if it is *x* days from the current date, *n* hours from
current time, etc. Would anyone be kind enough to provide an example? I'm
thinking I may have to implement something of my own to offer that
functionality?
Big thanks,
David
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users