[rules-users] not operation available in drools
I have a scenario like below Rule a When ! ( (aaa == “bbb”) (bbb == “aaa”) ) Then // do smth End I’m looking for an operator to reverse the evaluation result of the expression in the brackets. Is this possible -- View this message in context: http://drools.46999.n3.nabble.com/not-operation-available-in-drools-tp4017936.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] not operation available in drools
Read about the Conditional Element not in the Drools Expert manual. You'll also need to learn about the Conditional Element or. -W On 14/06/2012, learner anandbabu6...@yahoo.com wrote: I have a scenario like below Rule a When ! ( (aaa == “bbb”) (bbb == “aaa”) ) Then // do smth End I’m looking for an operator to reverse the evaluation result of the expression in the brackets. Is this possible -- View this message in context: http://drools.46999.n3.nabble.com/not-operation-available-in-drools-tp4017936.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
Re: [rules-users] not operation available in drools
Hello, you can use not like this Rule a When not( (aaa == “bbb”) (bbb == “aaa”) ) Then // do smth End -- View this message in context: http://drools.46999.n3.nabble.com/not-operation-available-in-drools-tp4017936p4017938.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] Implementing complex operators in Decision table
I need some help in implementing complex rules in decision table.. Following are the two queries that I need to implement in decision table. 1 --- ((UPPER(PRODUCT_TYPE_CODE) IN ('REO', 'TRM')) OR (UPPER(INVESTMENT_GROUP_TYPE) = 'EQUITY' AND deal_ltv_nbi_ext_Debt = .6)) AND UPPER(PRIMARY_COLLATERAL_TYPE) = 'HOTEL' 2 --(UPPER(INVESTMENT_GROUP_TYPE) = 'EQUITY' OR UPPER(PRODUCT_TYPE_CODE) = 'LES') AND ((UPPER(NNN_LEASE) = 'Y' AND DECODE(ENHANCED_ITV, NULL, DEAL_ITV_NBI_SPP_CURR_MKT_VAL, ENHANCED_ITV) = .95 AND Core_Property_Type_YN = 'Y') OR (UPPER(NNN_LEASE) = 'Y' AND DECODE(ENHANCED_ITV, NULL, DEAL_ITV_NBI_SPP_CURR_MKT_VAL, ENHANCED_ITV) = .85 AND Core_Property_Type_YN = 'N')) I need to use decision tables only. so do I implement them. I have attached a decsion table in which I have to implement. http://drools.46999.n3.nabble.com/file/n4017941/LeverageRuleSheet1.xls LeverageRuleSheet1.xls -- View this message in context: http://drools.46999.n3.nabble.com/Implementing-complex-operators-in-Decision-table-tp4017941.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] Implementing complex operators in Decsion Table
I need some help in implementing complex rules in decision table.. Following are the two queries that I need to implement in decision table. 1 --- ((UPPER(PRODUCT_TYPE_CODE) IN ('REO', 'TRM')) OR (UPPER(INVESTMENT_GROUP_TYPE) = 'EQUITY' AND deal_ltv_nbi_ext_Debt = .6)) AND UPPER(PRIMARY_COLLATERAL_TYPE) = 'HOTEL' 2 --(UPPER(INVESTMENT_GROUP_TYPE) = 'EQUITY' OR UPPER(PRODUCT_TYPE_CODE) = 'LES') AND ((UPPER(NNN_LEASE) = 'Y' AND DECODE(ENHANCED_ITV, NULL, DEAL_ITV_NBI_SPP_CURR_MKT_VAL, ENHANCED_ITV) = .95 AND Core_Property_Type_YN = 'Y') OR (UPPER(NNN_LEASE) = 'Y' AND DECODE(ENHANCED_ITV, NULL, DEAL_ITV_NBI_SPP_CURR_MKT_VAL, ENHANCED_ITV) = .85 AND Core_Property_Type_YN = 'N')) I need to use decision tables only. so how do I implement them. I have also attached a decsion table in which I have to implement these queries. http://drools.46999.n3.nabble.com/file/n4017943/LeverageRuleSheet1.xls LeverageRuleSheet1.xls -- View this message in context: http://drools.46999.n3.nabble.com/Implementing-complex-operators-in-Decsion-Table-tp4017943.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] not operation available in drools
Sotty, You want to be careful with applying De Morgan's laws indiscriminately when terms aren't plain boolean expressions. Even the simpler Foo( a != x ) and Foo( b != y ) is not equivalent to Foo( a != x b != y ) -W On 14/06/2012, Davide Sottara dso...@gmail.com wrote: Are the two conditions constraints inside the same pattern or two different patterns? In the former case, DeMorgan's laws also apply: ( a != x) || ( b != y ) and you should anyway be able to use free-form boolean expressions inside a pattern, provided that you use one of the latest versions. Otherwise (two patterns), see the previous posts. Best, Davide -- View this message in context: http://drools.46999.n3.nabble.com/not-operation-available-in-drools-tp4017936p4017939.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
Re: [rules-users] not operation available in drools
Wolfgang and learner, sorry for not stressing it clearly enough. My suggestion was assuming that the constraints are inside the same pattern, otherwise it's a different story... From the posted DRL-like snippet, it's not clear whether it's a single pattern or two. -- View this message in context: http://drools.46999.n3.nabble.com/not-operation-available-in-drools-tp4017936p4017945.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] Programatically filled Enum not getting loaded
Hi, I just tried to recreate the problem but when I create everything from scratch in a new package, it seems to work?! So I can't reliably reproduce the situation which on the other hand means, that there seems to be a problem in the state of the package. Bad, but seems like I have to start from the bottom again to get that working ... Von: rules-users-boun...@lists.jboss.org im Auftrag von Michael Anstis Gesendet: Mi 13.06.2012 18:37 An: Rules Users List Betreff: Re: [rules-users] Programatically filled Enum not getting loaded Sounds like a bug to me. Please raise a JIRA at https://issues.jboss.org/browse/GUVNOR, including a self-contained repository export and your description below. With kind regards, Mike On 13 June 2012 16:47, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote: I use Guvnor 5.4.0 with the following Assets: Enum: 'Enums.Modules' : (new de.itm.util.DroolsEnumHelper()).loadModules() DSL: [when]Testmodule {module:ENUM:Enums.Modules} is just for testing={module} : Cylinder() DroolsEnumHelper-Class: public ListString loadModules() { ListString values = new ArrayListString(); for (Module module : Module.values()) { values.add(module.getModuleName() + = + module.getDisplayName()); } return values; } When running the Source-Validate in the Enum-Editor, I see the method getting called (being connected to the JBoss for Debugging). But if I use the DSL rule in the guided editor, I can select the rule but the dropdown field stays grayed out. The loadModules() method isn't even called, no getting stuck in my breakpoint! Anyone an idea why and how this happens? Am I doing something totally wrong? Thanks Dominik ... mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Mobil+49 (0) 162 2624490 Fax: +49 (0) 203 60878 22 e-mail: dominik.sandj...@it-motive.de mailto:dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de mailto:i...@it-motive.de http://www.it-motive.de http://www.it-motive.de/ .. Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users winmail.dat___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] getBestSolution not returning the correct Solution?
I displayed the score to console on hardConstraintsBroken rule. rule hardConstraintsBroken dialect java salience -1 // Do the other rules first (optional, for performance) when $sd : ServiceRequest( $object : object ); $hardTotal : Number() from accumulate ( IntConstraintOccurrence( $weight : weight ), sum( $weight ) ); then System.out.println( $object.getId() + : + (- $hardTotal.intValue()) ); scoreHolder.setScore(- $hardTotal.intValue() ); end I found that the getBestSolution() did not return the correct best solution based on console output. For example, in console output Problem Entity: O00010440201002 O00010440201003 O00010440201004 O00010440201009 O00010440201010 O00010440201011 Object: O00010440201002 : -5 Object: O00010440201002 : -5 Object: O00010440201010 : -4 Object: O00010440201003 : -5 Object: O00010440201004 : -5 Object: O00010440201011 : -4 Object: O00010440201009 : -1 Object: O00010440201004 : -5 Object: O00010440201010 : -4 Object: O00010440201002 : -5 Object: O00010440201003 : -5 Object: O00010440201011 : -4 Object: O00010440201002 : -5 Object: O00010440201003 : -5 Object: O00010440201004 : -5 Object: O00010440201009 : -1 Object: O00010440201011 : -4 Object: O00010440201003 : -5 Object: O00010440201011 : -4 Object: O00010440201004 : -5 Best Solution return by Solver O00010440201011 : -1 My expectation O00010440201009 : -1 Previous implementation in 5.3.0 doesn't have this problem. Can explain where I might do wrongly? -- View this message in context: http://drools.46999.n3.nabble.com/getBestSolution-not-returning-the-correct-Solution-tp4017948.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] Programatically filled Enum not getting loaded
Alright ... After some more investigation and a lot of trial-and-error, I think I found the problem: If the class which contains the method filling the enum (in my case the DroolsEnumHelper class) is also contained in the POJO model, the dropDown seems to stop working. Further investigation needs to be carried out to confirm this, but for the moment I am happy J Greetings Dominik Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Sandjaja, Dominik Gesendet: Donnerstag, 14. Juni 2012 11:33 An: Rules Users List Betreff: AW: [rules-users] Programatically filled Enum not getting loaded Hi, I just tried to recreate the problem but when I create everything from scratch in a new package, it seems to work?! So I can't reliably reproduce the situation which on the other hand means, that there seems to be a problem in the state of the package. Bad, but seems like I have to start from the bottom again to get that working ... Von: rules-users-boun...@lists.jboss.org im Auftrag von Michael Anstis Gesendet: Mi 13.06.2012 18:37 An: Rules Users List Betreff: Re: [rules-users] Programatically filled Enum not getting loaded Sounds like a bug to me. Please raise a JIRA at https://issues.jboss.org/browse/GUVNOR, including a self-contained repository export and your description below. With kind regards, Mike On 13 June 2012 16:47, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote: I use Guvnor 5.4.0 with the following Assets: Enum: 'Enums.Modules' : (new de.itm.util.DroolsEnumHelper()).loadModules() DSL: [when]Testmodule {module:ENUM:Enums.Modules} is just for testing={module} : Cylinder() DroolsEnumHelper-Class: public ListString loadModules() { ListString values = new ArrayListString(); for (Module module : Module.values()) { values.add(module.getModuleName() + = + module.getDisplayName()); } return values; } When running the Source-Validate in the Enum-Editor, I see the method getting called (being connected to the JBoss for Debugging). But if I use the DSL rule in the guided editor, I can select the rule but the dropdown field stays grayed out. The loadModules() method isn't even called, no getting stuck in my breakpoint! Anyone an idea why and how this happens? Am I doing something totally wrong? Thanks Dominik ... mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Mobil+49 (0) 162 2624490 Fax: +49 (0) 203 60878 22 e-mail: dominik.sandj...@it-motive.de mailto:dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de mailto:i...@it-motive.de http://www.it-motive.de http://www.it-motive.de/ .. Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ 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
[rules-users] Check problems of conflicts in the rules
I want to detect the conflict between the rules with Drools Verifier. For example the first condition of the second rule is present in the first rule and the actions to perform are the same in both rules as they demonstrate in the following case. It works very well when these rules belong to the same drl file. - fichier a.drl--- rule a no-loop true ruleflow-group group1 dialect mvel when A==0 then Action1 end rule b no-loop true ruleflow-group group1 dialect mvel when A==0 B==1 then Action1 end The problem arises when I separated its rules and that I have to put each in its own file a.drl rule a no-loop true ruleflow-group group1 dialect mvel when A==0 then Action1 end --b.drl rule b no-loop true ruleflow-group group1 dialect mvel when A==0 B==1 then Action1 end I can no longer detect this problem with Drools Verifier. Does anyone ever encountered this problem? How can I do to write a small program to audit if this case? -- View this message in context: http://drools.46999.n3.nabble.com/Check-problems-of-conflicts-in-the-rules-tp4017952.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] [planner] getBestSolution not returning the correct Solution?
1) First, can you turn on environmentMode TRACE and verify that no exceptions are thrown? Then turn it back off. 2) I suspect you have a bug in your Solution's clone() method. To prove that theory, do Solver.addSolverEventListener(...) and output the solution each time the best solution is found. You should see something like this: Object: O00010440201002 : -5 new best solution O00010440201002 Object: O00010440201002 : -5 Object: O00010440201010 : -4 new best solution O00010440201010 Object: O00010440201003 : -5 Object: O00010440201004 : -5 Object: O00010440201011 : -4 Object: O00010440201009 : -1 new best solution O00010440201009 Object: O00010440201004 : -5 Object: O00010440201010 : -4 Object: O00010440201002 : -5 Object: O00010440201003 : -5 Object: O00010440201011 : -4 Object: O00010440201002 : -5 Object: O00010440201003 : -5 Object: O00010440201004 : -5 Object: O00010440201009 : -1 Object: O00010440201011 : -4 Object: O00010440201003 : -5 Object: O00010440201011 : -4 Object: O00010440201004 : -5 then, in the end, the best solution must be equal to the last best solution (unless the clone() method forgets to clone the entities correctly). If it's not 1) or 2), please provide more info. Op 14-06-12 12:19, Charles schreef: I displayed the score to console on hardConstraintsBroken rule. rule hardConstraintsBroken dialect java salience -1 // Do the other rules first (optional, for performance) when $sd : ServiceRequest( $object : object ); $hardTotal : Number() from accumulate ( IntConstraintOccurrence( $weight : weight ), sum( $weight ) ); then System.out.println( $object.getId() + : + (- $hardTotal.intValue()) ); scoreHolder.setScore(- $hardTotal.intValue() ); end I found that the getBestSolution() did not return the correct best solution based on console output. For example, in console output Problem Entity: O00010440201002 O00010440201003 O00010440201004 O00010440201009 O00010440201010 O00010440201011 Object: O00010440201002 : -5 Object: O00010440201002 : -5 Object: O00010440201010 : -4 Object: O00010440201003 : -5 Object: O00010440201004 : -5 Object: O00010440201011 : -4 Object: O00010440201009 : -1 Object: O00010440201004 : -5 Object: O00010440201010 : -4 Object: O00010440201002 : -5 Object: O00010440201003 : -5 Object: O00010440201011 : -4 Object: O00010440201002 : -5 Object: O00010440201003 : -5 Object: O00010440201004 : -5 Object: O00010440201009 : -1 Object: O00010440201011 : -4 Object: O00010440201003 : -5 Object: O00010440201011 : -4 Object: O00010440201004 : -5 Best Solution return by Solver O00010440201011 : -1 My expectation O00010440201009 : -1 Previous implementation in 5.3.0 doesn't have this problem. Can explain where I might do wrongly? -- View this message in context: http://drools.46999.n3.nabble.com/getBestSolution-not-returning-the-correct-Solution-tp4017948.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 -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to read DRL files not in resource classpath?
Hi Charles, The KnowledgeBuilder will build your knowledge based in your resources when: kbuilder.add(Resource arg0, ResourceType arg1) The ResourceFactory.newUrlResource, newClassPathResource, or others will return a Resource instance kBuilder.add( the resource with ResourceFactory, and ResourceType as DSL/DRL/CHANGE_SET(xml from guvnor) and others) you can optionally add a resource with your specific configuration: kbuilder.add(Resource arg0, ResourceType arg1, ResourceConfiguration arg2) after finishing to add your resources, you finished to build your knowledge base and now you can get the instace of the knowledge base doing that: KnowledgeBase kbase = kbuilder.newKnowledgeBase(); and after get the knowledge packages from knowledgeBuilder to the knowledgeBase: kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); its good idea to check for errors: if (kbuilder.hasErrors()) { System.err.println(kbuilder.getErrors().toString()); System.exit(1); } the resources could be written with errors or the mix of Resources could not match each other. After that, you have your knowledge base build as a point start to start your sessions. StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); add your facts, and after fire your rules. I hope this helps you, Daniel Souza - Brazil -- View this message in context: http://drools.46999.n3.nabble.com/How-to-read-DRL-files-not-in-resource-classpath-tp4017885p4017954.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] jsp, java and drl file
Hi Friends I am trying to create a web page with a form, so when we click on submit, we are redirected to the result web page, but the content of this page will be generated according to the rules i created in my drl file. Does anyone knows the easiest way to do this? are they a way to call the drl file from the jsp file, or the java file? My Jsp file form:form method=post action=login.htm commandName=loginForm id=loginForm table tr tdEnter username:/td tdform:input path=UserName style=width:250px maxlength=75//td /tr tr tdEnter password/td tdform:password path=UserPassword style=width:250px maxlength=75//td /tr /table table width=100% border=0 cellspacing=0 cellpadding=0 tr td valign=top label input type=submit value=Save / /label label input type=reset value=clear/ /label /td /tr /table /form:form My controller class @RequestMapping(value=login.htm, method=RequestMethod.POST) public String showAffilaiteform(MapString, Object model,login loginform,BindingResult result) { String target = AFFILIATE_REGISTRATION; try{ testDAO.drools(loginform); model.put(affiliateRegistrationForm, new AffiliateUserRegistration()); }catch(Exception e) { e.printStackTrace(); } return target; } My TestDao class public class TestDAO implements ITestDao { public void drools(login loginform) { try { // load up the knowledge base KnowledgeBase kbase = readKnowledgeBase(); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, myLog); ksession.insert(loginform); ksession.fireAllRules(); logger.close(); } catch (Throwable t) { t.printStackTrace(); } } private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(LoginRules.drl), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } throw new IllegalArgumentException(Could not parse knowledge.); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } My DRL file import com.ri.bean.login; rule b dialect mvel when login( userName == ||==null) then System.out.println(hello); login lo = new login(); end These are my files and my application runs without any error.Now I want to show a message on my jsp page when the rule violates.can anybody provide me a small piece of code. Regards Brajesh -- View this message in context: http://drools.46999.n3.nabble.com/jsp-java-and-drl-file-tp4017955.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] How to read DRL files not in resource classpath?
Hi Charles.. I did a mistake.. You are using Drools Planner.. What I said is using with drools expert.. sorry.. Daniel Souza -- View this message in context: http://drools.46999.n3.nabble.com/How-to-read-DRL-files-not-in-resource-classpath-tp4017885p4017957.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] How to read DRL files not in resource classpath?
It applies too :) Anything you can use in Drools Expert, you can take advantage from in the score calculation for Drools Planner. Op 14-06-12 16:00, Daniel Souza schreef: Hi Charles.. I did a mistake.. You are using Drools Planner.. What I said is using with drools expert.. sorry.. Daniel Souza -- View this message in context: http://drools.46999.n3.nabble.com/How-to-read-DRL-files-not-in-resource-classpath-tp4017885p4017957.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 -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Trouble using java.util.List.size in constraints in 5.4.0.Final
Hi everyone, I've tried to go from Drools 5.3.0.Final to 5.4.0.Final and some strange errors appeared on constraints using the size of a list. For instance, given the following object: public class MyObject { private ListString param = new ArrayListString(); public MyObject() { super(); } public ListString getParam() { return param; } public void setParam(ListString param) { this.param = param; } } This rule: rule Sample rule when MyObject( param.size 0 ) then System.out.println( Sample rule activated ); end Provokes the following error: Unable to Analyse Expression param.size 0: [Error: Comparison operation requires compatible types. Found class java.lang.String and class java.lang.Integer] [Near : {... param.size 0 }] ^ : [Rule name='Sample rule'] This worked very well in Drools 5.3.0.Final. Is there some configuration specific to Drools 5.4.0.Final that I've missed in the release notes? Thanks in advance for your help. Best, Alexis ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Trouble using java.util.List.size in constraints in 5.4.0.Final
This looks like a bug. MyObject( param.size 0 ) = incorrect diagnostic But: MyObject( param.size() 0 ) =OK MyObject( param.size == 0 ) =OK MyObject( param.size != 0 ) =OK -W On 14/06/2012, Alexis Brouard alexis.brou...@haulogy.net wrote: Hi everyone, I've tried to go from Drools 5.3.0.Final to 5.4.0.Final and some strange errors appeared on constraints using the size of a list. For instance, given the following object: public class MyObject { private ListString param = new ArrayListString(); public MyObject() { super(); } public ListString getParam() { return param; } public void setParam(ListString param) { this.param = param; } } This rule: rule Sample rule when MyObject( param.size 0 ) then System.out.println( Sample rule activated ); end Provokes the following error: Unable to Analyse Expression param.size 0: [Error: Comparison operation requires compatible types. Found class java.lang.String and class java.lang.Integer] [Near : {... param.size 0 }] ^ : [Rule name='Sample rule'] This worked very well in Drools 5.3.0.Final. Is there some configuration specific to Drools 5.4.0.Final that I've missed in the release notes? Thanks in advance for your help. Best, Alexis ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] jsp, java and drl file
What, exactly, do you mean by when the rule violates? -W On 14/06/2012, Brajesh brajesh4...@gmail.com wrote: Hi Friends I am trying to create a web page with a form, so when we click on submit, we are redirected to the result web page, but the content of this page will be generated according to the rules i created in my drl file. Does anyone knows the easiest way to do this? are they a way to call the drl file from the jsp file, or the java file? My Jsp file form:form method=post action=login.htm commandName=loginForm id=loginForm table tr tdEnter username:/td tdform:input path=UserName style=width:250px maxlength=75//td /tr tr tdEnter password/td tdform:password path=UserPassword style=width:250px maxlength=75//td /tr /table table width=100% border=0 cellspacing=0 cellpadding=0 tr td valign=top label input type=submit value=Save / /label label input type=reset value=clear/ /label /td /tr /table /form:form My controller class @RequestMapping(value=login.htm, method=RequestMethod.POST) public String showAffilaiteform(MapString, Object model,login loginform,BindingResult result) { String target = AFFILIATE_REGISTRATION; try{ testDAO.drools(loginform); model.put(affiliateRegistrationForm, new AffiliateUserRegistration()); }catch(Exception e) { e.printStackTrace(); } return target; } My TestDao class public class TestDAO implements ITestDao { public void drools(login loginform) { try { // load up the knowledge base KnowledgeBase kbase = readKnowledgeBase(); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, myLog); ksession.insert(loginform); ksession.fireAllRules(); logger.close(); } catch (Throwable t) { t.printStackTrace(); } } private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(LoginRules.drl), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } throw new IllegalArgumentException(Could not parse knowledge.); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } My DRL file import com.ri.bean.login; rule b dialect mvel when login( userName == ||==null) then System.out.println(hello); login lo = new login(); end These are my files and my application runs without any error.Now I want to show a message on my jsp page when the rule violates.can anybody provide me a small piece of code. Regards Brajesh -- View this message in context: http://drools.46999.n3.nabble.com/jsp-java-and-drl-file-tp4017955.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
Re: [rules-users] jsp, java and drl file
Hi I am trying to say that as in my drl file if username is null or blank I want to show a message in my jsp page that username can't be null. Regards Brajesh -- View this message in context: http://drools.46999.n3.nabble.com/jsp-java-and-drl-file-tp4017955p4017964.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] Giving multiple range values in condition of Decision table
Hello Team, I have written a condition like this, see the highlighted one.. http://drools.46999.n3.nabble.com/file/n4017965/error.png I am getting the prob when rule engine parses the range value. When I generate a DRL out of this sheet what I get is: rule Rule 2 salience 65520 when lvgBslaData: LeverageBSLAData(((productTypeCode in ('REO' || (investmentGroupType == 'TRM'))(dealLtvNbiExtDebt = EQUITY)) primaryCollateralType == 0.6) then lvgBslaData.setCorpLeverageName( Hotel Equity ); end except of getting the below rule: rule Rule 2 salience 65520 when lvgBslaData: LeverageBSLAData(((productTypeCode in ('REO','TRM') || (investmentGroupType == EQUITY) (dealLtvNbiExtDebt = 0.6)) primaryCollateralType == Hotel) then lvgBslaData.setCorpLeverageName( Hotel Equity ); end I cannot change the condition except the ordering.. Please tell me how can I achieve this? -- View this message in context: http://drools.46999.n3.nabble.com/Giving-multiple-range-values-in-condition-of-Decision-table-tp4017965.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] Giving multiple range values in condition of Decision table
Escape the comma in your input values.. Change: ('REO','TRM'),EQUITY, 0.6, HOTEL TO: ('REO'\,'TRM'), EQUITY, 0.6, HOTEL The comma is the delimeter between your arguments $1, $2, etc... so just escape the comma and it will be skipped as a delimeter. Regards, Armand -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of pratibhapandey Sent: Thursday, June 14, 2012 7:45 AM To: rules-users@lists.jboss.org Subject: [rules-users] Giving multiple range values in condition of Decision table Hello Team, I have written a condition like this, see the highlighted one.. http://drools.46999.n3.nabble.com/file/n4017965/error.png I am getting the prob when rule engine parses the range value. When I generate a DRL out of this sheet what I get is: rule Rule 2 salience 65520 when lvgBslaData: LeverageBSLAData(((productTypeCode in ('REO' || (investmentGroupType == 'TRM'))(dealLtvNbiExtDebt = EQUITY)) primaryCollateralType == 0.6) then lvgBslaData.setCorpLeverageName( Hotel Equity ); end except of getting the below rule: rule Rule 2 salience 65520 when lvgBslaData: LeverageBSLAData(((productTypeCode in ('REO','TRM') || (investmentGroupType == EQUITY) (dealLtvNbiExtDebt = 0.6)) primaryCollateralType == Hotel) then lvgBslaData.setCorpLeverageName( Hotel Equity ); end I cannot change the condition except the ordering.. Please tell me how can I achieve this? -- View this message in context: http://drools.46999.n3.nabble.com/Giving-multiple-range-values-in-condition-of-Decision-table-tp4017965.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
Re: [rules-users] getInfo(return).equals(TEST) function is not working as expected
To use the function in the LHS of a rule: when eval ( getinfo(return).equals(TEST) ) then but as stated in this prior response, if you have POJO with get methods, you can use the standard mvel syntax to query it. If return is a variable that is an object you can also do your test like this: when FactType ( somevalue == TEST ) from return Then -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Tuesday, June 12, 2012 6:10 AM To: Rules Users List Subject: Re: [rules-users] getInfo(return).equals(TEST) function is not working as expected If method getInfo() returns the value of some field of a fact (object) you can simply write FactType( info == TEST ) What you quote from your code isn't likely to be correct; it's certainly incomplete and, therefore, no basis for constructive remarks. -W On 12/06/2012, vysrinivas vysrini...@gmail.com wrote: Hi, i have below condition in my drools file. getInfo(return).equals(TEST) function is not working as expected getInfo function will return a string value. If it is equal to TEST, then i should not do further validation. can you please let me know what might be the issue? and there are other few conditions in which the same equals condition is working without any issue. regards, Sri. -- View this message in context: http://drools.46999.n3.nabble.com/getInfo-return-equals-TEST-function-is-not-working-as-expected-tp4017869.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Is a single StatefulKnowledgeSession with Distributed Memory cache possible?
Hi All, I am working on a banking fraud detection project with Drools Fusion, which will match a transaction against hunreds of rules to check whether the transaction is suspicious. In some rules, I use time-based sliding window to calculate the average transaction amount of an account in the past 3 or 6 months. One possible rule will be as below: rule Single Large Amount Transaction dialect mvel when $account : Account($number : number) $averageAmount : BigDecimal() from accumulate( TransactionCompletedEvent(fromAccountNumber == $account.number, $amount : amount) over window:time(90d) from entry-point TransactionStream, bigDecimalAverage($amount)) $t1 : TransactionCreatedEvent(fromAccountNumber == $account.number, amount $account.creditAmount * 0.5, amount $averageAmount * 3.0) from entry-point TransactionStream then end In such cases, the Fusion Engine will hold TransactionCompletedEvent in its memory for 90 days. And we have about 1 billion Accounts in total, so the TransactionCompletedEvent will be huge, we will very soon run out of memory. I have been blocked here for a long time! Is it possible to distribute a single StatefulKnowledgeSession in multiple JVMs or machines using Distributed Memory cache such as Hazelcast? If yes, could you give me some opinion on the solution? Or is this the problem the Drools Grid project try to handle? Or there are other techonology to handle large numbers of facts or events problem? As far as I know, Drools Grid distribute multilple ksessions on multiple machines in the Grid, each or several kseesions on one node? Is my understandings right? Any response or opinion from you will be appriciated! Thank you very much! -- View this message in context: http://drools.46999.n3.nabble.com/Is-a-single-StatefulKnowledgeSession-with-Distributed-Memory-cache-possible-tp4017968.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] Is a single StatefulKnowledgeSession with Distributed Memory cache possible?
May be you can think differently : Instead of keeping all objects for 90 days, keep only the accumulate results for each previous day. - Mail original - De: chrisLi shengtao0...@163.com À: rules-users@lists.jboss.org Envoyé: Jeudi 14 Juin 2012 18:06:50 Objet: [rules-users] Is a single StatefulKnowledgeSession with Distributed Memory cache possible? Hi All, I am working on a banking fraud detection project with Drools Fusion, which will match a transaction against hunreds of rules to check whether the transaction is suspicious. In some rules, I use time-based sliding window to calculate the average transaction amount of an account in the past 3 or 6 months. One possible rule will be as below: rule Single Large Amount Transaction dialect mvel when $account : Account($number : number) $averageAmount : BigDecimal() from accumulate( TransactionCompletedEvent(fromAccountNumber == $account.number, $amount : amount) over window:time(90d) from entry-point TransactionStream, bigDecimalAverage($amount)) $t1 : TransactionCreatedEvent(fromAccountNumber == $account.number, amount $account.creditAmount * 0.5, amount $averageAmount * 3.0) from entry-point TransactionStream then end In such cases, the Fusion Engine will hold TransactionCompletedEvent in its memory for 90 days. And we have about 1 billion Accounts in total, so the TransactionCompletedEvent will be huge, we will very soon run out of memory. I have been blocked here for a long time! Is it possible to distribute a single StatefulKnowledgeSession in multiple JVMs or machines using Distributed Memory cache such as Hazelcast? If yes, could you give me some opinion on the solution? Or is this the problem the Drools Grid project try to handle? Or there are other techonology to handle large numbers of facts or events problem? As far as I know, Drools Grid distribute multilple ksessions on multiple machines in the Grid, each or several kseesions on one node? Is my understandings right? Any response or opinion from you will be appriciated! Thank you very much! -- View this message in context: http://drools.46999.n3.nabble.com/Is-a-single-StatefulKnowledgeSession-with-Distributed-Memory-cache-possible-tp4017968.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
Re: [rules-users] jsp, java and drl file
Hello manstis Thanks for your fast reply but can you provide me a small piece of code what you said theoretically so I became familiar with drools as I am a starter. Regards Brajesh -- View this message in context: http://drools.46999.n3.nabble.com/jsp-java-and-drl-file-tp4017955p4017972.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] jsp, java and drl file
Leaving Drools and rules aside for a moment: Do you have a simple Java program that handles the server side and returns something to the client/browser when that form is submitted? What does this look like? (I don't see how the JSP file relates to the Java code you have shown, but I'm not well experienced with JSP.) -W On 14/06/2012, Brajesh brajesh4...@gmail.com wrote: Hello manstis Thanks for your fast reply but can you provide me a small piece of code what you said theoretically so I became familiar with drools as I am a starter. Regards Brajesh -- View this message in context: http://drools.46999.n3.nabble.com/jsp-java-and-drl-file-tp4017955p4017972.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
Re: [rules-users] jsp, java and drl file
Drools provides an excellent user-guide. Plenty in there relating to Globals and Queries if I remember correctly. On 14 June 2012 17:58, Brajesh brajesh4...@gmail.com wrote: Hello manstis Thanks for your fast reply but can you provide me a small piece of code what you said theoretically so I became familiar with drools as I am a starter. Regards Brajesh -- View this message in context: http://drools.46999.n3.nabble.com/jsp-java-and-drl-file-tp4017955p4017972.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
Re: [rules-users] Is a single StatefulKnowledgeSession with Distributed Memory cache possible?
Yes, that's another option too.. it really depends on how you can accumulate data or split your data to be analyzed. Cheers On Thu, Jun 14, 2012 at 1:22 PM, Vincent LEGENDRE vincent.legen...@eurodecision.com wrote: May be you can think differently : Instead of keeping all objects for 90 days, keep only the accumulate results for each previous day. - Mail original - De: chrisLi shengtao0...@163.com À: rules-users@lists.jboss.org Envoyé: Jeudi 14 Juin 2012 18:06:50 Objet: [rules-users] Is a single StatefulKnowledgeSession with Distributed Memory cache possible? Hi All, I am working on a banking fraud detection project with Drools Fusion, which will match a transaction against hunreds of rules to check whether the transaction is suspicious. In some rules, I use time-based sliding window to calculate the average transaction amount of an account in the past 3 or 6 months. One possible rule will be as below: rule Single Large Amount Transaction dialect mvel when $account : Account($number : number) $averageAmount : BigDecimal() from accumulate( TransactionCompletedEvent(fromAccountNumber == $account.number, $amount : amount) over window:time(90d) from entry-point TransactionStream, bigDecimalAverage($amount)) $t1 : TransactionCreatedEvent(fromAccountNumber == $account.number, amount $account.creditAmount * 0.5, amount $averageAmount * 3.0) from entry-point TransactionStream then end In such cases, the Fusion Engine will hold TransactionCompletedEvent in its memory for 90 days. And we have about 1 billion Accounts in total, so the TransactionCompletedEvent will be huge, we will very soon run out of memory. I have been blocked here for a long time! Is it possible to distribute a single StatefulKnowledgeSession in multiple JVMs or machines using Distributed Memory cache such as Hazelcast? If yes, could you give me some opinion on the solution? Or is this the problem the Drools Grid project try to handle? Or there are other techonology to handle large numbers of facts or events problem? As far as I know, Drools Grid distribute multilple ksessions on multiple machines in the Grid, each or several kseesions on one node? Is my understandings right? Any response or opinion from you will be appriciated! Thank you very much! -- View this message in context: http://drools.46999.n3.nabble.com/Is-a-single-StatefulKnowledgeSession-with-Distributed-Memory-cache-possible-tp4017968.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 -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is a single StatefulKnowledgeSession with Distributed Memory cache possible?
Hi, Thank you very much for so qucik response. I cannot even believe it! As far as I know, the Fusion engine has to store the event details for sliding windows. Because if an event in the window is expired, the Fusion engine still need this event details to update the accumulate results. So, I think storing the accumulate results for per day could not conform to Fusion's logic. Thank you, all! -- View this message in context: http://drools.46999.n3.nabble.com/Is-a-single-StatefulKnowledgeSession-with-Distributed-Memory-cache-possible-tp4017968p4017977.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] [planner] getBestSolution not returning the correct Solution?
1. Thank you for pointing out the problem. This made me look into Solution file and found the different of getProblemFacts() with Example. Updated it and now it return the result correctly. Old implementation for 5.3.0: public CollectionMaterial getProblemFacts() { return this.materials; } New implementation for 5.4.0: public Collection? extends Object getProblemFacts() { List facts = new ArrayList(); facts.addAll( this.materials ); // Do not add the planning entity's (serviceRequests) because that will be done automatically return facts; } 2. Question about the cloneSolution. I have 3 properties in my Solution implementation. ArrayListMaterial materials; // Problem Facts ArrayListServiceRequest serviceRequests; // Planning Entities SimpleScore score; In example, I noticed that Planning Entity is cloned but Problem Facts is not cloned. Why problem facts not cloned? -- View this message in context: http://drools.46999.n3.nabble.com/getBestSolution-not-returning-the-correct-Solution-tp4017948p4017978.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