[rules-users] Problem in using or operator with values in map.
Hi All, I am using drool 4.0.1,I am facing some problem in using or operator i am using 2 maps by inserting in to working memory: 1) ErrorMapString,String 2) validationmapString,Object my requirment is to generate error when rule fails for this i am taking following steps: 1) i insert one entry in error map in when part and if that rule is success 2)i remove that entry from map and 3) at the end on the basis of this map i generates validation errors. import java.util.Map; import com.IValidationField; rule ValueAllowed_G10.3 when IValidationField(attributeId ==G10.3) $map : Map( keySet contains ErrorMap ) eval($map.put(G10.3_V,E_V_ALLOWED) == null || true) (or Map( this[G10.2] not in(5)) Map( this[G10.2] in(5))) then map.remove(G10.3_V); System.out.println(comming here-); end this file is giving classcast exception org.drools.RuntimeDroolsException: java.lang.ClassCastException: com.ValidationFieldImpl at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75) at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:141) at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(SingleTupleSinkAdapter.java:20) at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120) but when i replace or with and operator then it is working fine: import java.util.Map; import com.IValidationField; rule ValueAllowed_G10.3 when IValidationField(attributeId ==G10.3) $map : Map( keySet contains ErrorMap ) eval($map.put(G10.3_V,E_V_ALLOWED) == null || true) (and Map( this[G10.2] not in(5)) Map( this[G10.2] in(5))) then map.remove(G10.3_V); System.out.println(comming here-); end -- View this message in context: http://www.nabble.com/Problem-in-using-or-operator-with-values-in-map.-tf4472442.html#a12752031 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] Date for 2 years ago
Hello Brian, I've done something similar previously using a combination of a field binding constraint, an eval and the excellent joda-time API (http://joda-time.sourceforge.net/). If I remember right, you'd need something along the lines of : import org.joda.time.Duration; import org.joda.time.DateTime; Reference($fromDate : fromDate, eval(new Duration(new DateTime($fromDate), new DateTime()).getMillis() (2*365*24*60*60*1000))) It might be more readable if you can encapsulate this in a function :-) Dean. On 9/18/07, Brian Enderle [EMAIL PROTECTED] wrote: I need to code a rule which checks that the begin date for an object is at least two years ago (from todays date). Is there an easy way to code this within Drools rule, something like: when Reference(fromDate (todaysDate - 2 years)) then Output error end Thanks in advance, Brian Enderle ___ 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] Problem to run
Hello! Im new with Drools and I follow the documentation to install, but when I try to run the example Hello World its return an error: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java' at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:134) at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:110) at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:83) at org.drools.compiler.PackageBuilder.init(PackageBuilder.java:120) at org.drools.compiler.PackageBuilder .init(PackageBuilder.java:86) at com.sample.DroolsTest.readRule(DroolsTest.java:64) at com.sample.DroolsTest.main(DroolsTest.java:26) Caused by: java.lang.RuntimeException: The Eclipse JDT Core jar is not in the classpath at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:98) at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java :56) at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:130) ... 6 more To try to fix the problem I change the build configuration: Properties properties = new Properties(); properties.setProperty( drools.dialect.java.compiler, JANINO ); PackageBuilderConfiguration cfg = new PackageBuilderConfiguration( properties ); JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( java ); assertEquals(JavaDialectConfiguration.JANINO, javaConf.getCompiler() ); // demonstrate that the compiler is correctly configured But it also returns an error: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java' at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry (PackageBuilderConfiguration.java:134) at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:110) at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java :67) at com.sample.DroolsTest.readRule(DroolsTest.java:58) at com.sample.DroolsTest.main(DroolsTest.java:26) Caused by: java.lang.RuntimeException: The Janino jar is not in the classpath at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler (JavaDialectConfiguration.java:104) at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:56) at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry (PackageBuilderConfiguration.java:130) ... 4 more Someone could explain me how to fix the problem? Thanks! ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem in using or operator with values in map.
This seems a bug. May I ask you please to open a JIRA for it and attach a self contained test showing the problem? At the same time, I think there is a conceptual error in your rules: no object should be changed in the LHS of the rules. This will surely cause you problems in the future, so, I strongly advise you to rethink your rules. []s Edson 2007/9/18, Gaurav2007 [EMAIL PROTECTED]: Hi All, I am using drool 4.0.1,I am facing some problem in using or operator i am using 2 maps by inserting in to working memory: 1) ErrorMapString,String 2) validationmapString,Object my requirment is to generate error when rule fails for this i am taking following steps: 1) i insert one entry in error map in when part and if that rule is success 2)i remove that entry from map and 3) at the end on the basis of this map i generates validation errors. import java.util.Map; import com.IValidationField; rule ValueAllowed_G10.3 when IValidationField(attributeId ==G10.3) $map : Map( keySet contains ErrorMap ) eval($map.put(G10.3_V,E_V_ALLOWED) == null || true) (or Map( this[G10.2] not in(5)) Map( this[G10.2] in(5))) then map.remove(G10.3_V); System.out.println(comming here-); end this file is giving classcast exception org.drools.RuntimeDroolsException: java.lang.ClassCastException: com.ValidationFieldImpl at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75) at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java :141) at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple( SingleTupleSinkAdapter.java:20) at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120) but when i replace or with and operator then it is working fine: import java.util.Map; import com.IValidationField; rule ValueAllowed_G10.3 when IValidationField(attributeId ==G10.3) $map : Map( keySet contains ErrorMap ) eval($map.put(G10.3_V,E_V_ALLOWED) == null || true) (and Map( this[G10.2] not in(5)) Map( this[G10.2] in(5))) then map.remove(G10.3_V); System.out.println(comming here-); end -- View this message in context: http://www.nabble.com/Problem-in-using-or-operator-with-values-in-map.-tf4472442.html#a12752031 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 Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of 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] Possible shadow proxy issue with JDK Dynamic proxies in 4.0.1?
I'll be glad to test with the trunk. Do you have a snapshot build or do I have to build my own? It would be nice for your downloads area to contain a nightly snapshot build. -Chris On 9/17/07, Mark Proctor [EMAIL PROTECTED] wrote: Maybe some fixes broke this? can you test with trunk, and submit a jira with a self contained test if you still have a problem Mark Chris West wrote: Hello, After stumbling upon an issue with version 4.0.0 using memberOf, I decided to upgrade to version 4.0.1. After upgrading, my rules do not seem to fire correctly. In the past, I had discovered issues (prior to 4.0.0 release) relating to my use of JDK dynamic proxies as facts. The drools team developed a fix for my problem, and it involved searching for a base interface type to build the shadow proxy from when the class type is final (all JDK dynamic proxies are). This problem I'm seeing now seems very similar in behavior to what I saw before. Is there any change related to shadow proxies that went into 4.0.1? Thanks, -Chris West -- ___ rules-users mailing list [EMAIL PROTECTED]://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] Possible shadow proxy issue with JDK Dynamic proxies in 4.0.1?
Snapshot build: http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules Thanks. 2007/9/18, Chris West [EMAIL PROTECTED]: I'll be glad to test with the trunk. Do you have a snapshot build or do I have to build my own? It would be nice for your downloads area to contain a nightly snapshot build. -Chris On 9/17/07, Mark Proctor [EMAIL PROTECTED] wrote: Maybe some fixes broke this? can you test with trunk, and submit a jira with a self contained test if you still have a problem Mark Chris West wrote: Hello, After stumbling upon an issue with version 4.0.0 using memberOf, I decided to upgrade to version 4.0.1. After upgrading, my rules do not seem to fire correctly. In the past, I had discovered issues (prior to 4.0.0 release) relating to my use of JDK dynamic proxies as facts. The drools team developed a fix for my problem, and it involved searching for a base interface type to build the shadow proxy from when the class type is final (all JDK dynamic proxies are). This problem I'm seeing now seems very similar in behavior to what I saw before. Is there any change related to shadow proxies that went into 4.0.1? Thanks, -Chris West -- ___ 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 -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Globals and Boolean object
Hi, My rule is : #created on: 29 août 2007 package example #list any import classes here. global Boolean test rule Your Third Rule #include attributes such as salience here... when then #actions test = true; System.out.println(OK- + test); end In my java codes, I have : session.setGlobal(test, new Boolean(false)); System.out.println(global + session.getGlobal(test)); session.fireAllRules(); System.out.println(global + session.getGlobal(test)); I expect this : global false OK-true global true but I have : global false OK-true global false Anybody have a solution to manipulate Boolean object in globals ? thanks, V. -- View this message in context: http://www.nabble.com/Globals-and-Boolean-object-tf4474442.html#a12757328 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] localhost issue with JBoss and Drools BRMS
I am having trouble with the BRMS running under JBoss in that the default for the JBoss app server is to run as localhost but when you change JBoss to use the actual hostname of the machine so that it can be accessed remotely, the repository can't be accessed any more. I know you can export the repository but then you lose all version history. Is there any other solution? Thanks. -- I am using Drools 4.0.1 with JBoss 4.2.1 GA. -- View this message in context: http://www.nabble.com/localhost-issue-with-JBoss-and-Drools-BRMS-tf4474532.html#a12757609 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] Possible shadow proxy issue with JDK Dynamic proxies in 4.0.1?
I tested the SNAPSHOT, and the problem exists. So my tests indicate that the example attached to the JIRA runs properly on 4.0.0, does not work on 4.0.1, and does not work on the trunk SNAPSHOT. -Chris On 9/18/07, Chris West [EMAIL PROTECTED] wrote: Edson, Thanks for the snapshot build location. I just created a JIRA against 4.0.1 illustrating the problem. I'll now test against the snapshot. http://jira.jboss.com/jira/browse/JBRULES-1203 Thanks, -Chris West On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Snapshot build: http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules Thanks. 2007/9/18, Chris West [EMAIL PROTECTED]: I'll be glad to test with the trunk. Do you have a snapshot build or do I have to build my own? It would be nice for your downloads area to contain a nightly snapshot build. -Chris On 9/17/07, Mark Proctor [EMAIL PROTECTED] wrote: Maybe some fixes broke this? can you test with trunk, and submit a jira with a self contained test if you still have a problem Mark Chris West wrote: Hello, After stumbling upon an issue with version 4.0.0 using memberOf, I decided to upgrade to version 4.0.1. After upgrading, my rules do not seem to fire correctly. In the past, I had discovered issues (prior to 4.0.0 release) relating to my use of JDK dynamic proxies as facts. The drools team developed a fix for my problem, and it involved searching for a base interface type to build the shadow proxy from when the class type is final (all JDK dynamic proxies are). This problem I'm seeing now seems very similar in behavior to what I saw before. Is there any change related to shadow proxies that went into 4.0.1? Thanks, -Chris West -- ___ 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 -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.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] Globals and Boolean object
thanks, it's working. V. Mark Proctor wrote: java is pass by reference, so all you are doing is assigning the local test pointer to point to something else; which ofcourse won't be reflected in the global resolvers drools.getWorkingMemory.setGlobal(test, test); Mark vdelbart wrote: Hi, My rule is : #created on: 29 août 2007 package example #list any import classes here. global Boolean test rule Your Third Rule #include attributes such as salience here... when then #actions test = true; System.out.println(OK- + test); end In my java codes, I have : session.setGlobal(test, new Boolean(false)); System.out.println(global + session.getGlobal(test)); session.fireAllRules(); System.out.println(global + session.getGlobal(test)); I expect this : global false OK-true global true but I have : global false OK-true global false Anybody have a solution to manipulate Boolean object in globals ? thanks, V. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://www.nabble.com/Globals-and-Boolean-object-tf4474442.html#a12758332 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] Exception executing predicate
Hi all, When exceptions occur during runtime of drools, is there a list of things to see to understand what may be causing this to happen ? I know it is a very generic question. I want to see if there is a methodical way to understand what to look for ?. org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:197) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:122) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject( CompositeObjectSinkAdapter.java:317) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject( SingleObjectSinkAdapter.java:20) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.Rete.assertObject( Rete.java:168) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java :848) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java :822) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java :60) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java :54) Any help is appreciated ? thanks, Krishnan. -- Sivaramakrishna Iyer Krishnan (Anand) Never assume the obvious is true. - William Safire ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] how to perform some task when rule fails.
Hi All, My requirment is that i want to send corresponding error when any rule fails. for example: rule ValidationRuleExp_G250.4_0 when IValidationField(attributeId ==G250.4) (((Map( this[G250.18] !=4))(Map( this[G250.4]not in(910,990,983,995,996,997||((Map( this[G250.18] ==4))(Map( this[G250.4] in(910,990,983,995,996,997) then System.out.println(comming here---Success--); end In this case i can call some method in success,Is there any way so that i can call some method when any rule fails. the problem is that i am trying to generate rule file and all the validation expressions are already defined. my task is to evaluate these expression and generate corresponding error message when any rule fails can you please suggest me how can i do this using drools. Thanks, Gaurav -- View this message in context: http://www.nabble.com/how-to-perform-some-task-when-rule-fails.-tf4475301.html#a12760314 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] localhost issue with JBoss and Drools BRMS
just enable the -Djboss.bind.address=0.0.0.0 property in your jboss config On 9/18/07, Peter Docherty [EMAIL PROTECTED] wrote: I am having trouble with the BRMS running under JBoss in that the default for the JBoss app server is to run as localhost but when you change JBoss to use the actual hostname of the machine so that it can be accessed remotely, the repository can't be accessed any more. I know you can export the repository but then you lose all version history. Is there any other solution? Thanks. -- I am using Drools 4.0.1 with JBoss 4.2.1 GA. -- View this message in context: http://www.nabble.com/localhost-issue-with-JBoss-and-Drools-BRMS-tf4474532.html#a12757609 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 -- Fernando Meyer http://fmeyer.org [EMAIL PROTECTED] ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] Can't upload model in BRMS
Has anyone managed to download the model from the insurance example in the BRMS? I'm using the standalone version on tomcat 5.5.20. Thanks, Mat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drouin.Mathieu Sent: September 11, 2007 11:52 AM To: rules-users@lists.jboss.org Subject: [rules-users] Can't upload model in BRMS I can't seem to upload a model into the BRMS. I also tried downloading and uploading the model in the insurance example and it failed. (I tried both the .war on tomcat 6.0.13 and the standalone version on tomcat 5.5.20). Can somebody help? Thanks, Mat ___ 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] Can't upload model in BRMS
Ok, found out the download didn't work because I was using IE 6...so I tried in firefox and it works... The upload still doesn't work though...getting the following exception... ERROR 18-09 13:01:48,014 (ApplicationContext.java:log:675) Exception while dispatching incoming RPC call com.google.gwt.user.client.rpc.SerializationException: java.lang.ClassNotFoundException: org.drools.brms.client.rpc.RuleAsset at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese rialize(ServerSerializationStreamReader.java:156) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.re adObject(AbstractSerializationStreamReader.java:61) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese rializeValue(ServerSerializationStreamReader.java:70) at org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.processCall(GWTRemot eServiceServlet.java:285) at org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.doPost(GWTRemoteServ iceServlet.java:181) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:56) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:107) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541 ) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 48) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86 9) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc essConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint .java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow erWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java:684) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.ClassNotFoundException: org.drools.brms.client.rpc.RuleAsset at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese rialize(ServerSerializationStreamReader.java:135) ... 24 more -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drouin.Mathieu Sent: September 18, 2007 1:00 PM To: Rules Users List Subject: RE: [rules-users] Can't upload model in BRMS Has anyone managed to download the model from the insurance example in the BRMS? I'm using the standalone version on tomcat 5.5.20. Thanks, Mat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drouin.Mathieu Sent: September 11, 2007 11:52 AM To: rules-users@lists.jboss.org Subject: [rules-users] Can't upload model in BRMS I can't seem to upload a model into the BRMS. I also tried downloading and uploading the model in the insurance example and it failed. (I tried both the .war on tomcat 6.0.13 and the standalone version on tomcat 5.5.20). Can somebody help? Thanks, Mat ___ 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] Problem with memberOf and/or eval used in collect statement
Chris, Thanks for reporting this. I fixed a bug in 4.0.0 (released in 4.0.1) that causes you to see the correct value for TestEval1 in 4.0.1 and later versions. Although, at that time I missed the memberOf scenario. I know why it happens (shadow fact related), but now I need to figure out a way to fix it. May I ask you to open a ticket for that? Thanks, Edson 2007/9/18, Chris West [EMAIL PROTECTED]: All, I'm having a problem using memberOf combined with a collect statement. My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use). The rules are: rule TestMemberOf salience 10 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages)) then System.out.println(TestMemberOf: + $wrappers.size()); end rule TestEval1 salience 9 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message then System.out.println(TestEval1: + $wrappers.size()); end rule TestEval2 salience 8 when $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100))) then System.out.println(TestEval2: + $wrappers.size()); end The output is (by version): 4.0.0 TestMemberOf: 0 TestEval1: 0 TestEval2: 2 4.0.1 TestMemberOf: 0 TestEval1: 2 TestEval2: 2 4.0.2.SNAPSHOT (taken 9/18/07) TestMemberOf: 0 TestEval1: 2 TestEval2: 2 The correct output should be: TestMemberOf: 2 TestEval1: 2 TestEval2: 2 Am I using memberOf correctly? Is there some issue using an eval to test conditions on a list created by a collect? Any help would be appreciated. Attached is the full example. Thanks, -Chris West ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of 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] how to perform some task when rule fails.
Hi, First, it would be better if you can use the constraints inside the same pattern, avoiding subrule generation, instead of using multiple patterns: Map( this[G250.18] !=4 this[G250.4] not in(910,990,983,995, 996,997) || this[G250.18] ==4 this[G250.4] in (910,990,983,995,996,997) ) Remember that has precedence over ||, but you can use () if you want to make it explicit: Map( ( this[G250.18] !=4 this[G250.4] not in(910,990,983,995, 996,997) ) || ( this[G250.18] ==4 this[G250.4] in (910,990,983,995,996,997) ) ) Now, answering your question, if you want to negate part of the whole of the LHS, just use the not CE. Example: rule ValidationRuleExp_G250.4_0 when not ( IValidationField(attributeId ==G250.4) and Map( this[G250.18] !=4 this[G250.4] not in(910,990,983,995, 996,997) || this[G250.18] ==4 this[G250.4] in (910,990,983,995,996,997) ) ) then // do something end Hope it helps, Edson 2007/9/18, Gaurav2007 [EMAIL PROTECTED]: Hi All, My requirment is that i want to send corresponding error when any rule fails. for example: rule ValidationRuleExp_G250.4_0 when IValidationField(attributeId ==G250.4) (((Map( this[G250.18] !=4))(Map( this[G250.4]not in(910,990,983,995,996,997||((Map( this[G250.18] ==4))(Map( this[G250.4] in(910,990,983,995,996,997) then System.out.println(comming here---Success--); end In this case i can call some method in success,Is there any way so that i can call some method when any rule fails. the problem is that i am trying to generate rule file and all the validation expressions are already defined. my task is to evaluate these expression and generate corresponding error message when any rule fails can you please suggest me how can i do this using drools. Thanks, Gaurav -- View this message in context: http://www.nabble.com/how-to-perform-some-task-when-rule-fails.-tf4475301.html#a12760314 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 Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of 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] Exception executing predicate
Krushnan, Isn't there a cause by down the stack trace? Current code for raising the exception is: try { return this.expression.evaluate( object, null, this.previousDeclarations, this.localDeclarations, workingMemory ); } catch ( final Exception e ) { throw new RuntimeDroolsException( Exception executing predicate + this.expression, e ); } All we can say for sure from the exception stack trace snippet you provided is that it was raised in a rule named Rule Cisco Systems, in the first return value predicate. We need to improve that a bit I think. []s Edson 2007/9/18, Krishnan [EMAIL PROTECTED]: Hi all, When exceptions occur during runtime of drools, is there a list of things to see to understand what may be causing this to happen ? I know it is a very generic question. I want to see if there is a methodical way to understand what to look for ?. org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java :197) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:122) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject( CompositeObjectSinkAdapter.java:317) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject( SingleObjectSinkAdapter.java:20) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.Rete.assertObject(Rete.java:168) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.ReteooWorkingMemory.doInsert (ReteooWorkingMemory.java :70) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java :848) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.insert (AbstractWorkingMemory.java :822) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java :60) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.base.DefaultKnowledgeHelper.insert (DefaultKnowledgeHelper.java :54) Any help is appreciated ? thanks, Krishnan. -- Sivaramakrishna Iyer Krishnan (Anand) Never assume the obvious is true. - William Safire ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of 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] Exception executing predicate
Hi, Thanks for your help as always. I did look at it a little more closer. The caused error is as follows :- INFO | jvm 1 | 2007/09/14 16:46:33 | Caused by: java.lang.NullPointerException INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.Rule_Cisco_Systems_0.returnValue0 (Rule_Cisco_Systems_0.java:14) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.Rule_Cisco_Systems_0ReturnValue0Invoker.evaluate (Rule_Cisco_Systems_0ReturnValue0Invoker.java:19) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:191) INFO | jvm 1 | 2007/09/14 16:46:33 | ... 28 more INFO | jvm 1 | 2007/09/14 16:46:33 | org.drools.spi.ConsequenceException: org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:549) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.fireAllRules( AbstractWorkingMemory.java:430) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.fireAllRules( AbstractWorkingMemory.java:392) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.SnmpVendorBehaviourDetermination.determineVendorType (SnmpVendorBehaviourDetermination.java:45) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.vendorTypeRuleSNMP(DNPIACTask.java:487) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.determineVendorTypeFromSNMP( DNPIACTask.java:512) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.determineVendorType(DNPIACTask.java:556) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.processNode(DNPIACTask.java:262) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.performTask(DNPIACTask.java:171) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.common.utilities.threads.ServiceThread.service( ServiceThread.java:187) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.common.utilities.threads.ServiceThread.runTask( ServiceThread.java:233) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.common.utilities.threads.DisposableServiceThread.run( DisposableServiceThread.java:126) INFO | jvm 1 | 2007/09/14 16:46:33 | at java.lang.Thread.run(Unknown Source) Based on the above I realized that it is complaining about a NPE. Not sure, if it is happening in the lhs or rhs ?. Is there something that tells you where this happens. I least think I have a couple of things to try out. -Krishnan rule Generate Cisco object salience 100 when eval (vendorObj != null) eval (SnmpHelper.getSysObjectId(vendorObj.getPing ()).matches(.*\\.1\\.3\\.6\\.1\\.4\\.1\\.9.*)) then CiscoBaseObject baseObj = new CiscoBaseObject(); baseObj.initialize(vendorObj.getPing(), vendorObj.getDp(), vendorObj.getNodeInfo()); insert(baseObj); end On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Krushnan, Isn't there a cause by down the stack trace? Current code for raising the exception is: try { return this.expression.evaluate( object, null, this.previousDeclarations, this.localDeclarations, workingMemory ); } catch ( final Exception e ) { throw new RuntimeDroolsException( Exception executing predicate + this.expression, e ); } All we can say for sure from the exception stack trace snippet you provided is that it was raised in a rule named Rule Cisco Systems, in the first return value predicate. We need to improve that a bit I think. []s Edson 2007/9/18, Krishnan [EMAIL PROTECTED]: Hi all, When exceptions occur during runtime of drools, is there a list of things to see to understand what may be causing this to happen ? I know it is a very generic question. I want to see if there is a methodical way to understand what to look for ?. org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java :197) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:122) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject( CompositeObjectSinkAdapter.java:317) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130) INFO | jvm 1 | 2007/09/14 16:46:33 | at
Re: [rules-users] Exception executing predicate
Krishnan, By the line: INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.Rule_Cisco_Systems_0.returnValue0 (Rule_Cisco_Systems_0.java:14) We can decipher the trace :) and know that the NPE is raised in the rule Rule Cisco Systems, in the first return value predicate. Not the rule you pasted in your e-mail. []s Edson 2007/9/18, Krishnan [EMAIL PROTECTED]: Hi, Thanks for your help as always. I did look at it a little more closer. The caused error is as follows :- INFO | jvm 1 | 2007/09/14 16:46:33 | Caused by: java.lang.NullPointerException INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.Rule_Cisco_Systems_0.returnValue0 (Rule_Cisco_Systems_0.java:14) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.Rule_Cisco_Systems_0ReturnValue0Invoker.evaluate(Rule_Cisco_Systems_0ReturnValue0Invoker.java:19) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java :191) INFO | jvm 1 | 2007/09/14 16:46:33 | ... 28 more INFO | jvm 1 | 2007/09/14 16:46:33 | org.drools.spi.ConsequenceException: org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:549) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java :509) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.fireAllRules( AbstractWorkingMemory.java:430) INFO | jvm 1 | 2007/09/14 16:46:33 | at org.drools.common.AbstractWorkingMemory.fireAllRules ( AbstractWorkingMemory.java:392) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.vendorBehaviour.snmp.SnmpVendorBehaviourDetermination.determineVendorType (SnmpVendorBehaviourDetermination.java:45) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.vendorTypeRuleSNMP(DNPIACTask.java :487) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.determineVendorTypeFromSNMP ( DNPIACTask.java:512) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.determineVendorType(DNPIACTask.java :556) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.processNode (DNPIACTask.java:262) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.fs.is.dnpiac.DNPIACTask.performTask(DNPIACTask.java:171) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.common.utilities.threads.ServiceThread.service ( ServiceThread.java:187) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.common.utilities.threads.ServiceThread.runTask( ServiceThread.java:233) INFO | jvm 1 | 2007/09/14 16:46:33 | at com.makesys.common.utilities.threads.DisposableServiceThread.run ( DisposableServiceThread.java:126) INFO | jvm 1 | 2007/09/14 16:46:33 | at java.lang.Thread.run(Unknown Source) Based on the above I realized that it is complaining about a NPE. Not sure, if it is happening in the lhs or rhs ?. Is there something that tells you where this happens. I least think I have a couple of things to try out. -Krishnan rule Generate Cisco object salience 100 when eval (vendorObj != null) eval (SnmpHelper.getSysObjectId(vendorObj.getPing ()).matches(.*\\.1\\.3\\.6\\.1\\.4\\.1\\.9.*)) then CiscoBaseObject baseObj = new CiscoBaseObject(); baseObj.initialize(vendorObj.getPing(), vendorObj.getDp(), vendorObj.getNodeInfo()); insert(baseObj); end On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Krushnan, Isn't there a cause by down the stack trace? Current code for raising the exception is: try { return this.expression.evaluate( object, null, this.previousDeclarations, this.localDeclarations, workingMemory ); } catch ( final Exception e ) { throw new RuntimeDroolsException( Exception executing predicate + this.expression, e ); } All we can say for sure from the exception stack trace snippet you provided is that it was raised in a rule named Rule Cisco Systems, in the first return value predicate. We need to improve that a bit I think. []s Edson 2007/9/18, Krishnan [EMAIL PROTECTED]: Hi all, When exceptions occur during runtime of drools, is there a list of things to see to understand what may be causing this to happen ? I know it is a very generic question. I want to see if there is a methodical way to understand what to look for ?. org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] INFO |
Re: [rules-users] Problem with memberOf and/or eval used in collect statement
http://jira.jboss.com/jira/browse/JBRULES-1204 On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Chris, Thanks for reporting this. I fixed a bug in 4.0.0 (released in 4.0.1) that causes you to see the correct value for TestEval1 in 4.0.1 and later versions. Although, at that time I missed the memberOf scenario. I know why it happens (shadow fact related), but now I need to figure out a way to fix it. May I ask you to open a ticket for that? Thanks, Edson 2007/9/18, Chris West [EMAIL PROTECTED]: All, I'm having a problem using memberOf combined with a collect statement. My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use). The rules are: rule TestMemberOf salience 10 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages)) then System.out.println(TestMemberOf: + $wrappers.size()); end rule TestEval1 salience 9 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message then System.out.println(TestEval1: + $wrappers.size()); end rule TestEval2 salience 8 when $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100))) then System.out.println(TestEval2: + $wrappers.size()); end The output is (by version): 4.0.0 TestMemberOf: 0 TestEval1: 0 TestEval2: 2 4.0.1 TestMemberOf: 0 TestEval1: 2 TestEval2: 2 4.0.2.SNAPSHOT (taken 9/18/07) TestMemberOf: 0 TestEval1: 2 TestEval2: 2 The correct output should be: TestMemberOf: 2 TestEval1: 2 TestEval2: 2 Am I using memberOf correctly? Is there some issue using an eval to test conditions on a list created by a collect? Any help would be appreciated. Attached is the full example. Thanks, -Chris West ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.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] Problem with memberOf and/or eval used in collect statement
Chris, Do you really need to collect all these facts? Are you doing anything with these lists? It would be easier if you can show me the full rule, but seems to me that maybe you can avoid some or all of these collects. Remember that collect is a heavy CE, so it is always good to avoid when possible. Anyway, there should be no problem if you use eval(). The problem in JBRULES-1204 only affects memberOf operator, since the fix I implemented in http://jira.jboss.org/jira/browse/JBRULES-1115 fixed the eval()s. I will fix 1204 asap. []s Edson 2007/9/18, Chris West [EMAIL PROTECTED]: Edson, So now my dilemma is that I cannot use 4.0.0 due to JBRULES-1204, but I cannot use 4.0.1 or 4.0.2-SNAPSHOT due to JBRULES-1203. Below is an actual block from my rule. I'd like to transform it into something like TestEval2 from my example, but it is more complicated. Can it be rewritten like TestEval2? $sorties: ArrayList() from collect (AirPlanSortie(event == $currentEvent, spare == false, superSpare == false)) $statuses: ArrayList($sortieSize: size) from collect (SortieStatus(state != SortieState.CANCELLED, $sortie1: sortie, eval ($sorties.contains($sortie1 $launches: ArrayList(size 0, size == $sortieSize) from collect (LaunchAircraftStatus(launched == true, $sortie0: sortie, eval($sortie0.getEvent().equals($currentEvent -Chris On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Chris, Thanks for reporting this. I fixed a bug in 4.0.0 (released in 4.0.1) that causes you to see the correct value for TestEval1 in 4.0.1 and later versions. Although, at that time I missed the memberOf scenario. I know why it happens (shadow fact related), but now I need to figure out a way to fix it. May I ask you to open a ticket for that? Thanks, Edson 2007/9/18, Chris West [EMAIL PROTECTED]: All, I'm having a problem using memberOf combined with a collect statement. My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use). The rules are: rule TestMemberOf salience 10 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages)) then System.out.println(TestMemberOf: + $wrappers.size()); end rule TestEval1 salience 9 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message then System.out.println(TestEval1: + $wrappers.size()); end rule TestEval2 salience 8 when $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100))) then System.out.println(TestEval2: + $wrappers.size()); end The output is (by version): 4.0.0 TestMemberOf: 0 TestEval1: 0 TestEval2: 2 4.0.1 TestMemberOf: 0 TestEval1: 2 TestEval2: 2 4.0.2.SNAPSHOT (taken 9/18/07) TestMemberOf: 0 TestEval1: 2 TestEval2: 2 The correct output should be: TestMemberOf: 2 TestEval1: 2 TestEval2: 2 Am I using memberOf correctly? Is there some issue using an eval to test conditions on a list created by a collect? Any help would be appreciated. Attached is the full example. Thanks, -Chris West ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.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 -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of 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] Problem with memberOf and/or eval used in collect statement
The fix for 1115 and fix for 1204 you're working will not help me unless 1203 is fixed, because all versions of code after 4.0.0 are affected by 1203, and it is a showstopper for me since I use JDK dynamic proxies as facts. -Chris On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Chris, Do you really need to collect all these facts? Are you doing anything with these lists? It would be easier if you can show me the full rule, but seems to me that maybe you can avoid some or all of these collects. Remember that collect is a heavy CE, so it is always good to avoid when possible. Anyway, there should be no problem if you use eval(). The problem in JBRULES-1204 only affects memberOf operator, since the fix I implemented in http://jira.jboss.org/jira/browse/JBRULES-1115 fixed the eval()s. I will fix 1204 asap. []s Edson 2007/9/18, Chris West [EMAIL PROTECTED]: Edson, So now my dilemma is that I cannot use 4.0.0 due to JBRULES-1204, but I cannot use 4.0.1 or 4.0.2-SNAPSHOT due to JBRULES-1203. Below is an actual block from my rule. I'd like to transform it into something like TestEval2 from my example, but it is more complicated. Can it be rewritten like TestEval2? $sorties: ArrayList() from collect (AirPlanSortie(event == $currentEvent, spare == false, superSpare == false)) $statuses: ArrayList($sortieSize: size) from collect (SortieStatus(state != SortieState.CANCELLED, $sortie1: sortie, eval ($sorties.contains($sortie1 $launches: ArrayList(size 0, size == $sortieSize) from collect (LaunchAircraftStatus(launched == true, $sortie0: sortie, eval($sortie0.getEvent().equals($currentEvent -Chris On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Chris, Thanks for reporting this. I fixed a bug in 4.0.0 (released in 4.0.1) that causes you to see the correct value for TestEval1 in 4.0.1 and later versions. Although, at that time I missed the memberOf scenario. I know why it happens (shadow fact related), but now I need to figure out a way to fix it. May I ask you to open a ticket for that? Thanks, Edson 2007/9/18, Chris West [EMAIL PROTECTED]: All, I'm having a problem using memberOf combined with a collect statement. My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use). The rules are: rule TestMemberOf salience 10 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages)) then System.out.println(TestMemberOf: + $wrappers.size()); end rule TestEval1 salience 9 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message then System.out.println(TestEval1: + $wrappers.size()); end rule TestEval2 salience 8 when $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100))) then System.out.println(TestEval2: + $wrappers.size()); end The output is (by version): 4.0.0 TestMemberOf: 0 TestEval1: 0 TestEval2: 2 4.0.1 TestMemberOf: 0 TestEval1: 2 TestEval2: 2 4.0.2.SNAPSHOT (taken 9/18/07) TestMemberOf: 0 TestEval1: 2 TestEval2: 2 The correct output should be: TestMemberOf: 2 TestEval1: 2 TestEval2: 2 Am I using memberOf correctly? Is there some issue using an eval to test conditions on a list created by a collect? Any help would be appreciated. Attached is the full example. Thanks, -Chris West ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.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 -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @
Re: [rules-users] Problem with memberOf and/or eval used in collect statement
Chris, Ok, 1203 is in the pipeline too... []s Edson 2007/9/18, Chris West [EMAIL PROTECTED]: The fix for 1115 and fix for 1204 you're working will not help me unless 1203 is fixed, because all versions of code after 4.0.0 are affected by 1203, and it is a showstopper for me since I use JDK dynamic proxies as facts. -Chris On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Chris, Do you really need to collect all these facts? Are you doing anything with these lists? It would be easier if you can show me the full rule, but seems to me that maybe you can avoid some or all of these collects. Remember that collect is a heavy CE, so it is always good to avoid when possible. Anyway, there should be no problem if you use eval(). The problem in JBRULES-1204 only affects memberOf operator, since the fix I implemented in http://jira.jboss.org/jira/browse/JBRULES-1115 fixed the eval()s. I will fix 1204 asap. []s Edson 2007/9/18, Chris West [EMAIL PROTECTED]: Edson, So now my dilemma is that I cannot use 4.0.0 due to JBRULES-1204, but I cannot use 4.0.1 or 4.0.2-SNAPSHOT due to JBRULES-1203. Below is an actual block from my rule. I'd like to transform it into something like TestEval2 from my example, but it is more complicated. Can it be rewritten like TestEval2? $sorties: ArrayList() from collect (AirPlanSortie(event == $currentEvent, spare == false, superSpare == false)) $statuses: ArrayList($sortieSize: size) from collect (SortieStatus(state != SortieState.CANCELLED, $sortie1: sortie, eval ($sorties.contains($sortie1 $launches: ArrayList(size 0, size == $sortieSize) from collect (LaunchAircraftStatus(launched == true, $sortie0: sortie, eval($sortie0.getEvent().equals($currentEvent -Chris On 9/18/07, Edson Tirelli [EMAIL PROTECTED] wrote: Chris, Thanks for reporting this. I fixed a bug in 4.0.0 (released in 4.0.1) that causes you to see the correct value for TestEval1 in 4.0.1 and later versions. Although, at that time I missed the memberOf scenario. I know why it happens (shadow fact related), but now I need to figure out a way to fix it. May I ask you to open a ticket for that? Thanks, Edson 2007/9/18, Chris West [EMAIL PROTECTED]: All, I'm having a problem using memberOf combined with a collect statement. My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use). The rules are: rule TestMemberOf salience 10 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages)) then System.out.println(TestMemberOf: + $wrappers.size()); end rule TestEval1 salience 9 when $messages: ArrayList() from collect (Message(status == 100)) $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message then System.out.println(TestEval1: + $wrappers.size()); end rule TestEval2 salience 8 when $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100))) then System.out.println(TestEval2: + $wrappers.size()); end The output is (by version): 4.0.0 TestMemberOf: 0 TestEval1: 0 TestEval2: 2 4.0.1 TestMemberOf: 0 TestEval1: 2 TestEval2: 2 4.0.2.SNAPSHOT (taken 9/18/07) TestMemberOf: 0 TestEval1: 2 TestEval2: 2 The correct output should be: TestMemberOf: 2 TestEval1: 2 TestEval2: 2 Am I using memberOf correctly? Is there some issue using an eval to test conditions on a list created by a collect? Any help would be appreciated. Attached is the full example. Thanks, -Chris West ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli Software Engineer - JBoss Rules Core Developer Office: +55 11 3529-6000 Mobile: +55 11 9287-5646 JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users