Re: [rules-users] Rules doubt
Puneet, this is what I do to load rules and start a session: File drl = new File( getDrlPath() ); ruleBase = RuleBaseFactory.newRuleBase(); PackageBuilder pb = new PackageBuilder(); Reader fr = new FileReader( drl ); pb.addPackageFromDrl( fr ); if( pb.hasErrors() ){ PackageBuilderErrors errors = pb.getErrors(); for( DroolsError err: errors.getErrors() ){ System.err.println( err.toString() ); } return; // or whatever you need to do in your environment to abort } ruleBase.addPackages( pb.getPackages() ); session = ruleBase.newStatefulSession(); and this is the error message that's printed due to a comparable error: Rule Compilation error : [Rule name='ruleB'] appl/activation/Rule_ruleB_0.java (10:524) : The method setName(String) in the type Thing is not applicable for the arguments (Double) -W 2010/5/4 Puneet duggal duggalpu...@gmail.com This is My rule rule Area_SquareFt_01_10-01-09_12-31-14 date-effective 01-Oct-2009 date-expires 31-Dec-2014 salience 6 no-loop true when eval(BusinessLogic.gettest(Inside Area_SquareFt_01_10-01-09_12-31-14 executed)) objectP2483 : Para_2483( (fid2335==Block) (fid2336==16) ); then System.out.println(Area_SquareFt_01_10-01-09_12-31-14 executed); objectP2483.setFid31003(new Double(497)); end here My 31003 is a String field but i am assigning a Double in it so that should'nt work . But the problem is because of this my all remmaning rules also stoped working. And it took 2 hours to detect it because the execute() method dosent through any error. So how can we detect these situation earlier ,so as to catch the problem early and why my the remm rules stoped woking because on this. On 5/4/10, tolitius webaka...@gmail.com wrote: @Puneet, Examples would be useful to understand what kind of problem you are having. As to Puneet wrote: how can I detect which exact business rule is having error Check out Debugging Rules section of Drools documentation: http://bit.ly/9PRDRJ @Wolfgang, No need to be a hater Wolfgang, the question is simple. I agree, examples would be helpful, but that is NOT how you grow a friendly community. Community is the biggest problem JBoss has. Why is it so inhumanly difficult to be polite and considerate? /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p775029.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to move a repository from derby database to Oracle Database
The first FileSystem path param should be the same as in the default repository.xml file. This is param name=path value=${rep.home}/repository/ and not param name=path value=${rep.home}/ vadlam wrote: for some reason, the xml info within the OraclePersistenceManager tag came out as blank in the post. I am attaching the file this time. Also, I changed the path to point to rep.home variable as you suggested. I still get the same error. http://n3.nabble.com/file/n773632/repository.xml repository.xml ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Chained Rules
Hi all, I know there are some basic ways to chain rules together, by setting flags in consequences that are checked in the conditions of other rules... but in a large system based on rule templates, where thousands of rules are generated, it is not feasible to chain rules in this manner, especially when they are chained in a somewhat arbitrary fashion (eg. True if Rule 130 AND Rule 200 AND Rule 480 fire) has anyone had this situation before? would I need to execute this as a post-processing step? or, is there any design pattern that will allow rules to be chained, preferably in a manageable way? regards, Daniel -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Chained-Rules-tp775491p775491.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] how exists works exactly?
Hi all, I don't know exactly why I have a problem in my exists function. I've tried many different ways, but it does not work. Anybody could help me, please? I have the following rules: *rule diff when $var1: EReference(name == employee) $var2: EClass(name == Company, EAllReferences contains $var1) not (exists( EPackage(EClassifiers contains $var2 ) )) then insertLogical(new IntConstraintOccurrence(diff, 10)); end rule ClassesNotReferenced when $q1 : EClass(); $q2 : EPackage(EClassifiers contains $q1); not( exists ( EReference(EType == $q1) )); then insertLogical(new IntConstraintOccurrence(ClassesNotReferenced, 1, $q1)); end* and in my facts (and my EPackage) I have 4 instances of EClass Company with a EReference employee, and another EClass Person. I still have a move that removes EClasses in my Drools Solver. I need to have only one classe Company after processing. But it removes only the EClass Person, when it was supposed to remove one EClass Person and 3 ECLasses Company. Leaving one EClass Company in the end. The problem is: when Drools tries to remove a EClass Person it thinks that the EClass Company does not exists. But in fact there are 3 others. Any clue about it, please ? Thanks Bests regards Antonio ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rules doubt
drlFile = BusinessRuleUtils.createCombinedDrlDocument(id,map.get(id)); PackageBuilder PACKAGE_BUILDER = new PackageBuilder(BUILDER_CONFIGURATION); org.drools.rule.Package pkg = null; PACKAGE_BUILDER .addPackageFromDrl(new StringReader(drlFile)); if (PACKAGE_BUILDER.hasErrors()) { DSM_LOGGER .logFatal(Error has occured while building package. For Parameter ID : + id + Error details are : + PACKAGE_BUILDER.getErrors() .toString()); } else { pkg = PACKAGE_BUILDER.getPackage(); RULEBASE.addPackage(pkg); DSM_LOGGER .logInfo(Package created for Component Prmr ID : + id); } This is the code which i am using at it is not giving any error at the time creating the drl file.it is also not giving any error at the time of calling of execute() method , but rules are not executed . On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Anatoly, please note that I wrote please to Puneet, which is usually not considered as being impolite. Also, kindly note that I asked for more information, which, in my book, is not inconsiderate, as simply deleting Puneet's post might have been. I do resent being called a hater, and I'll let the community judge whether my (admittedly ironic) kidding is hateful. Somehow, however, posters have to be admonished to state their problem more detailed, without people on the list having to waste their time playing guessing games or writing replies begging for more information. -W PS: A you can see now, it was not a question of debugging, and so you have wasted your time on a simple question. :-) On Tue, May 4, 2010 at 5:10 AM, tolitius webaka...@gmail.com wrote: @Wolfgang, No need to be a hater Wolfgang, the question is simple. I agree, examples would be helpful, but that is NOT how you grow a friendly community. Community is the biggest problem JBoss has. Why is it so inhumanly difficult to be polite and considerate? /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p775029.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools Flow: how to get knowledge session ID from WorkItem
The subject says it all really: is there any way of determining the knowledge session ID from the WorkItem argument (or WorkItemManager argument?) passed in to the executeWorkItem method of an implementation of the WorkItemHandler interface? Any help would be very much appreciated. Thanks, Alan___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow: how to get knowledge session ID from WorkItem
Hi Alan, On 2010-05-04 13:10, alan.gai...@tessella.com wrote: The subject says it all really: is there any way of determining the knowledge session ID from the WorkItem argument (or WorkItemManager argument?) passed in to the executeWorkItem method of an implementation of the WorkItemHandler interface? I had the same problem so i simply extended the work item handler interface like this: public interface SessionAwareWorkItemHandler extends WorkItemHandler { StatefulKnowledgeSession getKnowledgeSession(); void setKnowledgeSession(StatefulKnowledgeSession session); } If you register a SessionAwareWorkItemHandler, just let him know about the session: if (handler instanceof SessionAwareWorkItemHandler) { SessionAwareWorkItemHandler sessionAware = (SessionAwareWorkItemHandler)handler; sessionAware.setKnowledgeSession(ksession); } ksession.getWorkItemManager().registerWorkItemHandler(workItem, handler); Hope this helps, it works for me. - chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rules doubt
Actually, this kind of error isn't discovered by the Drools DRL compiler; it would be flagged by the Java compiler. (You can verify: if you make the same error in Java code, you'll get that error message.) But if you are using dialect mvel (are you?), this is not flagged as an error, and it would silently convert the Double to a String, and set fid31003 to 497.0. Is this what keeps your other rules from firing, i.e., the excess .0? I suggest that you do not use mvel unless there is a compelling reason (in other rules). Even then, you might restrict use mvel to those rules where it is really necessary. -W 2010/5/4 Puneet duggal duggalpu...@gmail.com drlFile = BusinessRuleUtils.createCombinedDrlDocument(id,map.get(id)); PackageBuilder PACKAGE_BUILDER = new PackageBuilder(BUILDER_CONFIGURATION); org.drools.rule.Package pkg = null; PACKAGE_BUILDER .addPackageFromDrl(new StringReader(drlFile)); if (PACKAGE_BUILDER.hasErrors()) { DSM_LOGGER .logFatal(Error has occured while building package. For Parameter ID : + id + Error details are : + PACKAGE_BUILDER.getErrors() .toString()); } else { pkg = PACKAGE_BUILDER.getPackage(); RULEBASE.addPackage(pkg); DSM_LOGGER .logInfo(Package created for Component Prmr ID : + id); } This is the code which i am using at it is not giving any error at the time creating the drl file.it is also not giving any error at the time of calling of execute() method , but rules are not executed . On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Anatoly, please note that I wrote please to Puneet, which is usually not considered as being impolite. Also, kindly note that I asked for more information, which, in my book, is not inconsiderate, as simply deleting Puneet's post might have been. I do resent being called a hater, and I'll let the community judge whether my (admittedly ironic) kidding is hateful. Somehow, however, posters have to be admonished to state their problem more detailed, without people on the list having to waste their time playing guessing games or writing replies begging for more information. -W PS: A you can see now, it was not a question of debugging, and so you have wasted your time on a simple question. :-) On Tue, May 4, 2010 at 5:10 AM, tolitius webaka...@gmail.com wrote: @Wolfgang, No need to be a hater Wolfgang, the question is simple. I agree, examples would be helpful, but that is NOT how you grow a friendly community. Community is the biggest problem JBoss has. Why is it so inhumanly difficult to be polite and considerate? /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p775029.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 ___ 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 doubt
@ Wolfgang Laun , i am using just this statement:- javaConf.setCompiler( JavaDialectConfiguration.*JANINO* ); I dont know the exact use of this statement .I am not using the mvel , i tried to google abt it but couldnt find the use of this ... can u through some light on this. Thanks On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Actually, this kind of error isn't discovered by the Drools DRL compiler; it would be flagged by the Java compiler. (You can verify: if you make the same error in Java code, you'll get that error message.) But if you are using dialect mvel (are you?), this is not flagged as an error, and it would silently convert the Double to a String, and set fid31003 to 497.0. Is this what keeps your other rules from firing, i.e., the excess .0? I suggest that you do not use mvel unless there is a compelling reason (in other rules). Even then, you might restrict use mvel to those rules where it is really necessary. -W 2010/5/4 Puneet duggal duggalpu...@gmail.com drlFile = BusinessRuleUtils.createCombinedDrlDocument(id,map.get(id)); PackageBuilder PACKAGE_BUILDER = new PackageBuilder(BUILDER_CONFIGURATION); org.drools.rule.Package pkg = null; PACKAGE_BUILDER .addPackageFromDrl(new StringReader(drlFile)); if (PACKAGE_BUILDER.hasErrors()) { DSM_LOGGER .logFatal(Error has occured while building package. For Parameter ID : + id + Error details are : + PACKAGE_BUILDER.getErrors() .toString()); } else { pkg = PACKAGE_BUILDER.getPackage(); RULEBASE.addPackage(pkg); DSM_LOGGER .logInfo(Package created for Component Prmr ID : + id); } This is the code which i am using at it is not giving any error at the time creating the drl file.it is also not giving any error at the time of calling of execute() method , but rules are not executed . On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Anatoly, please note that I wrote please to Puneet, which is usually not considered as being impolite. Also, kindly note that I asked for more information, which, in my book, is not inconsiderate, as simply deleting Puneet's post might have been. I do resent being called a hater, and I'll let the community judge whether my (admittedly ironic) kidding is hateful. Somehow, however, posters have to be admonished to state their problem more detailed, without people on the list having to waste their time playing guessing games or writing replies begging for more information. -W PS: A you can see now, it was not a question of debugging, and so you have wasted your time on a simple question. :-) On Tue, May 4, 2010 at 5:10 AM, tolitius webaka...@gmail.com wrote: @Wolfgang, No need to be a hater Wolfgang, the question is simple. I agree, examples would be helpful, but that is NOT how you grow a friendly community. Community is the biggest problem JBoss has. Why is it so inhumanly difficult to be polite and considerate? /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p775029.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 ___ 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] Rules doubt
@Wolfgang, 1.Thank you for being considered, and not simply deleting Puneet's question. 2.I know that debugging was not the right answer, in case the error meant his rule did not even compile, and it was not a business error. 2.After Puneet's gave you a better description, you answer ( pb.getErrors() ) had nothing to do with the actual description. 3.@salaboy gave the same answer ( kbuilder.getErrors() ) only based on the initial question, was he sitting a little to the left with a better vision, so the font did not need to be enlarged for him? The moral is: Knowledge in a matter ( and the power to delete the post ) should not make you less willing to help. /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p776069.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rules doubt
Here, I've found this for you, a comment from the Drools source file org.drools.rule.builder.dialect.java.JavaDialectConfiguration * There are options to use various flavours of runtime compilers. * Apache JCI is used as the interface to all the runtime compilers. * * You can also use the system property drools.compiler to set the desired compiler. * The valid values are ECLIPSE and JANINO only. * * drools.dialect.java.compiler = ECLIPSE|JANINO * drools.dialect.java.lngLevel = 1.5|1.6 * * The default compiler is Eclipse and the default lngLevel is 1.5. * The lngLevel will attempt to autodiscover your system using the * system property java.version * * The JavaDialectConfiguration will attempt to validate that the specified compiler * is in the classpath, using ClassLoader.loasClass(String). If you intented to * just Janino sa the compiler you must either overload the compiler property before * instantiating this class or the PackageBuilder, or make sure Eclipse is in the * classpath, as Eclipse is the default. Try it without the JANINO setting - it *should* flag the setter with the incompatible types. If you haven't used MVEL so far, I don't see any reason to start now. -W 2010/5/4 Puneet duggal duggalpu...@gmail.com: @ Wolfgang Laun , i am using just this statement:- javaConf.setCompiler( JavaDialectConfiguration.JANINO ); I dont know the exact use of this statement .I am not using the mvel , i tried to google abt it but couldnt find the use of this ... can u through some light on this. Thanks On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Actually, this kind of error isn't discovered by the Drools DRL compiler; it would be flagged by the Java compiler. (You can verify: if you make the same error in Java code, you'll get that error message.) But if you are using dialect mvel (are you?), this is not flagged as an error, and it would silently convert the Double to a String, and set fid31003 to 497.0. Is this what keeps your other rules from firing, i.e., the excess .0? I suggest that you do not use mvel unless there is a compelling reason (in other rules). Even then, you might restrict use mvel to those rules where it is really necessary. -W 2010/5/4 Puneet duggal duggalpu...@gmail.com drlFile = BusinessRuleUtils.createCombinedDrlDocument(id,map.get(id)); PackageBuilder PACKAGE_BUILDER = new PackageBuilder(BUILDER_CONFIGURATION); org.drools.rule.Package pkg = null; PACKAGE_BUILDER .addPackageFromDrl(new StringReader(drlFile)); if (PACKAGE_BUILDER.hasErrors()) { DSM_LOGGER .logFatal(Error has occured while building package. For Parameter ID : + id + Error details are : + PACKAGE_BUILDER.getErrors() .toString()); } else { pkg = PACKAGE_BUILDER.getPackage(); RULEBASE.addPackage(pkg); DSM_LOGGER .logInfo(Package created for Component Prmr ID : + id); } This is the code which i am using at it is not giving any error at the time creating the drl file.it is also not giving any error at the time of calling of execute() method , but rules are not executed . On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Anatoly, please note that I wrote please to Puneet, which is usually not considered as being impolite. Also, kindly note that I asked for more information, which, in my book, is not inconsiderate, as simply deleting Puneet's post might have been. I do resent being called a hater, and I'll let the community judge whether my (admittedly ironic) kidding is hateful. Somehow, however, posters have to be admonished to state their problem more detailed, without people on the list having to waste their time playing guessing games or writing replies begging for more information. -W PS: A you can see now, it was not a question of debugging, and so you have wasted your time on a simple question. :-) On Tue, May 4, 2010 at 5:10 AM, tolitius webaka...@gmail.com wrote: @Wolfgang, No need to be a hater Wolfgang, the question is simple. I agree, examples would be helpful, but that is NOT how you grow a friendly community. Community is the biggest problem JBoss has. Why is it so inhumanly difficult to be polite and considerate? /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-doubt-tp774023p775029.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 ___ rules-users mailing list rules-users@lists.jboss.org
Re: [rules-users] Rules doubt
@Wolfgang, thanks a lot for ur wonderful explanation regarding the Dialect... But i still cant find the better way to know the exact error in some cases ,one case i had mentioned in my previous post ...i want to highlight that my drl are loading from database so i cant put break point in drl. appreciate ur help. thanks Puneet On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Here, I've found this for you, a comment from the Drools source file org.drools.rule.builder.dialect.java.JavaDialectConfiguration * There are options to use various flavours of runtime compilers. * Apache JCI is used as the interface to all the runtime compilers. * * You can also use the system property drools.compiler to set the desired compiler. * The valid values are ECLIPSE and JANINO only. * * drools.dialect.java.compiler = ECLIPSE|JANINO * drools.dialect.java.lngLevel = 1.5|1.6 * * The default compiler is Eclipse and the default lngLevel is 1.5. * The lngLevel will attempt to autodiscover your system using the * system property java.version * * The JavaDialectConfiguration will attempt to validate that the specified compiler * is in the classpath, using ClassLoader.loasClass(String). If you intented to * just Janino sa the compiler you must either overload the compiler property before * instantiating this class or the PackageBuilder, or make sure Eclipse is in the * classpath, as Eclipse is the default. Try it without the JANINO setting - it *should* flag the setter with the incompatible types. If you haven't used MVEL so far, I don't see any reason to start now. -W 2010/5/4 Puneet duggal duggalpu...@gmail.com: @ Wolfgang Laun , i am using just this statement:- javaConf.setCompiler( JavaDialectConfiguration.JANINO ); I dont know the exact use of this statement .I am not using the mvel , i tried to google abt it but couldnt find the use of this ... can u through some light on this. Thanks On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Actually, this kind of error isn't discovered by the Drools DRL compiler; it would be flagged by the Java compiler. (You can verify: if you make the same error in Java code, you'll get that error message.) But if you are using dialect mvel (are you?), this is not flagged as an error, and it would silently convert the Double to a String, and set fid31003 to 497.0. Is this what keeps your other rules from firing, i.e., the excess .0? I suggest that you do not use mvel unless there is a compelling reason (in other rules). Even then, you might restrict use mvel to those rules where it is really necessary. -W 2010/5/4 Puneet duggal duggalpu...@gmail.com drlFile = BusinessRuleUtils.createCombinedDrlDocument(id,map.get(id)); PackageBuilder PACKAGE_BUILDER = new PackageBuilder(BUILDER_CONFIGURATION); org.drools.rule.Package pkg = null; PACKAGE_BUILDER .addPackageFromDrl(new StringReader(drlFile)); if (PACKAGE_BUILDER.hasErrors()) { DSM_LOGGER .logFatal(Error has occured while building package. For Parameter ID : + id + Error details are : + PACKAGE_BUILDER.getErrors() .toString()); } else { pkg = PACKAGE_BUILDER.getPackage(); RULEBASE.addPackage(pkg); DSM_LOGGER .logInfo(Package created for Component Prmr ID : + id); } This is the code which i am using at it is not giving any error at the time creating the drl file.it is also not giving any error at the time of calling of execute() method , but rules are not executed . On 5/4/10, Wolfgang Laun wolfgang.l...@gmail.com wrote: Anatoly, please note that I wrote please to Puneet, which is usually not considered as being impolite. Also, kindly note that I asked for more information, which, in my book, is not inconsiderate, as simply deleting Puneet's post might have been. I do resent being called a hater, and I'll let the community judge whether my (admittedly ironic) kidding is hateful. Somehow, however, posters have to be admonished to state their problem more detailed, without people on the list having to waste their time playing guessing games or writing replies begging for more information. -W PS: A you can see now, it was not a question of debugging, and so you have wasted your time on a simple question. :-) On Tue, May 4, 2010 at 5:10 AM, tolitius webaka...@gmail.com wrote: @Wolfgang, No need to be a hater Wolfgang, the question is simple. I agree, examples would be helpful, but that is NOT how you grow a friendly community. Community is the biggest problem JBoss has. Why is it so inhumanly difficult to be polite and considerate? /Anatoly -- View this message in context:
Re: [rules-users] Drools Flow: how to get knowledge session ID from WorkItem
@Alan, Implementation of WorkItemHandler is a custom ( your ) component. This means that this implementation may have anything injected ( set as property or at construction time ). Let's say you implement YourCustomWorkItemHandler to take a session id at the construction time ( good choice :) ), then to start the process you would: session = create a newStatefulKnowledgeSession() session.getWorkItemManager().registerWorkItemHandler( WorkItemName, new YourCustomWorkItemHandler( session.getId() ) ); session.startProcess( process-name ); /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-how-to-get-knowledge-session-ID-from-WorkItem-tp775649p776358.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] expert: usage of ruleflow-groups
Hi there, I'm having some trouble implementing the desired workflow of rule firing in an application using drools expert. I've read the thread about the difference between ruleflow groups and agenda groups, but it is still unclear to me how to achieve what i need. What i intend to have is the ability to fire a specific set of rules according to the object i'm inserting into the ksession. I do not want to use agenda-groups because it stacks all the agenda groups declared on the rule file (as far as i understand) and therefore it may fire activations i do not want to be fired. Instead, i want to isolate them completely. I tried using ruleflow groups for this, but i cannot find a way to activate a specific group programmatically, before calling fireAllRules(), the way i can with agenda-groups (setFocus() method). That being said, i'm asking for help in trying to use either one of ruleflow/agenda groups or even both in order to get things working the way i described. Thanks in advance, _ miguel ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools + ETL Process
Hi Mauricio, It's below, thanks! ?xml version=1.0 encoding=UTF-8 standalone=yes? persistence version=1.0 xsi:schemaLocation= http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd; xmlns:orm=http://java.sun.com/xml/ns/persistence/orm; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/persistence; persistence-unit name=org.drools.persistence.jpa transaction-type=RESOURCE_LOCAL providerorg.hibernate.ejb.HibernatePersistence/provider classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.ProcessInstanceEventInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property name=hibernate.dialect value=org.hibernate.dialect.MySQLDialect / property name=hibernate.connection.url value=jdbc:mysql://localhost:3306/drools / property name=hibernate.connection.driver_class value=com.mysql.jdbc.Driver / property name=hibernate.connection.password value=mysql / property name=hibernate.connection.username value=root / property name=hibernate.hbm2ddl.auto value=create-drop / property name=hibernate.transaction.manager_lookup_class value=org.hibernate.transaction.BTMTransactionManagerLookup / /properties /persistence-unit /persistence -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Mon, May 3, 2010 11:24 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, can you show us your persistence.xml file where it's defined org.drools.persistence.jpa Persistence Unit? 2010/5/3 andre.fons...@mail.com Hi Mauricio, thanks for your reply I have commented the transaction , please check http://pastebin.com/NxQyft2t I put the hibernate log there too. There is no error, after the first time executed I have the tables created in mysql | processinstanceeventinfo | | processinstanceinfo| | processinstanceinfo_eventtypes | | sessioninfo| | workiteminfo | but they are empty, this is because I am not creating a process just rules and facts? the drools expert knowlege database persist rules and facts or this is maintained only in the working memory? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Sun, May 2, 2010 11:16 pm Subject: Re: [rules-users] Drools + ETL Process Ok looks nice.. but you shouldn't begin and commit the transaction. If you remove that.. do you have some error? 2010/5/2 andre.fons...@mail.com Hi Mauricio, Sorry if I was not clear. I have already installed Guvnor, and I have also changed repository.xml to persist data in MySQL. But I dont want to use Guvnor, I would like to author the rules and facts in Eclipse using Drools plugin ( I have also installed it ) and persist data in MySQL. That's because I'm trying to use JPAKnowlegeService Could you please take a look in the code of pastebin? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Fri, Apr 30, 2010 6:54 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, you are mixing a lot of stuff here.. I will recommend you the following steps for achieving the steps that you are mentioning 1) Install guvnor 2) author the rules inside it.. (it already contains a JCR repository, that is similar to a database, it will allow you to store rules there), you can also author some objects (fact model) inside guvnor. 3) Then you can create tests to execute the rules and see which rules are fired. Greetings, hope it helps! 2010/4/30 andre.fons...@mail.com Hi Esteban, Sorry, I have only one week looking into Drools =) Yes, I am talking about Drools Expert Database Looking into this http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/drools/persistence/jpa/JPAKnowledgeService.html I tried a sample snippet http://pastebin.com/uJd5642D But its incomplete, for example, I need to create the Rule in the database also The things that I need to do are: 1) Create Rule and Object Facts in Java and persist them in the Drools Expert Database 2) Check in the Guvnor Interface the Rules and Facts created in the step before 2) Fire the Rules created and get the response Is there someone that have experience using JPA persistence with Drools? I already have a simple project configured using JPA and Hibernate but I still don't know how to proceed =( Thanks In
Re: [rules-users] Drools Flow: how to get knowledge session ID from WorkItem
Anatoly, if you can share your generic implementation that would be nice.. because a lot of people is looking for something like that. I prefer custom and domain specific implementation, but it seams that a lot of people is looking for something generic that can be reused. I can blog about that generic idea too to spread the word and also mention the different situations and the perspective of having decoupled and coupled applications to the work items. On Tue, May 4, 2010 at 11:16 AM, tolitius webaka...@gmail.com wrote: @Alan, Implementation of WorkItemHandler is a custom ( your ) component. This means that this implementation may have anything injected ( set as property or at construction time ). Let's say you implement YourCustomWorkItemHandler to take a session id at the construction time ( good choice :) ), then to start the process you would: session = create a newStatefulKnowledgeSession() session.getWorkItemManager().registerWorkItemHandler( WorkItemName, new YourCustomWorkItemHandler( session.getId() ) ); session.startProcess( process-name ); /Anatoly -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-how-to-get-knowledge-session-ID-from-WorkItem-tp775649p776358.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 -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] expert: usage of ruleflow-groups
Hi miguel, Did you try creating a new Drools Flow process with Rule Tasks inside it to isolate each specific set of rules. Then you can insert the facts into the working memory, start the process and the rules will be executed secuencially. You need to remember also that, if the rules are activated but the agenda group is without focus, the rules will never fire. 2010/5/4 Miguel Machado mls.mach...@gmail.com Hi there, I'm having some trouble implementing the desired workflow of rule firing in an application using drools expert. I've read the threadhttp://bit.ly/bKMRSq about the difference between ruleflow groups and agenda groups, but it is still unclear to me how to achieve what i need. What i intend to have is the ability to fire a specific set of rules according to the object i'm inserting into the ksession. I do not want to use agenda-groups because it stacks all the agenda groups declared on the rule file (as far as i understand) and therefore it may fire activations i do not want to be fired. Instead, i want to isolate them completely. I tried using ruleflow groups for this, but i cannot find a way to activate a specific group programmatically, before calling fireAllRules(), the way i can with agenda-groups (setFocus() method). That being said, i'm asking for help in trying to use either one of ruleflow/agenda groups or even both in order to get things working the way i described. Thanks in advance, _ miguel ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] expert: usage of ruleflow-groups
I've been using agenda groups without any trouble for a similar problem, doing setFocus( ... ); insert( ... );... insert( ... ); fireAllRules(); repeatedly. You don't have to be afraid of the focus stack growing indefinitely:You control the push (setFocus()), and if an agenda group's activations are all gone, the group is automatically popped from the stack. -W 2010/5/4 Miguel Machado mls.mach...@gmail.com: Hi there, I'm having some trouble implementing the desired workflow of rule firing in an application using drools expert. I've read the thread about the difference between ruleflow groups and agenda groups, but it is still unclear to me how to achieve what i need. What i intend to have is the ability to fire a specific set of rules according to the object i'm inserting into the ksession. I do not want to use agenda-groups because it stacks all the agenda groups declared on the rule file (as far as i understand) and therefore it may fire activations i do not want to be fired. Instead, i want to isolate them completely. I tried using ruleflow groups for this, but i cannot find a way to activate a specific group programmatically, before calling fireAllRules(), the way i can with agenda-groups (setFocus() method). That being said, i'm asking for help in trying to use either one of ruleflow/agenda groups or even both in order to get things working the way i described. Thanks in advance, _ miguel ___ 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] Drools + ETL Process
Hi Mauricio, team I mapped my javabean in the persistence.xml classorg.acme.drools.Account/class And after run my main test I can see the account table in DB, but it's still empty, probably I am missing something in the project configuration. Let me check and I'll reply back Tks! -Original Message- From: andre.fons...@mail.com To: rules-users@lists.jboss.org Sent: Tue, May 4, 2010 12:28 pm Subject: Re: [rules-users] Drools + ETL Process Hi Mauricio, It's below, thanks! ?xml version=1.0 encoding=UTF-8 standalone=yes? persistence version=1.0 xsi:schemaLocation= http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd; xmlns:orm=http://java.sun.com/xml/ns/persistence/orm; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/persistence; persistence-unit name=org.drools.persistence.jpa transaction-type=RESOURCE_LOCAL providerorg.hibernate.ejb.HibernatePersistence/provider classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.ProcessInstanceEventInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property name=hibernate.dialect value=org.hibernate.dialect.MySQLDialect / property name=hibernate.connection.url value=jdbc:mysql://localhost:3306/drools / property name=hibernate.connection.driver_class value=com.mysql.jdbc.Driver / property name=hibernate.connection.password value=mysql / property name=hibernate.connection.username value=root / property name=hibernate.hbm2ddl.auto value=create-drop / property name=hibernate.transaction.manager_lookup_class value=org.hibernate.transaction.BTMTransactionManagerLookup / /properties /persistence-unit /persistence -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Mon, May 3, 2010 11:24 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, can you show us your persistence.xml file where it's defined org.drools.persistence.jpa Persistence Unit? 2010/5/3 andre.fons...@mail.com Hi Mauricio, thanks for your reply I have commented the transaction , please check http://pastebin.com/NxQyft2t I put the hibernate log there too. There is no error, after the first time executed I have the tables created in mysql | processinstanceeventinfo | | processinstanceinfo| | processinstanceinfo_eventtypes | | sessioninfo| | workiteminfo | but they are empty, this is because I am not creating a process just rules and facts? the drools expert knowlege database persist rules and facts or this is maintained only in the working memory? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Sun, May 2, 2010 11:16 pm Subject: Re: [rules-users] Drools + ETL Process Ok looks nice.. but you shouldn't begin and commit the transaction. If you remove that.. do you have some error? 2010/5/2 andre.fons...@mail.com Hi Mauricio, Sorry if I was not clear. I have already installed Guvnor, and I have also changed repository.xml to persist data in MySQL. But I dont want to use Guvnor, I would like to author the rules and facts in Eclipse using Drools plugin ( I have also installed it ) and persist data in MySQL. That's because I'm trying to use JPAKnowlegeService Could you please take a look in the code of pastebin? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Fri, Apr 30, 2010 6:54 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, you are mixing a lot of stuff here.. I will recommend you the following steps for achieving the steps that you are mentioning 1) Install guvnor 2) author the rules inside it.. (it already contains a JCR repository, that is similar to a database, it will allow you to store rules there), you can also author some objects (fact model) inside guvnor. 3) Then you can create tests to execute the rules and see which rules are fired. Greetings, hope it helps! 2010/4/30 andre.fons...@mail.com Hi Esteban, Sorry, I have only one week looking into Drools =) Yes, I am talking about Drools Expert Database Looking into this http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/drools/persistence/jpa/JPAKnowledgeService.html I tried a sample snippet http://pastebin.com/uJd5642D But its incomplete, for example, I need to create the Rule in
Re: [rules-users] Drools + ETL Process
I saw that you change the transaction-type to RESOURCE_LOCAL, and not JTA as it's in the documentation. In the documentation I think that it mention that drools requires JTA, for it's internal mechanisms, that's why we use bitronix as a transaction manager implementation. 2010/5/4 andre.fons...@mail.com Hi Mauricio, It's below, thanks! ?xml version=1.0 encoding=UTF-8 standalone=yes? persistence version=1.0 xsi:schemaLocation= http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd; xmlns:orm=http://java.sun.com/xml/ns/persistence/orm; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/persistence; persistence-unit name=org.drools.persistence.jpa transaction-type=RESOURCE_LOCAL providerorg.hibernate.ejb.HibernatePersistence/provider classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.ProcessInstanceEventInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property name=hibernate.dialect value=org.hibernate.dialect.MySQLDialect / property name=hibernate.connection.url value=jdbc:mysql://localhost:3306/drools / property name=hibernate.connection.driver_class value=com.mysql.jdbc.Driver / property name=hibernate.connection.password value=mysql / property name=hibernate.connection.username value=root / property name=hibernate.hbm2ddl.auto value=create-drop / property name=hibernate.transaction.manager_lookup_class value=org.hibernate.transaction.BTMTransactionManagerLookup / /properties /persistence-unit /persistence -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Mon, May 3, 2010 11:24 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, can you show us your persistence.xml file where it's defined org.drools.persistence.jpa Persistence Unit? 2010/5/3 andre.fons...@mail.com Hi Mauricio, thanks for your reply I have commented the transaction , please check http://pastebin.com/NxQyft2t I put the hibernate log there too. There is no error, after the first time executed I have the tables created in mysql | processinstanceeventinfo | | processinstanceinfo| | processinstanceinfo_eventtypes | | sessioninfo| | workiteminfo | but they are empty, this is because I am not creating a process just rules and facts? the drools expert knowlege database persist rules and facts or this is maintained only in the working memory? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Sun, May 2, 2010 11:16 pm Subject: Re: [rules-users] Drools + ETL Process Ok looks nice.. but you shouldn't begin and commit the transaction. If you remove that.. do you have some error? 2010/5/2 andre.fons...@mail.com Hi Mauricio, Sorry if I was not clear. I have already installed Guvnor, and I have also changed repository.xml to persist data in MySQL. But I dont want to use Guvnor, I would like to author the rules and facts in Eclipse using Drools plugin ( I have also installed it ) and persist data in MySQL. That's because I'm trying to use JPAKnowlegeService Could you please take a look in the code of pastebin? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Fri, Apr 30, 2010 6:54 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, you are mixing a lot of stuff here.. I will recommend you the following steps for achieving the steps that you are mentioning 1) Install guvnor 2) author the rules inside it.. (it already contains a JCR repository, that is similar to a database, it will allow you to store rules there), you can also author some objects (fact model) inside guvnor. 3) Then you can create tests to execute the rules and see which rules are fired. Greetings, hope it helps! 2010/4/30 andre.fons...@mail.com Hi Esteban, Sorry, I have only one week looking into Drools =) Yes, I am talking about Drools Expert Database Looking into this http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/drools/persistence/jpa/JPAKnowledgeService.htmlI tried a sample snippet http://pastebin.com/uJd5642D But its incomplete, for example, I need to create the Rule in the database also The things that I need to do are: 1) Create Rule and Object Facts in Java and persist them in the Drools Expert
Re: [rules-users] How to make this rule more memory efficient?
Hi Wolfgang, Sorry for the late reply on this. Actually I did miss your earlier reply. I applied the changes you suggested and made a few more tweaks and I have been able to get the memory down from over 1.5GB (where I was getting OOM exceptions) to 300MB. I now realise that I have to be very careful how I define the patterns and order them. Thanks a million for your help. /Ryan. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: 28 April 2010 10:25 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? Did you miss my earlier reply proposing an alternative order of patterns? ( I just saw that the second eval isn't necessary.) HEre is the revised form: rule Check consistent references when $proxy1 : ProxyCell() $cell1 : Cell( id == $proxy1.id ) $proxy2 : ProxyCell( id $proxy1.id, eval( $cell1.references contains this.name ) ) $cell2 : Cell( id == $proxy2.id, references not contains $proxy1.name ) then //report an error. end -W On Wed, Apr 28, 2010 at 10:45 AM, Ryan Fitzgerald ryan.fitzger...@ericsson.com wrote: Thanks Wolfgang. Should I conclude therefore that high memory usage is unavoidable due to the number of facts that must be processed? I was hoping that there might be a clever way of writing the rules so that the rules engine can minimise the network it generates - even if it takes a little longer to execute. All of the facts are read from a database and thus loaded into working memory. My fallback position is to not load all these objects into working memory but instead embed into a rule, a service call that queries the db for all inconsistencies (effectively using SQL instead of a drools rule). However, since I will have other rules that operate on these objects in working memory, I was hoping to use these facts for all rules. /Ryan. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: 27 April 2010 14:59 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? If there are n Cell facts, $cell1 : Cell() $cell2 : Cell() needs to create n*n pairs in the network before any reduction may set in. Using $cell2 : Cell(this != $cell1) reduces this by n, so we're still quadratic. Something like $cell1 : Cell( $id1 : id ) $cell2 : Cell( id $id1 ) reduces it to n*(n-1)/2 which is less than 50% of the original, but still quadratic. -W 2010/4/26 Swindells, Thomas tswinde...@nds.com: You should probably restrict it so that $cell2 : Cell(this != $cell1) Thomas From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Ryan Fitzgerald Sent: 26 April 2010 15:34 To: rules-users@lists.jboss.org Subject: [rules-users] How to make this rule more memory efficient? Hi, Can anyone advise me on how to make a drools rule more memory efficient? Here is the problem: I have a Cell and a ProxyCell object classes. The ProxyCell represents the Cell when their internal ID's match. Each Cell and ProxyCell however has a unique name (not same as ID). A Cell can reference (by name) a ProxyCell (as long as the ProxyCell does not represent that actual Cell - which would effectively be a self-reference and is not allowed). What I want to do is find out where I have a reference from any instance of Cell - cell1 - to any instance of ProxyCell - proxycell2 - but am missing a reference from cell2 to proxycell1 where proxycell2 is a representation of cell2 and proxycell1 is a representation of cell1. Here is the rule I have written for it: rule Check consistent references when $cell1 : Cell() $cell2 : Cell() $proxycell1 : ProxyCell ( id = $cell1.id, $cell2.references contains this.name ) $proxycell2 : ProxyCell ( id = $cell2.id, $cell1.references not contains this.name ) then //report an error. end I have 10,000 instances of Cell and 10,000 instances of ProxyCell in working memory. For each instance of Cell, it can have references to 60 different ProxyCell instances. Loading the Cell and ProxyCell instances into working memory is not a problem. However, when I try to run this rule above, the memory quickly goes above 1GB and I eventually get an out of memory error. I was wondering if there is a better way to structure or write this rule so that it doesn't use so much memory. Thanks, Ryan. * * This message is confidential and intended only for the addressee. If you have received this message in error, please immediately
Re: [rules-users] How to make this rule more memory efficient?
Hi Thomas, You are correct in your interpretation of what I want to do. I did consider adding the mappings as their own facts but I was concerned that the sheer number of them would overload drools. For each Cell instance, it can refer to up to 60 ProxyCell instances. With 20,000 Cell instances (in my proto-type), that means 1.2 million mappings. Can drools handle these kinds of numbers of facts? Thanks, Ryan. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas Sent: 28 April 2010 10:17 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? If I understand the following What I want to do is find out where I have a reference from any instance of Cell - cell1 - to any instance of ProxyCell - proxycell2 - but am missing a reference from cell2 to proxycell1 where proxycell2 is a representation of cell2 and proxycell1 is a representation of cell1. What I think you saying is that if C1 - P2 then there must be a C2 - P1 Where C2 == P2.cellId and P1 == C1.cellId. I've not worked this through properly (It's still too early in the working day) but do you may make a win by inserting the mappings into working memory as their own facts (and so trading memory for processing time). You can then reason over these relationships which should reduce the number of combinations that are made. So have a rules like the following: Rule createRelationship salience [high] $cell1 : Cell() $proxy2 : Proxy($cell1.relationships contains this.name) then insert new Relationship($cell1.id, $proxy2.id); end Rule check inverse salience [low] $relationship : Relationship() $cell1 : Cell(id == $relationship.cellId) $proxy2 : Proxy(id == $relationship.proxyId) not exist Relationship(cellId == $relationship.proxyId, proxyId == relationship.cellId) then //raise warning or whatever end Hopefully this does what you wants and should be more efficient processing wise and activation count wise. Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Ryan Fitzgerald Sent: 28 April 2010 09:46 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? Thanks Wolfgang. Should I conclude therefore that high memory usage is unavoidable due to the number of facts that must be processed? I was hoping that there might be a clever way of writing the rules so that the rules engine can minimise the network it generates - even if it takes a little longer to execute. All of the facts are read from a database and thus loaded into working memory. My fallback position is to not load all these objects into working memory but instead embed into a rule, a service call that queries the db for all inconsistencies (effectively using SQL instead of a drools rule). However, since I will have other rules that operate on these objects in working memory, I was hoping to use these facts for all rules. /Ryan. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: 27 April 2010 14:59 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? If there are n Cell facts, $cell1 : Cell() $cell2 : Cell() needs to create n*n pairs in the network before any reduction may set in. Using $cell2 : Cell(this != $cell1) reduces this by n, so we're still quadratic. Something like $cell1 : Cell( $id1 : id ) $cell2 : Cell( id $id1 ) reduces it to n*(n-1)/2 which is less than 50% of the original, but still quadratic. -W 2010/4/26 Swindells, Thomas tswinde...@nds.com: You should probably restrict it so that $cell2 : Cell(this != $cell1) Thomas From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Ryan Fitzgerald Sent: 26 April 2010 15:34 To: rules-users@lists.jboss.org Subject: [rules-users] How to make this rule more memory efficient? Hi, Can anyone advise me on how to make a drools rule more memory efficient? Here is the problem: I have a Cell and a ProxyCell object classes. The ProxyCell represents the Cell when their internal ID's match. Each Cell and ProxyCell however has a unique name (not same as ID). A Cell can reference (by name) a ProxyCell (as long as the ProxyCell does not represent that actual Cell - which would effectively be a self-reference and is not allowed). What I want to do is find out where I have a reference from any instance of Cell - cell1 - to any instance of ProxyCell - proxycell2 - but am missing a reference from cell2 to proxycell1 where proxycell2 is a representation of cell2 and proxycell1 is a representation of cell1. Here is the rule I have
[rules-users] Getting an Error While Executing Rule in Drools 5.0
Hi, I have compiled some rules and added it in packages. Then I serialized those packages and stored in database in the form of CLOB data Now I am able to get Packages back from database and loaded it in RuleBase. But while executing Rule, I am getting the following Exception. java.lang.NullPointerException at org.drools.base.ClassFieldReader.getValue(ClassFieldReader.java:91) at org.drools.base.evaluators.EqualityEvaluatorsDefinition$StringEqualEvaluator.evaluate(EqualityEvaluatorsDefinition.java:1962) at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:92) at org.drools.rule.OrCompositeRestriction.isAllowed(OrCompositeRestriction.java:25) at org.drools.rule.MultiRestrictionFieldConstraint.isAllowed(MultiRestrictionFieldConstraint.java:97) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:143) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788) at org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:201) The similar kind of issue is already logged by someone. Please inform If anyone has an idea about this. Waiting for Reply. Thanks Regards, Nikhil S. Kulkarni MASTEK LTD. Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server. ~~ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools + ETL Process
that's good.. but please check the transaction configurations.. because that's the problem I think 2010/5/4 andre.fons...@mail.com Hi Mauricio, team I mapped my javabean in the persistence.xml classorg.acme.drools.Account/class And after run my main test I can see the account table in DB, but it's still empty, probably I am missing something in the project configuration. Let me check and I'll reply back Tks! -Original Message- From: andre.fons...@mail.com To: rules-users@lists.jboss.org Sent: Tue, May 4, 2010 12:28 pm Subject: Re: [rules-users] Drools + ETL Process Hi Mauricio, It's below, thanks! ?xml version=1.0 encoding=UTF-8 standalone=yes? persistence version=1.0 xsi:schemaLocation= http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd; xmlns:orm=http://java.sun.com/xml/ns/persistence/orm; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/persistence; persistence-unit name=org.drools.persistence.jpa transaction-type=RESOURCE_LOCAL providerorg.hibernate.ejb.HibernatePersistence/provider classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.ProcessInstanceEventInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property name=hibernate.dialect value=org.hibernate.dialect.MySQLDialect / property name=hibernate.connection.url value=jdbc:mysql://localhost:3306/drools / property name=hibernate.connection.driver_class value=com.mysql.jdbc.Driver / property name=hibernate.connection.password value=mysql / property name=hibernate.connection.username value=root / property name=hibernate.hbm2ddl.auto value=create-drop / property name=hibernate.transaction.manager_lookup_class value=org.hibernate.transaction.BTMTransactionManagerLookup / /properties /persistence-unit /persistence -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Mon, May 3, 2010 11:24 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, can you show us your persistence.xml file where it's defined org.drools.persistence.jpa Persistence Unit? 2010/5/3 andre.fons...@mail.com Hi Mauricio, thanks for your reply I have commented the transaction , please check http://pastebin.com/NxQyft2t I put the hibernate log there too. There is no error, after the first time executed I have the tables created in mysql | processinstanceeventinfo | | processinstanceinfo| | processinstanceinfo_eventtypes | | sessioninfo| | workiteminfo | but they are empty, this is because I am not creating a process just rules and facts? the drools expert knowlege database persist rules and facts or this is maintained only in the working memory? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Sun, May 2, 2010 11:16 pm Subject: Re: [rules-users] Drools + ETL Process Ok looks nice.. but you shouldn't begin and commit the transaction. If you remove that.. do you have some error? 2010/5/2 andre.fons...@mail.com Hi Mauricio, Sorry if I was not clear. I have already installed Guvnor, and I have also changed repository.xml to persist data in MySQL. But I dont want to use Guvnor, I would like to author the rules and facts in Eclipse using Drools plugin ( I have also installed it ) and persist data in MySQL. That's because I'm trying to use JPAKnowlegeService Could you please take a look in the code of pastebin? TIA -Original Message- From: Mauricio Salatino sala...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Fri, Apr 30, 2010 6:54 pm Subject: Re: [rules-users] Drools + ETL Process Hi man, you are mixing a lot of stuff here.. I will recommend you the following steps for achieving the steps that you are mentioning 1) Install guvnor 2) author the rules inside it.. (it already contains a JCR repository, that is similar to a database, it will allow you to store rules there), you can also author some objects (fact model) inside guvnor. 3) Then you can create tests to execute the rules and see which rules are fired. Greetings, hope it helps! 2010/4/30 andre.fons...@mail.com Hi Esteban, Sorry, I have only one week looking into Drools =) Yes, I am talking about Drools Expert Database Looking into this
Re: [rules-users] How to make this rule more memory efficient?
It can handle it. The limiting factor is available heap. GreG On May 4, 2010, at 10:55, Ryan Fitzgerald ryan.fitzger...@ericsson.com wrote: Hi Thomas, You are correct in your interpretation of what I want to do. I did consider adding the mappings as their own facts but I was concerned that the sheer number of them would overload drools. For each Cell instance, it can refer to up to 60 ProxyCell instances. With 20,000 Cell instances (in my proto-type), that means 1.2 million mappings. Can drools handle these kinds of numbers of facts? Thanks, Ryan. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas Sent: 28 April 2010 10:17 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? If I understand the following What I want to do is find out where I have a reference from any instance of Cell - cell1 - to any instance of ProxyCell - proxycell2 - but am missing a reference from cell2 to proxycell1 where proxycell2 is a representation of cell2 and proxycell1 is a representation of cell1. What I think you saying is that if C1 - P2 then there must be a C2 - P1 Where C2 == P2.cellId and P1 == C1.cellId. I've not worked this through properly (It's still too early in the working day) but do you may make a win by inserting the mappings into working memory as their own facts (and so trading memory for processing time). You can then reason over these relationships which should reduce the number of combinations that are made. So have a rules like the following: Rule createRelationship salience [high] $cell1 : Cell() $proxy2 : Proxy($cell1.relationships contains this.name) then insert new Relationship($cell1.id, $proxy2.id); end Rule check inverse salience [low] $relationship : Relationship() $cell1 : Cell(id == $relationship.cellId) $proxy2 : Proxy(id == $relationship.proxyId) not exist Relationship(cellId == $relationship.proxyId, proxyId == relationship.cellId) then //raise warning or whatever end Hopefully this does what you wants and should be more efficient processing wise and activation count wise. Thomas -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Ryan Fitzgerald Sent: 28 April 2010 09:46 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? Thanks Wolfgang. Should I conclude therefore that high memory usage is unavoidable due to the number of facts that must be processed? I was hoping that there might be a clever way of writing the rules so that the rules engine can minimise the network it generates - even if it takes a little longer to execute. All of the facts are read from a database and thus loaded into working memory. My fallback position is to not load all these objects into working memory but instead embed into a rule, a service call that queries the db for all inconsistencies (effectively using SQL instead of a drools rule). However, since I will have other rules that operate on these objects in working memory, I was hoping to use these facts for all rules. /Ryan. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: 27 April 2010 14:59 To: Rules Users List Subject: Re: [rules-users] How to make this rule more memory efficient? If there are n Cell facts, $cell1 : Cell() $cell2 : Cell() needs to create n*n pairs in the network before any reduction may set in. Using $cell2 : Cell(this != $cell1) reduces this by n, so we're still quadratic. Something like $cell1 : Cell( $id1 : id ) $cell2 : Cell( id $id1 ) reduces it to n*(n-1)/2 which is less than 50% of the original, but still quadratic. -W 2010/4/26 Swindells, Thomas tswinde...@nds.com: You should probably restrict it so that $cell2 : Cell(this != $cell1) Thomas From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Ryan Fitzgerald Sent: 26 April 2010 15:34 To: rules-users@lists.jboss.org Subject: [rules-users] How to make this rule more memory efficient? Hi, Can anyone advise me on how to make a drools rule more memory efficient? Here is the problem: I have a Cell and a ProxyCell object classes. The ProxyCell represents the Cell when their internal ID's match. Each Cell and ProxyCell however has a unique name (not same as ID). A Cell can reference (by name) a ProxyCell (as long as the ProxyCell does not represent that actual Cell - which would effectively be a self-reference and is not allowed). What I want to do is find out where I have a reference from any instance of Cell - cell1 - to any instance of ProxyCell - proxycell2 - but am missing a reference from cell2 to proxycell1 where proxycell2 is a representation of cell2 and proxycell1 is a representation of cell1. Here is
Re: [rules-users] expert: usage of ruleflow-groups
You could manually activate and deactivate ruleflow groups using workingMemory.getAgenda().[de]activateRuleflowGroup(name). workingMemory.getAgenda().[de]activateRuleflowGroup(name). session.fireAllRules(); http://drools-java-rules-engine.46999.n3.nabble.com/Agenda-group-doesn-t-stay-set-td56599.html Source -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/expert-usage-of-ruleflow-groups-tp776406p776798.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] expert: usage of ruleflow-groups
if you use the new api's (5.x StatefulKnowledgeSession instead of workingMemory) you don't have that methods exposed. 2010/5/4 vasilievip vasilie...@ukr.net You could manually activate and deactivate ruleflow groups using workingMemory.getAgenda().[de]activateRuleflowGroup(name). workingMemory.getAgenda().[de]activateRuleflowGroup(name). session.fireAllRules(); Sourcehttp://drools-java-rules-engine.46999.n3.nabble.com/Agenda-group-doesn-t-stay-set-td56599.html -- View this message in context: Re: expert: usage of ruleflow-groupshttp://drools-java-rules-engine.46999.n3.nabble.com/expert-usage-of-ruleflow-groups-tp776406p776798.html Sent from the Drools - User mailing list archivehttp://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.htmlat Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] expert: usage of ruleflow-groups
Exactly! That's precisely why i'm trying to find a workaround. I have no way to activate a specific set of rules except for stacking up activations using agenda-groups. Any other suggestions? Thank you. 2010/5/4 Mauricio Salatino sala...@gmail.com if you use the new api's (5.x StatefulKnowledgeSession instead of workingMemory) you don't have that methods exposed. 2010/5/4 vasilievip vasilie...@ukr.net You could manually activate and deactivate ruleflow groups using workingMemory.getAgenda().[de]activateRuleflowGroup(name). workingMemory.getAgenda().[de]activateRuleflowGroup(name). session.fireAllRules(); Sourcehttp://drools-java-rules-engine.46999.n3.nabble.com/Agenda-group-doesn-t-stay-set-td56599.html -- View this message in context: Re: expert: usage of ruleflow-groupshttp://drools-java-rules-engine.46999.n3.nabble.com/expert-usage-of-ruleflow-groups-tp776406p776798.html Sent from the Drools - User mailing list archivehttp://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.htmlat Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- To understand what is recursion you must first understand recursion ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting an Error While Executing Rule in Drools 5.0
@ Nikhil, I am not sure weather it a good practice to seralize a package and store it , i am new to it and i am storing the drl files in db . Can we retrive our DRL file after retriving the packge from database.?? On 5/4/10, Nikhil S. Kulkarni nikhil.kulka...@mastek.com wrote: Hi, I have compiled some rules and added it in packages. Then I serialized those packages and stored in database in the form of CLOB data Now I am able to get Packages back from database and loaded it in RuleBase. But while executing Rule, I am getting the following Exception. java.lang.NullPointerException at org.drools.base.ClassFieldReader.getValue(ClassFieldReader.java:91) at org.drools.base.evaluators.EqualityEvaluatorsDefinition$StringEqualEvaluator.evaluate(EqualityEvaluatorsDefinition.java:1962) at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:92) at org.drools.rule.OrCompositeRestriction.isAllowed(OrCompositeRestriction.java:25) at org.drools.rule.MultiRestrictionFieldConstraint.isAllowed(MultiRestrictionFieldConstraint.java:97) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:143) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788) at org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:201) The similar kind of issue is already logged by someone. Please inform If anyone has an idea about this. Waiting for Reply. Thanks Regards, Nikhil S. Kulkarni MASTEK LTD. Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server. ~~ ___ 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] expert: usage of ruleflow-groups
2010/5/5 miguel machado mls.mach...@gmail.com: Hi, First of all, thank you both for your answers. @Wolfgang: My problem is that i cannot have the different rule groups stacked. I may do as you suggested, but i'll have rules firing from other agenda-groups after the first agenda-group activations are all gone (because they go into the stack as well, right?). No, no, no! Nothing goes on the stack unless you setFocus()! What i'm looking for is a way to isolate the execution and just fire the rules within a specific set (aka just one group). Does this make any sense? This is *exactly* what my sketchy statement sequence does, in an existing application. -W Thank you for your support. I appreciate all the help i can get. _ miguel On Tue, May 4, 2010 at 4:46 PM, Wolfgang Laun wolfgang.l...@gmail.com wrote: I've been using agenda groups without any trouble for a similar problem, doing setFocus( ... ); insert( ... );... insert( ... ); fireAllRules(); repeatedly. You don't have to be afraid of the focus stack growing indefinitely:You control the push (setFocus()), and if an agenda group's activations are all gone, the group is automatically popped from the stack. -W 2010/5/4 Miguel Machado mls.mach...@gmail.com: Hi there, I'm having some trouble implementing the desired workflow of rule firing in an application using drools expert. I've read the thread about the difference between ruleflow groups and agenda groups, but it is still unclear to me how to achieve what i need. What i intend to have is the ability to fire a specific set of rules according to the object i'm inserting into the ksession. I do not want to use agenda-groups because it stacks all the agenda groups declared on the rule file (as far as i understand) and therefore it may fire activations i do not want to be fired. Instead, i want to isolate them completely. I tried using ruleflow groups for this, but i cannot find a way to activate a specific group programmatically, before calling fireAllRules(), the way i can with agenda-groups (setFocus() method). That being said, i'm asking for help in trying to use either one of ruleflow/agenda groups or even both in order to get things working the way i described. Thanks in advance, _ miguel ___ 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 -- To understand what is recursion you must first understand recursion ___ 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