[rules-users] Welcome to the rules-users mailing list
I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map. class Person { Map props; public Map getProps(); …. Extra stuff } I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”. These entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”) rule My Rule dialect mvel when $person : Person( props[“AGE”] 20, props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”] ) then System.out.println(found match”+$person); End But I am running into a parsing error: no viable alternative at input ')' in rule My Rule in pattern Person. The second condition seems to be the problem. Can I check for membership inside a List I create inline in mvel? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Using memberOf on inline mvel list was Re: Welcome to the rules-users mailing list
Apologies for the initial subject. Changing to a more appropriate one. On Feb 21, 2010, at 2:26 PM, Adam Krieg wrote: I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map. class Person { Map props; public Map getProps(); …. Extra stuff } I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”. These entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”) rule My Rule dialect mvel when $person : Person( props[“AGE”] 20, props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”] ) then System.out.println(found match”+$person); End But I am running into a parsing error: no viable alternative at input ')' in rule My Rule in pattern Person. The second condition seems to be the problem. Can I check for membership inside a List I create inline in mvel? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Welcome to the rules-users mailing list
You are expecting map values to be elevated somehow from Object to Integer and String. By using typed attributes in the Person class you can overcome your problem. Sent from my HTC (Android) On Feb 21, 2010 9:28 PM, Adam Krieg spamcont...@mac.com wrote: I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map. class Person { Map props; public Map getProps(); …. Extra stuff } I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”. These entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”) rule My Rule dialect mvel when $person : Person( props[“AGE”] 20, props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”] ) then System.out.println(found match”+$person); End But I am running into a parsing error: no viable alternative at input ')' in rule My Rule in pattern Person. The second condition seems to be the problem. Can I check for membership inside a List I create inline in mvel? ___ 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] Trying to build Drools trunk / getting build failure
I'm trying to build Drools from the trunk. I updated from svn about 10 minutes ago. My build command was: mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=C:\tmp\drools\eclipse The result of my build is given below. I have two questions: 1. I'm a little confused about -DlocalEclipseDrop=C:\tmp\drools\eclipse. Is C:\tmp\drools\eclipse supposed to point to where I have eclipse installed. 2. Does the fact that 2 tests errored out mean that my build produced nothing useful? Tests run: 184, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.203 sec Running org.drools.integrationtests.ProcessEventTest Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.211 sec Results : Tests in error: testUnmarshallingPerformance(org.drools.integrationtests.LargeRuleBaseSerializationTest) testUnmarshallWithCompressionPerformance(org.drools.integrationtests.LargeRuleBaseSerializationTest) Tests run: 1306, Failures: 0, Errors: 2, Skipped: 1 [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] There are test failures. Please refer to C:\Users\Chuck\workspace\drools-trunk\drools-compiler\target\surefire-reports for the individual test results. [INFO] [INFO] For more information, run Maven with the -e switch [INFO] [INFO] Total time: 9 minutes 14 seconds [INFO] Finished at: Sun Feb 21 15:35:42 CST 2010 [INFO] Final Memory: 27M/49M [INFO] ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] memberOf mvel list
I'm using a map because this is a legacy class that is quite dynamic and can contain arbitrary tag/values. Ideally, if I knew all the attributes I would declare them as fields, but I'm stuck with this map at the moment. Regardless, using your explanation, why does when $person : Person( props[“AGE”] 20, (props[“NAME”] ==Fred || props[NAME] == Barney || props[NAME] == Wilma]) ) work? Corneil du Plessis-2 wrote: You are expecting map values to be elevated somehow from Object to Integer and String. By using typed attributes in the Person class you can overcome your problem. Sent from my HTC (Android) On Feb 21, 2010 9:28 PM, Adam Krieg spamcont...@mac.com wrote: I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map. class Person { Map props; public Map getProps(); …. Extra stuff } I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”. These entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”) rule My Rule dialect mvel when $person : Person( props[“AGE”] 20, props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”] ) then System.out.println(found match”+$person); End But I am running into a parsing error: no viable alternative at input ')' in rule My Rule in pattern Person. The second condition seems to be the problem. Can I check for membership inside a List I create inline in mvel? ___ 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 -- View this message in context: http://n3.nabble.com/Welcome-to-the-rules-users-mailing-list-tp325731p325878.html Sent from the Drools - User 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] memberOf mvel list
Hi Adam, try operator in instead of memberOf. AFAIK, in deals with list literals (which is what you want) whereas memberof can be used to check whether some value is part of a collection given as variable reference. Kind regards Ansgar Am 21.02.2010 23:14, schrieb deaddowney: I'm using a map because this is a legacy class that is quite dynamic and can contain arbitrary tag/values. Ideally, if I knew all the attributes I would declare them as fields, but I'm stuck with this map at the moment. Regardless, using your explanation, why does when $person : Person( props[“AGE”] 20, (props[“NAME”] ==Fred || props[NAME] == Barney || props[NAME] == Wilma]) ) work? Corneil du Plessis-2 wrote: You are expecting map values to be elevated somehow from Object to Integer and String. By using typed attributes in the Person class you can overcome your problem. Sent from my HTC (Android) On Feb 21, 2010 9:28 PM, Adam Kriegspamcont...@mac.com wrote: I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map. class Person { Map props; public Map getProps(); …. Extra stuff } I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”. These entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”) rule My Rule dialect mvel when $person : Person( props[“AGE”] 20, props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”] ) then System.out.println(found match”+$person); End But I am running into a parsing error: no viable alternative at input ')' in rule My Rule in pattern Person. The second condition seems to be the problem. Can I check for membership inside a List I create inline in mvel? ___ 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
Re: [rules-users] Rules categorization/packages
A new feature called Sharable artifacts/Global artifacts will be available in Drools 5.1. This feature allows you share an asset among different packages. It also creates a global area (you can consider it as a global package). Potentially you can promote an asset that you think is more appropriate to be defined in a global scope from your current package to the global area, so that this global asset can be reused by every package. This feature is already on trunk, maybe you want to give it a try. Any comments or feedbacks will be highly appreciated. Cheers, Jervis Amit Kumar wrote: Hello All, I am looking to organize the rules in different categories. But for distribution purposes We are creating packages for different roles/processing phases So a rule will reside in one pckage but for navigation it can belong to multiple categories So packages are like Shirts, Pants, Shoes, Sweaters Categories are Color, Material, Size, Gender and those have sub categories witin them We have rules which will device the category of the item Like red rule, blue rule, cloth rule, leather rule Now the problem we are facing is for category rules is if I define the rule in Shirt package .. then I will not be able ot use it in Pant package.. Will have to redefine it. The other problem in this scenario is If I have a price rule in Shirt package and the category is Blue Color and XL Size then I will have to put it in both categories When I put the Blue Rule on Blue Category and XL Rule on XL Category and I put the rule in both categories.. will it be an and relationship or will be an OR Regards, Amit ___ 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] Trying to build Drools trunk / getting build failure
On 21/02/2010 21:52, Chuck Irvine wrote: I'm trying to build Drools from the trunk. I updated from svn about 10 minutes ago. My build command was: mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=C:\tmp\drools\eclipse The result of my build is given below. I have two questions: 1. I'm a little confused about -DlocalEclipseDrop=C:\tmp\drools\eclipse. Is C:\tmp\drools\eclipse supposed to point to where I have eclipse installed. 2. Does the fact that 2 tests errored out mean that my build produced nothing useful? Tests run: 184, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.203 sec Running org.drools.integrationtests.ProcessEventTest Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.211 sec Results : Tests in error: testUnmarshallingPerformance(org.drools.integrationtests.LargeRuleBaseSerializationTest) testUnmarshallWithCompressionPerformance(org.drools.integrationtests.LargeRuleBaseSerializationTest) Those two are intermittent failures, we aren't sure why. You can get the last src build from here, saving the need to build trunk yourself: https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/ Mark Tests run: 1306, Failures: 0, Errors: 2, Skipped: 1 [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] There are test failures. Please refer to C:\Users\Chuck\workspace\drools-trunk\drools-compiler\target\surefire-reports for the individual test results. [INFO] [INFO] For more information, run Maven with the -e switch [INFO] [INFO] Total time: 9 minutes 14 seconds [INFO] Finished at: Sun Feb 21 15:35:42 CST 2010 [INFO] Final Memory: 27M/49M [INFO] ___ 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] memberOf mvel list
The original problem seems to be due to not using a *variable* on the right hand side of memberOf, as defined in Drools Expert, subsection 4.8.2.1.1.3.1., Operators. -W On Sun, Feb 21, 2010 at 11:14 PM, deaddowney spamcont...@mac.com wrote: I'm using a map because this is a legacy class that is quite dynamic and can contain arbitrary tag/values. Ideally, if I knew all the attributes I would declare them as fields, but I'm stuck with this map at the moment. Regardless, using your explanation, why does when $person : Person( props[“AGE”] 20, (props[“NAME”] ==Fred || props[NAME] == Barney || props[NAME] == Wilma]) ) work? Corneil du Plessis-2 wrote: You are expecting map values to be elevated somehow from Object to Integer and String. By using typed attributes in the Person class you can overcome your problem. Sent from my HTC (Android) On Feb 21, 2010 9:28 PM, Adam Krieg spamcont...@mac.com wrote: I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map. class Person { Map props; public Map getProps(); …. Extra stuff } I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”. These entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”) rule My Rule dialect mvel when $person : Person( props[“AGE”] 20, props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”] ) then System.out.println(found match”+$person); End But I am running into a parsing error: no viable alternative at input ')' in rule My Rule in pattern Person. The second condition seems to be the problem. Can I check for membership inside a List I create inline in mvel? ___ 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 -- View this message in context: http://n3.nabble.com/Welcome-to-the-rules-users-mailing-list-tp325731p325878.html Sent from the Drools - User 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