[rules-users] Need Sample Java Code
Hi Team, I need sample java code that on Drools v5.0.. can anyone share the rule XML file format along with the sample code that fires the rules defined in XML? Do i need to save the file with '.xml' extension or it will be XML data in .drl file? Please throw some light on this.. Thanks, JFly. ___ 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 again, Thank you for clearing that up. I didn't think it worked that way because i've tried it before and it didn't work. Anyway, according to what you're saying... * this is the stack as soon as i insert my objects: | MAIN | * this is the stack as soon as i setFocus on a specific agenda-group: | FOCUSED_GROUP | MAIN | (from left to right) * as soon as all activations from FOCUSED_GROUP fire, that agenda-group is popped out of the stack and the rule engine fires the remaining activations from MAIN Is this the way it works? I've tried this before with no success. I get rules firing from agenda-groups that *are not focused before* (besides MAIN, of course). Maybe this has something to do with the rules being declared in XML? Or some kind of bug? Thank you. _ miguel On Wed, May 5, 2010 at 6:40 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: @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 -- 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
@puneet it may be a good ideia memory wise. I'm doing it right now, in order to compile rules just once. _ miguel 2010/5/5 Puneet duggal duggalpu...@gmail.com @ 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 -- 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] expert: usage of ruleflow-groups
2010/5/5 miguel machado mls.mach...@gmail.com: Hi again, Thank you for clearing that up. I didn't think it worked that way because i've tried it before and it didn't work. Anyway, according to what you're saying... * this is the stack as soon as i insert my objects: | MAIN | * this is the stack as soon as i setFocus on a specific agenda-group: | FOCUSED_GROUP | MAIN | (from left to right) * as soon as all activations from FOCUSED_GROUP fire, that agenda-group is popped out of the stack and the rule engine fires the remaining activations from MAIN Is this the way it works? I've tried this before with no success. I get rules firing from agenda-groups that *are not focused before* (besides MAIN, of course). Maybe this has something to do with the rules being declared in XML? Or some kind of bug? If you don't have auto-focus, rules from other agenda groups should not fire. XML should not matter. A bug might be possible, e.g., due to misinterpretation of the rules in XML. -W Thank you. _ miguel On Wed, May 5, 2010 at 6:40 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote: @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 -- 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
[rules-users] Insert Fact Speed bottleneck
Hi Drools team, I wrote a Drools application for my company, which evaluates clinical claim processing rules. That is, it checks current medical claims against the patient's historical claims. It appears that 95% of the run time is dedicated to inserting facts, which is presumably when it propagates through the RETE graph, since firing the rules takes no time. But it seems like it's not fast enough. I made a rule template, which by trial and error of moving the conditions around, is optimised. I'm averaging 310ms, and need it to be under 170ms for it to be viable. Is there any not-too-technical guide to optimisation somewhere? (alpha and beta-nodes scare me a bit). Regards, Daniel -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778322.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] how exists works exactly?
Any idea? Please... 2010/5/4 Antonio Neto antoniosouzan...@gmail.com 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] expert: usage of ruleflow-groups
Hi, Yeah, i think this might be a bug indeed. I just tried converting to DRL using the dumper and the agenda-group item doesn't show up in the generated DRL file. It is possible that that this tag isn't being interpreted for the same reason it isn't being converted into the DRL format. Can someone please confirm this? Anyway, if this doesn't work.. is there any kind of workaround? Maybe using ruleflow-group's or any other technique? Thank you. _ miguel On Wed, May 5, 2010 at 9:11 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: If you don't have auto-focus, rules from other agenda groups should not fire. XML should not matter. A bug might be possible, e.g., due to misinterpretation of the rules in XML. -W -- 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] Smooks Data Loader uses
no one could help me? maybe something is not clear. Please tell me what ;) Regards Jérôme -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Smooks-Data-Loader-uses-tp773488p778366.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
How did you specify the agenda group in the XML? There aren't much checks being done in XML handling, so it's easy to slip up. Here's how I interpret the XML schema: rule name=myrule rule-attribute name=agenda-group value=group42/ ... -W 2010/5/5 miguel machado mls.mach...@gmail.com: Hi, Yeah, i think this might be a bug indeed. I just tried converting to DRL using the dumper and the agenda-group item doesn't show up in the generated DRL file. It is possible that that this tag isn't being interpreted for the same reason it isn't being converted into the DRL format. Can someone please confirm this? Anyway, if this doesn't work.. is there any kind of workaround? Maybe using ruleflow-group's or any other technique? Thank you. _ miguel On Wed, May 5, 2010 at 9:11 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote: If you don't have auto-focus, rules from other agenda groups should not fire. XML should not matter. A bug might be possible, e.g., due to misinterpretation of the rules in XML. -W -- 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
Re: [rules-users] Insert Fact Speed bottleneck
@ djb , Can u tell me how did u inserted the facts urself ?? Is a just a simple assertion or any thing else ? On 5/5/10, djb dbrownel...@hotmail.com wrote: Hi Drools team, I wrote a Drools application for my company, which evaluates clinical claim processing rules. That is, it checks current medical claims against the patient's historical claims. It appears that 95% of the run time is dedicated to inserting facts, which is presumably when it propagates through the RETE graph, since firing the rules takes no time. But it seems like it's not fast enough. I made a rule template, which by trial and error of moving the conditions around, is optimised. I'm averaging 310ms, and need it to be under 170ms for it to be viable. Is there any not-too-technical guide to optimisation somewhere? (alpha and beta-nodes scare me a bit). Regards, Daniel -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778322.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] Getting an Error While Executing Rule in Drools 5.0
ohk compiling the rule and storing it its really a good for memory On 5/5/10, miguel machado mls.mach...@gmail.com wrote: @puneet it may be a good ideia memory wise. I'm doing it right now, in order to compile rules just once. _ miguel 2010/5/5 Puneet duggal duggalpu...@gmail.com @ 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 -- 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
Re: [rules-users] how exists works exactly?
One thing I've noticed is that not (exists (EPackage( ) ) ) is a roundabout (and possibly inefficient) way of saying not (EPackage( ... ) ) It's difficult (for me) to deduce what should happen in the rules as the description of the fact data isn't clear enough (for me). -W 2010/5/5 Antonio Neto antoniosouzan...@gmail.com: Any idea? Please... 2010/5/4 Antonio Neto antoniosouzan...@gmail.com 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Insert Fact Speed bottleneck
Not having any clue about the fact structure (field types) and rule patterns makes it impossible to advise. Moving conditions around is, of course, one way, but there might be things you have overlooked; or essentially different techniques. -W On Wed, May 5, 2010 at 10:19 AM, djb dbrownel...@hotmail.com wrote: Hi Drools team, I wrote a Drools application for my company, which evaluates clinical claim processing rules. That is, it checks current medical claims against the patient's historical claims. It appears that 95% of the run time is dedicated to inserting facts, which is presumably when it propagates through the RETE graph, since firing the rules takes no time. But it seems like it's not fast enough. I made a rule template, which by trial and error of moving the conditions around, is optimised. I'm averaging 310ms, and need it to be under 170ms for it to be viable. Is there any not-too-technical guide to optimisation somewhere? (alpha and beta-nodes scare me a bit). Regards, Daniel -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778322.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] Drools Planner - Time Slots vs Time Periods
Hello, most of the Drools Planner examples deal with fixed time slots. Lessons are assigned to defined time slots, nurses are assigned to work at fixed time slots, etc. So the time slots start at a defined time and have a defined length. What I'm looking for is an example which is dealing with flexible time periods instead (flexible start times and durations). E.g. a work item needs a defined time to be processed on a machine (processing time can vary for each work item). In order to keep all machines busy all the time the work items should be scheduled without gaps if possible. In addition work items should be assigned only to machines that have a certain capability required by the work item. Some work items might have a defined order in which they have to be processed. Some items can have a defined time when they should start, etc. I assume that in this case the planner move logic would have to be changed. Instead of exchanging fixed time slots the time periods would have to be modified. Any idea how this could be modelled / implemented? Thanks for any comment on this, Andreas -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Planner-Time-Slots-vs-Time-Periods-tp778460p778460.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] Insert Fact Speed bottleneck
Hi, in your case is there no way to insert data at other moments ? do you need all the data you insert ? If you use statefull session you can insert data during time and not at once. Also, the more rules you have with complex when conditions = The rete is big so inserting takes time. On on of my project, using a rule flow makes it easier as you make decision step by step. So for each step, the rete graph is smaller (it my view when you divide in smaller steps) = Quicker when you insert. Hope it helps Nicolas Héron 2010/5/5 Wolfgang Laun wolfgang.l...@gmail.com Not having any clue about the fact structure (field types) and rule patterns makes it impossible to advise. Moving conditions around is, of course, one way, but there might be things you have overlooked; or essentially different techniques. -W On Wed, May 5, 2010 at 10:19 AM, djb dbrownel...@hotmail.com wrote: Hi Drools team, I wrote a Drools application for my company, which evaluates clinical claim processing rules. That is, it checks current medical claims against the patient's historical claims. It appears that 95% of the run time is dedicated to inserting facts, which is presumably when it propagates through the RETE graph, since firing the rules takes no time. But it seems like it's not fast enough. I made a rule template, which by trial and error of moving the conditions around, is optimised. I'm averaging 310ms, and need it to be under 170ms for it to be viable. Is there any not-too-technical guide to optimisation somewhere? (alpha and beta-nodes scare me a bit). Regards, Daniel -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778322.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] Insert Fact Speed bottleneck
Hi, thanks for the replies. Essentially, its a rule template, with 4 conditions. One checks for a current claimline, One checks for a historic claimline, One checks that the historic claimline is within a time period of the current claimline, One checks that there are X historic claimlines. I'm just a bit hesitant to post my work here. But i did have a BIG breakthrough. What I was doing was Insert-Fire-Retract, once per claim. When I changed it to Retract at the end, it jumped down to 50ms! (6X speed increase!) But, unfortunately, i need to retract the data for each claim, because the rules assume that everything in WM is relevant. (That is, it assumes all the historic claims are for the current member) Hmm. Any new ideas? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778508.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] Drools Planner - Time Slots vs Time Periods
I 've heard this use case a couple of time (machine queue planning) and Drools Planner is highly suited for it. Vehicle routing suffers from the same pitfall you describe. You don't have fixed time slots, so you don't have discrete timeslot start times. Don't start assigning items to indiscrete (=dynamic) start times. Your number of possible solutions will go through the roof (the pas example with 10^6700 possible solutions will look like a joke) and almost all of them (a lot more than 99,999%) will have unwelcome gaps. Instead, assign items to a sequence number on a certain machine. Optionally, also assign gaps if you need gaps. Your moves will be more complicated as they will have to squeeze an item in or out the middle of a queue, forcing the items coming later to change sequence number too. Your score rules will be more complicated as you 'll have to determine the start time of an time by accumulating the duration of all the items coming before it (possibly even taking work breaks such as lunch, nights and weekends into account or maybe you can ignore because breaks are a 0 operation). Those complications are annoying, but IMHO, assigning items directly to indiscrete start times will never be performant enough to get to a feasible solution of a real-world problem. Although I'd love it if you can prove me wrong :) With kind regards, Geoffrey De Smet Drools Planner lead awuttke schreef: Hello, most of the Drools Planner examples deal with fixed time slots. Lessons are assigned to defined time slots, nurses are assigned to work at fixed time slots, etc. So the time slots start at a defined time and have a defined length. What I'm looking for is an example which is dealing with flexible time periods instead (flexible start times and durations). E.g. a work item needs a defined time to be processed on a machine (processing time can vary for each work item). In order to keep all machines busy all the time the work items should be scheduled without gaps if possible. In addition work items should be assigned only to machines that have a certain capability required by the work item. Some work items might have a defined order in which they have to be processed. Some items can have a defined time when they should start, etc. I assume that in this case the planner move logic would have to be changed. Instead of exchanging fixed time slots the time periods would have to be modified. Any idea how this could be modelled / implemented? Thanks for any comment on this, Andreas ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Insert Fact Speed bottleneck
@puneet - I would suggest downloading the sample files, namely those that come with the Drools plug-in for eclipse. I found the Conway Game of Life example to be the most useful for learning past the basics. But your question should be in another post. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778521.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] Insert Fact Speed bottleneck
Sorry, I re-read my post, and it might not make sense. I changed from Insert-Fire-Retract in a loop (once per claim), to a loop of Insert-Fire, then doing a bulk retract after a 100 or so claims. For some reason, this decreased run time 600% i think i'll modify the claims to have a context of who they belong to, and then add an extra condition to link them. That is, if no one thinks perhaps there is a way to keep the Insert-Fire-Retract loop and gain the same kind of speed. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bottleneck-tp778322p778591.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] Changing Guvnor PresistantManager to MSSQL
Getting there.. I've manged to make drools find the jdbc.jar and even start successfully!! :) so it auto-created some VERSION_x tables in the Drools DB. the conf i'm using is: (diff driver + url) PersistenceManager class=org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager param name=driver value= com.microsoft.sqlserver.jdbc.SQLServerDriver/ param name=url value= jdbc:sqlserver://my-sql:1433;databaseName=Drools;/ param name=schema value=mssql/ param name=user value=sa/ param name=password value=xxx/ param name=schemaObjectPrefix value=${wsp.name}_/ param name=externalBLOBs value=false/ /PersistenceManager now, when i tell him to create a new sample project it fails with: 14:39:45,497 INFO [STDOUT] ERROR 05-05 14:39:45,496 (RulesRepositoryAdministrator.java:clearRulesRepository:79) javax.jcr.RepositoryException: /: unable to update item.: 17528b92-d60d-48cf-82dd-7c9654effe34: 17528b92-d60d-48cf-82dd-7c9654effe34 14:39:54,217 INFO [STDOUT] ERROR 05-05 14:39:54,216 (RepositoryServiceServlet.java:doUnexpectedFailure:62) org.drools.repository.RulesRepositoryException: javax.jcr.InvalidItemStateException: /: the item cannot be saved because it has been modified externally. ideas? On Wed, May 5, 2010 at 2:32 PM, eyal edri eyal.e...@gmail.com wrote: OK, some progress, i found out that the versioning section was casuing the problem, so i changed param name=schemaObjectPrefix value=${wsp.name}_/ to param name=schemaObjectPrefix value=version_/ now i get an exception about not finding the jdbc driver. Caused by: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver i put sql-jdbc.2.0.jar which i use in all my java apps in the class path (/usr/lib and also in the lib dir of the jboss server). with no luck. is there another jar i should use for this driver? attached is the new stacktrace.. thanks, Eyal. On Wed, May 5, 2010 at 2:08 PM, eyal edri eyal.e...@gmail.com wrote: Hi, I'm a drools newbie, and i'm trying to connect GUVNOR to MSSQL. I've followed the guide and changed repository.xml as follows (the rest i left unchanged from the default repository.xml): Workspace name=${wsp.name} FileSystem class=org.apache.jackrabbit.core.fs.local.LocalFileSystem param name=path value=${wsp.home}/ PersistenceManager class=org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager param name=driver value=com.microsoft.jdbc.sqlserver.SQLServerDriver/ param name=url value=jdbc:microsoft:sqlserver://my-sql:1433;;DatabaseName=Drools;SelectMethod=Cursor;/ param name=schema value=mssql/ param name=user value=sa/ param name=password value=xxx/ param name=schemaObjectPrefix value=${wsp.name}_/ param name=externalBLOBs value=false/ /PersistenceManager /Workspace and versioning also: Versioning rootPath=${rep.home}/version PersistenceManager class=org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager param name=driver value=com.microsoft.jdbc.sqlserver.SQLServerDriver/ param name=url value=jdbc:microsoft:sqlserver://my-sql:1433;;DatabaseName=Drools;SelectMethod=Cursor;/ param name=schema value=mssql/ param name=user value=sa/ param name=password value=xxx/ param name=schemaObjectPrefix value=${wsp.name}_/ param name=externalBLOBs value=false/ /PersistenceManager /Versioning - i'm running a standalone GUVNOR package. - i created an empty Drools db in my server: my-sql - I deleted all the repository dir content - i'm getting a few exceptions: ERROR [[/drools-guvnor]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener org.jboss.seam.InstantiationException: Could not instantiate Seam component: repositoryConfiguration (attached is the full stacktrace) can anyone help? -- Eyal Edri -- Eyal Edri -- Eyal Edri ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] FIXED: Changing Guvnor PresistantManager to MSSQL
OK, after changing the default workspace.xml file PersistantManager to also MSSQL settings, things look a lot better... (created another tables on Drools db). thanks :) Eyal. On Wed, May 5, 2010 at 2:52 PM, eyal edri eyal.e...@gmail.com wrote: Getting there.. I've manged to make drools find the jdbc.jar and even start successfully!! :) so it auto-created some VERSION_x tables in the Drools DB. the conf i'm using is: (diff driver + url) PersistenceManager class=org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager param name=driver value= com.microsoft.sqlserver.jdbc.SQLServerDriver/ param name=url value= jdbc:sqlserver://my-sql:1433;databaseName=Drools;/ param name=schema value=mssql/ param name=user value=sa/ param name=password value=xxx/ param name=schemaObjectPrefix value=${wsp.name}_/ param name=externalBLOBs value=false/ /PersistenceManager now, when i tell him to create a new sample project it fails with: 14:39:45,497 INFO [STDOUT] ERROR 05-05 14:39:45,496 (RulesRepositoryAdministrator.java:clearRulesRepository:79) javax.jcr.RepositoryException: /: unable to update item.: 17528b92-d60d-48cf-82dd-7c9654effe34: 17528b92-d60d-48cf-82dd-7c9654effe34 14:39:54,217 INFO [STDOUT] ERROR 05-05 14:39:54,216 (RepositoryServiceServlet.java:doUnexpectedFailure:62) org.drools.repository.RulesRepositoryException: javax.jcr.InvalidItemStateException: /: the item cannot be saved because it has been modified externally. ideas? On Wed, May 5, 2010 at 2:32 PM, eyal edri eyal.e...@gmail.com wrote: OK, some progress, i found out that the versioning section was casuing the problem, so i changed param name=schemaObjectPrefix value=${wsp.name}_/ to param name=schemaObjectPrefix value=version_/ now i get an exception about not finding the jdbc driver. Caused by: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver i put sql-jdbc.2.0.jar which i use in all my java apps in the class path (/usr/lib and also in the lib dir of the jboss server). with no luck. is there another jar i should use for this driver? attached is the new stacktrace.. thanks, Eyal. On Wed, May 5, 2010 at 2:08 PM, eyal edri eyal.e...@gmail.com wrote: Hi, I'm a drools newbie, and i'm trying to connect GUVNOR to MSSQL. I've followed the guide and changed repository.xml as follows (the rest i left unchanged from the default repository.xml): Workspace name=${wsp.name} FileSystem class=org.apache.jackrabbit.core.fs.local.LocalFileSystem param name=path value=${wsp.home}/ PersistenceManager class=org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager param name=driver value=com.microsoft.jdbc.sqlserver.SQLServerDriver/ param name=url value=jdbc:microsoft:sqlserver://my-sql:1433;;DatabaseName=Drools;SelectMethod=Cursor;/ param name=schema value=mssql/ param name=user value=sa/ param name=password value=xxx/ param name=schemaObjectPrefix value=${wsp.name}_/ param name=externalBLOBs value=false/ /PersistenceManager /Workspace and versioning also: Versioning rootPath=${rep.home}/version PersistenceManager class=org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager param name=driver value=com.microsoft.jdbc.sqlserver.SQLServerDriver/ param name=url value=jdbc:microsoft:sqlserver://my-sql:1433;;DatabaseName=Drools;SelectMethod=Cursor;/ param name=schema value=mssql/ param name=user value=sa/ param name=password value=xxx/ param name=schemaObjectPrefix value=${wsp.name}_/ param name=externalBLOBs value=false/ /PersistenceManager /Versioning - i'm running a standalone GUVNOR package. - i created an empty Drools db in my server: my-sql - I deleted all the repository dir content - i'm getting a few exceptions: ERROR [[/drools-guvnor]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener org.jboss.seam.InstantiationException: Could not instantiate Seam component: repositoryConfiguration (attached is the full stacktrace) can anyone help? -- Eyal Edri -- Eyal Edri -- Eyal Edri -- Eyal Edri ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Need Sample Java Code
You can always take a look at the tests in the source code. 2010/5/5 ashok kumar softwarebudd...@gmail.com Hi Team, I need sample java code that on Drools v5.0.. can anyone share the rule XML file format along with the sample code that fires the rules defined in XML? Do i need to save the file with '.xml' extension or it will be XML data in .drl file? Please throw some light on this.. Thanks, JFly. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Esteban Aliverti ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Error running Drools example : org.drools.WorkingMemory not found
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
Re: [rules-users] Error running Drools example : org.drools.WorkingMemory not found
I think WorkingMemory is a relic from the past. You may be trying Drools 4.0 examples while using Drools 5.0 jars? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Error-running-Drools-example-org-drools-WorkingMemory-not-found-tp778793p778815.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] 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 devyani.sa...@wipro.com 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] Error running Drools example : org.drools.WorkingMemory not found
Thanks but I downloaded Drools 4.0.7 Eclipse 3.2 Workbench from http://www.jboss.org/drools/downloads.html. Unless the link has the wrong package named. Please suggest. Thanks Devyani -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of djb Sent: Wednesday, May 05, 2010 6:12 PM To: rules-users@lists.jboss.org Subject: Re: [rules-users] Error running Drools example : org.drools.WorkingMemory not found I think WorkingMemory is a relic from the past. You may be trying Drools 4.0 examples while using Drools 5.0 jars? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Error-running-Drools -example-org-drools-WorkingMemory-not-found-tp778793p778815.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 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
Re: [rules-users] Error running Drools example :org.drools.WorkingMemory not found
I see. But then I shouldn;t be getting this error since these jars are part of the jar downloaded for eclipse workbench (org.drools.eclipse_4.0.7.jar ) Thanks Devyani From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Rajnikant Gupta Sent: Wednesday, May 05, 2010 6:16 PM To: Rules Users List Subject: 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 devyani.sa...@wipro.com 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 http://www.wipro.com/ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users 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
Re: [rules-users] how exists works exactly?
Antonio, I think that the problem may not be the exists. I'm not an expert at solver, but I believe that there may be an issue with the consequence of your first rule. insertLogical(new IntConstraintOccurrence(diff, 10)); The way that insertLogical works the new object will only be inserted if it does not .equals() with another fact in the working memory (or maybe in the truth maintenance system). Without seeing the rest of the solver (moves and such) I can't say for certain, but I think that each move is being evaluated to the same weight because the 1st rule will never result in a constraint occurrence 10. Multiple matches of that rule will only result in one IntConstraintOccurrence being inserted. Maybe Wolfgang or someone else a little more experienced can verify my assumptions about how insertLogical works. Thanks, Steve rules-users-boun...@lists.jboss.org wrote on 05/05/2010 04:07:37 AM: [image removed] Re: [rules-users] how exists works exactly? Wolfgang Laun to: Rules Users List 05/05/2010 04:15 AM Sent by: rules-users-boun...@lists.jboss.org Please respond to Rules Users List One thing I've noticed is that not (exists (EPackage( ) ) ) is a roundabout (and possibly inefficient) way of saying not (EPackage( ... ) ) It's difficult (for me) to deduce what should happen in the rules as the description of the fact data isn't clear enough (for me). -W 2010/5/5 Antonio Neto antoniosouzan...@gmail.com: Any idea? Please... 2010/5/4 Antonio Neto antoniosouzan...@gmail.com 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 are3 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 ___ 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 exists works exactly?
Hi Antonio, Documentation states that the complement to not is exists,whereas not keyword is used to match the absence of a fact (in Working Memory), and exists keyword is used to test the existence of one or more facts (in Working memory). So if you want to test that a fact is not in working memory, then you should use the not(MyClass()) pattern. Hope this helps, Francois. Antonio Neto antoniosouzan...@gmail.com a écrit : Any idea? Please... 2010/5/4 Antonio Neto antoniosouzan...@gmail.com 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] how exists works exactly?
Hi, Thank you very much for all replies. I've tried also with not ( EPackage(...)), but the result is the same. I think that I remove the EClass from the facts in my solution, but they continue in my workingMemory. How I can see the facts of the workingMemory object (and how remove it)? Thanks Best regards Antonio 2010/5/5 fgad...@genigraph.fr Hi Antonio, Documentation states that the complement to not is exists, whereas not keyword is used to match the absence of a fact (in Working Memory), and exists keyword is used to test the existence of one or more facts (in Working memory). So if you want to test that a fact is not in working memory, then you should use the not(MyClass()) pattern. Hope this helps, Francois. Antonio Neto antoniosouzan...@gmail.com a écrit : Any idea? Please... 2010/5/4 Antonio Neto antoniosouzan...@gmail.com 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Bulk-Retract speed conundrum
Hi Drools aficionados, This is further to my request to improve speed. As requested previously, I am providing an example rule. So, I found that by only retracting facts after processing multiple claims, instead of after every claim, I managed to improve speed from 300ms per claim to 50ms! We need it to be sub-170ms to be a viable option. But, I need to retract facts. As you can see, if I add new Claim data, it might match the last guy's claim data (Bad!). It would appear that 'disabling' the data would require an update and take as much time as a retract. So, is there any way around this? Am I stuck with 300ms per claim? Would changing to sequential stateless session be possible, or worthwhile? If I can't improve the speed, I will have to advice against Drools for the project. regards, Daniel - My rules look like this: rule RULE_2090 when $cl: ClaimLine(historic == false, code == 3908, type == T) $historic: ClaimLine(historic == true, code = 0052 = 0052, type == P, $dt : date) eval(Utilities.isWithinTimePeriod($dt, $cl.date, Y, 99)) $historic_many: ArrayList(size = 0) from collect(ClaimLine(historic == true, code = 0052 = 0052, type == P)) then String ruleName = drools.getRule().getName(); results.addMessage(ruleName, 3908,Only 1 test per day ); results.setRefer(R); end -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Bulk-Retract-speed-conundrum-tp779188p779188.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] Insert Fact Speed bottleneck
On 05/05/2010 09:19, djb wrote: Hi Drools team, I wrote a Drools application for my company, which evaluates clinical claim processing rules. That is, it checks current medical claims against the patient's historical claims. It appears that 95% of the run time is dedicated to inserting facts, which is presumably when it propagates through the RETE graph, since firing the rules takes no time. But it seems like it's not fast enough. I made a rule template, which by trial and error of moving the conditions around, is optimised. I'm averaging 310ms, and need it to be under 170ms for it to be viable. Is there any not-too-technical guide to optimisation somewhere? (alpha and beta-nodes scare me a bit). Other than writting the rules well - using == constraints, avoiding cross products ete, there isn't much more you can do. If you have time you can work with us on the next generation engine, which will emit compiled java code, should be about 3 to 5 times faster. But the core team aren't working on that quite yet, just ideas in our head. Mark Regards, Daniel ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Bulk-Retract speed conundrum
Daniel, I think I missed your previous messages but can't you simply throw the session away and create a new session for every claim (don't forget to call dispose() when throwing away a session)? Also, your rule seems odd, so I am assuming that was just a sub-optimal example. As it was pasted, it seems to me that it could be simplified to the following, more efficient rule: rule RULE_2090 when $cl: ClaimLine(historic == false, code == 3908, type == T) $historic: ClaimLine(historic == true, type == P, code = 0052 = 0052, $dt : date, eval(Utilities.isWithinTimePeriod($dt, $cl.date, Y, 99)) ) then String ruleName = drools.getRule().getName(); results.addMessage(ruleName, 3908,Only 1 test per day); results.setRefer(R); end Inlining the eval helps a bit, and in your example rule the collect() call is totally redundant as it will always be true and the consequence is not using the bound list. Like in SQL queries, the performance of the rules is totally dependent on how they are written and the how you modeled the domain model. Also, if you have just a couple rules, it might be more efficient running pure java code, but for higher number of rules, Drools becomes more and more efficient when compared to simple java code implementations of the rules. I worked with a customer sometime ago that uses hundreds of rules with 500k+ facts in memory constantly and has average response time on the 100ms order... although, they did fine tuned their rules. Edson 2010/5/5 djb dbrownel...@hotmail.com Hi Drools aficionados, This is further to my request to improve speed. As requested previously, I am providing an example rule. So, I found that by only retracting facts after processing multiple claims, instead of after every claim, I managed to improve speed from 300ms per claim to 50ms! We need it to be sub-170ms to be a viable option. But, I need to retract facts. As you can see, if I add new Claim data, it might match the last guy's claim data (Bad!). It would appear that 'disabling' the data would require an update and take as much time as a retract. So, is there any way around this? Am I stuck with 300ms per claim? Would changing to sequential stateless session be possible, or worthwhile? If I can't improve the speed, I will have to advice against Drools for the project. regards, Daniel - My rules look like this: rule RULE_2090 when $cl: ClaimLine(historic == false, code == 3908, type == T) $historic: ClaimLine(historic == true, code = 0052 = 0052, type == P, $dt : date) eval(Utilities.isWithinTimePeriod($dt, $cl.date, Y, 99)) $historic_many: ArrayList(size = 0) from collect(ClaimLine(historic == true, code = 0052 = 0052, type == P)) then String ruleName = drools.getRule().getName(); results.addMessage(ruleName, 3908,Only 1 test per day ); results.setRefer(R); end -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Bulk-Retract-speed-conundrum-tp779188p779188.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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Bulk-Retract speed conundrum
Also, the condition code = 0052 = 0052, looks like the simpler code == 0052, to me. -W 2010/5/5 Edson Tirelli ed.tire...@gmail.com: Daniel, I think I missed your previous messages but can't you simply throw the session away and create a new session for every claim (don't forget to call dispose() when throwing away a session)? Also, your rule seems odd, so I am assuming that was just a sub-optimal example. As it was pasted, it seems to me that it could be simplified to the following, more efficient rule: rule RULE_2090 when $cl: ClaimLine(historic == false, code == 3908, type == T) $historic: ClaimLine(historic == true, type == P, code = 0052 = 0052, $dt : date, eval(Utilities.isWithinTimePeriod($dt, $cl.date, Y, 99)) ) then String ruleName = drools.getRule().getName(); results.addMessage(ruleName, 3908,Only 1 test per day); results.setRefer(R); end Inlining the eval helps a bit, and in your example rule the collect() call is totally redundant as it will always be true and the consequence is not using the bound list. Like in SQL queries, the performance of the rules is totally dependent on how they are written and the how you modeled the domain model. Also, if you have just a couple rules, it might be more efficient running pure java code, but for higher number of rules, Drools becomes more and more efficient when compared to simple java code implementations of the rules. I worked with a customer sometime ago that uses hundreds of rules with 500k+ facts in memory constantly and has average response time on the 100ms order... although, they did fine tuned their rules. Edson 2010/5/5 djb dbrownel...@hotmail.com Hi Drools aficionados, This is further to my request to improve speed. As requested previously, I am providing an example rule. So, I found that by only retracting facts after processing multiple claims, instead of after every claim, I managed to improve speed from 300ms per claim to 50ms! We need it to be sub-170ms to be a viable option. But, I need to retract facts. As you can see, if I add new Claim data, it might match the last guy's claim data (Bad!). It would appear that 'disabling' the data would require an update and take as much time as a retract. So, is there any way around this? Am I stuck with 300ms per claim? Would changing to sequential stateless session be possible, or worthwhile? If I can't improve the speed, I will have to advice against Drools for the project. regards, Daniel - My rules look like this: rule RULE_2090 when $cl: ClaimLine(historic == false, code == 3908, type == T) $historic: ClaimLine(historic == true, code = 0052 = 0052, type == P, $dt : date) eval(Utilities.isWithinTimePeriod($dt, $cl.date, Y, 99)) $historic_many: ArrayList(size = 0) from collect(ClaimLine(historic == true, code = 0052 = 0052, type == P)) then String ruleName = drools.getRule().getName(); results.addMessage(ruleName, 3908,Only 1 test per day ); results.setRefer(R); end -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Bulk-Retract-speed-conundrum-tp779188p779188.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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ClassCastException: org.drools.reteoo.RuleTerminalNode$TerminalNodeMemory cannot be cast to org.drools.reteoo.EvalConditionNode$EvalMemory
Any ideas what the svn commit revision was I'd like to patch our code as we're trying to get to a production state and this plus the issue reported by Jason Smith at http://drools-java-rules-engine.46999.n3.nabble.com/no-subject-tt48858.html#a48858 are holding us back. Any pointers you have here would be appreciated. As well as a review of his code for fixing the removeFactHandle issue pointed out in that thread so I can try to apply these patches and see if these issues are fixed. -- Paul Ryan On Apr 30, 2010, at 8:49 AM, Edson Tirelli wrote: Paul, I believe this is related to a problem I fixed in trunk a couple weeks ago. Can you please test trunk and let me know if the problem persists? Thank you, Edson 2010/4/29 Paul Ryan pr...@infotrustgroup.commailto:pr...@infotrustgroup.com Hi all, We're receiving some error messages that we don't understand from rules that had conditionals that worked and now don't (no upgrade or anything like that, they just stopped working), any clues as to what kinds of things to look for when we get an error like the following? (if not we can try to pair down to an a test case) org.drools.runtime.rule.ConsequenceException: java.lang.ClassCastException: org.drools.reteoo.RuleTerminalNode$TerminalNodeMemory cannot be cast to org.drools.reteoo.EvalConditionNode$EvalMemory at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183) at com.infotrustgroup.rules.engine.RulesManager.runRules(RulesManager.java:353) at com.infotrustgroup.util.rules.RuleFileUtil.runRules(RuleFileUtil.java:406) at com.infotrustgroup.util.rules.RuleFileUtil.runRules(RuleFileUtil.java:370) at com.infotrustgroup.util.rules.RuleRunner.run(RuleRunner.java:395) at com.infotrustgroup.util.rules.RuleRunner.call(RuleRunner.java:193) at com.infotrustgroup.jobs.services.auth.EditionsRulesJobRunner.runRules(EditionsRulesJobRunner.java:87) Caused by: java.lang.ClassCastException: org.drools.reteoo.RuleTerminalNode$TerminalNodeMemory cannot be cast to org.drools.reteoo.EvalConditionNode$EvalMemory at org.drools.reteoo.EvalConditionNode.retractLeftTuple(EvalConditionNode.java:199) at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:159) at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:68) at org.drools.reteoo.JoinNode.retractLeftTuple(JoinNode.java:231) at org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:239) at org.drools.reteoo.EntryPointNode.retractObject(EntryPointNode.java:195) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1416) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1360) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:141) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:154) at com.infotrustgroup.what.Rule_Transform_SGML_to_XML_0.consequence(Rule_Transform_SGML_to_XML_0.java:48) at com.infotrustgroup.what.Rule_Transform_SGML_to_XML_0ConsequenceInvoker.evaluate(Rule_Transform_SGML_to_XML_0ConsequenceInvoker.java:34) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934) ... 11 more Thanks in advance for your help with this, -- Paul Ryan ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.comhttp://www.jboss.com/ ___ rules-users mailing list rules-users@lists.jboss.orgmailto: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] Bug in not ???
Using Drools Expert 5.0.1 The following rule fires both when the not is there, and also if the not is commented out. Clearly, both cannot be true, so there is something wrong somewhere. I've narrowed it down to the testing of the $parentEmploymentId declaration - the AccountHolder CE, which is inside the context of the not, is referencing $parentEmploymentId, which is declared outside the not. If the indicated line is commented out, then the expression behaves sensibly (i.e. fires either when the not is used, or when it isn't, but not both). However, an important business semantic element is then missing from the rule. Is this a bug in Drools, or am I misusing something? rule RS7713.9.2_ when Employment ( $parentEmploymentId : myId ) not # if the not is commented out, the rule still fires ( AccountHolder ( $parentEmployerInfoId : myId , parentId == $parentEmploymentId # if this line is commented, it behaves sensibly (per the 'not'), but misses an important business semantic ) and BusinessName ( parentId == $parentEmployerInfoId , lines contains DISTRESS ) ) then ; end Tom Murphy Business Process Consultant Wells Fargo HCFG - CORE Deal Decisioning Platform 800 S. Jordan Creek Parkway | West Des Moines, IA 50266 MAC: X2301-01B Office: 515 324 4853 | Mobile: 515 423 4334 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Can NOT map variable to User Task in BPMN2
Hi All, 1. I have the following BPMN2 flow. http://n3.nabble.com/file/n780238/flow.jpg 2. With a String type flow variable called firstName. http://n3.nabble.com/file/n780238/props.jpg 3. Work Handler has a WorkItemHandler behind it that just prints out the value of firstName. Variable firstName is mapped in Parameter Mapping. 4. User Task is a Human Task node with just a regular WorkItemHandler behind it that as well just prints out the value of firstName. There is NO Mina Server involvement, just a common WorkItemHandler. Variable firstName is mapped in Parameter Mapping. 5. Finished Script just access firstName directly. Results: 1. Work Handler executes just fine and prints the value of firstName. 2. Finished Script executes just fine and prints the value of firstName. 3. User Task can NOT find firstName and shows the following error: http://n3.nabble.com/file/n780238/error1.jpg Comments: 1. I don't believe it is a mapping problem as I have declared the variable at the flow level and mapped it accordingly to each node. Is not a typo error either as I checked that like more than 100 times :) 2. I have the same example in a Ruleflow (.rf) instead of BPMN2 (.bpmn) and it works just fine. Questions: 1. Is there any difference in mapping in variables to a User Task node in BPMN2 vs Ruleflow? Specially when not using the Mina Server and just registering a regular WorkItemHandler? 2. Do I have to declare any kind of scope for the variable? Work Handler doesn't seem to have any problems and doesn't complain about scope. 3. Any other ideas why the WorkItemHandler behind User Task cannot find firstName? I appreciate any comments or ideas. Thanks, Nick. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Can-NOT-map-variable-to-User-Task-in-BPMN2-tp780238p780238.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] rule fires while condition is false
I'm running drools 4. It has been running for a long time with no issues. I have this weird issue now and I'm wondering what can explain this. I have the following rule defined. rule netRepaymentWithLiabilities1 agenda-group autoUnderwriting when #conditions enrichedApplication: EnrichedApplicationVersionTO() eval (enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities() = 0.65) decision: Decision() then #actions System.out.println(!! + (enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities() = 0.65)); decision.setDecision(APPROVED, NetRepaymentWthLiblt); end This rule invokes although 'enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()' 1. More over in the then part it prints 'false', so how come it invoked while the condition is not fulfilled? What can cause this? Shai ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users