The loop problem is not related to the rule format. I.e., if you have a
loop in the decision table, you will have it on drl rules too, etc.
There are mechanisms to avoid undesired loops, like no-loop and
lock-on-active rule attributes, but usually it is just a matter of refining
your rule declarations.
Regarding the update() call, once you understand how it works, you may
decide not to use it in some cases, but the original description for your
problem clearly states what happens when update is not used properly.
[]s
Edson
2008/2/17, Massi Gmail <mmquelo(a)gmail.com>:
Morning Edson!
Thank You for your reply!
I have already added the "Update()".
I added it in the ACTION column following the column
where i set the "upronto" field.
But then it produces an infinite Loop!
It updates the upronto and the rule fires again....
so the infinite loop starts!
Should I avoid using decision tables?
Should I use a sequential algorithm instead of rete??
Should I clear the agenda?
So far I have never seen any .xls decision table
using the update()!
Every time I use the update in a decision table
I get back a loop.
Bye bye
Massi
----- Original Message -----
*From:* Edson Tirelli <tirelli(a)post.com>
*Newsgroups:* gmane.comp.java.drools.user
*To:* mmquelo(a)gmail.com ; Rules Users List <rules-users(a)lists.jboss.org>
*Sent:* Sunday, February 17, 2008 9:55 AM
*Subject:* Re: Re: You must see this,guys...new bug? defining rules
saturday night made me mad?
I don't know about your ruleflow question, but you seems to be missing
an update() call that will cause exactly the behavior you are describing:
**
*when*
*cw: ContractWrapper(mycontract.serviceDetail.pronto == "Y",
mycontract.serviceDetail.pronto == "Y")*
*then*
*cw.setUpronto(Pronto.Y);*
*update( cw ); // <---------
*
*System.out.println("PS1"+cw.getMycontract().getId());*
*end*
Without the update call, the LHS of the rules will never see the
attribute change. This is expected behavior.
The RHS of the rules always see the actual attribute values though,
since shadow proxies are only used in LHS.
[]s
Edson
2008/2/16, mmquelo(a)gmail.com <mmquelo(a)gmail.com>:
>
>
> I think I got the point....
>
> This is the rule (table generated) which sets the "upronto" field.
>
> *(It should have been fired in a previous ruleflow-node)*
>
>
> *package com.rules.ConsolidateData;*
>
> *#generated from Decision Table*
>
> *import com.engine.wrappers.ContractWrapper;*
>
> *import com.engine.enums.Pronto;*
>
> *#From row number: 13*
>
> *rule "Pronto_13"*
>
> *(RULEFLOW GROUP IS MISSING!!!!!)*
>
> **
>
> *when*
>
> *cw: ContractWrapper(mycontract.serviceDetail.pronto == "Y",
> mycontract.serviceDetail.pronto == "Y")*
>
> *then*
>
> *cw.setUpronto(Pronto.Y);*
>
> *System.out.println("PS1"+cw.getMycontract().getId());*
>
> *end*
>
> I think I DEFINED "THE RULEFLOW-GROUP" IN THE WRONG WAY in the .xls
> table!!!
>
> *So, I think... the **Pronto_13 **rule has been fired after the ScorePronto
> rule.*
>
> I tell you how I defined it....
>
> In the same column where I have "Ruleset", "Import" and
"Variables" I
> put "RULEFLOW-GROUP" as well...it is as follows:
>
> |Ruleset | ...
> |
> |Import | ...import ... ContractWrapper...|
> |Variables | ...
> |
> |RULEFLOW-GROUP | Scoring |
> <--- HERE!
>
>
> Is it correct?
>
> I thought this is what was meant in
>
http://jira.jboss.com/jira/browse/JBRULES-1077
>
> In case this were not the problem I really would not know what to do....
> now I go to sleep... here in rome is quite late!
>
> I hope tomorrow to work it out.
>
> Thank You for your Help Edson!
>
> Buona notte.
>
> Massi
>
> "Edson Tirelli" <tirelli(a)post.com> ha scritto nel messaggio
> news:e6dd5ba30802161533m1d6e035cq9e12dd1b148fa71@mail.gmail.com...
>
> Need to see the full test case to be able to understand if it is a
> bug or not, because the expression in the LHS is using the ShadowProxy,
> while the one in the RHS is not... so, it may be a bug or it may not...
> depends when and how you are setting the upronto field.
>
> []s
> Edson
>
>
> 2008/2/16, mmquelo(a)gmail.com <mmquelo(a)gmail.com>:
> >
> >
> > Look at this....
> >
> > I have got a "ContractWrapper" fact inserted into WM.
> >
> > It wraps a "Contract" object and some "enums" fields.
> >
> > One of these fields is "upronto":
> >
> >
> > *
> >
> > public
> > **class* ContractWrapper *extends* BaseOmPersistentWithAssignedId{
> >
> > Contract
> > mycontract=*null*;
> >
> > ...
> >
> > Pronto upronto = *null*;
> >
> > *...*
> >
> > *<getters and setters....>*
> >
> > ...
> >
> > }
> >
> >
> >
> > "upronto" is an insance of a "Pronto" java enum:
> >
> >
> > *
> >
> > public
> > **enum* Pronto {*
> >
> > N
> > *,*
> >
> > UNKNOWN
> > *,*
> >
> > Y
> > *;
> >
> > }
> >
> >
> > "Pronto" can be : (Y, N, UNKNOWN)
> >
> > Here is the rule which reasons over this enum:
> > (ofcourse I have got a Request into WM as well)
> >
> > *rule "ScorePronto"
> > dialect "mvel"
> > ruleflow-group "Scoring"
> > when
> > $r:Request( $mc:mainContract != null )
> > $cw_p:ContractWrapper($c_w_p:mycontract == $mc, eval(upronto !=
> > Pronto.Y))*
> > * then
> > System.out.println("Test Result: "+($cw_p.upronto == Pronto.Y))
> > end*
> >
> > Any guesses for the output???
> >
> > Well....
> >
> > *Test Result: true*
> >
> > HOW COMES???????????????????
> >
> > I mean ... the test "eval(upronto != Pronto.Y)" returned
"true".... It
> > means that the rule
> > engine sees upronto <> Pronto.Y!, doesn't it??!!!!
> >
> > *So... why do I get "upronto == Pronto.Y" in the RHS????*
> >
> > What the.........&$%%&()%%$/%£....sorry....but having these
> > kind of problems during saturday night is not so pleaseant!
> >
> > T-T
> >
> > I really hope you can help me with a workaround to this issue.
> >
> > Bye
> >
> > Massi
> >
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> >
https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @
www.jboss.com
>
> ------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @