Re: [drools-user] Chaining Rules

2006-03-14 Thread Lionel Port
Ok tell us the result when you've re-ordered your priorities.
I suspect that what you will likely see is that the consequeces for the
Assign Task and Audit Task will run over and over again forever. This is
because the modifyObject() call will cause the re-evaluation of the
conditions of rules that use the TaskVO, even those the rules that have
already had there consequences executed. From what I can see neither Assign
Task or Audit Task do anything  that would prevent Assign Task being
executed again.


Also is this condition in your Assign Task correct, seems slightly unusual.
Did you mean to use an OR?

java:conditiontaskVO.getIdentifiersList() != null ||
taskVO.isIdentifiersListEmpty() == false/java:condition




On 3/15/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Lionel:

   Okay let me reorder the priorities so the highest priority is the first
 rule and step down the priority until i get to the last rule.  I will re-run
 the test again.

 When I start the process off, I call fireAllRules method.  When I am about
 to leave the rule, I call the method --objectModified()--and pass the object
 that I modified in the method. I understand this will change the state of
 the object I am working with.   This change of state should fire the next
 rule.  Is this not right?

 Russ



Re: [drools-user] Chaining Rules

2006-03-13 Thread Lionel Port
From the look of it.
If that last rule you defined is activated it will fire first and set the
status to suspend, so no other rule is fired.
If not you will likely have the rules firing in the following sequence
RouteTask, AssignTask, AuditTask, AssignTask, AuditTask, AssignTask,
AuditTask... forever.
Or have I missed the ending condition.

On 3/14/06, Geoffrey Wiseman [EMAIL PROTECTED] wrote:

 On 3/13/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
 Maybe I am not seeing the error in my ways.  I have four rules.  I am
  chaining them together.  Each rule acts upon the object in a different
  way.  I have set up the no-loop attribute so no rule is fired more than
  once.  I have also assigned a priority for each of the rules so they
 will
  execute in sequence. I have four Conflict resolvers loaded (Salience,
  Recency, Simplicity, Load).  After I have performed a said operation
 within
  a rule, I call the functiondrools.modifyObject(taskVO) for updating
  the fact.  However, I am not seeing the final results with all the
  information getting into the object after all the four rules have fired:
 

 Ok, so what ARE you seeing?   Are any of the rules firing?  Did you try
 adding an event listener to trace the rules?

 --
 Geoffrey Wiseman




Re: Re[2]: [drools-user] can your use fireAllRules(AgendaFilter) multiple times

2006-03-07 Thread Lionel Port
Michael was not saying to modify the facts in the consequence. Instead, he
was saying that you it would be _possible_ iterate through the facts after
the rules had fired and modify them.

You could do something like:

memory.fireAllRules(agendaFilter1);

// do something

// modify all facts so that rules are re-added to agenda.
List objects = memory.getObjects();
for (Object fact : objects )
{
  FactHandle factHandle = memory.getFactHandle(fact);
  memory.modifyObject(factHandle, fact);
}

memory.fireAllRules(agendaFilter2);










On 3/8/06, Felipe Piccolini [EMAIL PROTECTED]  wrote:

 Michael,

   But, how can you modify 'all' the objects on the working memory?..
   when a consequence finds a drools.modifyObject(Fact) inside the .drl
   all the rulebase is checked again no matter the next line...

   I want to do:

   java:consequence
   drools.modifyObject (myFact1);
   drools.modifyObject(myFact2);
   /java:consequence

   But the matter is the second line is never executed.

 Monday, March 6, 2006, 10:51:29 PM, you wrote:

  no when its finished, the agenda is clear.

  I think what you really want is Agenda Groups where it is partioned
 based
  on some logic - but this is an upcoming drools 3 feature.

  in the meantime, you can also iterate through and modify all the
 objects
  that are already in working memory, causing rules to be put on the
 agenda
  again (possibly).

  However, I think the correct way is what you suggested, as you are
 talking
  about 2 different points in your applications workflow, hence 2
 rulesets.
  The facts just happen to be the same. In any case, the cost is not so
 much
  in iterating and calling assertObject, but the work done to calculate
 what
  rules should fire, which in any case needs to happen twice.

  Someone may have another more efficient suggestion however.

  On 3/7/06, Lionel Port [EMAIL PROTECTED] wrote:
 
  When you use the fireAllRules(AgendaFilter) method on the WorkingMemory

  does
  it clear the Agenda when its done or can you fire different rules in
 the
  working memory at different points in time without modifying the facts
 in
  between.
 
  The rules I have can be broken into two distinct rulesets that need to
 be
  executed at different points but the conditions largely operate on the
  same
  facts, so I was trying to save time by asserting all the facts once and

  then
  doing something like:
 
  memory.fireAllRules(agendaFilter1);
  // do something not related to drools
  memory.fireAllRules(agendaFilter2);
 
 
  It doesn't seem to be working though. Should I just put the rules in
  different rule bases and assert the facts before I use it.
 
 


 --
 Felipe Piccolini
 [EMAIL PROTECTED]




Re: Re[2]: [drools-user] can your use fireAllRules(AgendaFilter) multiple times

2006-03-07 Thread Lionel Port
Felipe,

Note that in this situation it seems a waste as your evaluating conditions
for rules you have no intention of firing. Its better to do away with the
agenda filters and have seperate rulebases and seperate working memories and
just assert the same facts into both working memories.

Lionel

On 3/8/06, Lionel Port [EMAIL PROTECTED] wrote:

 Michael was not saying to modify the facts in the consequence. Instead, he
 was saying that you it would be _possible_ iterate through the facts after
 the rules had fired and modify them.

 You could do something like:


 memory.fireAllRules(agendaFilter1);

 // do something

 // modify all facts so that rules are re-added to agenda.
 List objects = memory.getObjects();
 for (Object fact : objects )
 {
   FactHandle factHandle = memory.getFactHandle(fact);
   memory.modifyObject(factHandle, fact);
 }

 memory.fireAllRules(agendaFilter2);











 On 3/8/06, Felipe Piccolini  [EMAIL PROTECTED]  wrote:
 
  Michael,
 
But, how can you modify 'all' the objects on the working memory?..
when a consequence finds a drools.modifyObject(Fact) inside the .drl
all the rulebase is checked again no matter the next line...
 
I want to do:
 
java:consequence
drools.modifyObject (myFact1);
drools.modifyObject(myFact2);
/java:consequence
 
But the matter is the second line is never executed.
 
  Monday, March 6, 2006, 10:51:29 PM, you wrote:
 
   no when its finished, the agenda is clear.
 
   I think what you really want is Agenda Groups where it is partioned
  based
   on some logic - but this is an upcoming drools 3 feature.
 
   in the meantime, you can also iterate through and modify all the
  objects
   that are already in working memory, causing rules to be put on the
  agenda
   again (possibly).
 
   However, I think the correct way is what you suggested, as you are
  talking
   about 2 different points in your applications workflow, hence 2
  rulesets.
   The facts just happen to be the same. In any case, the cost is not
  so much
   in iterating and calling assertObject, but the work done to calculate
  what
   rules should fire, which in any case needs to happen twice.
 
   Someone may have another more efficient suggestion however.
 
   On 3/7/06, Lionel Port  [EMAIL PROTECTED] wrote:
  
   When you use the fireAllRules(AgendaFilter) method on the
  WorkingMemory
   does
   it clear the Agenda when its done or can you fire different rules in
  the
   working memory at different points in time without modifying the
  facts in
   between.
  
   The rules I have can be broken into two distinct rulesets that need
  to be
   executed at different points but the conditions largely operate on
  the
   same
   facts, so I was trying to save time by asserting all the facts once
  and
   then
   doing something like:
  
   memory.fireAllRules(agendaFilter1);
   // do something not related to drools
   memory.fireAllRules(agendaFilter2);
  
  
   It doesn't seem to be working though. Should I just put the rules in
   different rule bases and assert the facts before I use it.
  
  
 
 
  --
  Felipe Piccolini
  [EMAIL PROTECTED]
 
 



[drools-user] can your use fireAllRules(AgendaFilter) multiple times

2006-03-06 Thread Lionel Port
When you use the fireAllRules(AgendaFilter) method on the WorkingMemory does
it clear the Agenda when its done or can you fire different rules in the
working memory at different points in time without modifying the facts in
between.

The rules I have can be broken into two distinct rulesets that need to be
executed at different points but the conditions largely operate on the same
facts, so I was trying to save time by asserting all the facts once and then
doing something like:

memory.fireAllRules(agendaFilter1);
// do something not related to drools
memory.fireAllRules(agendaFilter2);


It doesn't seem to be working though. Should I just put the rules in
different rule bases and assert the facts before I use it.