Hi,
Being new to drools myself, I will try to answer some questions which
hopefully might be right, but others please clarify.
I'm new to drools rule engine. Please help me with my questions:
I have a huge object hierarchy. At the top of the tree is a group object.
The group object contains many customer objects. Each customer has many item
objects associated with it. The item object has a due date property.
My question is as follows:
I assert the root object and all customer and item objects in the WM. The
goal for me is to find out all item objects whose due date is today and do
some work. The condition part of my rule would check if the due date in the
item object is today and if so put these objects in a List. Assuming that my
group object fires this rule at some particular time, following is my
question:
1. Would the rule apply to all Item objects in WM.
Yes, it would apply to every Item object in the WM.
2. How can I accumulate these objects in a List?
Well, you need to fire a rule which would create a new List object in the
WM. This could be done using a bootstrap kind of rule which checks for the
existence of your root object and if it exists then create a new list
object.
Alternatively you could use the setGlobal function of the working memory in
order to push in a global variable which you can later access from your main
program.
Hope this helps.
Thanks,
Sudha
Ramesh Bhaskar
www.rameshbhaskar.com
--
View this message in context:
http://www.nabble.com/How-to-accumulate-facts-tf2749531.html#a7671165
Sent from the drools - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email