It looks like you have may have to start with a simple representation of the calendar, for all weeks in a given year. I am not sure exactly what you are trying to accomplish - you could generate these kinds of facts, as many as you need, from Java (or any other language) dynamically. You may need 52 weeks in a year or may need less (part of the year) or more (more than a year), depending on the application.
 
Nevertheless, it is good you are seeking opinions from this good group!
 
Ravi.
 
-------- Original Message --------
Subject: Re: [rules-users] need some advice in defining rules
From: Wolfgang Laun <wolfgang.laun@gmail.com>
Date: Tue, April 28, 2009 4:37 pm
To: Rules Users List <rules-users@lists.jboss.org>

Have you considered the simple fact that a month may have between four (full) and six (one or two fractional) weeks? Reminder objects ought to have a field identifying the week; if they have its easy to count them per week if they are simple facts in WM.

Note that the identificaton of weeks by running number per year also has up to two fractional weeks.

-W


On Mon, Apr 27, 2009 at 6:08 PM, Brody bach <brodybach@yahoo.com> wrote:

Hi all,

I'm having difficulty in defining a rule for the following problem:
We need to check if within a week there are more than 5 objects of type
Reminder inserted into Memory.
(one day corresponds to one object)
The number of the inserted objects depends on the usage of the application.
That means there could be nothing, 1, 2, or any number of the objects.
Before, within a session, I inserted a list containg data from within one
week (7 days).
Than I can check using the rule:
when:
$list : list(size > 5)
Reminder() from $list
no String(trim == "limit reached");
then
System.out.println("This rule fires");
insert new String("limit reached");

Now I need to insert a list containing data from a whole month, but I still
need to check whether within one week there are more than 5 reminders exist.

so, the constraint list> 5 can't be used anymore for a single list. I tried
to break the whole list in several smaller list, where each list represents
one week.
Now the problem is, if the rule fires for a certain week, than it won't work
for the following weeks anymore.

My idea is then to insert an integer containing specific number to the
current list, i.e. the calendar week (i.e insert new Integer(52)) and then
to prove this in LHS; but the problem is now how to prove the week number in
LHS? as I remeber, a function can only be called within an eval statement
and  in this case actually I should only prove the existence of an Integer

Hope my explanation is quite understandable and looking forward for any
hints

Regards

--
View this message in context: http://www.nabble.com/need-some-advice-in-defining-rules-tp23259683p23259683.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users