Sounds like a very good idea. If you go forward with this, I'd love to see
your method for solving the following type of problem:
I need to update a particular object without causing the rule to re-fire.
Say I have two classes, Stack and Board. I need to choose the Stack to put
each Board, so one of these sorting rulles would look like this:
when
board : Board (thickness == 1)
stack : Stack (location == "A")
then
board.setStack(stack);
update(board);
end
The problem is the update statement puts the rule back in the Agenda to be
fired again, thus an infinite loop. My solution in general has been to use a
Collection to track boards that have been processed, but it seems to be alot
of overhead. I'm not pleased by my solution.
when
board : Board (thickness == 1)
stack : Stack (location == "A")
processed : NamedCollection(name == "BoardsSorted", collection not
contains board)
then
board.setStack(stack);
update(board);
processed.add(board);
update(processed);
end
Also, the NamedCollection needs to be created, which I'm doing within the
ruleset, which adds a somewhat meaningless to Business Analysts rule. Though
I could create the NamedCollection in Java and add it to WorkingMemory prior
to firing the rules, I'd like the rulesets to take care of themselves.
My actual problem set is laced with many solutions that need to update
objects. Even if the object is not directly related to the rule criteria, a
map to the object needs to be created in the RHS so the LHS has a reference
to the object being updated, thus posing the same problem as above.
Your insights would be greatly appreciated.
Mark Proctor wrote:
I'm going to try an informal experiment for the 4th of February at 5PM
GMT (Date/Time subject to change), we will run an online Drools Clinic
in the form of a Webinar. So the idea here isn't of a 60 minute
presentation, but really more of a 60 minute interactive Q&A where we
will use the desktop to assist in some explanations talking through code
or examples. What do people think?
Ideally we would have a set of pre-determined questions, with some adhoc
ones on the day too. Feel free to start listing your Qs here. I want to
avoid "What's WorkingMemory" type questions, but other than that,
anything is game. Also if anyone has anything cool they would like to
discuss about how they have used Drools, or just general interesting AI
ideas, then that's fine too - happy for this just to turn into a fun
geek chat too.
Mark
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users