[rules-users] Drools library - updating Drools jar
Thanks to Edson and André for the very interesting discussion on maps in Drools. :) I suspect my follow up question got a bit buried in that thread and probably is a separate topic anyway, so I hope you don't mind my asking this newbie question in a new thread. All Drools projects created in Eclipse with the Drools plugin have a Drools library associated with them, which shows up as a Drools Library entry on the left in both project/package explorer, and in the project properties for the project - in the Libraries tab for the project properties' Java Build Path. My question is, how do you get Eclipse to recognise an updated jar in the Drools library please? Or perhaps it should be, how do you get Drools to recognise an update to a jar which it uses? Edson said in the other thread that I need to update my mvel jar to 2.0.12. I can only find 2.0.13 but no doubt that's also got the maps bugfix. However where I'm stuck is how get the Drools projects to use the updated jar. I've copied the 2.0.13 jar to the Drools runtime folder on my computer (both top level and subfolder). I've tried to add the 2.0.13 jar to the Java build path for the project as an external jar. I've tried to create a fresh Drools project in Eclipse. I've restarted Eclipse with -clean. The map issue is still there, and the Drools library for the Drools projects still don't even show 2.0.13 in the list of jars - just 2.0.10. I'm sure the crux of it is that somewhere Drools has been told to use 2.0.10, and I don't know how to tell it otherwise. I'm sure it's a really easy thing to do if you know how, but I've tried everything I can think of and am totally at a loss as to what to try next. (Probably try to rename 2.0.13 to 2.0.10, delete or rename the old 2.0.10 and restart Eclipse?). Would some kind person be able to point me in the right direction please? I'm trying to think of a workaround for my project that doesn't use maps, but ideally maps would be the best way. I'm willing to offer a box of chocolates or a bottle of wine or beer whatever your poison of choice, if blatant bribes will help! :D Many thanks. Any suggestions at all would be most appreciated. -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25057905.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] Collecting / sorting by the number of matches
Thank you Dave, point taken. :) If my deadline allows I'll try to do it using AgendaEventListener instead - the All Drools way! :D dave sinclair wrote: Just remember that doing it this way alleviates the author of the rules from having to add that book keeping when creating new rules. This may not be a *rule based* solution, but it is a *Drools* solution :) -- View this message in context: http://www.nabble.com/Collecting---sorting-by-the-number-of-matches-tp25039921p25058018.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] Guvnor and Drools 4.0.7
Hi All - Is Guvnor meant to work only with Drools 5? Thanks, Leo. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools library - updating Drools jar
I am no Eclipse expert, but: The correct way (TM): checkout the source code, change the pom.xml to use the correct MVEL version, rebuild the plugin and re-install. When we release the next version, just update it. The easy way (TM): add the new mvel jar to your eclipse project classpath and move it up to be before the drools library in the eclipse project classpath order. You will have both in the classpath, but being first in the classpath order will make eclipse use it. You must use 2.0.12 or 2.0.14-SNAPSHOT. When I tested 2.0.13 there was a regression, if I remember correctly. []s Edson 2009/8/20 KDR dr.sopr...@neverbox.com Thanks to Edson and André for the very interesting discussion on maps in Drools. :) I suspect my follow up question got a bit buried in that thread and probably is a separate topic anyway, so I hope you don't mind my asking this newbie question in a new thread. All Drools projects created in Eclipse with the Drools plugin have a Drools library associated with them, which shows up as a Drools Library entry on the left in both project/package explorer, and in the project properties for the project - in the Libraries tab for the project properties' Java Build Path. My question is, how do you get Eclipse to recognise an updated jar in the Drools library please? Or perhaps it should be, how do you get Drools to recognise an update to a jar which it uses? Edson said in the other thread that I need to update my mvel jar to 2.0.12. I can only find 2.0.13 but no doubt that's also got the maps bugfix. However where I'm stuck is how get the Drools projects to use the updated jar. I've copied the 2.0.13 jar to the Drools runtime folder on my computer (both top level and subfolder). I've tried to add the 2.0.13 jar to the Java build path for the project as an external jar. I've tried to create a fresh Drools project in Eclipse. I've restarted Eclipse with -clean. The map issue is still there, and the Drools library for the Drools projects still don't even show 2.0.13 in the list of jars - just 2.0.10. I'm sure the crux of it is that somewhere Drools has been told to use 2.0.10, and I don't know how to tell it otherwise. I'm sure it's a really easy thing to do if you know how, but I've tried everything I can think of and am totally at a loss as to what to try next. (Probably try to rename 2.0.13 to 2.0.10, delete or rename the old 2.0.10 and restart Eclipse?). Would some kind person be able to point me in the right direction please? I'm trying to think of a workaround for my project that doesn't use maps, but ideally maps would be the best way. I'm willing to offer a box of chocolates or a bottle of wine or beer whatever your poison of choice, if blatant bribes will help! :D Many thanks. Any suggestions at all would be most appreciated. -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25057905.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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Guvnor and Drools 4.0.7
Leonardo Gomes wrote: Hi All - Is Guvnor meant to work only with Drools 5? Yes. Thanks, Leo. ___ 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] Decision table problem
Hey I am using drools with a decision table (XLS). One of the conditions in the table is a call to a java method, c.checkFoo($1,$2)), where c is of type Foo. When I first created this method it took 2 integers and that worked fine, now I need to update it to take to strings instead. I have updated the method but when trying to it I get some errors. Some examples of values in the cells for this condition are [ 901, 910 ] [ 90AAA, 90ABC] For the first value I get this error: The method checkFoo(String, String) in the type Foo is not applicable for the arguments (int, int) For the second value I get this error: The method checkFoo(String, String) in the type Foo is not applicable for the arguments (int, int) Syntax error on token AAA, delete this token Syntax error on token AAC, delete this token How do I convince drools that the values in the cells should be read as strings and not integers? Kind Regards Alex ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Decision table problem
c.checkFoo($1,$2), -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Alex Esmann Sent: Thursday, August 20, 2009 10:15 AM To: Rules Users List Subject: [rules-users] Decision table problem Hey I am using drools with a decision table (XLS). One of the conditions in the table is a call to a java method, c.checkFoo($1,$2)), where c is of type Foo. When I first created this method it took 2 integers and that worked fine, now I need to update it to take to strings instead. I have updated the method but when trying to it I get some errors. Some examples of values in the cells for this condition are [ 901, 910 ] [ 90AAA, 90ABC] For the first value I get this error: The method checkFoo(String, String) in the type Foo is not applicable for the arguments (int, int) For the second value I get this error: The method checkFoo(String, String) in the type Foo is not applicable for the arguments (int, int) Syntax error on token AAA, delete this token Syntax error on token AAC, delete this token How do I convince drools that the values in the cells should be read as strings and not integers? Kind Regards Alex ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools library - updating Drools jar
Edson thank you very much for your suggestions. I wonder if it didn't work because I used 2.0.13? - I did that because I couldn't find 2.0.12 on the download page at http://docs.codehaus.org/display/MVEL/Downloading+MVEL - as you can see from the attached pic I did try adding that jar to the project build path, ahead of the standard Drools library. I'll download 2.0.14-SNAPSHOT and try it with that. Don't have the strength to rebuild etc right now! I'll report back. Thanks again for your help, much appreciated. :) http://www.nabble.com/file/p25063132/drools3.png drools3.png Edson Tirelli-3 wrote: I am no Eclipse expert, but: The correct way (TM): checkout the source code, change the pom.xml to use the correct MVEL version, rebuild the plugin and re-install. When we release the next version, just update it. The easy way (TM): add the new mvel jar to your eclipse project classpath and move it up to be before the drools library in the eclipse project classpath order. You will have both in the classpath, but being first in the classpath order will make eclipse use it. You must use 2.0.12 or 2.0.14-SNAPSHOT. When I tested 2.0.13 there was a regression, if I remember correctly. []s Edson -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25063132.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] Decision table problem
Hey, Thanks for the fast answer On Thu, 2009-08-20 at 10:24 -0400, Knapp, Barry wrote: c.checkFoo($1,$2), When I try that I just get a whole lot of these errors: [962,140]: [ERR 101] Line 962:140 no viable alternative at input '' [962,145]: [ERR 101] Line 962:145 no viable alternative at input '' /Alex -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Alex Esmann Sent: Thursday, August 20, 2009 10:15 AM To: Rules Users List Subject: [rules-users] Decision table problem Hey I am using drools with a decision table (XLS). One of the conditions in the table is a call to a java method, c.checkFoo($1,$2)), where c is of type Foo. When I first created this method it took 2 integers and that worked fine, now I need to update it to take to strings instead. I have updated the method but when trying to it I get some errors. Some examples of values in the cells for this condition are [ 901, 910 ] [ 90AAA, 90ABC] For the first value I get this error: The method checkFoo(String, String) in the type Foo is not applicable for the arguments (int, int) For the second value I get this error: The method checkFoo(String, String) in the type Foo is not applicable for the arguments (int, int) Syntax error on token AAA, delete this token Syntax error on token AAC, delete this token How do I convince drools that the values in the cells should be read as strings and not integers? Kind Regards Alex ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users !DSPAM:4a8d5ca239714658650203! ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Using in in Guvnor's Guided Rule Editor
Hello Rules Users, I think I've seen a message about this before, but I can not find it. We make heavy use of the in keyword in our current DRL rules files. We are trying to start using Guvnor and its Guided Rule Editor. Is there a way to use in in the Guided Rule Editor, other than by adding free form DRL? If there is not a way, can anyone propose another way to accomplish the same goal? Also if you can't use in in the Guided Rule Editor, is there an open feature request? Thanks, Steve Ronderos ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use xml file instead of java object ?
Hi, have a look at the dsl: http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_6/product/services/jbrules/src/main/resources/XPathLanguage.dsl This rule expects an object of type org.jboss.soa.esb.message.Message which contains the XML in its body. Also note that a lot of stuff is going on behind the scenes: http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_6/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java Drools Pipeline might be helpful in inserting XML data into sessions. https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e1992 Cheers, Jarek tv.raghavan wrote: I remember seeing a sample in jboss-esb sample where they were able to use xpath to query a xml file [sample extract] package com.jboss.soa.esb.routing.cbr #list any import classes here. import org.jboss.soa.esb.message.Message; import org.jboss.soa.esb.message.format.MessageType; expander XPathLanguage.dsl #declare any global variables here global java.util.List destinations; rule Blue Routing Rule using XPATH when xpathEquals /Order/@statusCode, 0 then Log : Blue Team; Destination : blue; end Is it possible to use this approach to use a xml as input to drool vs java object ? Thanks, -Raghav ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools library - updating Drools jar
There's another way. In the Eclipse Plugin Preferences (Eclipse - Preferences - Drools - Installed Drools Runtime) you point to the location of the Drools runtime you want to use. If you swap out the MVEL file at the location of your Drools Runtime it should pick up the right version of the MVEL. You could also duplicate the jar files in that folder into a Patch folder, replace the MVEL jar in the PATCH copy, and setup a Patch Drools Runtime if you want to keep your original installation pristine. You will likely need/want to bounce Eclipse for this to take effect. From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Thursday, August 20, 2009 12:12 PM To: Rules Users List Subject: Re: [rules-users] Drools library - updating Drools jar Does not matter the order in the libraries tab. You need to set them in the Order and Export tab. []s Edson 2009/8/20 KDR dr.sopr...@neverbox.com Edson thank you very much for your suggestions. I wonder if it didn't work because I used 2.0.13? - I did that because I couldn't find 2.0.12 on the download page at http://docs.codehaus.org/display/MVEL/Downloading+MVEL - as you can see from the attached pic I did try adding that jar to the project build path, ahead of the standard Drools library. I'll download 2.0.14-SNAPSHOT and try it with that. Don't have the strength to rebuild etc right now! I'll report back. Thanks again for your help, much appreciated. :) http://www.nabble.com/file/p25063132/drools3.png drools3.png Edson Tirelli-3 wrote: I am no Eclipse expert, but: The correct way (TM): checkout the source code, change the pom.xml to use the correct MVEL version, rebuild the plugin and re-install. When we release the next version, just update it. The easy way (TM): add the new mvel jar to your eclipse project classpath and move it up to be before the drools library in the eclipse project classpath order. You will have both in the classpath, but being first in the classpath order will make eclipse use it. You must use 2.0.12 or 2.0.14-SNAPSHOT. When I tested 2.0.13 there was a regression, if I remember correctly. []s Edson -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25 063132.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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools library - updating Drools jar
Cool, living and learning! Thanks, Edson 2009/8/20 Pegram, Macon zmpeg...@choosehmc.com There’s another way….. In the Eclipse Plugin Preferences (Eclipse - Preferences - Drools - Installed Drools Runtime) you point to the location of the Drools runtime you want to use. If you swap out the MVEL file at the location of your Drools Runtime it should pick up the right version of the MVEL. You could also duplicate the jar files in that folder into a “Patch” folder, replace the MVEL jar in the PATCH copy, and setup a “Patch Drools Runtime” if you want to keep your original installation pristine. You will likely need/want to bounce Eclipse for this to take effect. -- *From:* rules-users-boun...@lists.jboss.org [mailto: rules-users-boun...@lists.jboss.org] *On Behalf Of *Edson Tirelli *Sent:* Thursday, August 20, 2009 12:12 PM *To:* Rules Users List *Subject:* Re: [rules-users] Drools library - updating Drools jar Does not matter the order in the libraries tab. You need to set them in the Order and Export tab. []s Edson 2009/8/20 KDR dr.sopr...@neverbox.com Edson thank you very much for your suggestions. I wonder if it didn't work because I used 2.0.13? - I did that because I couldn't find 2.0.12 on the download page at http://docs.codehaus.org/display/MVEL/Downloading+MVEL - as you can see from the attached pic I did try adding that jar to the project build path, ahead of the standard Drools library. I'll download 2.0.14-SNAPSHOT and try it with that. Don't have the strength to rebuild etc right now! I'll report back. Thanks again for your help, much appreciated. :) http://www.nabble.com/file/p25063132/drools3.png drools3.png Edson Tirelli-3 wrote: I am no Eclipse expert, but: The correct way (TM): checkout the source code, change the pom.xml to use the correct MVEL version, rebuild the plugin and re-install. When we release the next version, just update it. The easy way (TM): add the new mvel jar to your eclipse project classpath and move it up to be before the drools library in the eclipse project classpath order. You will have both in the classpath, but being first in the classpath order will make eclipse use it. You must use 2.0.12 or 2.0.14-SNAPSHOT. When I tested 2.0.13 there was a regression, if I remember correctly. []s Edson -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25063132.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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools library - updating Drools jar
Does not matter the order in the libraries tab. You need to set them in the Order and Export tab. []s Edson 2009/8/20 KDR dr.sopr...@neverbox.com Edson thank you very much for your suggestions. I wonder if it didn't work because I used 2.0.13? - I did that because I couldn't find 2.0.12 on the download page at http://docs.codehaus.org/display/MVEL/Downloading+MVEL - as you can see from the attached pic I did try adding that jar to the project build path, ahead of the standard Drools library. I'll download 2.0.14-SNAPSHOT and try it with that. Don't have the strength to rebuild etc right now! I'll report back. Thanks again for your help, much appreciated. :) http://www.nabble.com/file/p25063132/drools3.png drools3.png Edson Tirelli-3 wrote: I am no Eclipse expert, but: The correct way (TM): checkout the source code, change the pom.xml to use the correct MVEL version, rebuild the plugin and re-install. When we release the next version, just update it. The easy way (TM): add the new mvel jar to your eclipse project classpath and move it up to be before the drools library in the eclipse project classpath order. You will have both in the classpath, but being first in the classpath order will make eclipse use it. You must use 2.0.12 or 2.0.14-SNAPSHOT. When I tested 2.0.13 there was a regression, if I remember correctly. []s Edson -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25063132.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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Hooray! Re: Drools library - updating Drools jar
Thanks Macon and Edson. Macon I did try the swapping out in the Drools runtime folder (i.e. removing the 2.0.10 jars and adding in the 2.0.14_snapshot), but then Eclipse completely died (errors even with the existing rules, because they no longer were able to resolve types). I figure that was because the plugin was still looking for 2.0.10 and wasn't happy that only 2.0.14_snapshot was on offer. This is what I did before trying a new runtime folder: - Downloaded 2.0.14_snapshot and saved it into my current Drools runtime folder (both top level and lib for luck) - Added 2.0.14_snapshot as an external JAR to my project's Java build path in Eclipse - it was at the top (as in the pic in one of my previous posts). - Didn't work (even on restarting Eclipse) so I guess it didn't use 2.0.14_snapshot even tho' it was at the top of the build path list. Again, because I think the plugin was looking for 2.0.10. Then I did this, which worked! - I know it was probably a bit naughty of me because I really ought to be editing the POM and rebuilding it all as Edson suggested, but a workaround is a workaround... - Closed Eclipse. - Renamed the 2.0.10 to something else in top level and lib subfolders of the Drools Runtime folder - Renamed 2.0.14_snapshot to the 2.0.10 name in both folders - Restarted Eclipse - It works! To be precise, because the bug I was trying to get the fix for was described in another thread, it is now accepts - m: Map( this[$str] == 1 ) without any org.drools.RuntimeDroolsException: Exception executing predicate this[$str] == 1 - and the rule even runs as expected. I'm waiting till tomorrow before really celebrating, just in case, but I think that did it. If it reverts back to the old problem, I will try your brand new runtime folder suggestion then, Macon. Thanks again for everyone's help. Edson Tirelli-3 wrote: Cool, living and learning! Thanks, Edson 2009/8/20 Pegram, Macon zmpeg...@choosehmc.com There’s another way….. In the Eclipse Plugin Preferences (Eclipse - Preferences - Drools - Installed Drools Runtime) you point to the location of the Drools runtime you want to use. If you swap out the MVEL file at the location of your Drools Runtime it should pick up the right version of the MVEL. You could also duplicate the jar files in that folder into a “Patch” folder, replace the MVEL jar in the PATCH copy, and setup a “Patch Drools Runtime” if you want to keep your original installation pristine. You will likely need/want to bounce Eclipse for this to take effect. -- View this message in context: http://www.nabble.com/Drools-library---updating-Drools-jar-tp25057905p25066246.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] MVEL syntax String as key for maps Re: Maps in Drools
Just to report back. Downloading the mvel2-2.0.14-SNAPSHOT.jar and renaming it to mvel2-2.0.10.jar in my Drools runtime folder (top level and lib) while renaming the old mvel2-2.0.10.jars to something else. got this to work: $m: Map( this[$str] == 1 ) However, although the MVEL page at http://mvel.codehaus.org/MVEL+2.0+Property+Navigation says For Maps that use a String as a key, you may use another special syntax: user.foobar I found that $m: Map( this.$str == 1 ) still produces the same error as before. I don't know if this is only because that particular special MVEL syntax is not supported in Drools (obviously it's not a major thing as [$str] works), or because there's still a bug there. Just thought I ought to mention it in case it's a bug. Cheers. KDR wrote: Hi, I'm relatively new to both Java and Drools. I'm trying to figure out how to use maps in Drools. I've looked at the thread http://www.mail-archive.com/rules-users@lists.jboss.org/msg09802.html From what I've read generally it seems best to insert objects directly rather than use nested accessors. So I've been experimenting with trying to insert a map and then checking stuff in it. I set up a simple test map of String to Integer, with just a as key and 1 as value, and b with 2. MapString, Integer map = new HashMapString, Integer(); map.put(a, 1); map.put(b, 2); String a = a; I then inserted the map and also inserted the String a of value a. Here's the test rule, with various things I tried commented out: rule testing maps dialect mvel when $str: String() // $m: Map( this[$str] == 1 ) # error // $m: Map( this.$str == 1 ) # error // $m: Map( this[$str] == 1 ) # compiles but rule won't fire $m: Map( this[a] == 1 ) # this works however! then System.out.println($m[$str]); #also works with String and Map objects no conditions end It obviously doesn't like it when I try to use the String object as the key for the map. But it works when I use a String literal as the key. What am I doing wrong? Does anyone have any suggestions please, or shall I give up and either use eval as mentioned in http://www.mail-archive.com/rules-users@lists.jboss.org/msg09716.html or use the map as a field of another object which I insert instead of the map (in fact that was my original plan!)? I'd also need to test for null i.e. whether a key/value pair exists for a given String as the key. Any thoughts would be very much appreciated. Many thanks in advance. -- View this message in context: http://www.nabble.com/Maps-in-Drools-tp25031348p25066578.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] Maps in Drools
Edson Tirelli schrieb: ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end Okay, so in the mvel syntax this is possible. Can this also be achieved in the default rule syntax, without mvel? The mvel syntax needs to be interpreted at runtime, so my Clojure lib will have to output rules in Drools' native rule language. What interests me most is that first part: Map( this[type] == Point, $x : this[x] ) André -- Lisp is not dead. It’s just the URL that has changed: http://clojure.org/ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Maps in Drools
Edson Tirelli schrieb: So, in principle having Maps support in the LHS is not a big challenge? No. Just requires developing a set of classes to work with maps. Being brief: * Implement: MapObjectType extends ObjectType * Implement: MapReadAccessor and MapWriteAccessor * Add support to them into the builders (i.e., the actual wiring of the new classes) * Test everything... I probably forgot something, since there's been quite some time since I worked on this. Would there not be an addition to the syntax needed, for the default rule language? For mvel it would not require a change I guess. Could you please explain this in a bit more detail? Lets call |A| the number of A facts in the working memory and |B| the number of B facts (i.e. cardinality). Lets call p(|A|,|B|) the number of partial matches a rule will create given the cardinality of A and B. Imagine your rule is: when A() B() then This rule creates a join between A() and B() and the number of join attempts will be: p(|A|,|B|) = |A| * |B| Now, if instead of representing A and B as different classes you use Maps with the type attribute as you was suggesting: $a : Map() $b : Map() eval( ... ) The number of partial matches will be: p(|A|,|B|) = (|A|+|B|)! / (|A|+|B|-2)! Ah yes okay, I see what you mean. Well, the current situation for me is that I have to do exactly that. As it is typical for Clojure apps to store data in Maps I need support for that. So, I want to allow rules like: (map-rule Rule name, type (when Customer ( $cust-id id ) DailyOrders (= 1 (get count $cust-id))) (then (println match))) This is semantically exactly the same as in your example, where Customer and DailyOrders were POJOs, while they are for me Maps. Draw the graph for these two functions and you will get the picture. If you have more than 2 patterns, situation gets worst and worst. If instead of eval() you use some alpha constraints, things go down to the same level as using different classes: $a : Map( this[type] == A ) $b : Map( this[type] == B ) The above will result in the same p(|A|,|B|) = |A| * |B| partial matches. Hmm, but the MVEL syntax can not magically eliminate the eval. Under the hood the map accesses will still be inside an eval. Marc confirmed that a few days ago. MVEL only hides this from the user. This is what I will also do. But under the hood it will become $a:Map() $b:Map() eval( $a.get(type) == Customer ) eval( $b.get(type) == DailyOrders ) And the only reason why I need to do it this way is because in its current version Drools does not support Maps as 1st class objects. If it would, then the eval would not be needed anymore. So, for Clojure users (and basically everyone else who stores data inside Maps, for whatever the reasons may be) it would be so good to have that support. You gave a perfect explanation of why this would be a great addition. The actual rule syntax is not important for me. My lib will hide it, as MVEL already does now. But my lib will compile the rules into the fast native rule language. It won't be interpreted or any slower than hand written rules. But currently I am forced to produce this cross product, as there is no direct support for Maps yet. 2009/8/19 André Thieme address.good.until.2009.dec...@justmail.de mailto:address.good.until.2009.dec...@justmail.de Edson Tirelli schrieb: I will skip the first half of your e-mail as I am not sure what were the reasons for your nit-picking. If my explanation was not helpful for the public it was intended to, you are welcome to explain yourself. Oh, I did not intend it to sound like nit-picking. I only meant that with a specialized syntax one can make rules operating on Maps looking basically identical to the ones operating on POJOs. Regarding the part that matters, i.e., adding the support to other fact types, Drools is prepared to support them in the LHS. Let me explain by example: when $c : Customer( name == bob ) then For the reasoning algorithm, does not matter if Customer is a POJO, an XML document, a Map with the type attribute set to Customer as you mentioned, or whatever you can think. We use a set of interfaces that allows us to completely abstract that and we even supported 2 different fact types as a proof of concept in the past. That sounds good! So, in principle having Maps support in the LHS is not a big challenge? As I understand it, code inside an eval can not be cached and needs to get executed every time and results in less performant code. The only reason we did not support multiple fact types yet for Drools is the RHS. Our reasoning is that does not make sense to abstract the LHS if you don't do the same for
Re: [rules-users] Drools and Clojure
Mark Proctor schrieb: André Thieme wrote: Mark Proctor schrieb: Map( this['c'] == 206 ) That should work, we do support MVEL syntax for maps and arrays - we just don't suppor method calls, yet. Hello Mark. I just tested it and it indeed works for me. Although as I understand it, this will be compiled into an expression using eval (or it will even be only interpreted). So, if that is true it can't bring any performance advantage. yes, no performance benefit. As this form of use is a return value really, it should be possible to index (if we assume that nest objects do not change). Although it's a fair bit of work to do this, but interesting work - if anyone wants to help out :) It would be fantastic if there was the same optimization support for Maps available as it exists for POJOs. Edson gave a great explanation on how things slow down for cross products. I thought about one thing: Could there could maybe be a new attribute, immutable true or something like that, which would signal that the rule writer promises the engine that only immutable objects are used? That way my lib could implicitly always set that attribute. The syntax is nothing I worry about. In Clojure, which is a Lisp, I have macros and can remove any obstacles in the syntax I like. It is trivial to develop new domain specific languages for rules. So, my rule syntax for Clojure will look very lispy, and each user is free to change and extend it. I will also allow the RHS to be written in Clojure code, no Java needed. Btw if you are doing lispy stuff: http://blog.athico.com/2008/02/drools-clips.html http://blog.athico.com/2008/06/drools-clips-progress.html Ah yes, very interesting. In principle it is very similar what I do. With Clojure there is a full featured Lisp on the JVM. What I do is adding some functions and macros, easy to use, which will do all the Drools managing and hide it from the user. It will be simple to add all kinds of syntaxes as soon I am done. You can have the Jess syntax. Just write a macro and expand it into mine. It will result in compiled rules code. So, in some days (when I have time) the project above will be finished ;-) see Null-Safe Bean Navigation http://mvel.codehaus.org/MVEL+2.0+Property+Navigation Ah of course, I forgot the null. And MVEL already has the check built in. I think I will also implicitly add it. And another interesting thing I noticed: to both rules I added the line global String s; and in the LHS's of both rules I removed the c and put s at its place. Then the first thing I did after creating a session was to (.setGlobal session s c) The rule 1 accepted this change. I can use s instead of c. But there is still the limitation that I can only insert Maps into the session which do have the String c as key. Otherwise: NPE. The rule 2 (mvel) however does not accept s as a placeholder. I get: Exception executing predicate this[s] == 206 [Thrown class org.drools.RuntimeDroolsException] Any ideas how to get rid of the NPE? We'll have to look into this, probably a bug. Edson confirmed that this is an MVEL problem. In a different thread KDR may have discovered another one. André -- Lisp is not dead. It’s just the URL that has changed: http://clojure.org/ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Maps in Drools
André Thieme wrote: Edson Tirelli schrieb: ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end We default to MVEL, because it's simple and already contains everything we need for expression evaluation. However it would definitely be possible to implement this natively, effectively emulating MVEL - although you need to think what this actual buys? It doesn't buy indexing, as it's not MVEL that is the problem here. Mark Okay, so in the mvel syntax this is possible. Can this also be achieved in the default rule syntax, without mvel? The mvel syntax needs to be interpreted at runtime, so my Clojure lib will have to output rules in Drools' native rule language. What interests me most is that first part: Map( this[type] == Point, $x : this[x] ) André ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools and Clojure
André Thieme wrote: Mark Proctor schrieb: André Thieme wrote: Mark Proctor schrieb: Map( this['c'] == 206 ) That should work, we do support MVEL syntax for maps and arrays - we just don't suppor method calls, yet. Hello Mark. I just tested it and it indeed works for me. Although as I understand it, this will be compiled into an expression using eval (or it will even be only interpreted). So, if that is true it can't bring any performance advantage. yes, no performance benefit. As this form of use is a return value really, it should be possible to index (if we assume that nest objects do not change). Although it's a fair bit of work to do this, but interesting work - if anyone wants to help out :) It would be fantastic if there was the same optimization support for Maps available as it exists for POJOs. Edson gave a great explanation on how things slow down for cross products. I thought about one thing: Could there could maybe be a new attribute, immutable true or something like that, which would signal that the rule writer promises the engine that only immutable objects are used? That way my lib could implicitly always set that attribute. It could certainly be done, lots of ways to cook this - from annotation on the pojo, type declarations and possibly some annotation on the rule or pattern itself. If you want to take a crack at this, you know where to find us :) http://www.jboss.org/drools/irc.html Mark The syntax is nothing I worry about. In Clojure, which is a Lisp, I have macros and can remove any obstacles in the syntax I like. It is trivial to develop new domain specific languages for rules. So, my rule syntax for Clojure will look very lispy, and each user is free to change and extend it. I will also allow the RHS to be written in Clojure code, no Java needed. Btw if you are doing lispy stuff: http://blog.athico.com/2008/02/drools-clips.html http://blog.athico.com/2008/06/drools-clips-progress.html Ah yes, very interesting. In principle it is very similar what I do. With Clojure there is a full featured Lisp on the JVM. What I do is adding some functions and macros, easy to use, which will do all the Drools managing and hide it from the user. It will be simple to add all kinds of syntaxes as soon I am done. You can have the Jess syntax. Just write a macro and expand it into mine. It will result in compiled rules code. So, in some days (when I have time) the project above will be finished ;-) see Null-Safe Bean Navigation http://mvel.codehaus.org/MVEL+2.0+Property+Navigation Ah of course, I forgot the null. And MVEL already has the check built in. I think I will also implicitly add it. And another interesting thing I noticed: to both rules I added the line global String s; and in the LHS's of both rules I removed the c and put s at its place. Then the first thing I did after creating a session was to (.setGlobal session s c) The rule 1 accepted this change. I can use s instead of c. But there is still the limitation that I can only insert Maps into the session which do have the String c as key. Otherwise: NPE. The rule 2 (mvel) however does not accept s as a placeholder. I get: Exception executing predicate this[s] == 206 [Thrown class org.drools.RuntimeDroolsException] Any ideas how to get rid of the NPE? We'll have to look into this, probably a bug. Edson confirmed that this is an MVEL problem. In a different thread KDR may have discovered another one. André ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Here is a ResultSetCompiler for drools-templates
I’ve been trying out the DROOLS-TEMPLATES project, really impressed so far, surprised there isn’t more buzz about this project. I wrote a new version of the DataProviderCompiler that takes a SQL ResultSet instead of a org.drools.template.DataProvider. I don’t think it will be useful to that many people, so I’m not going to try and add it to the code base, but I’ll provide it here. I used it for testing out templates, but for our actual production code, I will naturally be using Hibernate to retrieve the rules from the DB (so I can take advantage of Hibernate cache.) It is much quicker to set up a template test with this compiler though. It also allows you to put the data in whatever types you like in the database, as long as you add a String converter for that type in processData(), like: pre case java.sql.Types.DOUBLE: cell = String.valueOf(rs.getInt(cellNum)); break; /pre Calling Code (based on drools-examples\drools-examples-drl\src\main\java\org\drools\examples\DataDrivenTemplateExample.java) pre ResultSet rs; try { Statement sta = conn.createStatement(); rs = sta.executeQuery(SELECT * FROM RulePricingPolicy); // TODO: you need to catch or handle } catch (SQLException e) { } final ResultSetCompiler converter = new ResultSetCompiler(); final String drl = converter.compile(rs, getTemplate()); /pre Here is the ResultSet Compiler: pre import org.drools.template.parser.TemplateContainer; import org.drools.template.parser.DefaultTemplateContainer; import org.drools.template.parser.TemplateDataListener; import org.drools.template.parser.DataListener; import java.io.InputStream; import java.util.List; import java.util.ArrayList; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; /** * p A Drools template compiler which takes a ResultSet and compiles it into * a template using DefaultTemplateContainer. * /p * * @author bxt, Aug 19, 2009 1:53:38 PM * br * Copyright © 2008 Customized Services Administrators, Inc. * All Rights Reserved. */ public class ResultSetCompiler { /** * Generates DRL from a data provider for the spreadsheet data and templates. * * @param rs the resultset for the table data * @param template the string containing the template resource name * @return the generated DRL text as a String */ public String compile(final ResultSet rs, final String template) { final InputStream templateStream = this.getClass().getResourceAsStream(template); return compile(rs, templateStream); } /** * Generates DRL from a data provider for the spreadsheet data and templates. * * @param rs the resultset for the table data * @param templateStream the InputStream for reading the templates * @return the generated DRL text as a String */ public String compile(final ResultSet rs, final InputStream templateStream) { TemplateContainer tc = new DefaultTemplateContainer(templateStream); closeStream(templateStream); return compile(rs, new TemplateDataListener(tc)); } /** * Generates DRL from a data provider for the spreadsheet data and templates. * * @param rs the resultset for the table data * @param listener a template data listener * @return the generated DRL text as a String */ public String compile(final ResultSet rs, final TemplateDataListener listener) { ListDataListener listeners = new ArrayListDataListener(); listeners.add(listener); processData(rs, listeners); return listener.renderDRL(); } /** * Iterate through the resultset. * @param rs the resultset for the table data * @param listeners list of template data listener */ private void processData(final ResultSet rs, ListDataListener listeners) { try { ResultSetMetaData rsmd = rs.getMetaData(); int colCount = rsmd.getColumnCount(); int i = 0; while (rs.next()) { newRow(listeners, i, colCount); for (int cellNum = 1; cellNum colCount + 1; cellNum++) { String cell; int sqlType = rsmd.getColumnType(cellNum); switch (sqlType) { case java.sql.Types.DATE: cell = rs.getDate(cellNum).toString(); break; case java.sql.Types.INTEGER: case java.sql.Types.DOUBLE: cell = String.valueOf(rs.getInt(cellNum)); break; default: cell = rs.getString(cellNum); } newCell(listeners, i, cellNum -1, cell,
Re: [rules-users] Maps in Drools
Mark Proctor schrieb: André Thieme wrote: Edson Tirelli schrieb: ooops... correct version: when Map( this[type] == Point, $x : this[x] ) Map( this[type] == Circle, this[x] == $x ) then end We default to MVEL, because it's simple and already contains everything we need for expression evaluation. However it would definitely be possible to implement this natively, effectively emulating MVEL - although you need to think what this actual buys? It doesn't buy indexing, as it's not MVEL that is the problem here. Ah okay, I didn't know that you are now defaulting to MVEL. Pretty much all the examples I found online and in the books don't use MVEL. You asked about what it buys: maybe nothing. I am very new to Drools and still need more experience. But now at least I *think* that MVEL rules run slower. I read on the official website that MVEL gets interpreted at runtime. Some days ago Greg did a little test: http://www.mail-archive.com/rules-users@lists.jboss.org/msg09839.html Right now it seems that Drools used from within Clojure would perform not too well in real world examples, because complex rules will have to look at 3-5 Maps. That would mean, as Edson explained, a cross product of all maps, which will reduce performance. If I don't use mvel I will manually say: $m1:Map() $m2:Map() $m3:Map() $m4:Map() eval ( $m1.get ...) eval ( $m2.get ...) and so on. In MVEL syntax it *looks* nicer, because I can make constraints directly by using the this keyword. But as MVEL is nothing but syntactic sugar over the real thing it will need to do the same when the program is running. On top of that, MVEL will be interpreted, thus resulting in even slower execution, although the rules will look more nicely. Now while I write this I just got a new thought: when the Drools engine is fed with the rules, it will also have to compile them, or interpret them at at runtime. I take a string s and do a s.getBytes(utf-8) and have this as an argument to ResourceFactory.newByteArrayResource. This is how I get rules into the Drools engine. It works. But now my new thought: shouldn't I be able to create new rules by purely writing Java code? If that were possible, then I would not compile my Clojure code into a string of either MVEL dialect or non-MVEL, but instead compile it to code which will do everything that would have happened if I had used a user readable string. Yeah, now that I think about it, then *this* is the right way how I should do it. That way I can do anything that Drools allows and not depend on any dialect. And my code would be compiled into byte code at runtime. No interpretation at all. Cool :) Now that I think about it: you could even trivially get a new dialect then with my library. dialect Lisp could be the attribute. That one would be as easy as mvel, but lispish (= more parens), but it would run at max speed, because it could be compiled directly into byte code. And it would be trivial to have a domain specific language with that. Could you please give me a start for a trivial example? rule points when Point( x == 0 ) then System.out.println(foobar); end where Point would be a public class Point { private int x; private int y; } plus two getters and a constructor. The rule points. If you would not have this as a file on disk or as a string in ram, but would want to add it with pure Java code, how would you then do it? André -- Lisp is not dead. It’s just the URL that has changed: http://clojure.org/ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] extends in rules
Hi, I found an example on using extends to extend a rule from another rule. Using extends would only include the WHEN side of the rule. I want to use the variable defined in the parent rule in sub rule ,something like below example,how do i do that? rule A when $a:String( ) eval($a==abc) then do something end rule B extends A when $b:String( ) $c:SomeClass() then $c.someMethod($a,$b) //i am not able to use $a here end Any suggestions? Thanks Chandana ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] extends in rules
It should work fine, the entire LHS is basically copied to the second rule. Just try it with it all in one rule and make sure you syntax is correct. -Michael On Aug 20, 2009, at 8:30 PM, Chandana Pingle chandana.pin...@intunity.com.au wrote: Hi, I found an example on using extends to extend a rule from another rule. Using extends would only include the WHEN side of the rule. I want to use the variable defined in the parent rule in sub rule ,something like below example,how do i do that? rule A when $a:String( ) eval($a==abc) then do something end rule B extends A when $b:String( ) $c:SomeClass() then $c.someMethod($a,$b) //i am not able to use $a here end Any suggestions? Thanks Chandana ___ 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] when condition on multiple facts of the same type
It seems that the problem was that I had ObligationComplianceEvent defined as an event. When I leave it as a normal fact it works fine. Can anyone explain why this is? Its a problem as I need the timestamp to be present for other things... 2009/8/18 Greg Barton greg_bar...@yahoo.com Doesn't seem to be a problem. See attached project. --- On Mon, 8/17/09, Justin King justin.matthew.k...@gmail.com wrote: From: Justin King justin.matthew.k...@gmail.com Subject: [rules-users] when condition on multiple facts of the same type To: Rules Users List rules-users@lists.jboss.org Date: Monday, August 17, 2009, 8:24 PM I'm trying to have a rule execute based on the following condition: ObligationComplianceEvent(term == term 1, obligation == obligation 1, level == 1) ObligationComplianceEvent(term == term 2, obligation == obligation 1, level == 1) I pass in two facts of type ObligationComplianceEvent with the values shown above but the rule does not execute. It only executes if I put an 'or' like so ObligationComplianceEvent(term == term 1, obligation == obligation 1, level == 1) or ObligationComplianceEvent(term == term 2, obligation == obligation 1, level == 1) Any help on what the correct way to do this is? I'm guessing its because it does not distinguish the two lines as two different facts, so because neither of the facts has the value 'term 1' and 'term 2' it never executes. Thanks for any help. Justin -Inline Attachment Follows- ___ 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] when condition on multiple facts of the same type
Does your event have an @expires time? If you're running in STREAM mode events will be garbage collected when they expire, and by default that's when the match no rules. If you specify an @expires value they will hang around for that time period even if they match nothing. So, with no @expires specified, two events would have to be inserted simultaneously to match. If you're in CLOUD mode I'm not sure what's up. :) --- On Thu, 8/20/09, Justin King justin.matthew.k...@gmail.com wrote: From: Justin King justin.matthew.k...@gmail.com Subject: Re: [rules-users] when condition on multiple facts of the same type To: Rules Users List rules-users@lists.jboss.org Date: Thursday, August 20, 2009, 9:28 PM It seems that the problem was that I had ObligationComplianceEvent defined as an event. When I leave it as a normal fact it works fine. Can anyone explain why this is? Its a problem as I need the timestamp to be present for other things... 2009/8/18 Greg Barton greg_bar...@yahoo.com Doesn't seem to be a problem. See attached project. --- On Mon, 8/17/09, Justin King justin.matthew.k...@gmail.com wrote: From: Justin King justin.matthew.k...@gmail.com Subject: [rules-users] when condition on multiple facts of the same type To: Rules Users List rules-users@lists.jboss.org Date: Monday, August 17, 2009, 8:24 PM I'm trying to have a rule execute based on the following condition: ObligationComplianceEvent(term == term 1, obligation == obligation 1, level == 1) ObligationComplianceEvent(term == term 2, obligation == obligation 1, level == 1) I pass in two facts of type ObligationComplianceEvent with the values shown above but the rule does not execute. It only executes if I put an 'or' like so ObligationComplianceEvent(term == term 1, obligation == obligation 1, level == 1) or ObligationComplianceEvent(term == term 2, obligation == obligation 1, level == 1) Any help on what the correct way to do this is? I'm guessing its because it does not distinguish the two lines as two different facts, so because neither of the facts has the value 'term 1' and 'term 2' it never executes. Thanks for any help. Justin -Inline Attachment Follows- ___ 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 -Inline Attachment Follows- ___ 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] extends in rules
Thanks for ur reply That works if i put everthing in one rule. When using extends and trying to access the variable in RHS of sub rule error in the editor is Builder Error:Internal Error:Unable to find declaration in list while generating the consequence invoker Thanks Chandana On 8/21/09, mrho...@franklinamerican.com mrho...@franklinamerican.com wrote: It should work fine, the entire LHS is basically copied to the second rule. Just try it with it all in one rule and make sure you syntax is correct. -Michael On Aug 20, 2009, at 8:30 PM, Chandana Pingle chandana.pin...@intunity.com.au wrote: Hi, I found an example on using extends to extend a rule from another rule. Using extends would only include the WHEN side of the rule. I want to use the variable defined in the parent rule in sub rule ,something like below example,how do i do that? rule A when $a:String( ) eval($a==abc) then do something end rule B extends A when $b:String( ) $c:SomeClass() then $c.someMethod($a,$b) //i am not able to use $a here end Any suggestions? Thanks Chandana ___ 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