Re: [rules-users] Error running Drools example : org.drools.WorkingMemory not found
Hi, The WorkingMemory class is inside org.drools package and not inside org.drools.WorkingMemory. Also make sure that you include all the dependency jars. As in my case I also have - drools-compiler-4.0.4.jar - drools-jsr94.jar etc Regards, Rajnikant Gupta http://rkthinks.wordpress.com/ 2010/5/5 > > Hi > > I am new to Drools (using version 4.0.7). I download eclipse workbench and > am trying to run the default example in it. But I get the following error > > java.lang.NoClassDefFoundError: org/drools/WorkingMemory > > When I looked at the drools-core jar; It seems to be missing WorkingMemory > package. What should I do? > > Using eclipse version 3.4.0. > > Thanks > Devyani > > > *Please do not print this email unless it is absolutely necessary. * > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. The > company accepts no liability for any damage caused by any virus transmitted > by this email. > > www.wipro.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] addKnowledgePackages Delay
As I said earlier It *may* or *may not* be relevant in your case. Usually caching improves performance significantly in drools. In case of our application it does so by a very significant factor. Regards, Rajnikant Gupta http://rkthinks.wordpress.com/ 2010/5/3 Moe Alkhafaji > Hmmm, so you are suggesting I keep caches all possible combinations of > KnowledgePackages? If I have 100 possible KnowledgePackages and they are > loaded and unloaded dynamically that means I will have to have 100 choose n > where n goes from 1 to 100. That will make me go out of memory easy no? > > Thanks. > > Sent from my iPhone > > On May 3, 2010, at 2:07 AM, Rajnikant Gupta > wrote: > > It may look something like this: > > Map *knowledgeBaseCacheMap* = new HashMap(); > > this.knowledgeBase = knowledgeBaseCacheMap.get(""); > > if(this.knowledgeBase == null){ >this.knowledgeBase.addKnowledgePackages(packages); >*knowledgeBaseCacheMap.put("", this.knowledgeBase)* > } > > By doing this the packages get added to the knowledgeBase only for the > first time. From second request onwards you get the same knowledgeBase each > time without the need for adding the packages again. > > But this is valid only if you are not changing your rules. If your rules > are changing from time to time, you may have to look at caching at more > lower levels. > > I am not sure whether this can be helpful in your case but this is often > helpful. > > > Regards, > > Rajnikant Gupta > http://rkthinks.wordpress.com/ > > > 2010/5/3 Moe Alkhafaji > >> Thanks for the reply. But I don't understand what you mean by caching >> the KnowledgeBase. This is about adding a pre compiled KnowledgePackage to a >> KnowledgeBase. So, how does caching a KnowledgeBase makes addition of new >> KnowledgePackage faster? Please excuse my ignorance if I am not catching >> what you are suggesting. Maybe a couple of lines of code to demonstrate your >> suggestion would be greatly appreciated. Thanks. >> >> Sent from my iPhone >> >> On May 3, 2010, at 1:24 AM, Rajnikant Gupta >> wrote: >> >> Hi, >> >> Yes, adding packages to knowledgeBase does take some time. You can >> probably try caching your knowledgeBase. By doing this all, but first, >> requests should be significantly fast. >> >> >> >> >> Regards, >> >> Rajnikant Gupta >> >> <http://rkthinks.wordpress.com/>http://rkthinks.wordpress.com/ >> >> >> On Mon, May 3, 2010 at 11:36 AM, malkhafaji < >> moe.alkhaf...@medcpu.com> wrote: >> >>> >>> Hello, >>> >>> I am trying to add knowledge packages to an existing KnowledgeBase. My >>> largest DRL file has 110 rules. I noticed that it may take up to 5 >>> seconds >>> just to execute the following statement: >>> >>> this.knowledgeBase.addKnowledgePackages(packages); >>> >>> where "packages" is just a list of one knowledge package representing one >>> drl. The nature of my rules is that I initially load a small set of rules >>> and then at runtime my rules may load other DRLs. The problem is each DRL >>> loading command (this.knowledgeBase.addKnowledgePackages(packages)) takes >>> a >>> few seconds and I have no idea why. Although, all those DRLs are already >>> compiled (at startup time). It is the line I pasted above that takes the >>> longest time out of anything else I do. >>> >>> Any idea why just merely adding a KnowledgePackage list to a >>> KnowledgeBase >>> can take this much time? Do you guys have any suggestions on how I can >>> reduce this time? I tried to create another dummy KnowledgeBase and get >>> the >>> KnowledgePackage from it at runtime and add that to my KnowedgeBase above >>> (thinking that would reduce the time maybe), but not at all. >>> >>> Any ideas would be great. The API does not have much info on what that >>> add >>> method exactly does behind the scenes, and how I can get around the long >>> delays. This is very frustrating to me, and I am not sure where to look. >>> Thanks for ANY help at all. >>> -- >>> View this message in context: >>> <http://drools-java-rules-engine.46999.n3.nabble.com/addKnowledgePackages-Delay-tp772574p772574.html> >>> http://drools-java-rules-engine.46999.n3.nabble.com/addKnowledgePackages-Delay-tp772574p772574.html >>> Sent from the Drools - User mailing list archive at >>> Nabble.com<http://nabble.com/>
Re: [rules-users] addKnowledgePackages Delay
It may look something like this: Map *knowledgeBaseCacheMap* = new HashMap(); this.knowledgeBase = knowledgeBaseCacheMap.get(""); if(this.knowledgeBase == null){ this.knowledgeBase.addKnowledgePackages(packages); *knowledgeBaseCacheMap.put("", this.knowledgeBase)* } By doing this the packages get added to the knowledgeBase only for the first time. From second request onwards you get the same knowledgeBase each time without the need for adding the packages again. But this is valid only if you are not changing your rules. If your rules are changing from time to time, you may have to look at caching at more lower levels. I am not sure whether this can be helpful in your case but this is often helpful. Regards, Rajnikant Gupta http://rkthinks.wordpress.com/ 2010/5/3 Moe Alkhafaji > Thanks for the reply. But I don't understand what you mean by caching the > KnowledgeBase. This is about adding a pre compiled KnowledgePackage to a > KnowledgeBase. So, how does caching a KnowledgeBase makes addition of new > KnowledgePackage faster? Please excuse my ignorance if I am not catching > what you are suggesting. Maybe a couple of lines of code to demonstrate your > suggestion would be greatly appreciated. Thanks. > > Sent from my iPhone > > On May 3, 2010, at 1:24 AM, Rajnikant Gupta > wrote: > > Hi, > > Yes, adding packages to knowledgeBase does take some time. You can probably > try caching your knowledgeBase. By doing this all, but first, > requests should be significantly fast. > > > > > Regards, > > Rajnikant Gupta > > http://rkthinks.wordpress.com/ > > > On Mon, May 3, 2010 at 11:36 AM, malkhafaji wrote: > >> >> Hello, >> >> I am trying to add knowledge packages to an existing KnowledgeBase. My >> largest DRL file has 110 rules. I noticed that it may take up to 5 seconds >> just to execute the following statement: >> >> this.knowledgeBase.addKnowledgePackages(packages); >> >> where "packages" is just a list of one knowledge package representing one >> drl. The nature of my rules is that I initially load a small set of rules >> and then at runtime my rules may load other DRLs. The problem is each DRL >> loading command (this.knowledgeBase.addKnowledgePackages(packages)) takes >> a >> few seconds and I have no idea why. Although, all those DRLs are already >> compiled (at startup time). It is the line I pasted above that takes the >> longest time out of anything else I do. >> >> Any idea why just merely adding a KnowledgePackage list to a KnowledgeBase >> can take this much time? Do you guys have any suggestions on how I can >> reduce this time? I tried to create another dummy KnowledgeBase and get >> the >> KnowledgePackage from it at runtime and add that to my KnowedgeBase above >> (thinking that would reduce the time maybe), but not at all. >> >> Any ideas would be great. The API does not have much info on what that add >> method exactly does behind the scenes, and how I can get around the long >> delays. This is very frustrating to me, and I am not sure where to look. >> Thanks for ANY help at all. >> -- >> View this message in context: >> http://drools-java-rules-engine.46999.n3.nabble.com/addKnowledgePackages-Delay-tp772574p772574.html >> Sent from the Drools - User mailing list archive at >> Nabble.com<http://nabble.com/> >> . >> ___ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > > ___ > 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] addKnowledgePackages Delay
Hi, Yes, adding packages to knowledgeBase does take some time. You can probably try caching your knowledgeBase. By doing this all, but first, requests should be significantly fast. Regards, Rajnikant Gupta http://rkthinks.wordpress.com/ On Mon, May 3, 2010 at 11:36 AM, malkhafaji wrote: > > Hello, > > I am trying to add knowledge packages to an existing KnowledgeBase. My > largest DRL file has 110 rules. I noticed that it may take up to 5 seconds > just to execute the following statement: > > this.knowledgeBase.addKnowledgePackages(packages); > > where "packages" is just a list of one knowledge package representing one > drl. The nature of my rules is that I initially load a small set of rules > and then at runtime my rules may load other DRLs. The problem is each DRL > loading command (this.knowledgeBase.addKnowledgePackages(packages)) takes a > few seconds and I have no idea why. Although, all those DRLs are already > compiled (at startup time). It is the line I pasted above that takes the > longest time out of anything else I do. > > Any idea why just merely adding a KnowledgePackage list to a KnowledgeBase > can take this much time? Do you guys have any suggestions on how I can > reduce this time? I tried to create another dummy KnowledgeBase and get the > KnowledgePackage from it at runtime and add that to my KnowedgeBase above > (thinking that would reduce the time maybe), but not at all. > > Any ideas would be great. The API does not have much info on what that add > method exactly does behind the scenes, and how I can get around the long > delays. This is very frustrating to me, and I am not sure where to look. > Thanks for ANY help at all. > -- > View this message in context: > http://drools-java-rules-engine.46999.n3.nabble.com/addKnowledgePackages-Delay-tp772574p772574.html > Sent from the Drools - User mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RuleAgent in webservice
Try putting your .properties file inside "WEB-INF/classes" folder of your context. Regards, Rajnikant Gupta http://rkthinks.wordpress.com/ On Fri, Apr 30, 2010 at 2:35 PM, Gayatri Chandak wrote: > Hi, > > I had also faced the same problem. > Use the below code, it works proeprly. > > Properties properties = new Properties(); > InputStream stream = DiscountCheckServlet.class.getResourceAsStream > (""); > properties.load(stream); > RuleAgent agent = RuleAgent.newRuleAgent(properties); > > Please let me know if it works. > > Regards, > Gayatri Chandak > TEG-Open Source > Tata Consultancy Services > Yantra Park -(STPI) > 2nd Pokharan Road, > Opp HRD Voltas Center,Subash Nagar > Mumbai - 400 601,Maharashtra > India > Ph:- 022-67782556 > Mailto: gayatri.chan...@tcs.com > Website: http://www.tcs.com > > Experience certainty. IT Services > Business Solutions > Outsourcing > > > > > From: shekharputtur puttur > > To: rules-users@lists.jboss.org > > Date: 04/30/2010 02:29 PM > > Subject:[rules-users] RuleAgent in webservice > > Sent by:rules-users-boun...@lists.jboss.org > > > > > > > Hi All, > I am using drools API, and developed a webservice out of it. > I created rule binary package using BRMS Guvnor. > I used RuleAgent to acces the properties file. > ie RuleAgent agent = RuleAgent.newRuleAgent("/ > application.properties"); > "application.properties" file was stored in current working directory. > I executed my application using eclipse, it was fine . > > For testing purpose i deployed the application in tomcat application > server. > Now it is unable to find "application.properties" file. and shows > following in "catalina.out" file: > java.lang.NullPointerException > at java.util.Properties$LineReader.readLine(Properties.java:418) > at java.util.Properties.load0(Properties.java:337) > at java.util.Properties.load(Properties.java:325) > at org.drools.agent.RuleAgent.loadFromProperties > (RuleAgent.java:299) > at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256) > My question is, in which location should i keep the > "application.properties" file , so that RuleAgent can access it. > > Could you please tell me the solution. > > Thanks & Regards > Shekhar___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > > > =-=-= > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] rules on web application
One of the possible ways could be to publish your rule as web service so that it can be called by any web application. Regards, Rajnikant Gupta http://rkthinks.wordpress.com/ 2010/4/20 joseramon diaz > Thanks Wolfgang, > I have been looking at DSLs, seems to be a very interesting concept. > When the domain expert has created new rules, is there a way to *test* > those rules against some data without executing them? > > Thanks > >Jose Ramón > > > 2010/4/20 Wolfgang Laun > > Look into Domain Specific Languages - this is an easy way for letting >> application domain experts edit rules, even with a mere HTML text entry >> field. >> -W >> >> 2010/4/19 joseramon diaz >> >>> Hi all, >>> >>> I *think* we should use a rules engine on our web application, as some >>> bussiness rules should be changed by user, and their context can be quite >>> reduced. >>> We have a web application, and rules would apply to some bussiness >>> objects, but my question is about hot to integrate the rules editor in our >>> web application. >>> One option I can imagine is to let him modify XML inside a textarea, >>> but it seems quite hard for him. Is there any web editor for rules that we >>> can integrate in our web application, as in eclipse? >>> >>> Thanks >>> >>> Jose Ramón >>> >>> ___ >>> 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 > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Tuples in Agenda Item.
DroolsWorkingMemory is our custom class which contains asserted facts and other custom objects based on our project requirement. It should not be confused with "WorkingMemory" of Drools. For issue 1, I assume that if I overwrite one field in ConcreteType1 to a different value than that in BaseType, they are treated as diferrent objects. Consider the xml snapshot of the two objects for eg: *BaseType* object: false 2010-04-09T00:00:00 a 0.0 *ConcreteType1* object: false 2010-04-09T00:00:00 b 0.0 false so I assume I have two objects BaseType(with value of String as "a") and ConcreteType1 object (with value of String as "b"). The rule should evaluate to false on the above assumption. For issue 2, Sorry If i have misled, my only question was why does the Tuple inside Agenda Item show only ConcreteType1 and not the BaseType, If both of them are inserted in WorkingMemory. Doesn't the tuple contain all the objects inserted in WM. Regards, Rajnikant Gupta 2010/4/9 Wolfgang Laun > Regarding Issue 1: > Even if you do have different objects of ConcreteType1, the rule is fired > for each of them, since each of these is equal to itself in terms of the > BaseType. > > I also fail to understand Issue 2. But perhaps your misconception about > base type and subtype matching is also responsible for that. > > Rule "s" looks strange for more than one reason. What is the > DroolsWorkingMemory() pattern supposed to achieve? Is it a general trigger > so that the rule only fires if one such object is present? > > Leaving base and extended types aside, testing for the equality of two > objects of the same type must be done much more carefully. Assuming three > objects of TypeX, x1, x2, x3 with x1.equals(x2) and NOT x1.equals(x3) and a > rule like this: > > rule "xxx" > when >o1 : TypeX() >o2 : TypeX() >eval( o1.equals( o2 ) ) > then > ... > > This rule will fire 5 times, with the following activations: >, , , , . > > Using, e.g., >o2:TypeX( this != o1 ) > reduces this to two firings. > > -W > > > 2010/4/9 Rajnikant Gupta > > Hi, >> ** >> Sorry for not being very clear. Here's the rule which I run: >> ** >> ** >> *package rr* >> *import com.thirdpillar.common.util.DroolsWorkingMemoryimport >> com.parentchild.BaseType* >> *import com.parentchild.ConcreteType1 * >> ** >> *rule "s"* >> *no-loop true * >> *salience 99 * >> ** >> *when* >> *DroolsWorkingMemory:DroolsWorkingMemory()* >> *BaseType:BaseType()* >> *ConcreteType1:ConcreteType1()* >> *eval (* >> *(* >> *((BaseType.equals(ConcreteType1)))* >> *)* >> *)* >> *then* >> *BaseType.setString("Blah Blah!");* >> *end * >> >> where *ConcreteType1 *extends *BaseType. * >> ** >> *Issues:* >> 1. Even for different values for fields in *ConcreteType1* and *BaseType, >> *the rule gets fired. >> >> 2. I also do audit for the rules for which i need tuples so that I can >> extract the objects out of it and evaluate the expression against Mvel. But >> the tuple shows me only the *ConcreteType1* instance not the *BaseType. *Thus >> getting wrong audit. >> >> Regards, >> >> Rajnikant Gupta >> Sr. Software Engineer >> GlobalLogic,Noida >> 09899530562 >> >> http://rkthinks.wordpress.com/ >> >> >> 2010/4/9 Greg Barton >> >> We need some rule code to get a better idea of what's going on. Can >>> you post some? >>> >>> --- On *Thu, 4/8/10, Rajnikant Gupta * wrote: >>> >>> >>> From: Rajnikant Gupta >>> Subject: [rules-users] Tuples in Agenda Item. >>> To: rules-users@lists.jboss.org >>> Date: Thursday, April 8, 2010, 1:36 PM >>> >>> >>> >>> Hi, >>> >>> I have a doubt regarding tuples. I created a rule using complex types >>> objects. I am comparing two complex type objecs which have parent-child >>> relationship eg. "ParentType.equals(ChildType)". I expect this to follow >>> java rule which allows such comparision. Now when I run the rules with >>> different values for fields in ParentType and ChildType (which means the >>> rule should fail) to my surprise it evals to TRUE. Also upon inspection, the >>> tuple shows me only the ChildType instance not the ParentType. >>> >>> I would appreciate any help on this. >>> >>> >>> Regards, >>> >>> Rajnikant >>> &
Re: [rules-users] Tuples in Agenda Item.
Hi, ** Sorry for not being very clear. Here's the rule which I run: ** ** *package rr* *import com.thirdpillar.common.util.DroolsWorkingMemoryimport com.parentchild.BaseType* *import com.parentchild.ConcreteType1 * ** *rule "s"* *no-loop true * *salience 99 * ** *when* *DroolsWorkingMemory:DroolsWorkingMemory()* *BaseType:BaseType()* *ConcreteType1:ConcreteType1()* *eval (* *(* *((BaseType.equals(ConcreteType1)))* *)* *)* *then* *BaseType.setString("Blah Blah!");* *end * where *ConcreteType1 *extends *BaseType. * ** *Issues:* 1. Even for different values for fields in *ConcreteType1* and *BaseType, *the rule gets fired. 2. I also do audit for the rules for which i need tuples so that I can extract the objects out of it and evaluate the expression against Mvel. But the tuple shows me only the *ConcreteType1* instance not the *BaseType. *Thus getting wrong audit. Regards, Rajnikant Gupta Sr. Software Engineer GlobalLogic,Noida 09899530562 http://rkthinks.wordpress.com/ 2010/4/9 Greg Barton > We need some rule code to get a better idea of what's going on. Can you > post some? > > --- On *Thu, 4/8/10, Rajnikant Gupta * wrote: > > > From: Rajnikant Gupta > Subject: [rules-users] Tuples in Agenda Item. > To: rules-users@lists.jboss.org > Date: Thursday, April 8, 2010, 1:36 PM > > > > Hi, > > I have a doubt regarding tuples. I created a rule using complex types > objects. I am comparing two complex type objecs which have parent-child > relationship eg. "ParentType.equals(ChildType)". I expect this to follow > java rule which allows such comparision. Now when I run the rules with > different values for fields in ParentType and ChildType (which means the > rule should fail) to my surprise it evals to TRUE. Also upon inspection, the > tuple shows me only the ChildType instance not the ParentType. > > I would appreciate any help on this. > > > Regards, > > Rajnikant > > -Inline Attachment Follows- > > ___ > rules-users mailing list > rules-users@lists.jboss.org<http://mc/compose?to=rules-us...@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
[rules-users] Tuples in Agenda Item.
Hi, I have a doubt regarding tuples. I created a rule using complex types objects. I am comparing two complex type objecs which have parent-child relationship eg. "ParentType.equals(ChildType)". I expect this to follow java rule which allows such comparision. Now when I run the rules with different values for fields in ParentType and ChildType (which means the rule should fail) to my surprise it evals to TRUE. Also upon inspection, the tuple shows me only the ChildType instance not the ParentType. I would appreciate any help on this. Regards, Rajnikant ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Query about the state of tuples in AgendaItem.
Hi Group, I have a doubt regarding tuples. I created a rule using complex types objects. I am comparing two complex type objecs which have parent-child relationship eg. "ParentType.equals(ChildType)". I expect this to follow java rule which allows such comparision. Now when I run the rules with different values for fields in ParentType and ChildType (which means the rule should fail) to my surprise it evals to TRUE. Also upon inspection, the tuple shows me only the ChildType instance not the ParentType. I would appreciate any help on this. Regards, Rajnikant Gupta ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users