[rules-users] matches operator
Hey there. I get stuck on using matches operator. The Documentation doesn't say the operator in details. I just need to find whether String2 contains String1 (Ignore Case). Now I have a key(String variable) and a value(String variable). If I write key matches value, I know it definitely wrong. So is there anyone knows how to write it? Cheers. Shawn -- View this message in context: http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816492.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] matches operator
Thanks for your reply. Is this means I can't match two string variables? Only match a string constant with a string variable? -- View this message in context: http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816818.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] matches operator
Thanks -- View this message in context: http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816900.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] Simple question about String comparison in Drool
Thank you` -- View this message in context: http://drools.46999.n3.nabble.com/Simple-question-about-String-comparison-in-Drool-tp3808352p3809203.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] Simple question about String comparison in Drool
I insert several strings into working memory to make a comparison. But how to compare a anonymous string to another string. code like: List String s = ArrayList String String key function void insertValue( s, KnowledgeHelper kh ) { for( String string : s ) { kh.insert( string ); } } ... When not $string : String( toString() == key) Then Obviously, toString() can not do this task. How to get the string's value ? Cheers. -- View this message in context: http://drools.46999.n3.nabble.com/Simple-question-about-String-comparison-in-Drool-tp3808352p3808352.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] Drool Function error
Thank you~ -- View this message in context: http://drools.46999.n3.nabble.com/Drool-Function-error-tp3788965p3789874.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] How to make the working memory clean?
I don't understand the garbage collection mechanism in drool, though I have read the expert documentation. 1 - how to retract a global variable in drool? 2 - how to retract all the facts that have been inserted into the working memory? If I use halt(), does it retract all facts in the working memory and stop the all the rules? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-make-the-working-memory-clean-tp3790730p3790730.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] How to make the working memory clean?
Thank you very much~ 1- You don't retract, you can set it to null, same way as set to an object. Is it in java or in drool? If I understand correct, global variable is not really inserted into the working memory,right? Global just ensure drool can see the variable? 2-Several ways, simple is to use KnowledgeSession's getFactHandles, and retract them. Or dispose the entire Session, and create another one, which might be faster. You mean the working memory belongs to the Session not knowledgeBase? Because I have to keep the knowledgebase running all the time, I have to ensure each fire() don't leave any useless facts in the working memeory. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-make-the-working-memory-clean-tp3790730p3791905.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] How to make the working memory clean?
Thanks a lot. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-make-the-working-memory-clean-tp3790730p3791945.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] Drool Function error
I write a function in drool, but it always has error. The error is :The method insertLogical(PreCondition) is undefined for the type InsertPreCondition Is it because insertLogical must be used in RHS? Is there any way to use insertLogical in function or implement the function in RHS? code: import PreCondition; import Authorization; function void insertPreCondition(Authorization a) { // a.getPreCondition() returns an arraylist for( PreCondition pc : a.getPreCondition() ){ insertLogical( pc ); } } -- View this message in context: http://drools.46999.n3.nabble.com/Drool-Function-error-tp3788965p3788965.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] How to create a drl file or decision table dynamically?
Hi Michael, Thank you for your reply~ Now, I understand some mechanism of building dynamic class. Back to my question, if I understand correct, those methods you mentioned is to add a drl file(exist) to the knowledgeBase dynamically, right? But how about the file? I mean if I need to write Condition 1 AND Condition 2 OR Condition 3 into the file, does drool have API to do it. Because the content that I write into the file is also dynamic. What I really want to do is how to make the drl file exist first? Does it mean I have to create the file myself, and after finished creation I can add it dynamically? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3776811.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] How to create a drl file or decision table dynamically?
Thank you ~ I will learn the documentation more. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777002.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] How to create a drl file or decision table dynamically?
Sorry, I forget to mention one thing. What's really difficult for me is to translate the AND,OR(Condition 1 AND Condition 2 OR Condition 3) to the drool. Because someone will send the request with the expression(Condition 1 AND Condition 2 OR Condition 3) to me. For each request the expression is different. They hope I can translate the AND,OR to rule file automatically. They don't want drool to parse the expression(maybe string) to pick AND, OR. This is why they want to have a rule file for each request. They want to trigger the function to make a rule file when they are making the expression, not only simply send me the expression and verify it.. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777057.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] How to create a drl file or decision table dynamically?
Thank your for your reply~ I am developing the Identity and Access management. I have finished the basic requirement, but the pre-condition part is what I am doing. The website sends the pre-condition(like what IP address or the time period can user access) that user sets. The pre-conditions are what I mentioned (expression). The difficulty is one expression may consist of several pre-conditions and every condition may be related to different rules. So here is the problem, how to verify users' authorization based on the expression which contains many operators(AND, OR). The number of AND, OR in the expression are set by users. This is why I thought to create a rule file for each expression when the expression is created. In this case, I won't bother how many AND, OR a expression contains. By the way, I also thought about parsing the expression in Java, then inserting every single condition into working memory. But it seems Drool can not be fully used in this way. Because it only looks like a if-else block Do you have any other solution for this requirement? Cheers -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777389.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] How to create a drl file or decision table dynamically?
Thank your for your reply~ I am developing the Identity and Access management. I have finished the basic requirement, but the pre-condition part is what I am doing. The website sends the pre-condition(like what IP address or the time period can user access) that user sets. The pre-conditions are what I mentioned (expression). The difficulty is one expression may consist of several pre-conditions and every condition may be related to different rules. So here is the problem, how to verify users' authorization based on the expression which contains many operators(AND, OR). The number of AND, OR in the expression are set by users. This is why I thought to create a rule file for each expression when the expression is created. In this case, I won't bother how many AND, OR a expression contains. By the way, I also thought about parsing the expression in Java, then inserting every single condition into working memory. But it seems Drool can not be fully used in this way. Because it only looks like a if-else block Do you have any other solution for this requirement? Cheers laune wrote A (dynamic) request with a logical expression that is to be evaluated as a rule is very much like a (dynamic) SQL query to be evaluated on a database. Are you sure that Drools is the right platform? If someone wants to send a logical expression in a formal language of their own, you'll have to parse that expression and translate it into the Drools Rule Language (aka DRL). Perhaps a Domain Specific Language might help, but there's no telling from the very sparse information you've provided. (In any case someone and Drools will have to agree on the data model and the way to refer to the data, or else you'll have to do more work.) -W On 26 February 2012 16:00, shawn lt;youngxiao121@gt; wrote: Sorry, I forget to mention one thing. What's really difficult for me is to translate the AND,OR(Condition 1 AND Condition 2 OR Condition 3) to the drool. Because someone will send the request with the expression(Condition 1 AND Condition 2 OR Condition 3) to me. For each request the expression is different. They hope I can translate the AND,OR to rule file automatically. They don't want drool to parse the expression(maybe string) to pick AND, OR. This is why they want to have a rule file for each request. They want to trigger the function to make a rule file when they are making the expression, not only simply send me the expression and verify it.. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777057.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3777398.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] How to create a drl file or decision table dynamically?
Hi~ Do you have any example about using stringBuilder? Cheers -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3774707.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] How to create a drl file or decision table dynamically?
If it is possible to create a drl file or decision table dynamically in drool or java? Like the drool received data then create drl or decision table based on the data? Data: Condition 1 AND Condition 2 OR Condition 3 . Can the above data be stored in the rule file which also contains the operators AND, OR? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3772708.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] How to create a drl file or decision table dynamically?
Thanks for your reply. Sorry, I am not quite clear about your first option. What's the meaning of 'Construct a DRL String'? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3773060.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] How to create a drl file or decision table dynamically?
Is it from JBPM or ? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3773142.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] How to create a drl file or decision table dynamically?
Thank you~ Does it mean I have to write a file in java and saved it as .drl? fluent API is in jbpm, right? -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3773187.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] How to create a drl file or decision table dynamically?
Thanks a lot~ Looking forward to hearing from you. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-create-a-drl-file-or-decision-table-dynamically-tp3772708p3773255.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] rule with array
Thank you~ -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3749524.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] rule with array
Thanks~~ -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3752097.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] KnowledgeBase and KnowledgePackage
I am a beginner. Just ask a simple question: What's the difference between KnowledgeBase and KnowledgePackage? In which case should I use knowledgePackage? Collection or ? -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeBase-and-KnowledgePackage-tp3752176p3752176.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] rule with array
Hi, I meet a problem to find an element in an array. First, I have a 2 dimensional array and a 1 dimensional array. I need to compare whether the element in 2 dimensional array is as same as 1 dimensional array. How to solve it? Like: In Java - int [][] A; int [] B; how to iterate array A and array B to find which element is the same in Drool? -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3747680.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] rule with array
yeah, I have thought about it. But if I use function, I have to write three for loops. like: /*function Boolean findSubject(Request request) { Pointer sPointer = request.getSubjectPath(); Pointer aPointer = request.getAuthorTable(); for( int i = 0; i p.length; i++ ) { for( int j = 0; j p[i].length; j++) { for( Iterator iter = aPointer.iterator(); iter.hasNext(); ) // if..else } } }*/ sPointer is a int[][]; aPointer is a ArrayList. I need to find which element in aPointer has the same value in sPointer. If I use function, I think it the efficiency is not so good. Do you have any other ideas? -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3747895.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] rule with array
I found someone idea. It's kind of like split array. when Request( $sPath : getSubjectPath() ) // get two dimensional array then for( int i = 0; i $sPath.length; i++ ) { insert( $sPath[i]); } But I don't know how to find the facts that are inserted through for loop. -- View this message in context: http://drools.46999.n3.nabble.com/rule-with-array-tp3747680p3747911.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] How to use database in drool
Hi~ My project requires to use drool interact with MySQL. Like once the rule engine received a request, the engine will ask the database to send some fact to the engine. The engine should give a result after matching the fact with the rule (in rule engine). Is there any tutorial for building connection between the engine to the database? I know Hibernate can do it, but for SQL is there any way to do it? Regards, Shawn -- View this message in context: http://drools.46999.n3.nabble.com/How-to-use-database-in-drool-tp3737584p3737584.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] How to use database in drool
Thanks~~ -- View this message in context: http://drools.46999.n3.nabble.com/How-to-use-database-in-drool-tp3737584p3737622.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] prevent infinite loops
Is there a good way to globally prevent infinite loops. I had rule A and rule B and they both have FactA on the condition. They also both modify FactA. I tried no-loop and it prevents a loop of repeating RuleA over and over. However it then goes from Rule A back to Rule B back to Rule A. I fixed it by lock-on-active instead of no-loop. However I was wondering if there was either a timeout feature or a maximum number of times you could set a rule to be executed to error out on infinite loops. Any guidance would be appreciated. Thanks, SDG -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] error on retracting fact on drools 5.0.1
I have a rule and it is supposed to retract two objects when $objectOne : ObjectOne(...) $objectTwo : ObjectTwo(...) then retract($objectOne); #retract($objectTwo); end No matter what I do I can't ever retract objectTwo. I put a print statement and it is there. If I comment out the retraction of objectTwo it works fine. I tried just retraction of objectTwo and that fails too. I tried prefixing with drools.retract. I get this: com.principal.health.rules.RulesException: Root exception: [Error: drools.retract($objectTwo): null] [Near : {... Unknown }] ^ [Line: 1, Column: 0] - [Error: drools.retract($objectTwo): null] [Near : {... Unknown }] ^ [Line: 1, Column: 0] at com.principal.health.rules.impl.DroolsRuleSetImpl.fireRuleflow(DroolsRuleSetImpl.java:100) at com.principal.health.rules.RulesTestCase.executeRules(RulesTestCase.java:247) at com.principal.health.rules.RulesTestCase.executeAvailableRules(RulesTestCase.java:129) at com.principal.health.rules.impl.available.MemberNetworkXFormRulesRuleId6Test.retractMemberNetworkContractWithNullTeminationDates(MemberNetworkXFormRulesRuleId6Test.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.drools.runtime.rule.ConsequenceException: [Error: drools.retract($wrappedNetwork): null] [Near : {... Unknown }] ^ [Line: 1, Column: 0] 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.principal.health.rules.impl.DroolsRuleSetImpl.fireRuleflow(DroolsRuleSetImpl.java:91) ... 23 more Caused by: [Error: drools.retract($wrappedNetwork): null] [Near : {... Unknown }] ^ [Line: 1, Column: 0] at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138) at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104) at org.mvel2.MVEL.executeExpression(MVEL.java:978) at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934) ... 29 more Caused by: java.lang.reflect.InvocationTargetException at
[rules-users] drools 5.0.1 enum serialization/deserialization problem
We are pre-compiling the rules and then reading them in and running them later. I'm getting this error when reading in the compiled (serialized rules) rules: Error deserializing enum value... This line (pretty similar to this) is causing the issue when it's deserializing the Java 5 Enum. MyClass( myEnumType == MyEnum.MY_ENUM_VALUE) I saw some bug reports that this is fixed in 5.0.2 but I can't find it and it's been a while since 5.0.1 was released. When is this going to be fixed or is there a way to get a snapshot 5.0.2 with this fixed? Can somebody help me? Thanks, SDG -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] (no subject)
Functions on the LHS are not advised and says so in the drools user guide. I can think of two ways to do this (forgive me if my syntax is slightly off). Way number 1 rule ProductDescription validation when $listing : Listing( $description:productDescription != null, description.title != null ) then ListingScrubber listingScrubber = new ListingScrubber(listing); insert(listingScrubber); end rule ProductDescription validation Part 2 when $listingScrubber : ListingScrubber(forbiddenWordInTitle == true , $title: productDescription.title) then String word = $listingScrubber.getWord(); System.out.println(ERROR: + word); end Way number2 rule ProductDescription validation when $listing : Listing( $description:productDescription != null, $title : productDescription.title != null) then ListListingWord listingWordList = listing.getListingWords(); IteratorListingWord listingWordListIter = listingWordList.iterator(); while(listingWordListIter.hasNext()) { ListingWord listingWord = listingWordListIter.next(); assert(listingWord); } end $word : hasForbiddenWordsSet( wordsSet, $description.getTitle() ) rule ProductDescription validation Part 2 when $badWordList : BadWordList($wordList : list) $listingWord : ListingWord($word : word memberof $wordList, $listing : listing) then System.out.println($listing.productDescription + has naughty word: + $word); End Original Message Hi! I'm new here and a have a doubt about rules and functions in Drools. I have this rule: rule ProductDescription validation when $listing : Listing( $description:productDescription != null ) eval( $description.getTitle() != null ) eval( hasForbiddenWordsSet( wordsSet, $description.getTitle() ) ) then System.out.println(ERROR!); end And this function: function boolean hasForbiddenWordsSet(Set wordsSet, String value) { #do something useful here } And everything works fine. But now I want that function hasForbiddenWordsSet return a String. For example to print at then. I tried something like this: rule ProductDescription validation when $listing : Listing( $description:productDescription != null ) eval( $description.getTitle() != null ) $word : hasForbiddenWordsSet( wordsSet, $description.getTitle() ) then System.out.println(ERROR: + word); end function String hasForbiddenWordsSet(Set wordsSet, String value) { #do something useful here } But it doesn't work, tried some other things and still no success. Could someone help me? Thanks in advance. -- Leandro Carvalho -- next part -- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090909/41bb3455/attachment-0001.html -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] question on drools and method calls on facts
I'm under the impression that in the action clause of a rule you should only do one of the following: 1) Set a property on a Fact 2) Retract a Fact 3) Insert (Assert) a new Fact 4) Modify an existing Fact However in some of the examples in the documentation it shows calling methods other than bean property getters and setters. I was wondering if what other peoples opinions are on whether you should be doing more than the 4 things I listed above in a then clause of a rule. Thanks, SG -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] RE: questions on guvnor and drools 5.0
Sorry it's been a few days and I haven't gotten any response on any questions/statements below. I've used drools in the past but am pretty new to some features of drools still and new to Guvnor. I wrote a proof of concept drools/Guvnor app and these are the things I don't like or have questions around. I was wondering if other people have the same problems or am I going about things wrong? Are there work arounds or is there plans to expand/change functionality? Maybe I should ask the dev list? SG -Original Message- From: G, S Sent: Monday, June 01, 2009 3:28 PM To: 'rules-users@lists.jboss.org' Subject: questions on guvnor and drools 5.0 I was wondering if somebody can help me with some questions: 1) Is there any more detail on how to setup Guvnor with a database? 2) How do you use the test scenarios with complex object structures? -eg Create a fact in working memory that has another Object in it which in turn has a list of Objects in it. -Seems like any Fact in working memory is assumed to only have only primitive values like Strings or numbers. -We would like a more depth of objects where objects have a deep relationship to other objects at least 2-4 levels deep. 3) Why add ruleflow-group to the rule definition instead of adding the rule to a ruleflow-group? If the ruleflow-group is part of the rule then you can't use the same rule in multiple ruleflow-groups and leads to copy and maintaining the rule in two different spots. 4) DSL seems to be very inconvenient to edit in a text box especially when it wraps. Why not a table where you can add rows and each row is a translation. Also there are no examples how to do translation into Drools syntax that is multiple lines long and not just a single line. 5) Is Java 5 Type Enumerations supported? I was assuming I'd get a list of values if a field was an Enumeration. 6) There seems to be a vast functionality difference between the Guvnor decision tables and examples that use spreadsheets. 7) Guvnor lost the ability to select variables for use in other statements. Functionality was in BRMS of drools 4.0.7 8) I was not able to insert a fact using a constructor that needed parameter values. Seems like it assumes everything is a bean but I couldn't find this requirement stated in the documentation anywhere. Examples in documentation show inserting facts with constructor parameters. 9) It would be nice when you upload a domain model jar that you could explore the objects and fields somehow. 10) When you write a rule using one particular editor it would be nice if you could switch to another editor. Switch between Guided, DSL, Technical, etc. 11) It seems hard to reorder the statements in a when or then block. If I put them in the wrong order I have to delete them all. Would be nice if a statement could be moved up or down. 12) When calling a method on an object the choices only showed me public methods that take in one parameter. I had a method with two parameters and it wouldn't show me the method. I had to do a DSL or custom drools statement to get around it. 13) Guvnor seems to limit the drools syntax. I couldn't do a from $collection statement without a custom drools statement line. 14) It would be nice if I could declare a global dialect java for all the rules. 15) It would be nice to define an existing agenda-group as part of a ruleflow-group without adding the ruleflow-group on the rules in that agenda-group. Thanks, SG -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters
RE: [rules-users] RE: questions on guvnor and drools 5.0
We have lists of objects and I was talking about how you do it with the test scenario in Guvnor. The fact is in working memory but I need to be able to create the object so it has a list of objects. Because the rule matches if it is in working memory and party of another object's list. So if I have a School and Children for example Then I write a rule that says if School and Child where child is a member of the School [when] $child : Child(readyForRegistration == true) $school : School($child memberof children) [then] $school.registerChild($child); [end] So in Guvnor I need to create a test scenario where School has a list of Children objects. But Guvnor only shows me a textfield so I assume it wants a value like Bob or 1. I don't see the option or an example how to create a Child fact with a name of Bob and readyForRegistration = true. Then another child with name of Nancy which readyForRegistration = false. Then I want to put them in both into a collection and create a new School object using the collection of Bob and Nancy. I can do this type of thing easily with a JUnit test creating and inserting facts into working memory. It would be nice if business users could write test scenarios just as easy with Guvnor. If you haven't checked out that part of Guvnor it might help if you take a peek. SG -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Thursday, June 04, 2009 11:59 AM To: Rules Users List Subject: Re: [rules-users] RE: questions on guvnor and drools 5.0 On 6/4/09, Garner, Shawn garner.sh...@principal.com wrote: 2) How do you use the test scenarios with complex object structures? -eg Create a fact in working memory that has another Object in it which in turn has a list of Objects in it. -Seems like any Fact in working memory is assumed to only have only primitive values like Strings or numbers. -We would like a more depth of objects where objects have a deep relationship to other objects at least 2-4 levels deep. Any object that is inserted as a fact may contain references to other objects, which, in turn, may contain references, and so on. The main thing to consider with complex object structures is, which of the objects should be inserted as facts. The distinction should be made according to whether an object's properties participate in rule patterns and whether this object will change during the (stateful) session. If so, make it a fact. Referring to object properties via one or more levels of dereferencing when using them in patterns won't be possible except in inline evals or eval patterns. Notice that LHS patterns may be written so that additional levels of objects are included in the reasoning, letting you access their non-reference fields in field constraints, e.g.: rule x when $p : Person( $name : name, $f : father ) Person( this == $f, name == Joe ) then // $name is a child of Joe end -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] Default rule
The ruleflow-group and the State Example from the documentation may be what you're looking for. SG -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Malenfant, Andre Sent: Thursday, June 04, 2009 3:47 PM To: Rules Users List Subject: RE: [rules-users] Default rule Yes, but I will have to have a condition in that rule to prevent it from firing if others have. I will have to alter my data model to detect that situation. I can fix my problem using the salience parameter but I was wondering if there is was a built-in mechanism for that purpose. I will try with the salience method Thanks -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Ingomar Otter Sent: Thursday, June 04, 2009 4:28 PM To: Rules Users List Subject: Re: [rules-users] Default rule How about if you create a rule with lowest salience, this will fire _after_ all other rules have fired. Would this help? Am 04.06.2009 um 22:17 schrieb Malenfant, Andre: Anyone knows if it is possible to have a `default` rule that would fire only if others have not? Also, is there a way, using decision tables in XLS, to look if the value of a field is contained in a list elsewhere in the XLS? Thanks André ___ 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 -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] questions on guvnor and drools 5.0
I was wondering if somebody can help me with some questions: 1) Is there any more detail on how to setup Guvnor with a database? 2) How do you use the test scenarios with complex object structures? -eg Create a fact in working memory that has another Object in it which in turn has a list of Objects in it. -Seems like any Fact in working memory is assumed to only have only primitive values like Strings or numbers. -We would like a more depth of objects where objects have a deep relationship to other objects at least 2-4 levels deep. 3) Why add ruleflow-group to the rule definition instead of adding the rule to a ruleflow-group? If the ruleflow-group is part of the rule then you can't use the same rule in multiple ruleflow-groups and leads to copy and maintaining the rule in two different spots. 4) DSL seems to be very inconvenient to edit in a text box especially when it wraps. Why not a table where you can add rows and each row is a translation. Also there are no examples how to do translation into Drools syntax that is multiple lines long and not just a single line. 5) Is Java 5 Type Enumerations supported? I was assuming I'd get a list of values if a field was an Enumeration. 6) There seems to be a vast functionality difference between the Guvnor decision tables and examples that use spreadsheets. 7) Guvnor lost the ability to select variables for use in other statements. Functionality was in BRMS of drools 4.0.7 8) I was not able to insert a fact using a constructor that needed parameter values. Seems like it assumes everything is a bean but I couldn't find this requirement stated in the documentation anywhere. Examples in documentation show inserting facts with constructor parameters. 9) It would be nice when you upload a domain model jar that you could explore the objects and fields somehow. 10) When you write a rule using one particular editor it would be nice if you could switch to another editor. Switch between Guided, DSL, Technical, etc. 11) It seems hard to reorder the statements in a when or then block. If I put them in the wrong order I have to delete them all. Would be nice if a statement could be moved up or down. 12) When calling a method on an object the choices only showed me public methods that take in one parameter. I had a method with two parameters and it wouldn't show me the method. I had to do a DSL or custom drools statement to get around it. 13) Guvnor seems to limit the drools syntax. I couldn't do a from $collection statement without a custom drools statement line. 14) It would be nice if I could declare a global dialect java for all the rules. 15) It would be nice to define an existing agenda-group as part of a ruleflow-group without adding the ruleflow-group on the rules in that agenda-group. Thanks, SG -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act (E-Sign) unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users