Re: [rules-users] query in drools expert :: rule language
Hi luane, thanks for that. Using the expression under eval() solves the problem. I don't develop the objects I am applying the rule against. So I have to make do with string datatype. cheers. -- View this message in context: http://drools.46999.n3.nabble.com/query-in-drools-expert-rule-language-tp3612345p3612444.html Sent from the Drools: User forum 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] query in drools expert :: rule language
The Drools version would be interesting, to raise a JIRA if it is 5.2.0. -W On 26 December 2011 09:05, bobbi_80 guruprasad_bo...@infosys.com wrote: Hi luane, thanks for that. Using the expression under eval() solves the problem. I don't develop the objects I am applying the rule against. So I have to make do with string datatype. cheers. -- View this message in context: http://drools.46999.n3.nabble.com/query-in-drools-expert-rule-language-tp3612345p3612444.html Sent from the Drools: User forum 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] query in drools expert :: rule language
sorry forgot to mention that part. I am using 5.3.0 final. -- View this message in context: http://drools.46999.n3.nabble.com/query-in-drools-expert-rule-language-tp3612345p3612453.html Sent from the Drools: User forum 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] Performance consideration in rule writing
Hi, team, I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: Rule 1 Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==995eval(creditOption($txn)==1)eval(isGCSwitch($txn))i sCurrencyEquals($txn)==0compareToPostThreshold($txn)==2); Then . End Rule 2 Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==995eval(creditOption($txn)==1)eval(isGCSwitch($txn))i sCurrencyEquals($txn)==0compareToPostThreshold($txn)==1); Then . End Questions: 1. Will I gain better performance if I put the rule differentiator condition compareToPostThreshold($txn)==2 at the beginning of both rule 1 and 2? 2. I saw salaboy's video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration or I'd better collect/ prepare all the data before I send them into the session? 3. What's you guys' naming convention for rule's salience? PS: my Drools version is 5.2.0. Best regards Abe ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] +1 buttons added to the website (Drools, Guvnor and Planner)
I 've added +1 buttons on these page for Drools, Guvnor and Planner in the top right corner: http://www.jboss.org/drools/drools-expert http://www.jboss.org/drools/drools-guvnor http://www.jboss.org/drools/drools-planner Click them if you like our software :) -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] +1 buttons added to the website (Drools, Guvnor and Planner)
Cool Geoffrey! jbpm.org needs that too! what happens with fusion? Cheers On Mon, Dec 26, 2011 at 10:23 AM, Geoffrey De Smet ge0ffrey.s...@gmail.com wrote: I 've added +1 buttons on these page for Drools, Guvnor and Planner in the top right corner: http://www.jboss.org/drools/drools-expert http://www.jboss.org/drools/drools-guvnor http://www.jboss.org/drools/drools-planner Click them if you like our software :) -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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] +1 buttons added to the website (Drools, Guvnor and Planner)
The buttons are linked to their G+ brand pages (so if you +1 it there or on the jboss.org page, the result is the same). It's up to Edson and Mark to decide if they want a separate Fusion page too. Op 26-12-11 14:26, Mauricio Salatino schreef: Cool Geoffrey! jbpm.org needs that too! what happens with fusion? Cheers On Mon, Dec 26, 2011 at 10:23 AM, Geoffrey De Smet ge0ffrey.s...@gmail.com wrote: I 've added +1 buttons on these page for Drools, Guvnor and Planner in the top right corner: http://www.jboss.org/drools/drools-expert http://www.jboss.org/drools/drools-guvnor http://www.jboss.org/drools/drools-planner Click them if you like our software :) -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Problems saving BPMN2 diagrams in Guvnor
Hi Christiano, the error message says that you have a sequence flow that has no targetRef attribute. Now you could either have a dangling sequence flow or this is a bug in the designer. If you can please show a screenshot of your process before saving it or describe what node types you have there and we will try to recreate and fix. As far as no warning showing before the save - this is something that we are working on. Currently if there are issues with parsing the BPMN2 created by designer, the asset source in Guvnor is blank and that's why you are looking your process in the canvas after a save. A workaround until this is done is do click on the BPMN2 button in the designer footer which just shows the process BPMN2 before saving it. In this case you will be able to see the log errors without loosing everything on your canvas. Hope this helps. On 12/25/11 10:56 PM, Cristiano Gavião wrote: Hi, I'm playing with Guvnor from jbpm-5.2.0.Final-installer-full using Jboss AS7. I'm using the Chrome browser I could create a bpmn2 diagram and play with it. After save it, sometimes I get a blank canvas and sometimes it is not saving the changes. I can open the file and see all my saving messages on the Version History folder, but when I try to open it..., it is blank... Normally I couldn't see any error message at the console when it just don't save the last change. but right now, that I lost all elements of my diagram (I mean, there is a blank canvas) I got this: 00:50:21,761 INFO [stdout] (http--127.0.0.1-8080-5) (null: 47, 119): cvc-complex-type.4: Attribute 'targetRef' must appear on element 'bpmn2:sequenceFlow'. 00:50:21,868 SEVERE [com.intalio.web.profile.impl.JbpmProfileImpl] (http--127.0.0.1-8080-3) null: java.lang.NullPointerException at com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallSequenceFlow(Bpmn2JsonMarshaller.java:1441) [classes:] at com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallFlowElement(Bpmn2JsonMarshaller.java:684) [classes:] at com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallProcess(Bpmn2JsonMarshaller.java:422) [classes:] at com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallDefinitions(Bpmn2JsonMarshaller.java:314) [classes:] at com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshall(Bpmn2JsonMarshaller.java:157) [classes:] at com.intalio.web.profile.impl.JbpmProfileImpl$2.parseModel(JbpmProfileImpl.java:255) [classes:] at com.intalio.web.repository.impl.UUIDBasedJbpmRepository.load(UUIDBasedJbpmRepository.java:36) [classes:] at com.intalio.web.server.UUIDBasedRepositoryServlet.doGet(UUIDBasedRepositoryServlet.java:123) [classes:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at com.intalio.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:75) [classes:] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at
Re: [rules-users] Performance consideration in rule writing
See below. 2011/12/26 Zhuo Li milanello1...@gmail.com Hi, team, ** ** I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: ** ** Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995”eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn)==0compareToPostThreshold($txn)==2); Then … End ** ** Rule “2” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995”eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn)==0compareToPostThreshold($txn)==1); Then … End ** ** Questions: **1. **Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? One kind pf Rete optimization is based on evaluating common constraints once, therefore: no. **2. **I saw salaboy’s video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration Constraints based on fields using == are best. Other things may result in eval-like evaluations anyway. Most of the time, it isn't eval that causes performance setbacks. or I’d better collect/ prepare all the data before I send them into the session? Not clear what you mean by this, but if you can provide attributes that lend themselves to straightforward constraints it might be worthwhile considering some up-front processing of facts. **3. **What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. -W ** ** PS: my Drools version is 5.2.0. ** ** Best regards Abe ___ 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] 答复: Performance consideration in rule writing
Hi, Wolfgang, I think I’ve figured out some answers and see my shares below. Thanks and let me know your thoughts about #3. Best Abe 1. Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? One kind pf Rete optimization is based on evaluating common constraints once, therefore: no. //Abe: it definitely makes a difference if you put differentiator conditions at the beginning �C this way RETE won’t waste efforts constructing networks which will not fulfill. See below example. rule Evaluation of assignment in r-value position no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0==Matcher.getClauseNum()) then System.out.println($value); modify($statement){ setSemantics(Matcher.getRVSemantics(memory,$value)); } end rule Evaluation of assignment clause in r-value position without updating memory no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0Matcher.getClauseNum()) then System.out.println(==+$value); Matcher.decreaseClauseNum(); modify($statement){ setSemantics(Matcher.getRVSemanticsWithoutUpdate(memory,$value)); } end These two rules try to validate if Matcher.getClauseNum() ==0 or 0. If you put differentiator “Matcher.getClauseNum()” at the end of LHS, Drools will start two threads to deduct RETE network so even if the fact hits rule 1, rule 2 will still be stepped in. But if we make the two rules as below, RETE will identify the shortcut correctly and no thread will be triggered to step into rule 2: rule Evaluation of assignment in r-value position no-loop true when eval(0==Matcher.getClauseNum()) $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) then System.out.println($value); modify($statement){ setSemantics(Matcher.getRVSemantics(memory,$value)); } end rule Evaluation of assignment clause in r-value position without updating memory no-loop true when eval(0Matcher.getClauseNum()) $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) then System.out.println(==+$value); Matcher.decreaseClauseNum(); modify($statement){ setSemantics(Matcher.getRVSemanticsWithoutUpdate(memory,$value)); } end 2. I saw salaboy’s video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration Constraints based on fields using == are best. Other things may result in eval-like evaluations anyway. Most of the time, it isn't eval that causes performance setbacks. or I’d better collect/ prepare all the data before I send them into the session? Not clear what you mean by this, but if you can provide attributes that lend themselves to straightforward constraints it might be worthwhile considering some up-front processing of facts. //Abe: I saw below statement from Drools document 5.2.0. As Eval is not indexed, overuse of evale reduces the rules’ clarity and will result in a bad performance. 5.8.3.7. Conditional Element eval eval Figure 5.29. eval The conditional element eval is essentially a catch-all which allows any semantic code (that returns a primitive boolean) to be executed. This code can refer to variables that were bound in the LHS of the rule, and functions in the rule package. Overuse of eval reduces the declarativeness of your rules and can result in a poorly performing engine. While eval can be used anywhere in the patterns, the best practice is to add it as the last conditional element in the LHS of a rule. Evals cannot be indexed and thus are not as efficient as Field Constraints. However this makes them ideal for being used when functions return values that change over time, which is not allowed within Field Constraints. 3. What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. //Abe: I mean how do you weight your salience values across different rules. I’ve seen various styles in my project �C somebody uses 100, 200, 300 but somebody uses 90, 100, 110, 120, etc. This is not a big problem as they are working on different rules and won’t pollute each other. However I would still try to make it consistent so maintain each other’s rule files will be easier… 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 22:20 收件人: Rules Users List 主题: Re: [rules-users] Performance consideration in rule writing See below. 2011/12/26 Zhuo Li milanello1...@gmail.com Hi, team, I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn )==0compareToPostThreshold($txn)==2); Then
Re: [rules-users] 答复: Performance consideration in rule writing
This ought to be another thread/another subject. 2011/12/26 Zhuo Li milanello1...@gmail.com Any question is also about performance consideration. See below example:* *** ** ** Rule “1” Dialect “mvel” Salience 300 No-loop true When $acctsrc: data(sourceid==1) $reposrc: data((sourceid==2||sourceid==5)amount==acctsrc.amount) Then … End ** ** Two questions here: **1. **In this kind of join conditions, is there any best practice to follow in the rule? I heard from somebody that I need to put data who have less # of transactions first in my when expression. For example, if I have less number of $reposrc transactions in facts, I should put it ahead of $acctsrc to gain better performance. Is this valid? Correct: narrowing down the number of joins is best practice. **2. **Do we know how to create an event listener in the rule for logging purpose rather than standard log4j? It was recommended in some other articles as well. Is this also valid? ( http://www.technologyblue.com/docs/presentations/DroolsBestPractices.pdf); An event listener as provided by Drools for rule and WM events is not to be confused with a logging service, so your question doesn't make much sense. The big difference is that a listener gets informed about all it is set up to listen to, whereas calls to Looger.info() need to be written wherever logging should be done. This could be in listener code reacting to an event, or anyplace else, as in the RHS of some rules in the quoted presentation. ** ** Ultimately, is there any place I can find a best practice of rule development as a generic guide? Not a single place that I know of. Perhaps if you post this as a separate thread with a fitting topic. -W ** ** Best Abe ** ** *发件人:* Zhuo Li [mailto:milanello1...@gmail.com] *发送时间:* 2011年12月26日 16:51 *收件人:* 'Rules Users List' *主题:* Performance consideration in rule writing ** ** Hi, team, ** ** I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: ** ** Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995”eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn)==0compareToPostThreshold($txn)==2); Then … End ** ** Rule “2” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995”eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn)==0compareToPostThreshold($txn)==1); Then … End ** ** Questions: **1. **Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? **2. **I saw salaboy’s video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration or I’d better collect/ prepare all the data before I send them into the session? **3. **What’s you guys’ naming convention for rule’s salience? ** ** PS: my Drools version is 5.2.0. ** ** Best regards Abe ___ 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] 答复: 答复: Performance consideration in rule writing
Hi, Wolfgang, Thanks for the message. I think I’m clear about the listener piece now! Best Abe 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 23:01 收件人: Rules Users List 主题: Re: [rules-users] 答复: Performance consideration in rule writing This ought to be another thread/another subject. 2011/12/26 Zhuo Li milanello1...@gmail.com Any question is also about performance consideration. See below example: Rule “1” Dialect “mvel” Salience 300 No-loop true When $acctsrc: data(sourceid==1) $reposrc: data((sourceid==2||sourceid==5)amount==acctsrc.amount) Then … End Two questions here: 1. In this kind of join conditions, is there any best practice to follow in the rule? I heard from somebody that I need to put data who have less # of transactions first in my when expression. For example, if I have less number of $reposrc transactions in facts, I should put it ahead of $acctsrc to gain better performance. Is this valid? Correct: narrowing down the number of joins is best practice. 2. Do we know how to create an event listener in the rule for logging purpose rather than standard log4j? It was recommended in some other articles as well. Is this also valid? (http://www.technologyblue.com/docs/presentations/DroolsBestPractices.pdf); An event listener as provided by Drools for rule and WM events is not to be confused with a logging service, so your question doesn't make much sense. The big difference is that a listener gets informed about all it is set up to listen to, whereas calls to Looger.info() need to be written wherever logging should be done. This could be in listener code reacting to an event, or anyplace else, as in the RHS of some rules in the quoted presentation. Ultimately, is there any place I can find a best practice of rule development as a generic guide? Not a single place that I know of. Perhaps if you post this as a separate thread with a fitting topic. -W Best Abe 发件人: Zhuo Li [mailto:milanello1...@gmail.com] 发送时间: 2011年12月26日 16:51 收件人: 'Rules Users List' 主题: Performance consideration in rule writing Hi, team, I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn )==0compareToPostThreshold($txn)==2); Then … End Rule “2” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn )==0compareToPostThreshold($txn)==1); Then … End Questions: 1. Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? 2. I saw salaboy’s video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration or I’d better collect/ prepare all the data before I send them into the session? 3. What’s you guys’ naming convention for rule’s salience? PS: my Drools version is 5.2.0. Best regards Abe ___ 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] 答复: Performance consideration in rule writing
On 26/12/2011, Zhuo Li milanello1...@gmail.com wrote: //Abe: it definitely makes a difference if you put differentiator conditions at the beginning �C this way RETE won’t waste efforts constructing networks which will not fulfill. See below example. rule Evaluation of assignment in r-value position no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0==Matcher.getClauseNum()) then System.out.println($value); modify($statement){ setSemantics(Matcher.getRVSemantics(memory,$value)); } end rule Evaluation of assignment clause in r-value position without updating memory no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0Matcher.getClauseNum()) then System.out.println(==+$value); Matcher.decreaseClauseNum(); modify($statement){ setSemantics(Matcher.getRVSemanticsWithoutUpdate(memory,$value)); } end This is quite different from the rules in the original post. It is generally not advisable to access and modify static variables, here: clauseNum in class Matcher, i.e., not a fact. //Abe: I saw below statement from Drools document 5.2.0. As Eval is not indexed, overuse of evale reduces the rules’ clarity and will result in a bad performance. Needlessly using eval is not good; if you have to use it you won't be able to avoid it. 3. What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. //Abe: I mean how do you weight your salience values across different rules. I’ve seen various styles in my project �C somebody uses 100, 200, 300 but somebody uses 90, 100, 110, 120, etc. This is not a big problem as they are working on different rules and won’t pollute each other. However I would still try to make it consistent so maintain each other’s rule files will be easier… Making your rules depend on salience isn't good practice, certainly not with more than 3 levels (my personal definition). The sort of multi-level salience you're indicating could be an indication that procedural style if-then-elsif logic has been fitted into rules. -W 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 22:20 收件人: Rules Users List 主题: Re: [rules-users] Performance consideration in rule writing See below. 2011/12/26 Zhuo Li milanello1...@gmail.com Hi, team, I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn )==0compareToPostThreshold($txn)==2); Then … End Rule “2” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEquals($txn )==0compareToPostThreshold($txn)==1); Then … End Questions: 1. Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? One kind pf Rete optimization is based on evaluating common constraints once, therefore: no. 2. I saw salaboy’s video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration Constraints based on fields using == are best. Other things may result in eval-like evaluations anyway. Most of the time, it isn't eval that causes performance setbacks. or I’d better collect/ prepare all the data before I send them into the session? Not clear what you mean by this, but if you can provide attributes that lend themselves to straightforward constraints it might be worthwhile considering some up-front processing of facts. 3. What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. -W PS: my Drools version is 5.2.0. Best regards Abe ___ 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] 答复: 答复: Performance consideration in rule writing
So for #1, you mean it is more from static variable safety to put uncommon conditions at the beginning of LHS? On #3, can you elaborate more about Making your rules depend on salience isn't good practice ? in general, what we need to define in every rule file is a business case, and every case stands for a flow with things like if-elseif-else. I guess you mean I may use Drools flow or Java itself to control the flow and leave judgment inside Drools? If that's the case, the original concern we had was it will have too many insert() into workingmemory which may impact performance... Best Abe -邮件原件- 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 23:15 收件人: Rules Users List 主题: Re: [rules-users] 答复: Performance consideration in rule writing On 26/12/2011, Zhuo Li milanello1...@gmail.com wrote: //Abe: it definitely makes a difference if you put differentiator conditions at the beginning �C this way RETE won’t waste efforts constructing networks which will not fulfill. See below example. rule Evaluation of assignment in r-value position no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0==Matcher.getClauseNum()) then System.out.println($value); modify($statement){ setSemantics(Matcher.getRVSemantics(memory,$value)); } end rule Evaluation of assignment clause in r-value position without updating memory no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0Matcher.getClauseNum()) then System.out.println(==+$value); Matcher.decreaseClauseNum(); modify($statement){ setSemantics(Matcher.getRVSemanticsWithoutUpdate(memory,$value)); } end This is quite different from the rules in the original post. It is generally not advisable to access and modify static variables, here: clauseNum in class Matcher, i.e., not a fact. //Abe: I saw below statement from Drools document 5.2.0. As Eval is not indexed, overuse of evale reduces the rules’ clarity and will result in a bad performance. Needlessly using eval is not good; if you have to use it you won't be able to avoid it. 3. What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. //Abe: I mean how do you weight your salience values across different rules. I’ve seen various styles in my project �C somebody uses 100, 200, 300 but somebody uses 90, 100, 110, 120, etc. This is not a big problem as they are working on different rules and won’t pollute each other. However I would still try to make it consistent so maintain each other’s rule files will be easier… Making your rules depend on salience isn't good practice, certainly not with more than 3 levels (my personal definition). The sort of multi-level salience you're indicating could be an indication that procedural style if-then-elsif logic has been fitted into rules. -W 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 22:20 收件人: Rules Users List 主题: Re: [rules-users] Performance consideration in rule writing See below. 2011/12/26 Zhuo Li milanello1...@gmail.com Hi, team, I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEqual s($txn )==0compareToPostThreshold($txn)==2); Then … End Rule “2” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEqual s($txn )==0compareToPostThreshold($txn)==1); Then … End Questions: 1. Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? One kind pf Rete optimization is based on evaluating common constraints once, therefore: no. 2. I saw salaboy’s video claiming that to avoid using eval() in the rule. Do we have any alternative way to do that from a performance consideration Constraints based on fields using == are best. Other things may result in eval-like evaluations anyway. Most of the time, it isn't eval that causes performance setbacks. or I’d better collect/ prepare all the data before I send them into the session? Not clear what you mean by this, but if you can provide attributes that lend themselves to straightforward constraints it might be worthwhile considering some up-front processing of facts. 3. What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. -W PS: my
Re: [rules-users] 答复: 答复: Performance consideration in rule writing
2011/12/26 Zhuo Li milanello1...@gmail.com So for #1, you mean it is more from static variable safety to put uncommon conditions at the beginning of LHS? A static variable or a DRL global is something that must be used with caution in a rule's LHS. In any case, if it is read, it should be used like a constant; if you modify it, it should be used like a one-way outoing service. On #3, can you elaborate more about Making your rules depend on salience isn't good practice ? in general, what we need to define in every rule file is a business case, and every case stands for a flow with things like if-elseif-else. I guess you mean I may use Drools flow or Java itself to control the flow and leave judgment inside Drools? Think of flow (either by Drools or by Java) as a high-level progress through application stages or phases. Salience is better restricted to precedence within flow groups, and there I don't recommend more than three levels. If that's the case, the original concern we had was it will have too many insert() into workingmemory which may impact performance... I don't see how one would require the other. Inserts are indicated if you derive new facts that need to be evaluated in subsequent rules. -W Best Abe -邮件原件- 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 23:15 收件人: Rules Users List 主题: Re: [rules-users] 答复: Performance consideration in rule writing On 26/12/2011, Zhuo Li milanello1...@gmail.com wrote: //Abe: it definitely makes a difference if you put differentiator conditions at the beginning �C this way RETE won’t waste efforts constructing networks which will not fulfill. See below example. rule Evaluation of assignment in r-value position no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0==Matcher.getClauseNum()) then System.out.println($value); modify($statement){ setSemantics(Matcher.getRVSemantics(memory,$value)); } end rule Evaluation of assignment clause in r-value position without updating memory no-loop true when $statement:CStatement($value:value) eval(Matcher.isRVExpression($value)) eval(0Matcher.getClauseNum()) then System.out.println(==+$value); Matcher.decreaseClauseNum(); modify($statement){ setSemantics(Matcher.getRVSemanticsWithoutUpdate(memory,$value)); } end This is quite different from the rules in the original post. It is generally not advisable to access and modify static variables, here: clauseNum in class Matcher, i.e., not a fact. //Abe: I saw below statement from Drools document 5.2.0. As Eval is not indexed, overuse of evale reduces the rules’ clarity and will result in a bad performance. Needlessly using eval is not good; if you have to use it you won't be able to avoid it. 3. What’s you guys’ naming convention for rule’s salience? Not clear what you mean by that. //Abe: I mean how do you weight your salience values across different rules. I’ve seen various styles in my project �C somebody uses 100, 200, 300 but somebody uses 90, 100, 110, 120, etc. This is not a big problem as they are working on different rules and won’t pollute each other. However I would still try to make it consistent so maintain each other’s rule files will be easier… Making your rules depend on salience isn't good practice, certainly not with more than 3 levels (my personal definition). The sort of multi-level salience you're indicating could be an indication that procedural style if-then-elsif logic has been fitted into rules. -W 发件人: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] 代表 Wolfgang Laun 发送时间: 2011年12月26日 22:20 收件人: Rules Users List 主题: Re: [rules-users] Performance consideration in rule writing See below. 2011/12/26 Zhuo Li milanello1...@gmail.com Hi, team, I have some quick questions here regarding performance best practices of rule writing. See below two pieces of rules: Rule “1” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEqual s($txn )==0compareToPostThreshold($txn)==2); Then … End Rule “2” Salience 100 No-loop true When $txn : data(sourceid == 5txnjustify==”995” eval(creditOption($txn)==1)eval(isGCSwitch($txn))isCurrencyEqual s($txn )==0compareToPostThreshold($txn)==1); Then … End Questions: 1. Will I gain better performance if I put the rule differentiator condition “compareToPostThreshold($txn)==2” at the beginning of both rule 1 and 2? One kind pf Rete optimization is based on
[rules-users] Running rules from the past
Hi folks, I work at a bank and I am currently studying the best way to use JBoss Rules so that it fits our needs. Our loan analysis process can take several months depending on the type of the loan. Although our business rules can evolve, a loan must follow the rules valid at the time the loan application was made. In order to attend this requirement I thought about storing at the database the name of the current snapshot with the loan application data, so that it will possible run this rules in the future without freezing my rule database. * Is there a better way to attend this requirement? * How can I retrieve meta information from a snapshot, such as the date when the snapshot was created? Thanks in advance, Celso ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Running rules from the past
Am 26.12.2011 18:08 schrieb Celso Junior celso...@gmail.com: Hi folks, I work at a bank Me too (sort of) and I am currently studying the best way to use JBoss Rules so that it fits our needs. Our loan analysis process can take several months depending on the type of the loan. Although our business rules can evolve, a loan must follow the rules valid at the time the loan application was made. In order to attend this requirement I thought about storing at the database the name of the current snapshot with the loan application data, so that it will possible run this rules in the future without freezing my rule database. * Is there a better way to attend this requirement? Don't use snapshots. Release your rules and store the rules' release number with the loan application data in your database. * How can I retrieve meta information from a snapshot, such as the date when the snapshot was created? Thanks in advance, Celso ___ 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] Running rules from the past
Did you try Guvnor? it already store the snapshots version. So you can get the right snapshot for running your rules against an old Loan again. @Ansgar: why do you recommend to not use snapshots? Cheers 2011/12/26 Ansgar Konermann ansgar.konerm...@googlemail.com: Am 26.12.2011 18:08 schrieb Celso Junior celso...@gmail.com: Hi folks, I work at a bank Me too (sort of) and I am currently studying the best way to use JBoss Rules so that it fits our needs. Our loan analysis process can take several months depending on the type of the loan. Although our business rules can evolve, a loan must follow the rules valid at the time the loan application was made. In order to attend this requirement I thought about storing at the database the name of the current snapshot with the loan application data, so that it will possible run this rules in the future without freezing my rule database. * Is there a better way to attend this requirement? Don't use snapshots. Release your rules and store the rules' release number with the loan application data in your database. * How can I retrieve meta information from a snapshot, such as the date when the snapshot was created? Thanks in advance, Celso ___ 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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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] Running rules from the past
Am 26.12.2011 18:16 schrieb Mauricio Salatino sala...@gmail.com: Did you try Guvnor? it already store the snapshots version. So you can get the right snapshot for running your rules against an old Loan again. @Ansgar: why do you recommend to not use snapshots? They change over time, making it more complex to track down the correct version. I'd preferr a stable loan application = rule set association. OTOH, it is probably *possible* to retrieve the correct snapshot version for a loan application if additional metadata is available. It's just more complicated: metadata needs to be available and sufficient to determine exactly *one* snapshot, snapshot needs to be available (not sure if Guvnor stores all snapshots forever or just a few). For releases, there is *one* figure you need to know to reference a certain ruleset (the version number). Releases are normally kept forever. Or, at least in my environment, deleting releases is done with extra extra care -if at all-, whereas snapshots older than a week or so get removed automatically on a daily basis. Best regards, Ansgar Cheers 2011/12/26 Ansgar Konermann ansgar.konerm...@googlemail.com: Am 26.12.2011 18:08 schrieb Celso Junior celso...@gmail.com: Hi folks, I work at a bank Me too (sort of) and I am currently studying the best way to use JBoss Rules so that it fits our needs. Our loan analysis process can take several months depending on the type of the loan. Although our business rules can evolve, a loan must follow the rules valid at the time the loan application was made. In order to attend this requirement I thought about storing at the database the name of the current snapshot with the loan application data, so that it will possible run this rules in the future without freezing my rule database. * Is there a better way to attend this requirement? Don't use snapshots. Release your rules and store the rules' release number with the loan application data in your database. * How can I retrieve meta information from a snapshot, such as the date when the snapshot was created? Thanks in advance, Celso ___ 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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Running rules from the past
@Ansgar, it looks like you are doing in a database the work that it's being done by Guvnor, that keeps a lot of meta data for all the snapshots and it's ready to keep the snapshots forever, exposing them via a service, so you applications can get the right version. In the same way that you mention just knowing the ID of the snapshot that it's required. Using Guvnor, there is no need to remove snapshots, each snapshot will only contain the rules associated with it and not a complete application. Cheers 2011/12/26 Ansgar Konermann ansgar.konerm...@googlemail.com: Am 26.12.2011 18:16 schrieb Mauricio Salatino sala...@gmail.com: Did you try Guvnor? it already store the snapshots version. So you can get the right snapshot for running your rules against an old Loan again. @Ansgar: why do you recommend to not use snapshots? They change over time, making it more complex to track down the correct version. I'd preferr a stable loan application = rule set association. OTOH, it is probably *possible* to retrieve the correct snapshot version for a loan application if additional metadata is available. It's just more complicated: metadata needs to be available and sufficient to determine exactly *one* snapshot, snapshot needs to be available (not sure if Guvnor stores all snapshots forever or just a few). For releases, there is *one* figure you need to know to reference a certain ruleset (the version number). Releases are normally kept forever. Or, at least in my environment, deleting releases is done with extra extra care -if at all-, whereas snapshots older than a week or so get removed automatically on a daily basis. Best regards, Ansgar Cheers 2011/12/26 Ansgar Konermann ansgar.konerm...@googlemail.com: Am 26.12.2011 18:08 schrieb Celso Junior celso...@gmail.com: Hi folks, I work at a bank Me too (sort of) and I am currently studying the best way to use JBoss Rules so that it fits our needs. Our loan analysis process can take several months depending on the type of the loan. Although our business rules can evolve, a loan must follow the rules valid at the time the loan application was made. In order to attend this requirement I thought about storing at the database the name of the current snapshot with the loan application data, so that it will possible run this rules in the future without freezing my rule database. * Is there a better way to attend this requirement? Don't use snapshots. Release your rules and store the rules' release number with the loan application data in your database. * How can I retrieve meta information from a snapshot, such as the date when the snapshot was created? Thanks in advance, Celso ___ 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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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] Running rules from the past
Hi, is there a distinction between snapshot and release versions at all in Guvnor? If I use snapshots only (referenced by an id) from my production code, how can I tell snapshots intended for development-only use and those for production use apart? How do I know which is the latest snapshot suitable for production use? Kind regards Ansgar Am 26.12.2011 18:49 schrieb Mauricio Salatino sala...@gmail.com: @Ansgar, it looks like you are doing in a database the work that it's being done by Guvnor, that keeps a lot of meta data for all the snapshots and it's ready to keep the snapshots forever, exposing them via a service, so you applications can get the right version. In the same way that you mention just knowing the ID of the snapshot that it's required. Using Guvnor, there is no need to remove snapshots, each snapshot will only contain the rules associated with it and not a complete application. Cheers 2011/12/26 Ansgar Konermann ansgar.konerm...@googlemail.com: Am 26.12.2011 18:16 schrieb Mauricio Salatino sala...@gmail.com: Did you try Guvnor? it already store the snapshots version. So you can get the right snapshot for running your rules against an old Loan again. @Ansgar: why do you recommend to not use snapshots? They change over time, making it more complex to track down the correct version. I'd preferr a stable loan application = rule set association. OTOH, it is probably *possible* to retrieve the correct snapshot version for a loan application if additional metadata is available. It's just more complicated: metadata needs to be available and sufficient to determine exactly *one* snapshot, snapshot needs to be available (not sure if Guvnor stores all snapshots forever or just a few). For releases, there is *one* figure you need to know to reference a certain ruleset (the version number). Releases are normally kept forever. Or, at least in my environment, deleting releases is done with extra extra care -if at all-, whereas snapshots older than a week or so get removed automatically on a daily basis. Best regards, Ansgar Cheers 2011/12/26 Ansgar Konermann ansgar.konerm...@googlemail.com: Am 26.12.2011 18:08 schrieb Celso Junior celso...@gmail.com: Hi folks, I work at a bank Me too (sort of) and I am currently studying the best way to use JBoss Rules so that it fits our needs. Our loan analysis process can take several months depending on the type of the loan. Although our business rules can evolve, a loan must follow the rules valid at the time the loan application was made. In order to attend this requirement I thought about storing at the database the name of the current snapshot with the loan application data, so that it will possible run this rules in the future without freezing my rule database. * Is there a better way to attend this requirement? Don't use snapshots. Release your rules and store the rules' release number with the loan application data in your database. * How can I retrieve meta information from a snapshot, such as the date when the snapshot was created? Thanks in advance, Celso ___ 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 -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Using hashmap in guided decision table in Guvnor
Hi, I am new to Drools and Guvnor and I have the following query: 1. I have uploaded a pojo model jar which has a class A containing a hashmapString, String attr1. 2. Then, I created a new rule- Guided decision table. 3. And i want to define a rule lets me select a key of the hashmap defined using the drop-down pop-up and check the corresponding value in the second column. Then perform an action. Example: check Key= Name and value=Abc. then set an output string- Name ok in action. Please provide any suggestions. Thank You Ankit -- View this message in context: http://drools.46999.n3.nabble.com/Using-hashmap-in-guided-decision-table-in-Guvnor-tp3613947p3613947.html Sent from the Drools: User forum 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] Using hashmap in guided decision table in Guvnor
Sorry, forgot to mention: I am using drools guvnor 5.3 -- View this message in context: http://drools.46999.n3.nabble.com/Using-hashmap-in-guided-decision-table-in-Guvnor-tp3613947p3613952.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users