Re: [rules-users] Collect from
Try this: rule "FindMismatchedBars" when f : Foo(fooId : id) bars : ArrayList() from collect( Bar(id != fooId) ) then System.out.println( "For " + f + " got " + bars ); end And see attached project. --- On Tue, 8/18/09, techy wrote: > From: techy > Subject: Re: [rules-users] Collect from > To: rules-users@lists.jboss.org > Date: Tuesday, August 18, 2009, 12:07 PM > > Please someone help me on this. > > techy wrote: > > > > I would like to collect All Foo() for which there is > no Bar() as given > > below.Please help me on this. > > Thanks. > > > > //psedo rule > > rule 'test' > > list : from collect( Foo(fooId: id) and not Bar(id > !=fooId)) > > then > > //do conseq > > end > > > > -- > View this message in context: > http://www.nabble.com/Collect-from-tp25014904p25029332.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 > DroolsCollectUnlike.tar.gz Description: GNU Zip compressed data ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How to change default Persistence Manager , Hibernate in Drools Flow to OFBiz entityengine persistence manager
Hi Users, I have a doubt regarding the persistance mechnanism in Drools Flow. By default drools flow supports Hibernate as persistence manager.Now I am integrating Drools Flow with OFBiz and OFBiz uses entityengine as a persistence manager. "http://ofbiz.apache.org/docs/entity.html"; Now I have seen in the docs that persistence manager can be changed by changing the default setting in persistence.xml. So can you please tell me what are the things I have to do to use my persistence manager and use Mysql database instead of file-based H2database. Also is this possible to use OFBiz pesistence manager here? Please help me to achieve this as it is very urgent. Thanks & Regards Pardeep Ruhil L&T Infotech Ltd Mumbai Ph: +919820283884 Larsen & Toubro Infotech Ltd. www.Lntinfotech.com This Document is classified as: L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech Internal Use Only L&T Infotech General Business This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. _ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Maps in Drools
Many thanks for your replies André and Edson. For some reason they hadn't shown up on my computer before I posted my follow up info. I'll download the updated jar and cross my fingers! On the general issue, is it received wisdom that it's better not to insert map objects direct, at least for now until map support is fully there - or is it 6 of one / half a dozen? André on your point below: André Thieme-4 wrote: > > KDR schrieb: >> I'd also need to test for null i.e. whether a key/value pair exists for a >> given String as the key. > > This seems to be only true when you go the route that I go, namely using > the default rule syntax, i.e., eval. > - I don't think I quite follow? If I need to check whether the key/value pair exists for a particular String key i.e. whether the get(key) returns null, is the only way to do that currently by using the eval? Cheers and thanks again for the help. -- View this message in context: http://www.nabble.com/Maps-in-Drools-tp25031348p25034293.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] Is "emptieness" supported in Drools 5 (LHS)
According to MVEL they've added a convenience for checking the "emptiness" of a value (see: http://mvel.codehaus.org/Value+Tests ) In MVEL you'd simply write: myMap == empty This seemed like a MUCH cleaner way to write some of the LHS of the rules, so I thought I'd try it out. Given the following rule: rule "Check Empties - Original" when $grabBag : MyGrabBag(someMap != null) eval ($grabBag.getSomeMap().size() == 0) then end This could be rewritten: rule "Check Empties - Simple" when MyGrabBag(someMap == empty) then end The IDE (Eclipse 3.4.2 w/ Drools plugin) seems to recognize "empty" is a keyword (it makes it bold), but the drools compiler in the IDE reports: BuildError: Unable to create restriction '[VariableRestriction: == empty ]' for field 'someMap' in the rule 'Check Empties - Simple' BuildError: Unable to return Declaration for identifier 'empty' Am I assuming incorrectly that the LHS is fully MVEL compliant? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Maps in Drools
Apologies, I should have given the error message I get with $m: Map( this[$str] == 1 ) and also with $m: Map( this.$str == 1 ) - org.drools.RuntimeDroolsException: Exception executing predicate this[$str] == 1 and lots more lines followed by - Caused by: [Error: unable to resolve method: java.util.HashMap.$str() [arglength=0]] 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. > Map map = new HashMap(); > 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-tp25031348p25031731.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
Yes, that was a bug that was fixed in newer versions of MVEL. Just update your MVEL jar to 2.0.12. []s Edson 2009/8/18 André Thieme > KDR schrieb: > > 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. > > Map map = new HashMap(); > > 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!)? > > In exactly this thread Marc answered to that problem. > http://www.mail-archive.com/rules-users@lists.jboss.org/msg09837.html > > His first idea is that this is a bug in the mvel dialect. > I tried exactly that. I had a global var and put the string "a" into it. > Then I wanted to check if Map( this[myVar] == 1 ) but this didn't work. > > > > I'd also need to test for null i.e. whether a key/value pair exists for a > > given String as the key. > > This seems to be only true when you go the route that I go, namely using > the default rule syntax, i.e., eval. > > > Sunny greetings, > 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 > -- 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] Maps in Drools
KDR schrieb: > 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. > Map map = new HashMap(); > 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!)? In exactly this thread Marc answered to that problem. http://www.mail-archive.com/rules-users@lists.jboss.org/msg09837.html His first idea is that this is a bug in the mvel dialect. I tried exactly that. I had a global var and put the string "a" into it. Then I wanted to check if Map( this[myVar] == 1 ) but this didn't work. > I'd also need to test for null i.e. whether a key/value pair exists for a > given String as the key. This seems to be only true when you go the route that I go, namely using the default rule syntax, i.e., eval. Sunny greetings, 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] Maps in Drools
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. Map map = new HashMap(); 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-tp25031348p25031348.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] enabling Japanese resource bundle in Guvnor
See https://jira.jboss.org/jira/browse/BRMS-206 Yusuke Yamamoto wrote: > Hi all, > It seems that there's already a Japanese resource bundle in the drools- > guvnor.war. > --- > $ find . -name "*.properties"|grep ja > ./src/main/java/org/drools/guvnor/client/messages/Constants.properties > ./src/main/java/org/drools/guvnor/client/messages/ > Constants_es_ES.properties > ./src/main/java/org/drools/guvnor/client/messages/ > Constants_ja_JP.properties > ./src/main/java/org/drools/guvnor/client/messages/Constants_zh_CN - > test.properties > ./src/main/java/org/drools/guvnor/client/messages/ > Constants_zh_CN.properties > --- > > But I don't see Japanese messages on the UI even after I set the > language preference of my browser to Japanese. > How do I enable the Japanese message resource bundle? > > Thanks, > Yusuke Yamamoto > yusu...@gmail.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] Collect from
Please someone help me on this. techy wrote: > > I would like to collect All Foo() for which there is no Bar() as given > below.Please help me on this. > Thanks. > > //psedo rule > rule 'test' > list : from collect( Foo(fooId: id) and not Bar(id !=fooId)) > then > //do conseq > end > -- View this message in context: http://www.nabble.com/Collect-from-tp25014904p25029332.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] enabling Japanese resource bundle in Guvnor
Hi all, It seems that there's already a Japanese resource bundle in the drools- guvnor.war. --- $ find . -name "*.properties"|grep ja ./src/main/java/org/drools/guvnor/client/messages/Constants.properties ./src/main/java/org/drools/guvnor/client/messages/ Constants_es_ES.properties ./src/main/java/org/drools/guvnor/client/messages/ Constants_ja_JP.properties ./src/main/java/org/drools/guvnor/client/messages/Constants_zh_CN - test.properties ./src/main/java/org/drools/guvnor/client/messages/ Constants_zh_CN.properties --- But I don't see Japanese messages on the UI even after I set the language preference of my browser to Japanese. How do I enable the Japanese message resource bundle? Thanks, Yusuke Yamamoto yusu...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How to change default Persistence Manager , Hibernate in Drools Flow to OFBiz entityengine persistence manager
Hi Users,I have a doubt regarding the persistance mechnanism in Drools Flow.By default drools flow supports Hibernate as persistence manager.Now I am integrating Drools Flow with OFBiz and OFBiz uses entityengine as a persistence manager. http://ofbiz.apache.org/docs/entity.htmlNow I have seen in the docs that persistence manager can be changed by changing thedefault setting in persistence.xml So can you please tell me what are the things I have to do to use my persistence manager and use Mysql database instead of file-based H2database. Also is this possible to use OFBiz pesistence manager here? Please help me to achieve this as it is very urgent.Thanks & RegardsPardeep RuhilThis email may contain confidential or privileged information for the intended recipient(s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. Thanks __ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Multiple approvals in a Drools Workflow Doubt
> So can you tell me how to get the current instance Id of the process. ProcessInstance processInstance = ksession.startProcess("myProcess"); long processInstanceId = processInstance.getId(); > How state is persisted in Drools workflow? Is Drools flow uses some database to store the process instance Id to store the state of the process like in JBPM? Yes, the persistence is fully pluggable (meaning that you can run the engine without any database behind it), but we provide a JPA-based implementation for storing the state in any persistent store supported by JPA. For more info, check out the documentation: https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch05.html#d0e1479 Thx, Kris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Multiple approvals in a Drools Workflow Doubt
Hi Kris , Thanks for your reply. As you have said that drools workflow supports persistence state of a workflow. So can you tell me how to get the current instance Id of the process. How state is persisted in Drools workflow? Is Drools flow uses some database to store the process instance Id to store the state of the process like in JBPM? Please help to answer my queries. Thanks & Regards Pardeep Ruhil L&T Infotech Ltd Mumbai Ph: +919820283884 Larsen & Toubro Infotech Ltd. www.Lntinfotech.com This Document is classified as: L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech Internal Use Only L&T Infotech General Business This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. _ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users