Re: [rules-users] Sir, Seekin your's Help on Drool
On 18/04/2012 11:49, Michael Anstis wrote: Emailed me directly too... some people do nothing to help themselves. me too.. Mark sent on the move On 18 Apr 2012 11:20, Wolfgang Laun wolfgang.l...@gmail.com mailto:wolfgang.l...@gmail.com wrote: San, (1) Do NOT post the same thing four times. (2) Do NOT start with decision tables. After one month you should be able to write a simple rule in DRL. (3) Do NOT post questions without providing sufficient context. is maturityAge a field of PremiumCalculatorFormBean? Why do you define this function getMaturityAge? How is it defined? (4) Do NOT say that there is an error unless you show sufficient context. You do not pass pp to any function in the code you show - so what's the point in saying not able to find etc. (5) Use the list, do NOT email me directly. I answer the list if I have the time. -W On 18/04/2012, Sangram Jethy sangram...@gmail.com mailto:sangram...@gmail.com wrote: Hi I am a student who recently working as a java developer on drools.I have been going thru drools over last one month. Nw I hav a couple of doubt...i am struck pz reply me if u cud find time out of yr busy schedule... I am trying to cal a local function getMaturityAge() in the decision table condition column like RuleTable MaturityAge Validation CONDITION ACTION pp:PremiumCalculatorFormBean getMaturityAge() $1 System.out.println(invalid maturity age); Premium Payment Term Print out message? 70 X The method is defined localy using functions key word. This is showing error in function line is .. getMaturityAge() $1.. And moreover whenever I trying to pass pp as the argument to my functions, its not able to find pp. I am getting cud not parse knowledge error. Pz tel me how to make it work... Also pz suggest some extensive reading material for rules both in( ddr and decision table format ). I am also goin thru d documentation n Mr Paul Brown book. But i cudnt find more on using decision table and its syntax. Pz suggest me on dat. Tnks n Regards Sangram Jethy (San) ___ rules-users mailing list rules-users@lists.jboss.org mailto: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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sir, Seekin your's Help on Drool
San, (1) Do NOT post the same thing four times. (2) Do NOT start with decision tables. After one month you should be able to write a simple rule in DRL. (3) Do NOT post questions without providing sufficient context. is maturityAge a field of PremiumCalculatorFormBean? Why do you define this function getMaturityAge? How is it defined? (4) Do NOT say that there is an error unless you show sufficient context. You do not pass pp to any function in the code you show - so what's the point in saying not able to find etc. (5) Use the list, do NOT email me directly. I answer the list if I have the time. -W On 18/04/2012, Sangram Jethy sangram...@gmail.com wrote: Hi I am a student who recently working as a java developer on drools.I have been going thru drools over last one month. Nw I hav a couple of doubt...i am struck pz reply me if u cud find time out of yr busy schedule... I am trying to cal a local function getMaturityAge() in the decision table condition column like RuleTable MaturityAge Validation CONDITION ACTION pp:PremiumCalculatorFormBean getMaturityAge() $1 System.out.println(invalid maturity age); Premium Payment Term Print out message? 70 X The method is defined localy using functions key word. This is showing error in function line is .. getMaturityAge() $1.. And moreover whenever I trying to pass pp as the argument to my functions, its not able to find pp. I am getting cud not parse knowledge error. Pz tel me how to make it work... Also pz suggest some extensive reading material for rules both in( ddr and decision table format ). I am also goin thru d documentation n Mr Paul Brown book. But i cudnt find more on using decision table and its syntax. Pz suggest me on dat. Tnks n Regards Sangram Jethy (San) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sir, Seekin your's Help on Drool
Emailed me directly too... some people do nothing to help themselves. sent on the move On 18 Apr 2012 11:20, Wolfgang Laun wolfgang.l...@gmail.com wrote: San, (1) Do NOT post the same thing four times. (2) Do NOT start with decision tables. After one month you should be able to write a simple rule in DRL. (3) Do NOT post questions without providing sufficient context. is maturityAge a field of PremiumCalculatorFormBean? Why do you define this function getMaturityAge? How is it defined? (4) Do NOT say that there is an error unless you show sufficient context. You do not pass pp to any function in the code you show - so what's the point in saying not able to find etc. (5) Use the list, do NOT email me directly. I answer the list if I have the time. -W On 18/04/2012, Sangram Jethy sangram...@gmail.com wrote: Hi I am a student who recently working as a java developer on drools.I have been going thru drools over last one month. Nw I hav a couple of doubt...i am struck pz reply me if u cud find time out of yr busy schedule... I am trying to cal a local function getMaturityAge() in the decision table condition column like RuleTable MaturityAge Validation CONDITION ACTION pp:PremiumCalculatorFormBean getMaturityAge() $1 System.out.println(invalid maturity age); Premium Payment Term Print out message? 70 X The method is defined localy using functions key word. This is showing error in function line is .. getMaturityAge() $1.. And moreover whenever I trying to pass pp as the argument to my functions, its not able to find pp. I am getting cud not parse knowledge error. Pz tel me how to make it work... Also pz suggest some extensive reading material for rules both in( ddr and decision table format ). I am also goin thru d documentation n Mr Paul Brown book. But i cudnt find more on using decision table and its syntax. Pz suggest me on dat. Tnks n Regards Sangram Jethy (San) ___ 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
Re: [rules-users] Sir, Seekin your's Help on Drool
Hi Thnks for writing to me. I am new to this forum.I have indeed noted down your suggestion and I wll definitely act on it. I have gone thru the documentations and few books and have been trying hard to lean and implement since I have to deliver it as well. I could not find the solution after trying hard. So have to put it here desperately. Sorry again if I have broken the norms. Regards San ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sir, Seekin your's Help on Drool
pp:PremiumCalculatorFormBean (fact in this case) contains 2 int fields age and premiumPaymentTerm. I need to validate (age+premiumPaymentTerm) sud nt b 70. So in 1st condition column i am calling a method int getMaturityAge(pp) { int maturityAge=0; int age=0; int premiumPaymentTerm=0; maturityAge=age+premiumPaymentTerm; return maturityAge; } In the condition I write, maturityAge(pp) $1 and provide 70 as the param value. Nw the error that I am gettin... 1) while writing the above condition , it is unable to resolve pp. no viable alternative at input 'pp' in rule MaturityAge Validation_38 2) for testing purpose I call this method without any argument and returning 90. In his case also I am getting ...no viable alternative at input ')' in rule MaturityAge Validation_38 ...mismatched input '' expecting ')' in rule MaturityAge Validation_38 In Action part I have put System.out.println(Maturity value sud be less than 70 ) -- View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-Sir-Seekin-your-s-Help-on-Drool-tp3919571p3919784.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sir, Seekin your's Help on Drool
You said that you will stick to the norms here but you do the opposite in your post : Where are the rules ? As far I can guess from all you wrote so far, the errors you have are all easily fixable by reading the very basis of drools doc, like what is a field constraint, how to specify it and how it is transformed (this will explain why your maturityAge(pp) $1 has no chance to work). The errors mismatched input or cannot find ... are basic errors that are theorically fixed as soon as you have the DRL under your eyes... If you have read the doc, you know that a decision table is a way to write rules templates, and it finally generates some DRL (the only executable format for drools). Decision table design and debug cannot be done without a close analysis of produced drl code. The consequence of that is if you can't write a simple DRL that do the job, you won't be able to do the same with a decision table. So, start by getting the generated DRL, fix it, then go back to your decision table and fix it accordingly. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sir, Seekin your's Help on Drool
As the others have stated, without some actual rules it is very difficult, if not near impossible to provide help. Inferring what you might be trying to do, here is an example of what I *think* you are trying to do: CONDITION $pp: PremiumCalculatorFormBean ( ) $maturity: Integer ( ) from getMaturityAge($pp) eval ( $maturity 70 ) For this to work, you should change your Drools function to return Integer object. Drawing further assumptions form your function, which is always going to return 0 as you have it written here, I will assume that age and premiumPaymentTerm are properties of PremiumCalculatorForBean class, you could do the same this without the function call like this: CONDITION PremiumCalculatorFormBean ( $age: age, $term : premiumPaymentTerm) eval ( ($age + $term) 70 ) or CONDITION $pp: PremiumCalculatorFormBean ( ) eval ( ($pp.age + $pp.premiumPaymentTerm) 70 ) the difference is really just preference, and personal style. In the first example you capture the age and term into separate variable, and then you perform the math on those two varaibles. In the second pp is capturing the PremiumCaclulatorFormBean object and the math is done on properties of that object. In both examples, if you have two PremiumCalculatorFormBean objects in working memory, then this rule will fire twice, unless you use some control mechanism to force them to only fire once. I hope this helps. I suspect it may be on the right track, or at least let you see the proper syntax for define the LHS conditional constraints. Armand -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of San Sent: Wednesday, April 18, 2012 5:24 AM To: rules-users@lists.jboss.org Subject: Re: [rules-users] Sir, Seekin your's Help on Drool pp:PremiumCalculatorFormBean (fact in this case) contains 2 int fields age and premiumPaymentTerm. I need to validate (age+premiumPaymentTerm) sud nt b 70. So in 1st condition column i am calling a method int getMaturityAge(pp) { int maturityAge=0; int age=0; int premiumPaymentTerm=0; maturityAge=age+premiumPaymentTerm; return maturityAge; } In the condition I write, maturityAge(pp) $1 and provide 70 as the param value. Nw the error that I am gettin... 1) while writing the above condition , it is unable to resolve pp. no viable alternative at input 'pp' in rule MaturityAge Validation_38 2) for testing purpose I call this method without any argument and returning 90. In his case also I am getting ...no viable alternative at input ')' in rule MaturityAge Validation_38 ...mismatched input '' expecting ')' in rule MaturityAge Validation_38 In Action part I have put System.out.println(Maturity value sud be less than 70 ) -- View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-Sir-Seekin-your-s-Help-on-Drool-tp3919571p3919784.html Sent from the Drools: User forum mailing list archive at Nabble.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