So the cars with their shifts would be hard facts. Or, as I'd do it: there's cars, and shifts, and assignments of cars to shifts.
The definition of a shift is all that's necessary to generate the roster for any car that's defined to run during this shift, and so a shift would be a set of definitions made up from day of week, start time, end time, holiday flag, etc. Therefore, I think you'll need a way of defining these descriptions in a convenient way - but this is not a rule, it's the definition for an interval depending on calendar and clock values. (Does "crontab" mean anything to you?)
Now, given these sets of shift definitions and the cards and the association between these, you can generate, for any given month, the actual times for each car, i.e., what the drivers can sign up for. With all the days of a month as facts (with the properties that are used in the shift definitions) you can write a set of rules that match the days with shift definitions and cars, and each match will then create a schedule entry for sign up. You don't need a human readable notation for this (presumably: small) set of rules; these are technical and not to be messed with by end users.
HTH
Wolfgang
Hi Wolfgang
Well, to be more specific the resources are taxi cars. Each taxi has their pre-defined shifts when they should be operating, then the drivers can sign up for which shifts they want to work.
What I want to accomplish is to have a set of rules or formulas in a human readable syntax which at beginning of each month generate these shifts. The input to the rule/formula could e.g. be to iterate over the dates of the month something like this:
Rule for shift: Every Monday 8-17
Input: Iterate over the dates of February 2012
Output: Shift (2012-02-06 8-17), Shift (2012-02-13 8-17), Shift (2012-02-20 8-17), Shift (2012-02-27 8-17)
Would this be suitable to implement with drools or do you have a suggestion for a more appropriate tool?
Best regards
Sverker
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: den 14 januari 2012 9:45
To: Rules Users List
Subject: Re: [rules-users] Rules for generating calendar events
There is one sentence that lets me ask whether you understand the
workings of a rule based system: "...the rules that generate the events...".
The essential idea of a RBS is the selection of data ("facts") based on its
attributes by conditions being evaluated over combinations of
data items. Then, as a secondary activity, the RBS may be instructed
to create additional facts.
Generating facts out of Nothing is not the forte of a RBS; I don't see how
you could write rules that generate "events" by deriving them out of - what?
Perhaps you could provide more background?
-WOn 14 January 2012 02:47, sverker <sverker@abrahamsson.com> wrote:
Hi
I have an application where I want to generate calendar events. Each event
will have an attached resource and people will be able to book themselves to
this event. The events are re-occuring in that they are on fixed time each
day/weekday etc, like "every friday 07:00 -12:00 unless holiday" or
something like that. The events shall be batch generated at beginning of
each month and put into a database. I want the rules that generate the
events to have some kind of DSL to be easily readable also for
non-technishians.
My question, would drools be a suitable tool for this task? I've been trying
to find examples on the above but couldn't find any.
/Sverker
--
View this message in context: http://drools.46999.n3.nabble.com/Rules-for-generating-calendar-events-tp3658179p3658179.html
Sent from the Drools: User forum 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