[rules-users] When MinaTaskClient.complete throw NullPointerException
Hi. I use human task in JPA,when i call MinaTaskClient.complete throw below error: java.lang.NullPointerException at org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:83) at org.drools.process.workitem.wsht.WSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(WSHumanTaskHandler.java:282) at org.drools.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:67) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:752) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)2009-9-2 13:50:26 org.apache.mina.filter.logging.LogLevel$4 log at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:832) at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:379) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:173) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:832) at org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.messageReceived(DefaultIoFilterChain.java:616) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414) at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:408) at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:578) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:540) at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:532) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:58) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:857) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] question on drools and method calls on facts
It depends whether you are a purist, a pragmatist, or a maverick. A few random thoughts, and note that I consider myself a repenting pragmatist ;-) Having fact classes with methods that modify the object in addition to the usual setters is dangerous; a toString() according to the convention is harmless. Even from a purist's point of view your list could be extended by "calls of methods to global objects", e.g., for communicating results to some GUI or whatever. What is usually frowned at it the use of conditional statements on the RHS as going against the spirit of rule based programming. If complex processing is required, hide it in some static methods of an utility class. It will make your rule code trimmer and slimmer, avoiding needless binding between the business logic part and implementation details. -W On Tue, Sep 1, 2009 at 11:02 PM, Garner, Shawn wrote: > I'm under the impression that in the action clause of a rule you should > only do one of the following: > 1) Set a property on a Fact > 2) Retract a Fact > 3) Insert (Assert) a new Fact > 4) Modify an existing Fact > > However in some of the examples in the documentation it shows calling > methods other than bean property getters and setters. > I was wondering if what other peoples opinions are on whether you should be > doing more than the 4 things I listed above in a then clause of a rule. > > Thanks, > SG > > > -Message Disclaimer- > > This e-mail message is intended only for the use of the individual or > entity to which it is addressed, and may contain information that is > privileged, confidential and exempt from disclosure under applicable law. > If you are not the intended recipient, any dissemination, distribution or > copying of this communication is strictly prohibited. If you have > received this communication in error, please notify us immediately by > reply email to conn...@principal.com and delete or destroy all copies of > the original message and attachments thereto. Email sent to or from the > Principal Financial Group or any of its member companies may be retained > as required by law or regulation. > > Nothing in this message is intended to constitute an Electronic signature > for purposes of the Uniform Electronic Transactions Act (UETA) or the > Electronic Signatures in Global and National Commerce Act ("E-Sign") > unless a specific statement to the contrary is included in this message. > > While this communication may be used to promote or market a transaction > or an idea that is discussed in the publication, it is intended to provide > general information about the subject matter covered and is provided with > the understanding that The Principal is not rendering legal, accounting, > or tax advice. It is not a marketed opinion and may not be used to avoid > penalties under the Internal Revenue Code. You should consult with > appropriate counsel or other advisors on all matters pertaining to legal, > tax, or accounting obligations and requirements. > > > ___ > 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] DRools 5 with spring 2.5.6
Hi Everyone. I'm new to Drools 5, and I'd like to use it in a spring project. Basically, I want to load a knowledge base in a "Service" Spring object, and use it as a dependency in others treatment objects. Google serves me several sites on how to use Spring and previous Drools releases, but nothing really up to date. "Spring-modules", a kind of Spring extension wich provided a Drools integration is deprecated. Is there any simple way to use both Spring 2.5.6 and Drools 5.0.1 ? Thank you in advance. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Trouble getting Dynamic Salience working
Just a quick observance, but this is also an excellent example of subsumption of rules (almost). The first rule conditions elements are all contained in the second rule. However, the action items are different. Therefore the first rule should say that the topping does not contain sausage nor pepperoni... Or, the objects could be written so that there would be something to flag a cheese-only pizza otherwise both rules would fire as written. :-( SDG James Owen Founder October Rules Fest Senior Consultant / Architect KBSC http://www.kbsc.com http://www.OctoberRulesFest.org Twitter: OctRulesFest Blogs: http://JavaRules.blogspot.com [Rulebased Systems Blog] http://ORF2009.blogspot.com [October Rules Fest Blog] http://exscg.blogspot.com/ [Expert Systems Consulting Group Blog] "If I have seen a little further it is by standing on the shoulders of giants." Sir Isaac Newton in a letter to Robert Hooke, 5 Feb 1676 Come to October Rules Fest and stand on the shoulders of the Giants of the industry; if only for a week. On Sep 1, 2009, at 9:29 PM, Greg Barton wrote: I hope you're not going through all of that trouble just to get the functionality from that concrete example. You get that for free with Drools' default conflict resolution, which includes "specificity." Specificity means that rules with the more specific conditions, and all else equal, are fired first. So between these two rules, only the CheeseSausagePepperoniPepper one fires: rule "CheeseOnly" when p : Pizza( ) t1: Topping( pizza == p, name == "cheese" ) then System.out.println( "Eating cheese pizza" ); retract( t1 ); retract( p ); end rule "CheeseSausagePepperoniPepper" when p : Pizza( ) t1: Topping( pizza == p, name == "cheese" ) t2: Topping( pizza == p, name == "sausage" ) t3: Topping( pizza == p, name == "pepperoni" ) t4: Topping( pizza == p, name == "pepper" ) then System.out.println( "Eating cheese sausage pepperoni pepper pizza" ); retract( t4 ); retract( t3 ); retract( t2 ); retract( t1 ); retract( p ); end See the attached project. --- On Tue, 9/1/09, Bill Tarr wrote: From: Bill Tarr Subject: [rules-users] Trouble getting Dynamic Salience working To: rules-users@lists.jboss.org Date: Tuesday, September 1, 2009, 7:28 PM We have a winner! Many thanks Michal, hope I can return the favor one day. salience ( return getSalience4() ) for the record, my function looks something like (after tempate evaluation): function int getSalience4(){ int salience = 0; if("VALUE"=="VALUE") salience += 1000; return salience; } I think the combination activation-group and dynamic salience for rule-template projects are pretty useful. Just for anyone interested, the tempate code looks something like this: rule "Some ru...@{row.rownumber}" activation-group "@{param...@{param2}" salience ( return getsalie...@{row.rownumber}() ) where PARAM1 and PARAM2 make up a kind of key. I only want to execute one rule that matches that key, no matter how many options there are. Rules that have additional parameters get higher salience than rules with less parameters, so here is my function. function int getsalie...@{row.rownumber}(){ int salience = 0; if("@{PARAM3}"=="@{PARAM3}") salience += 1000; if("@{PARAM4}"=="@{PARAM4}") salience += 1000; return salience; } A concrete example could be pizza. So there are 3 types of pizza, all are grouped in the same activation-group. cheese, pepperoni cheese, pepperoni, sausage cheese, pepperoni, meatball, pepper Any cheese and pepperoni pizza should could match all these rules, but more toppings is always better for me. So cheese, pepperoni, onion, pepper getts a salience of 2000, and is the only rule evaluated. On Tue Sep 1 18:39:13 EDT 2009, Michal Bali michalbali at gmail.com wrote: does this work? salience ( return getSalience() ) or this: salience ( getSalience();) On Tue, Sep 1, 2009 at 6:50 PM, Bill Tarr wrote: Possibily just a simple MVEL error, but I've been struggling for a while and thought I'd see if anyone could help. I just want to run a logic test to determine salience for some rules I am generating with rules-templates. Even after making the logical test "true" I can't get any of variation to compile. (true ? "1000" : "0") **produces** Unable to build expression for 'salience' : not a statement, or badly formed structure ( true ? 1000 : 0) **produces** Unable to build expression for 'salience' : invalid number literal: 1000 salience ( getSalience() ) ... function int getSalience(){return 0;} **produces** Unable to build expression for 'salience' : org.mvel2.util.MethodStub cannot be cast to java.lang.Class'( getSalie
Re: [rules-users] Trouble getting Dynamic Salience working
I hope you're not going through all of that trouble just to get the functionality from that concrete example. You get that for free with Drools' default conflict resolution, which includes "specificity." Specificity means that rules with the more specific conditions, and all else equal, are fired first. So between these two rules, only the CheeseSausagePepperoniPepper one fires: rule "CheeseOnly" when p : Pizza( ) t1: Topping( pizza == p, name == "cheese" ) then System.out.println( "Eating cheese pizza" ); retract( t1 ); retract( p ); end rule "CheeseSausagePepperoniPepper" when p : Pizza( ) t1: Topping( pizza == p, name == "cheese" ) t2: Topping( pizza == p, name == "sausage" ) t3: Topping( pizza == p, name == "pepperoni" ) t4: Topping( pizza == p, name == "pepper" ) then System.out.println( "Eating cheese sausage pepperoni pepper pizza" ); retract( t4 ); retract( t3 ); retract( t2 ); retract( t1 ); retract( p ); end See the attached project. --- On Tue, 9/1/09, Bill Tarr wrote: > From: Bill Tarr > Subject: [rules-users] Trouble getting Dynamic Salience working > To: rules-users@lists.jboss.org > Date: Tuesday, September 1, 2009, 7:28 PM > We have a winner! Many thanks > Michal, hope I can return the favor one day. > > salience ( return getSalience4() ) > > for the record, my function looks something like (after > tempate evaluation): > > > function int getSalience4(){ > int salience = 0; > if("VALUE"=="VALUE") salience += 1000; > > return salience; > } > > > I think the combination activation-group and dynamic > salience for rule-template projects are pretty useful. > > Just for anyone interested, the tempate code looks > something like this: > > > rule "Some ru...@{row.rownumber}" > > activation-group "@{param...@{param2}" > salience ( return getsalie...@{row.rownumber}() ) > > > where PARAM1 and PARAM2 make up a kind of key. I only want > to execute one rule that matches that key, no matter how > many options there are. > > Rules that have additional parameters get higher salience > than rules with less parameters, so here is my function. > > > function int getsalie...@{row.rownumber}(){ > int salience = 0; > if("@{PARAM3}"=="@{PARAM3}") salience += 1000; > if("@{PARAM4}"=="@{PARAM4}") salience += 1000; > return salience; > } > > > A concrete example could be pizza. So there are 3 types > of pizza, all are grouped in the same activation-group. > > cheese, pepperoni > cheese, pepperoni, sausage > cheese, pepperoni, meatball, pepper > > Any cheese and pepperoni pizza should could match all these > rules, but more toppings is always better for me. > > So cheese, pepperoni, onion, pepper getts a salience of > 2000, and is the only rule evaluated. > > > > On Tue Sep 1 18:39:13 EDT 2009, Michal Bali michalbali at > gmail.com wrote: > > does this work? > salience ( return getSalience() ) > > or this: > > salience ( getSalience();) > > > On Tue, Sep 1, 2009 at 6:50 PM, Bill Tarr at yahoo.com> wrote: > > > Possibily just a simple MVEL error, but I've been > struggling for a while > > and thought I'd see if anyone could help. > > > > I just want to run a logic test to determine salience > for some rules I am > > generating with rules-templates. Even after making > the logical test "true" > > I can't get any of variation to compile. > > > > (true ? "1000" : "0") > > **produces** > > Unable to build expression for 'salience' : not a > statement, or badly > > formed structure > > > > ( true ? 1000 : 0) > > **produces** > > Unable to build expression for 'salience' : invalid > number literal: 1000 > > > > salience ( getSalience() ) > > ... > > function int getSalience(){return 0;} > > **produces** > > Unable to build expression for 'salience' : > org.mvel2.util.MethodStub > > cannot be cast to java.lang.Class'( > getSalienceNONCDW() )' > > > > Seems like I am missing something simple, but I've > tried many variations on > > the above, and have been unable to find any working > examples of using a > > logical test in salience, so if anyone has any > direction it would be greatly > > appreciated. > > > > Thanks! > > > > Bill > > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > DroolsSpecificity.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] Drools Expert API
Hi All, I am a newbie and just started using Drools 5. My question is that why there is no documentation provided for classes such as *org.drools.compiler.PackageBuilder*, *org.drools.RuleBase* which are part of Drools Expert in the main Javadocs ? Or the javadocs are only for Drools API? Cheers, Swapnil ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problem with JPA session persistence in Drools Flow (5.0.1)
Kris, Did download the artifacts (drools-5.1.0.SNAPSHOT-bin.zip) from the above location but ran into the same issue reported earlier. /*--*/ java.lang.RuntimeException: Unable to load session snapshot at org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:112) at org.drools.persistence.session.JPASessionMarshallingHelper.(JPASessionMarshallingHelper.java:46) at org.drools.persistence.session.SingleSessionCommandService.(SingleSessionCommandService.java:194) at org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.loadStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:75) at org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:102) at org.drools.examples.process.order.OrderExample.createWorkingMemory(OrderExample.java:279) at org.drools.examples.process.order.OrderExample.(OrderExample.java:107) at org.drools.examples.process.order.OrderExample.main(OrderExample.java:88) Caused by: java.lang.NullPointerException at org.drools.marshalling.impl.InputMarshaller.readLeftTuple(InputMarshaller.java:496) at org.drools.marshalling.impl.InputMarshaller.readLeftTuples(InputMarshaller.java:426) at org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:349) at org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:207) at org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:75) at org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:104) /*--*/ I am creating a JPA session and starting a process with a human task and then stopping the engine without completing the human task .Then trying to load from the earlier session. Am I missing any calls before exit. Appreciate your help,thanks in advance Sanjay Kris Verlaenen wrote: > > We're planning to do a M1 near the end of the month, and a final a few > weeks later. > > Kris > > Quoting SBalakrishnan : > >> >> Thanks Kris >> >> Will download from the below link and check. >> >> Quick question, do you know when the official 5.1 release will be >> available >> ? >> >> >> >> >> >> >> Kris Verlaenen wrote: >> > >> > The fix for this issue has been added to trunk about a month ago >> already >> > I think, have you already tried with the 5.1.0 SNAPSHOT release? >> Does >> > this solve your issue? >> > >> > You can get the snapshot at >> > >> https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/ >> > >> > Kris >> > >> > Quoting SBalakrishnan : >> > >> >> >> >> Looks like I am running into the same/similar issue while >> recreating >> >> from a >> >> session_id. >> >> Exception pasted below. >> >> >> >> Any idea whether it will be addressed in the coming release ? >> >> >> >> >> >> Thanks in advance.. >> >> >> >> >> >> /**/ >> >> >> >> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.dirty >> as >> >> dirty0_0_, sessioninf0_.lastModificationDate as lastModi3_0_0_, >> >> sessioninf0_.rulesByteArray as rulesByt4_0_0_, >> sessioninf0_.startDate >> >> as >> >> startDate0_0_ from SessionInfo sessioninf0_ where >> sessioninf0_.id=? >> >> java.lang.RuntimeException: Unable to load session snapshot >> >> at >> >> >> > >> > org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:112) >> >> at >> >> >> > >> > org.drools.persistence.session.JPASessionMarshallingHelper.(JPASessionMarshallingHelper.java:46) >> >> at >> >> >> > >> > org.drools.persistence.session.SingleSessionCommandService.(SingleSessionCommandService.java:171) >> >> at >> >> >> > >> > org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.loadStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:75) >> >> at >> >> >> > >> > org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:102) >> >> at >> >> >> > >> > org.drools.examples.process.order.OrderExample.createWorkingMemory(OrderExample.java:257) >> >> at >> >> >> > >> > org.drools.examples.process.order.OrderExample.(OrderExample.java:99) >> >> at >> >> >> org.drools.examples.process.order.OrderExample.main(OrderExample.java:80) >> >> Caused by: java.lang.NullPointerException >> >> at >> >> >> > >> > org.drools.marshalling.impl.InputMarshaller.readLeftTuple(InputMarshaller.java:496) >> >> at >> >> >> > >> > org.drools.marshalling.impl.InputMarshaller.readLeftTuples(InputMarshaller.java:426) >> >> at >> >> >> > >> > org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:349) >> >> at >> >> >> > >> > org.drools.marshalling.impl.Inp
[rules-users] AgendaGroup Focus
Hi all, How do i check if an agenda group has the focus from my java test class Thanks chandana ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Trouble getting Dynamic Salience working
We have a winner! Many thanks Michal, hope I can return the favor one day. salience ( return getSalience4() ) for the record, my function looks something like (after tempate evaluation): function int getSalience4(){ int salience = 0; if("VALUE"=="VALUE") salience += 1000; return salience; } I think the combination activation-group and dynamic salience for rule-template projects are pretty useful. Just for anyone interested, the tempate code looks something like this: rule "Some ru...@{row.rownumber}" activation-group "@{param...@{param2}" salience ( return getsalie...@{row.rownumber}() ) where PARAM1 and PARAM2 make up a kind of key. I only want to execute one rule that matches that key, no matter how many options there are. Rules that have additional parameters get higher salience than rules with less parameters, so here is my function. function int getsalie...@{row.rownumber}(){ int salience = 0; if("@{PARAM3}"=="@{PARAM3}") salience += 1000; if("@{PARAM4}"=="@{PARAM4}") salience += 1000; return salience; } A concrete example could be pizza. So there are 3 types of pizza, all are grouped in the same activation-group. cheese, pepperoni cheese, pepperoni, sausage cheese, pepperoni, meatball, pepper Any cheese and pepperoni pizza should could match all these rules, but more toppings is always better for me. So cheese, pepperoni, onion, pepper getts a salience of 2000, and is the only rule evaluated. On Tue Sep 1 18:39:13 EDT 2009, Michal Bali michalbali at gmail.com wrote: does this work? salience ( return getSalience() ) or this: salience ( getSalience();) On Tue, Sep 1, 2009 at 6:50 PM, Bill Tarr wrote: > Possibily just a simple MVEL error, but I've been struggling for a while > and thought I'd see if anyone could help. > > I just want to run a logic test to determine salience for some rules I am > generating with rules-templates. Even after making the logical test "true" > I can't get any of variation to compile. > > (true ? "1000" : "0") > **produces** > Unable to build expression for 'salience' : not a statement, or badly > formed structure > > ( true ? 1000 : 0) > **produces** > Unable to build expression for 'salience' : invalid number literal: 1000 > > salience ( getSalience() ) > ... > function int getSalience(){return 0;} > **produces** > Unable to build expression for 'salience' : org.mvel2.util.MethodStub > cannot be cast to java.lang.Class'( getSalienceNONCDW() )' > > Seems like I am missing something simple, but I've tried many variations on > the above, and have been unable to find any working examples of using a > logical test in salience, so if anyone has any direction it would be greatly > appreciated. > > Thanks! > > Bill ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Trouble getting Dynamic Salience working
does this work? salience ( return getSalience() ) or this: salience ( getSalience();) On Tue, Sep 1, 2009 at 6:50 PM, Bill Tarr wrote: > Possibily just a simple MVEL error, but I've been struggling for a while > and thought I'd see if anyone could help. > > I just want to run a logic test to determine salience for some rules I am > generating with rules-templates. Even after making the logical test "true" > I can't get any of variation to compile. > > (true ? "1000" : "0") > **produces** > Unable to build expression for 'salience' : not a statement, or badly > formed structure > > ( true ? 1000 : 0) > **produces** > Unable to build expression for 'salience' : invalid number literal: 1000 > > salience ( getSalience() ) > ... > function int getSalience(){return 0;} > **produces** > Unable to build expression for 'salience' : org.mvel2.util.MethodStub > cannot be cast to java.lang.Class'( getSalienceNONCDW() )' > > Seems like I am missing something simple, but I've tried many variations on > the above, and have been unable to find any working examples of using a > logical test in salience, so if anyone has any direction it would be greatly > appreciated. > > Thanks! > > Bill > > > > > ___ > 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] question on drools and method calls on facts
I'm under the impression that in the action clause of a rule you should only do one of the following: 1) Set a property on a Fact 2) Retract a Fact 3) Insert (Assert) a new Fact 4) Modify an existing Fact However in some of the examples in the documentation it shows calling methods other than bean property getters and setters. I was wondering if what other peoples opinions are on whether you should be doing more than the 4 things I listed above in a then clause of a rule. Thanks, SG -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act ("E-Sign") unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Why so many ACTIVATION/DEACTIVATION events?
Thanks for the reply, Wolfgang. If I understand your scenario correctly, I think you are describing the expected activation patterns during the firing of this rule. I agree with your description, and our logs show something very similar. Responding to your specific suggestions - 1. The data model is a given - we have no control over it. 2. No-loop true is used on all our rules, including this one. In the example, I had removed rule attributes for brevity. 3. Unfortunately, the data semantics are also not under our control, and the rule has to test all these objects in order to work right. Further diagnosis indicates that what looked like multi-activated rules are actually not all the same rule instance, even though their content is the same - the log4j appender being used was improperly trimming the ends of the distinguishing identifiers when it logged them. However, although these rules are different instances of the rule, their conditions are identical, so I'm still puzzled why a set of conditions that are not met in the data will lead to an activation / deactivation. I'm going to have to dig deeper, I guess. Thanks. Tom Murphy Business Process Consultant Wells Fargo HCFG - CORE Deal Decisioning Platform 800 S. Jordan Creek Parkway | West Des Moines, IA 50266 MAC: X2301-01B Office: 515 324 4853 | Mobile: 941 320 8014 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. Date: Tue, 1 Sep 2009 08:04:46 +0200 From: Wolfgang Laun Subject: Re: [rules-users] Why so many ACTIVATION/DEACTIVATION events? To: Rules Users List Message-ID: <17de7ee80908312304y52499c00m88f3a45c6b225...@mail.gmail.com> Content-Type: text/plain; charset="windows-1252" Hi Tom, your understanding of "Activation" is fine, so let's see what happens if your rule "RS..." fires. (I'm abbreviating names.) Initially, neither PolSet nor PolSetId are there, so "RS..." activation #1 is on the agenda, fires and executes the consequence. Now, PolSet is created and inserted as a new fact. This causes reevaluation of all rules, including "RS..." (with its activation #1 still executing). The not(PolSet and PolSetId) is still true, and therefore the LHS yields true, and "RS..." activation #2 is put on the agenda. Continuing with #1, PolSetId is created and inserted, causing reevaluations of all rules. Now the not(PolSet and PolSetId) is false, so that "RS..." #2 is removed again. As for a remedy, you might consider several approaches. Notice that I have to guess what else might be going on, so I could be way off with (3), for instance. (1) Is it really necessary to have PolSet and PolSetId as two separate facts? (It might still be possible to have PolSet as an *object* for establishing linkage to the parental TransDet, without being a *fact*.) (2) Add the rule attribute no-loop true to "RS..." (3) If the absences of PolSetId alone is sufficient for triggering the rule(s), omit PolSet from rule "RS..." and add another rule which creates the "missing link" when you have a TransDet, the existence of at least one PolSetId and no matching PolSet, to create the latter. Cheers -W 2009/9/1 > We have a fairly complex object model, but we?re still puzzled ? I > thought that the definition of ?Activation? was that the data matched on all > conditions of a rule, and therefore the rule was entered into the agenda > (activated). > If that is true, I cannot figure out why we?re experiencing this. > As our number of rules increases, we?re seeing exponential increases in > repetitive activation/deactivation pairs, even on rules where we know the > data does not match the conditions. > > Example: > The following rule (abbreviated here) creates an object of type PolicySet > if there are none that match the conditions. > I would expect this rule to activate once, then fire, wherein the matching > PolicySet is created, and then never activate again since the absence of a > matching PolicySet object is never again true. > However, in a rule base of ~4,000 rules, we see this rule activating 975 > times and deactivating 975 times. This is just one example ? nearly all our > rules do this, and it is seriously impacting decisioning performance. > > Have I misunderstood the meaning of ?activation?? Can anyone help me > understand this? > > rule "RS6090.1.12_RF7007_50001012" > when > LendingProduct ( $exitStrategyType1 : exitStrategyType ) > Features ( $lienPriority1 : lienPriority ) > DecisionResultsInfo ( $dealRiskCategory1 : dealRiskCategory > ) > TransactionDetail ( $parentTransactionDetail1Id : myId ) >
[rules-users] Trouble getting Dynamic Salience working
Possibily just a simple MVEL error, but I've been struggling for a while and thought I'd see if anyone could help. I just want to run a logic test to determine salience for some rules I am generating with rules-templates. Even after making the logical test "true" I can't get any of variation to compile. (true ? "1000" : "0") **produces** Unable to build expression for 'salience' : not a statement, or badly formed structure ( true ? 1000 : 0) **produces** Unable to build expression for 'salience' : invalid number literal: 1000 salience ( getSalience() ) ... function int getSalience(){return 0;} **produces** Unable to build expression for 'salience' : org.mvel2.util.MethodStub cannot be cast to java.lang.Class'( getSalienceNONCDW() )' Seems like I am missing something simple, but I've tried many variations on the above, and have been unable to find any working examples of using a logical test in salience, so if anyone has any direction it would be greatly appreciated. Thanks! Bill ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] sliding time in lhs
Did you try setting the attribute @expires(1d) ? 2009/8/31 Francesco Chiarelli > > Hi! > i'm new to use a drools-fusion, i've a next lhs condition in rule: > $o: Order(status!="EU_C_R1_INIT") > SystemConfig(value:value) from hbnSession.createQuery("from > SystemConfig where name=:name").setString("name","nRicMax").uniqueResult() > $nRic : Number(intValue < value) from accumulate($n: > Order(this==$o) over window:time(1d),count($n)) > Data: > 1) Order 1 date 28 aug 2009 EU_C_INIT > 2) Order 1 date 31 aug 2009 EU_A_INIT > 3) Order 1 date 31 aug 2009 EU_B_INIT > 4) Order 1 date 30 aug 2009 EU_B_INIT > 5) Order 1 date 28 aug 2009 EU_A_INIT > 6) Order 1 date 01 aug 2009 EU_A_INIT > 7) Order 1 date 28 aug 2009 EU_C_INIT > 8) Order 1 date 28 aug 2009 EU_C_INIT > > Only the first condition is verified [ Order(status!="EU_C_R1_INIT") ] > altough there are facts that verify Order(this==$o) over window:time(24h) ] > There are n-k facts that don't verify a previous condition but them come > count also: > I espect that drools count a 2-3-4 but it count also 5-6-7: i'm confused > P.S. i did set a stream mode, i' had set a timestamp attribute in event > fact @timestamp(myTimestampLong), i tried with pseudo clock (making it > advance for new Date().getTime() or at origin, therefore 01 jan 1970 > [without event @timestamp attribute] ) > Regards > Francesco > > ___ > 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] WG: Serialization of packages: InvalidClassException / serialVersionUID
The exception of the KnowledgePackage serialization (by the way, this is described in the docs, that you can serialize the KnowledgePackages!): /home/bruecker/workspace/1/iKS2/iks_drools_rules/drools-rules.pkg Exception in thread "main" java.io.NotSerializableException: org.drools.definitions.impl.KnowledgePackageImp at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at org.drools.util.DroolsStreamUtils.streamOut(DroolsStreamUtils.java:79) at org.drools.util.DroolsStreamUtils.streamOut(DroolsStreamUtils.java:61) So this doesnt work either (http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht ml_single/index.html#d0e992): 3.2.4. Building and Deployment in Separate Processes Both the KnowledgeBase and the KnowledgePackage are units of deployment and serializable. This means you can have one machine do any necessary building, requiring drools-compiler.jar, and have another machine deploy and execute everything, needing only drools-core.jar. Although serialization is standard Java, we present an example of how one machine might write out the deployment unit and how another machine might read in and use that deployment unit. Example 3.15. Writing the KnowledgePackage to an OutputStream ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream( fileName ) ); out.writeObject( kpkgs ); out.close(); Example 3.16. Reading the KnowledgePackage from an InputStream ObjectInputStream in = new ObjectInputStream( new FileInputStream( fileName ) ); // The input stream might contain an individual // package or a collection. @SuppressWarnings( "unchecked" ) Collection kpkgs = ()in.readObject( Collection ); in.close(); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kpkgs ); The KnowledgeBase is also serializable and some people may prefer to build and then store the KnowledgeBase itself, instead of the Knowledge Packages. Drools Guvnor, our server side management system, uses this deployment approach. After Guvnor has compiled and published serialized Knowledge Packages on a URL, Drools can use the URL resource type to load them. Von: Bernd Rücker [mailto:bernd.ruec...@camunda.com] Gesendet: Dienstag, 1. September 2009 17:21 An: 'rules-users@lists.jboss.org' Betreff: Serialization of packages: InvalidClassException / serialVersionUID Hi! I really struggled some time with serialization issues: I want to create a pkg and package that with the jar. From there I want to read it during runtime. Easy I thought. Drools 5 way should be to serialize the KnowledgeBase, right? At least, this is what the AntTask does. If I try to serialize the KnowledgePackage I get an excpetion anyway: Okay. Back to the KnowledgeBase. Serialized with Drools 5.0.0.M4 and try to read it with 5.0.0.M5: Caused by: java.io.InvalidClassException: org.drools.impl.KnowledgeBaseImpl; local class incompatible: stream classdesc serialVersionUID = -4540376767025107954, local class serialVersionUID = -3186110098262381425 So it seems Drools Packages are NOT compatible between minor versions? This would be a disaster for deployment. Or do I serialize the wrong thing? Unfortunately I didnt find anything in the docs about it. Then I tried to do it the old Drools 4 way and serialize Package objects, but same problem with a different serialVersionUID! Why do these important classes dont have a serialVersionUID? Or how should that be loaded? Must be a big issue with Govner, so I think there must be a solution already? Thanks for any help! Cheers Bernd ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Serialization of packages: InvalidClassException / serialVersionUID
Hi! I really struggled some time with serialization issues: I want to create a pkg and package that with the jar. From there I want to read it during runtime. Easy I thought. Drools 5 way should be to serialize the KnowledgeBase, right? At least, this is what the AntTask does. If I try to serialize the KnowledgePackage I get an excpetion anyway: Okay. Back to the KnowledgeBase. Serialized with Drools 5.0.0.M4 and try to read it with 5.0.0.M5: Caused by: java.io.InvalidClassException: org.drools.impl.KnowledgeBaseImpl; local class incompatible: stream classdesc serialVersionUID = -4540376767025107954, local class serialVersionUID = -3186110098262381425 So it seems Drools Packages are NOT compatible between minor versions? This would be a disaster for deployment. Or do I serialize the wrong thing? Unfortunately I didnt find anything in the docs about it. Then I tried to do it the old Drools 4 way and serialize Package objects, but same problem with a different serialVersionUID! Why do these important classes dont have a serialVersionUID? Or how should that be loaded? Must be a big issue with Govner, so I think there must be a solution already? Thanks for any help! Cheers Bernd ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users