[rules-users] Ruleflow loop until condition

Alessandro Terrinoni aleterrinoni at hotmail.com
Thu Apr 9 09:53:20 EDT 2009






Kris,

thanks for the answer, i found that the problem were some missing updates.

But now there's another issue:
In a node of the flow should take place an action also on NumeroRound, everytime just once, incrementing its field by one.

The problem is: with the attribute "no-loop true", the flow freezes in that flow-group, even if the update statement is present.
Obviously, without the attribute "no-loop true" it goes loop on the rule.


rule "query for results"
    no-loop true
    ruleflow-group "queryResult"
    when
        #conditions
        nRound : NumeroRound(n : numeroRound)
    then 
        #actions
        risultati.addAll(queryManager.getEnititesFromRequest(request));
        nRound.setNumeroRound(n+1);
        update( nRound );
end


The split and the join works fine now, as the modParams group evaluates twice. The problem seems to be in the queryResult node that contains only the rule above. I will try to add the audit logger to provide more informations.


Maybe, since the node queryResult have to take everytime one and only one action, i could replace the node with an Action node. But if i do, i dont think i could be be able to modify the field in the NumeroRound fact, could I? (note i need it as a fact as i use it also in some LHS of other rules..)



> Date: Thu, 9 Apr 2009 14:51:49 +0200
> From: Kris.Verlaenen at cs.kuleuven.be
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] Ruleflow loop until condition
> 
> Alessandro,
> 
> Not sure what the XOR constraint looks like exactly, but if you are
> using a rule constraint and it is referencing the NumeroRound object in
> working memory, are you notifying the engine when this number is changed
> (as I didn't see any update statements in your rules).
> 
> To figure out what is going on exactly, I recommend adding an audit log
> listener to your session (either to console or to file which can then be
> visualized in eclipse as a tree).  This will give you a clear idea on
> which nodes have been triggered and why.  For more information see the
> docs here:
> https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch10.html
> https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html/ch05.html#d0e2988
> 
> Kris
> 
> Quoting Alessandro Terrinoni <aleterrinoni at hotmail.com>:
> 
> > 
> > Hello
> > 
> > I created a ruleflow like this one:
> > http://i41.tinypic.com/2efmctx.jpg
> > 
> > And this is the rule package (rules are demonstrative only and one
> > per group, but later on more will be added in each group.
> > 
> > package package1
> > 
> > #list any import classes here.
> > ...
> > 
> > 
> > #declare any global variables here
> > ...
> > 
> > 
> > rule "start workflow"
> >     salience 1000
> >     when
> >         eval (true)
> >     then 
> >         System.out.println("matchata regola start");
> >         drools.getWorkingMemory().startProcess("rf_main");
> > 
> > end    
> > 
> > rule "Preferenza"
> >     ruleflow-group "modParams"
> >     when
> >         nRound : NumeroRound( n : numeroRound)
> >         pw : PreferenceWrapper(round == n ,pref : preference)
> >         
> >     then 
> >         pw.setRound(n+1);
> >         System.out.println("matchata regola pref");
> >         System.out.println("preferenza: "+ pref.getName());
> >         
> > end
> > 
> > rule "query for results"
> >     
> >     ruleflow-group "queryResult"
> >     when
> >         #conditions
> >         nRound : NumeroRound(n : numeroRound)
> >     then 
> >         #actions
> >         System.out.println("matchata regola query");
> > ...
> > end
> > 
> > rule "fasulla"
> >     
> >     ruleflow-group "fasullo"
> >     when
> >         eval (true)
> >     then 
> >         #actions
> >         System.out.println("sei fasullo1");
> >         
> > end
> > 
> > 
> > 
> > In the ruleflow, the join node is XOR type.
> > Split node is XOR type and checks with the object NumeroRound and the
> > variable numeroRound which is an int. If it is big enough it exits,
> > else continue to "fasullo" group
> > 
> > the issue is that the matching goes through "modParams" group, then
> > "queryResult" group, then "fasullo" group, but after that it freezes,
> > instead of going angain in group "modParams". Note that it doesnt
> > finish the execution, it waits something.
> > 
> > What is wrong with this ruleflow?
> > 
> > thanks in advance,
> > Alessandro Terrinoni
> > 
> > _________________________________________________________________
> > Chiama gratis dal tuo PC! Parla su Messenger
> > http://clk.atdmt.com/GBL/go/140630369/direct/01/
> 
> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

_________________________________________________________________
25 GB di spazio gratuito su Internet! Prova SkyDrive
http://clk.atdmt.com/GBL/go/140630371/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090409/0073f147/attachment.html 


More information about the rules-users mailing list