[rules-users] Globals asserted as facts... how to modify them...
Hi everybody, I followed all the topics about globals and the fact that they are immutables. I also understood that once we decide to reason over globals, it's time we no more use them and we start to use simple WM facts. Now... I tell you my scenario. I have got two globals. A request global and a reply global. The first one is a Request java instance and the second one is a Reply java instance. They belong to the Object model I designed. My application makes a request to the rule engine passing it a request as global, and get back a reply from it receiving a modified reply global. I use a ruleflow to execute the rules. I think everything would be perfect and smooth if I had not the need to reason over the reply during the rule session That's the point! I do not just need to modify the reply global in order to get the final value outside the rule engine, but I DO need to reason over it INSIDE the rule session. So what should I do in order to reason over the reply INSIDE AND OUTSIDE the Rule Session? Should I insert the reply global into the WM? Let assume I do that, what happen if I pass the reply global to a drools function which alters the reply? Imagine a rule as follows and imagine I previously inserted the reply global into the WM: ... global my.object.model.Reply reply ... rule addcriminal_2_reply when $p: Person(job==criminal) then addCriminaltoReply(reply, $p ); end Will this alteration affect the corresponding Reply() fact in the WM as well? Now let see this other rule: (Same, let imagine i previously inserted: insert(reply); ) global my.object.model.Reply reply rule FullFill_replyCode when $r: Reply(code==john.wayne) from reply then $r.code.name = john; $r.code.lastname = wayne; end If I execute this rule in a ruleflow, do i need to update($r) in order to get the modified $r value in the next ruleflow node? And what happens to the global??? Will it get modified as well? I am sure you can help me. Bye bye. Massi ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Globals asserted as facts... how to modify them...
Hi everybody, I followed all the topics about globals and the fact that they are immutables. I also understood that once we decide to reason over globals, it's time we no more use them and we start to use simple WM facts. Now... I tell you my scenario. I have got two globals. A request global and a reply global. The first one is a Request java instance and the second one is a Reply java instance. They belong to the Object model I designed. My application makes a request to the rule engine passing it a request as global, and get back a reply from it receiving a modified reply global. I use a ruleflow to execute the rules. I think everything would be perfect and smooth if I had not the need to reason over the reply during the rule session *That's the point!* I do not just need to modify the reply global in order to get the final value *outside* *the rule engine*, but I DO need to reason over it *INSIDE* the rule session. *So what should I do in order to reason over the reply INSIDE AND OUTSIDE * *the Rule Session?* Should I insert the reply global into the WM? Let assume I do that, what happen if I pass the reply global to a drools function which alters the reply? Imagine a rule as follows and imagine I previously inserted the reply global into the WM: ... global my.object.model.Reply reply ... rule addcriminal_2_reply when $p: Person(job==criminal) then addCriminaltoReply(reply, $p ); end Will this alteration affect the corresponding Reply() fact in the WM as well? Now let see this other rule: (Same, let imagine i previously inserted: insert(reply); ) global my.object.model.Reply reply rule FullFill_replyCode when $r: Reply(code==john.wayne) from reply then $r.code.name = john; $r.code.lastname = wayne; end If I execute this rule in a ruleflow, do i need to update($r) in order to get the modified $r value in the next ruleflow node? And what happens to the global??? Will it get modified as well? I am sure you can help me. Bye bye. Massi ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] From API Doc: ...This represents a working memory session where state is not kept between invocations...
Hi guys, ( :D Personal Banner: do not forget to read my previous post :D ) I was reading the http://downloads.jboss.com/drools/docs/4.0.4.17825.GA/apidocs/index.html documentation, looking to the StatelessSession interface. On the first line we can read: This represents a working memory session where state is not kept between invocations. What does invocation stand for? What is meant for invocation here? Is it an insert() call? Is it a fireAllRules() call? In case of a statfullsession... is it a startProcess() call? One more doubt... Are we allowed to execute a ruleflow using\within a stateless session? Thank you again guys. Massi___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Globals asserted as facts... how to modify them...
Hi, On Feb 16, 2008 1:00 PM, mmquelo massi [EMAIL PROTECTED] wrote: Hi everybody, I followed all the topics about globals and the fact that they are immutables. I also understood that once we decide to reason over globals, it's time we no more use them and we start to use simple WM facts. Now... I tell you my scenario. I have got two globals. A request global and a reply global. The first one is a Request java instance and the second one is a Reply java instance. They belong to the Object model I designed. My application makes a request to the rule engine passing it a request as global, and get back a reply from it receiving a modified reply global. I use a ruleflow to execute the rules. I think everything would be perfect and smooth if I had not the need to reason over the reply during the rule session That's the point! I do not just need to modify the reply global in order to get the final value outside the rule engine, but I DO need to reason over it INSIDE the rule session. So what should I do in order to reason over the reply INSIDE AND OUTSIDE the Rule Session? Should I insert the reply global into the WM? Let assume I do that, what happen if I pass the reply global to a drools function which alters the reply? Imagine a rule as follows and imagine I previously inserted the reply global into the WM: ... global my.object.model.Reply reply ... rule addcriminal_2_reply when $p: Person(job==criminal) then addCriminaltoReply(reply, $p ); end Will this alteration affect the corresponding Reply() fact in the WM as well? Now let see this other rule: (Same, let imagine i previously inserted: insert(reply); ) global my.object.model.Reply reply rule FullFill_replyCode when $r: Reply(code==john.wayne) from reply then $r.code.name = john; $r.code.lastname = wayne; end If I execute this rule in a ruleflow, do i need to update($r) in order to get the modified $r value in the next ruleflow node? And what happens to the global??? Will it get modified as well? I am sure you can help me. Bye bye. Massi have you thought about initializing and asserting the Reply instance in a separate rule at the beginning of the ruleflow? After the ruleflow has finished, you can look for instances of Reply in the WorkingMemory and retrieve your Reply object. Best regards Marcus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] You must see this, guys...new bug? defining rules saturday night made me mad?
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.$%%()%%$/%£sorrybut 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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] You must see this, guys...new bug? defining rules saturday night made me mad?
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, [EMAIL PROTECTED] [EMAIL PROTECTED]: 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.$%%()%%$/%£sorrybut 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@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Re: You must see this, guys...new bug? defining rules saturday night made me mad?
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 [EMAIL PROTECTED] ha scritto nel messaggio news:[EMAIL PROTECTED] 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, [EMAIL PROTECTED] [EMAIL PROTECTED]: 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.$%%()%%$/%£sorrybut 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@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users