[rules-users] Unable to compile JBoss Rules example code - HelloWorldExample.java
Hi, I am unable to compile the example code for JBoss, could some body help me out how to go about compiling the example code ? Is there a document that explains the steps for compiling the example source code ? Please let me know. Following is the error I am getting while trying to compile HelloWorldExample.java: javac HelloWorldExample.java -- 1. ERROR in HelloWorldExample.java (at line 14) private static RuleBase readRule() throws Exception { RuleBase cannot be resolved to a type CLASSPATH=.:/home/dnv/smc/PolicyMgmt/drools-examples/src/main/java: $JAVALIB/org/drools:/usr/local/bin/jdk1.5.0_04:$JAVALIB: $JAVALIB/antlr-2.7.6.jar:$JAVALIB/antlr-3.0ea8.jar: $JAVALIB/commons-collections-3.1.jar:$JAVALIB/commons-io-1.1.jar: $JAVALIB/commons-jci-core-1.0-406301.jar: $JAVALIB/commons-jci-eclipse-3.2.0.666.jar: $JAVALIB/commons-jci-janino-2.4.3.jar:$JAVALIB/commons-lang-2.1.jar: $JAVALIB/commons-logging-api-1.0.4.jar:$JAVALIB/core-3.2.0.666.jar: $JAVALIB/janino-2.4.3.jar:$JAVALIB/jsr94-1.1.jar: $JAVALIB/junit-3.8.1.jar:$JAVALIB/jxl-2.4.2.jar: $JAVALIB/stringtemplate-2.3b6.jar:$JAVALIB/xml-apis-1.0.b2.jar: $JAVALIB/xpp3-1.1.3.4.O.jar: $JAVALIB/xstream-1.1.3.jar:/home/dnv/smc/PolicyMgmt/plugins/org.drools.ide_3.0.5.jar Thanks, Venkatesh The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Handling ArrayList objects in rule conditions
I am a beginner. I have an ArrayList object - Say BoxList Object containing 10 Box objects . I need to check if the length of the bos is 10cm on each box object. How do I write this as rule condition. Is there any way to write the rule for iterating the BoxList to check the length of each box Can you please help? -- View this message in context: http://www.nabble.com/Handling-ArrayList-objects-in-rule-conditions-tf3251245.html#a9037969 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.NoSuchMethodError:org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
hi I am facing a problem while deployed it in websphere community edition. My application is working fine when it is running in tomcat using jBoss Rules... but the same thing if I deployed in Webspehere then its throwing exception. i thought its because of antlr jar version mismatch , then i replaced new version on antlr-2.7.6 antlr-3.0ea8... still its giving the following exception... CharScannar : Parse ClassNotFoundException : org.antlr.stringtemplate.language.ChunkTocken Can any of you solve my problem. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Help Needed on garbage collection
Hi, I need to know how garbage collection will happen in Drools. Because my system is taking too much time to execute the business logic. Please tell me how to rectify it? One more question I will generate the email content dynamically and send to the client but what will happening is it's taking same content for all mail I think the Last content. For example Through business rule it has generated three mails and it has to send to supervisor then all mail contains last main information like name, Address etc. Please tell me how to rectify it. I need to know how to assert two object of same type and refer then in .drl file. I need to know how to access string array. Regards Shilpa The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Convert logic to DRL rules
Hi Steven, Yes I thought of that but our business user says this is unacceptable unless I can write a parser to automatically generate all these combinations. The example I use is quite simple. Our business user have quite complex logic expressions (imagin my example plus a lot of parenthesis to build up multiple level logic) already built using Pascal like language and it is not easy to do. Thanks, Ye On 2/19/07, Steven Williams [EMAIL PROTECTED] wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, Bill Zhang [EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang [EMAIL PROTECTED] wrote: I tried: $a : Person(age 35 || age 25, zipCode == 23546 || == 68590) Errors: org.drools.rule.InvalidRulePackage : unknown:39:30 Unexpected token '||' unknown:39:40 mismatched token: [EMAIL PROTECTED],1040:1041='=',47,39:40]; expecting type '(' unknown:39:92 mismatched token: [EMAIL PROTECTED],1092:1092='',46,39:92]; expecting type '(' I also tried $a : Person(age 35 | age 25, zipCode == 23546 | == 68590) Pretty much the same error. Based on the document, || is only valid for columns... On 2/17/07, Bill Zhang [EMAIL PROTECTED] wrote: Thank you Steve. But I got syntax error using the following. On 2/17/07, Steven Williams [EMAIL PROTECTED] wrote: In trunk I think you can use connective constraints: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) then $a.setStatus(KT); On 2/18/07, Bill Zhang [EMAIL PROTECTED] wrote: Hello, I am a new Drools user trying to convert the following simple logic into DRL: IF (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode = 23546 or Person.ZipCode = 68590) THEN Person.Status = KT; I found that it is not easy to convert the above logic into ONE DRL rule. I tried something like this when $a: Person(age35) or Person (age25) $b: Person(Zipcode==23456) or Person (ZipCode == 68590) $c: $a and $b Then $c.setStatus(KT) But looks like I can not use $c: $a and $b becaue in Drools, you can only bind variable to column, not to other varaibles. Please advise how to do this. I would imagine this should be quite simple, maybe I missed something quite obvious. I know that I can write custom Java method to do this, but if I do that, I suppose I lose the power of RETEOO pattern matching (pattern resuing, etc.). So I prefer not to do that. I also understand I can break the above logic into 4 rules and that would be quite easy, but our business user is not used to think in that way. Also, we have more complex logic than the above. So what I want is to see if there is a way to convert this kind of logic in ONE DRL rule. Thanks in advance. Bill ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 [EMAIL PROTECTED] www.objectconsulting.com.au consulting | development | training | support our experience makes the difference ___ rules-users mailing list rules-users@lists.jboss.org
Re: [rules-users] Convert logic to DRL rules
Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin [EMAIL PROTECTED] wrote: We built a Rule Builder which creates drl with all possible combinations. In any case, drl syntax is not exactly business user friendly, so having such builder is not a bad idea. Simple Rule Builder can be implemented as an Excel spreadsheet, which can be easily parsed using POI library and then drl file produced. Steven Williams wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, *Bill Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I tried: $a : Person(age 35 || age 25, zipCode == 23546 || == 68590) Errors: org.drools.rule.InvalidRulePackage : unknown:39:30 Unexpected token '||' unknown:39:40 mismatched token: [EMAIL PROTECTED],1040:1041='=',47,39:40]; expecting type '(' unknown:39:92 mismatched token: [EMAIL PROTECTED],1092:1092='',46,39:92]; expecting type '(' I also tried $a : Person(age 35 | age 25, zipCode == 23546 | == 68590) Pretty much the same error. Based on the document, || is only valid for columns... On 2/17/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thank you Steve. But I got syntax error using the following. On 2/17/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: In trunk I think you can use connective constraints: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) then $a.setStatus(KT); On 2/18/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello, I am a new Drools user trying to convert the following simple logic into DRL: IF (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode = 23546 or Person.ZipCode = 68590) THEN Person.Status = KT; I found that it is not easy to convert the above logic into ONE DRL rule. I tried something like this when $a: Person(age35) or Person (age25) $b: Person(Zipcode==23456) or Person (ZipCode == 68590) $c: $a and $b
Re: [rules-users] Convert logic to DRL rules
Bill, The way of doing that is using connective constraints as explained by Steven previously: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) This is a new feature that only works in 3.1M1 and later versions. []s Edson Bill Zhang wrote: Hi Steven, Yes I thought of that but our business user says this is unacceptable unless I can write a parser to automatically generate all these combinations. The example I use is quite simple. Our business user have quite complex logic expressions (imagin my example plus a lot of parenthesis to build up multiple level logic) already built using Pascal like language and it is not easy to do. Thanks, Ye On 2/19/07, Steven Williams [EMAIL PROTECTED] wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, Bill Zhang [EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang [EMAIL PROTECTED] wrote: I tried: $a : Person(age 35 || age 25, zipCode == 23546 || == 68590) Errors: org.drools.rule.InvalidRulePackage : unknown:39:30 Unexpected token '||' unknown:39:40 mismatched token: [EMAIL PROTECTED],1040:1041='=',47,39:40]; expecting type '(' unknown:39:92 mismatched token: [EMAIL PROTECTED],1092:1092='',46,39:92]; expecting type '(' I also tried $a : Person(age 35 | age 25, zipCode == 23546 | == 68590) Pretty much the same error. Based on the document, || is only valid for columns... On 2/17/07, Bill Zhang [EMAIL PROTECTED] wrote: Thank you Steve. But I got syntax error using the following. On 2/17/07, Steven Williams [EMAIL PROTECTED] wrote: In trunk I think you can use connective constraints: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) then $a.setStatus(KT); On 2/18/07, Bill Zhang [EMAIL PROTECTED] wrote: Hello, I am a new Drools user trying to convert the following simple logic into DRL: IF (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode = 23546 or Person.ZipCode = 68590) THEN Person.Status = KT; I found that it is not easy to convert the above logic into ONE DRL rule. I tried something like this when $a: Person(age35) or Person (age25) $b: Person(Zipcode==23456) or Person (ZipCode == 68590) $c: $a and $b Then $c.setStatus(KT) But looks like I can not use $c: $a and $b becaue in Drools, you can only bind variable to column, not to other varaibles. Please advise how to do this. I would imagine this should be quite simple, maybe I missed something quite obvious. I know that I can write custom Java method to do this, but if I do that, I suppose I lose the power of RETEOO pattern matching (pattern resuing, etc.). So I prefer not to do that. I also understand I can break the above logic into 4 rules and that would be quite easy, but our business user is not used to think in that way. Also, we have more complex logic than the above. So what I want is to see if there is a way to convert this kind of logic in ONE DRL rule. Thanks in advance. Bill ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668
Re: [rules-users] Convert logic to DRL rules
Bill, Your statement bellow can be written in 3.1M1 as: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) ) then $person.setStatus( KT ); end []s Edson Bill Zhang wrote: Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin [EMAIL PROTECTED] wrote: We built a Rule Builder which creates drl with all possible combinations. In any case, drl syntax is not exactly business user friendly, so having such builder is not a bad idea. Simple Rule Builder can be implemented as an Excel spreadsheet, which can be easily parsed using POI library and then drl file produced. Steven Williams wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, *Bill Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I tried: $a : Person(age 35 || age 25, zipCode == 23546 || == 68590) Errors: org.drools.rule.InvalidRulePackage : unknown:39:30 Unexpected token '||' unknown:39:40 mismatched token: [EMAIL PROTECTED],1040:1041='=',47,39:40]; expecting type '(' unknown:39:92 mismatched token: [EMAIL PROTECTED],1092:1092='',46,39:92]; expecting type '(' I also tried $a : Person(age 35 | age 25, zipCode == 23546 | == 68590) Pretty much the same error. Based on the document, || is only valid for columns... On 2/17/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thank you Steve. But I got syntax error using the following. On 2/17/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: In trunk I think you can use connective constraints: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) then $a.setStatus(KT); On 2/18/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello, I am a new Drools user trying to convert the following
Re: [rules-users] Convert logic to DRL rules
Vlad, I think that for Bill's case, the object structure is flatten already (what is good for rules). Creating nested objects will actually make it more difficult to write the rules... Just my 0.02c []s Edson Olenin, Vladimir (MOH) wrote: I guess if you modify the business objects a bit (in quite weird way - I think it would be rather a shortcut than a solution) you can implement this kind of logic: you need to swap property (zipcode, age, etc) and 'property ownner' (Person) objects, so that you'll have: Person (id) ZipCode (id, code) Age (id, age) Etc In this case you should be able to write: Rule X When $p: Person($id: id) ( ZipCode(id == $id, code == 23456) or ZipCode(id == $id, code == 68590) ) And ( Age(id == $id, age 25) Or Age(id == $id, age 34) ) Then // do smth using $p End Or smth along those lines... Would that work?. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Zhang Sent: 19 February 2007 09:14 To: Rules Users List Subject: Re: [rules-users] Convert logic to DRL rules Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin [EMAIL PROTECTED] wrote: We built a Rule Builder which creates drl with all possible combinations. In any case, drl syntax is not exactly business user friendly, so having such builder is not a bad idea. Simple Rule Builder can be implemented as an Excel spreadsheet, which can be easily parsed using POI library and then drl file produced. Steven Williams wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, *Bill Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I tried: $a : Person(age 35 || age 25, zipCode == 23546 || == 68590) Errors: org.drools.rule.InvalidRulePackage : unknown:39:30 Unexpected token '||' unknown:39:40 mismatched token: [EMAIL PROTECTED],1040:1041='=',47,39:40]; expecting type '(' unknown:39:92 mismatched token: [EMAIL PROTECTED],1092:1092='',46,39:92]; expecting type '(' I also tried $a : Person(age 35 | age 25, zipCode == 23546 | == 68590) Pretty much the same error. Based on the document, || is only valid for columns... On 2/17/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thank you Steve. But I got syntax error using the following.
Re: [rules-users] Convert logic to DRL rules
Hi Vlad, Thank you for the help. Unfortunately I can not change the Object Model as these POJOs are not used only by myself. Bill Y. On 2/19/07, Olenin, Vladimir (MOH) [EMAIL PROTECTED] wrote: I guess if you modify the business objects a bit (in quite weird way - I think it would be rather a shortcut than a solution) you can implement this kind of logic: you need to swap property (zipcode, age, etc) and 'property ownner' (Person) objects, so that you'll have: Person (id) ZipCode (id, code) Age (id, age) Etc In this case you should be able to write: Rule X When $p: Person($id: id) ( ZipCode(id == $id, code == 23456) or ZipCode(id == $id, code == 68590) ) And ( Age(id == $id, age 25) Or Age(id == $id, age 34) ) Then // do smth using $p End Or smth along those lines... Would that work?. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Zhang Sent: 19 February 2007 09:14 To: Rules Users List Subject: Re: [rules-users] Convert logic to DRL rules Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin [EMAIL PROTECTED] wrote: We built a Rule Builder which creates drl with all possible combinations. In any case, drl syntax is not exactly business user friendly, so having such builder is not a bad idea. Simple Rule Builder can be implemented as an Excel spreadsheet, which can be easily parsed using POI library and then drl file produced. Steven Williams wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, *Bill Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I tried: $a : Person(age 35 || age 25, zipCode == 23546 || == 68590) Errors: org.drools.rule.InvalidRulePackage : unknown:39:30 Unexpected token '||' unknown:39:40 mismatched token: [EMAIL PROTECTED],1040:1041='=',47,39:40]; expecting type '(' unknown:39:92 mismatched token: [EMAIL PROTECTED],1092:1092='',46,39:92]; expecting type '(' I also tried $a : Person(age 35 | age 25, zipCode == 23546 | == 68590) Pretty much the same error. Based on the document, || is only valid for columns... On 2/17/07,
Re: [rules-users] Convert logic to DRL rules
Bill, The new version works fine with nested conditional elements and allow for any level of nesting. You simply must be very careful with OR as the semantics of OR in a rules engine are not exactly the same as most people are used to in imperative programming. Also, the syntax you showed bellow is not correct (but maybe it was simply a typo in the e-mail). Maybe if you can write your intent or a sample rule (in english) you are trying to implement it is easier to help. []s Edson Bill Zhang wrote: Edson, Thanks for the reply. The rule you authored worked fine on my new Drools build from SVN. However, I did notice that the following pattern matching is not working: $p: Person( (Person(some comparison logic) or Person(some comparison logic) ) and (Person(some comparison logic) or Person(some comparison logic) ) ) Looks like althugh or is allowed, the new version does not use and within pattern matching. Am I right or did I do something wrong? Thanks, Bill On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, Unfortunatelly we are working hard to get all features finished in time for the release and the documentation will only be done right before release unless we get some help from community. So, maybe if you (or anyone else) think you can help with that, we would gladly provide you with info that when written down would be usefull both for your users/team and to other drools users. You need to use bound variables when you want to do an OR (||) between constraints of different fields inside a single Pattern. So, in your example, as you want to do: lastOrderPrice 300 OR totalOrderNumber 2 For the same Person object, it means you need to do either: Person( $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) Or using a predicate without the bound variables: $p: Person( ($p.getLastOrderPrice() 300 || $p.getTotalOrderNumber() 2 ) ) Or use an eval (that I think is the least efficient way): $p: Person() eval( $p.getLastOrderPrice() 300 || $p.getTotalOrderNumber() 2 ) From the above options, I would go with the first. Unfortunatelly, there is no semantics currently defined for the syntax you used: Person( lastOrderPrice 300 || totalOrderNumber 2 ) We may eventually do it in the future, but for now (Mark can confirm that), we don't have resources to add it to the next major release (again, unless community comes in to help). []s Edson Bill Zhang wrote: That's it, Edson. I'll give it a try and I'll let you know whether I make it. Edson, I will appreciate if you can point to me where is the most recent syntax document. Thanks. I am not sure why I need to use bound variables ($lop: lastOrderPrice). Can I write it in the following: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, ( lastOrderPrice 300 || totalOrderNumber 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) ) then $person.setStatus( KT ); end Thanks to everyone helping me. This is really a great community. On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, Your statement bellow can be written in 3.1M1 as: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) ) then $person.setStatus( KT ); end []s Edson Bill Zhang wrote: Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin
Re: [rules-users] Convert logic to DRL rules
'and' is not needed at top level, it is implicitely assumed that all patters are under an 'and' CE. Mark Bill Zhang wrote: Edson, Thanks for the reply. The rule you authored worked fine on my new Drools build from SVN. However, I did notice that the following pattern matching is not working: $p: Person( (Person(some comparison logic) or Person(some comparison logic) ) and (Person(some comparison logic) or Person(some comparison logic) ) ) Looks like althugh or is allowed, the new version does not use and within pattern matching. Am I right or did I do something wrong? Thanks, Bill On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, Unfortunatelly we are working hard to get all features finished in time for the release and the documentation will only be done right before release unless we get some help from community. So, maybe if you (or anyone else) think you can help with that, we would gladly provide you with info that when written down would be usefull both for your users/team and to other drools users. You need to use bound variables when you want to do an OR (||) between constraints of different fields inside a single Pattern. So, in your example, as you want to do: lastOrderPrice 300 OR totalOrderNumber 2 For the same Person object, it means you need to do either: Person( $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) Or using a predicate without the bound variables: $p: Person( ($p.getLastOrderPrice() 300 || $p.getTotalOrderNumber() 2 ) ) Or use an eval (that I think is the least efficient way): $p: Person() eval( $p.getLastOrderPrice() 300 || $p.getTotalOrderNumber() 2 ) From the above options, I would go with the first. Unfortunatelly, there is no semantics currently defined for the syntax you used: Person( lastOrderPrice 300 || totalOrderNumber 2 ) We may eventually do it in the future, but for now (Mark can confirm that), we don't have resources to add it to the next major release (again, unless community comes in to help). []s Edson Bill Zhang wrote: That's it, Edson. I'll give it a try and I'll let you know whether I make it. Edson, I will appreciate if you can point to me where is the most recent syntax document. Thanks. I am not sure why I need to use bound variables ($lop: lastOrderPrice). Can I write it in the following: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, ( lastOrderPrice 300 || totalOrderNumber 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) ) then $person.setStatus( KT ); end Thanks to everyone helping me. This is really a great community. On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, Your statement bellow can be written in 3.1M1 as: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) ) then $person.setStatus( KT ); end []s Edson Bill Zhang wrote: Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin [EMAIL PROTECTED] wrote: We built a Rule Builder which creates drl with all possible combinations. In any case, drl syntax is not exactly business user friendly, so having such builder is not a bad idea. Simple Rule Builder can be implemented as an Excel spreadsheet, which can be easily parsed using POI library and then drl file produced. Steven Williams wrote: Hi Bill, To
Re: [rules-users] Convert logic to DRL rules
Edson and Mark, Thank you for your help. I have the complete rule expressed in PASCAL-like language in the following. Mark mentioned that and is not needed at top level but I am not sure what syntax I can use to express the top-level and in the following rule when the top-level and is used to connect Person objects with complex matching logic. Thank you for pointing out the diffrence between and in a rules engine vs. normal programming language - I will do some more experiments on that. IF ( ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 OR Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300) OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ) AND // Top Level AND ( (Person.Status=K AND Person.IsDelinquent = true) OR (Person.Status=T AND Person.IsDelinquent = true AND Person.DelinquentBucket = 3) ) THEN Person.Status = KT; On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, The new version works fine with nested conditional elements and allow for any level of nesting. You simply must be very careful with OR as the semantics of OR in a rules engine are not exactly the same as most people are used to in imperative programming. Also, the syntax you showed bellow is not correct (but maybe it was simply a typo in the e-mail). Maybe if you can write your intent or a sample rule (in english) you are trying to implement it is easier to help. []s Edson Bill Zhang wrote: Edson, Thanks for the reply. The rule you authored worked fine on my new Drools build from SVN. However, I did notice that the following pattern matching is not working: $p: Person( (Person(some comparison logic) or Person(some comparison logic) ) and (Person(some comparison logic) or Person(some comparison logic) ) ) Looks like althugh or is allowed, the new version does not use and within pattern matching. Am I right or did I do something wrong? Thanks, Bill On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, Unfortunatelly we are working hard to get all features finished in time for the release and the documentation will only be done right before release unless we get some help from community. So, maybe if you (or anyone else) think you can help with that, we would gladly provide you with info that when written down would be usefull both for your users/team and to other drools users. You need to use bound variables when you want to do an OR (||) between constraints of different fields inside a single Pattern. So, in your example, as you want to do: lastOrderPrice 300 OR totalOrderNumber 2 For the same Person object, it means you need to do either: Person( $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) Or using a predicate without the bound variables: $p: Person( ($p.getLastOrderPrice() 300 || $p.getTotalOrderNumber() 2 ) ) Or use an eval (that I think is the least efficient way): $p: Person() eval( $p.getLastOrderPrice() 300 || $p.getTotalOrderNumber() 2 ) From the above options, I would go with the first. Unfortunatelly, there is no semantics currently defined for the syntax you used: Person( lastOrderPrice 300 || totalOrderNumber 2 ) We may eventually do it in the future, but for now (Mark can confirm that), we don't have resources to add it to the next major release (again, unless community comes in to help). []s Edson Bill Zhang wrote: That's it, Edson. I'll give it a try and I'll let you know whether I make it. Edson, I will appreciate if you can point to me where is the most recent syntax document. Thanks. I am not sure why I need to use bound variables ($lop: lastOrderPrice). Can I write it in the following: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, ( lastOrderPrice 300 || totalOrderNumber 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) ) then $person.setStatus( KT ); end Thanks to everyone helping me. This is really a great community. On 2/19/07, Edson Tirelli [EMAIL PROTECTED] wrote: Bill, Your statement bellow can be written in 3.1M1 as: rule ... when $person : ( Person( age 35 | 25, zipCode == 23546 | == 68570, $lop: lastOrderPrice, $ton: totalOrderNumber, ( $lop 300 || $ton 2 )) or Person( lastOrderCategory == 098 | == 109, zipCode == 74567 | == 23756 ) )
RE: [rules-users] Convert logic to DRL rules
To improve my understanding of DROOLS a bit, just a small follow up question. If the modification of the business domain model is correct and will result in the correct behavior, I wonder what kind of performance implications such modification will bring (to compare with 'flatten' model)? Would the performance become worse, better or remain approximately the same (for a significant number of rules fact objects)? Currently I'm at the cross roads whether to create such artificial 'inverted index' for my application or not (I didn't know that the connective constraints are available in 3.1M...). Thanks, Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli Sent: 19 February 2007 11:05 To: Rules Users List Subject: Re: [rules-users] Convert logic to DRL rules Vlad, I think that for Bill's case, the object structure is flatten already (what is good for rules). Creating nested objects will actually make it more difficult to write the rules... Just my 0.02c []s Edson Olenin, Vladimir (MOH) wrote: I guess if you modify the business objects a bit (in quite weird way - I think it would be rather a shortcut than a solution) you can implement this kind of logic: you need to swap property (zipcode, age, etc) and 'property ownner' (Person) objects, so that you'll have: Person (id) ZipCode (id, code) Age (id, age) Etc In this case you should be able to write: Rule X When $p: Person($id: id) ( ZipCode(id == $id, code == 23456) or ZipCode(id == $id, code == 68590) ) And ( Age(id == $id, age 25) Or Age(id == $id, age 34) ) Then // do smth using $p End Or smth along those lines... Would that work?. Vlad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Zhang Sent: 19 February 2007 09:14 To: Rules Users List Subject: Re: [rules-users] Convert logic to DRL rules Hi Alex, Thank you for confirming this. Writing such a builder may take us a lot of time because our business user is used to free style Pascal-like authoring using quite complex logic. For example, IF ( ( (Person.Age 35 OR Person.Age 25) AND (Person.ZipCode =23546 or Person.ZipCode = 68590) ) and ( (Person.LastOrderPrice 300 OR (Person.TotalOrderNumber 2) ) ) OR ( ( (Person.LastOrderCategory in (098, 109) ) AND (Person.ZipCode =74567 or Person.ZipCode = 23765) ) and ( (Person.LastOrderPrice 1000 OR (Person.TotalOrderNumber 1) ) ) ... THEN Person.Status = KT; Before I set out to write the builder, I would like to know whether the new syntax can handle the above logic? Also, where can I find document for the new syntax? I am also trying to find some existing open source Java library to flatten out these complex logic - to break these complex logic to atomic ones that can be handled by Drools. Do you have any recommendation? Thanks a lot for your help. Bill Y. On 2/19/07, Alexander Varakin [EMAIL PROTECTED] wrote: We built a Rule Builder which creates drl with all possible combinations. In any case, drl syntax is not exactly business user friendly, so having such builder is not a bad idea. Simple Rule Builder can be implemented as an Excel spreadsheet, which can be easily parsed using POI library and then drl file produced. Steven Williams wrote: Hi Bill, To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode. $a : Person(age 35 zipCode == 23546) then $a.setStatus(KT); $a : Person(age 25, zipCode == 23546 ) then $a.setStatus(KT); $a : Person(age 35, zipCode == 68590) then $a.setStatus(KT); etc.. Steve On 2/19/07, *Bill Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: So Alex, if I only want to use the old syntax that is in production, there is no way to implement my seemingly simple logic conditioning? Thanks for your help. On 2/18/07, Alexander Varakin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: As far as I know this syntax is new and is available in SVN only, you will have to wait till 3.1 is released or take source from SVN and build it. Bill Zhang wrote: Hi Steven, Thank you very much for your help. Really appreciate. I still got the same error, Unexpected token '|'. I did not see | in the document, only saw ||, which is supposed to be used with columns. Ye On 2/18/07, Steven Williams [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Bill, I think it should be: $a : Person(age 35 | 25, zipCode == 23546 | == 68590) Edson, Mark or Michael can probably confirm or correct the above syntax. Make sure you are running of the latest trunk. cheers Steve On 2/18/07, Bill Zhang
Re: [rules-users] java.lang.NoSuchMethodError:org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
you also need stringtemplate-2.3b6.jar Steve On 2/19/07, Nagabhushanam B [EMAIL PROTECTED] wrote: hi I am facing a problem while deployed it in websphere community edition. My application is working fine when it is running in tomcat using jBoss Rules... but the same thing if I deployed in Webspehere then its throwing exception. i thought its because of antlr jar version mismatch , then i replaced new version on antlr-2.7.6 antlr-3.0ea8... still its giving the following exception... CharScannar : Parse ClassNotFoundException : org.antlr.stringtemplate.language.ChunkTocken Can any of you solve my problem. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 [EMAIL PROTECTED] www.objectconsulting.com.au consulting | development | training | support our experience makes the difference ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] conditional insert of 'exist' or 'not' keywords in decision table s
Hi Vlad, There is a very basic wiki page on it (http://wiki.jboss.org/wiki/Wiki.jsp?page=DecisionTableTemplates ). In terms of the functionality you mention you have your data having knowledge of the rule templates whereas the current implementation is such that the data has no knowledge of the templates. You can apply multiple rule templates to the same data however (as in ExternalSpreadsheetCompilerIntegrationTest): final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler(); final List listeners = new ArrayList(); ExternalSheetListener l1 = new ExternalSheetListener(10, 3, /templates/test_pricing1.drl); listeners.add(l1); ExternalSheetListener l2 = new ExternalSheetListener(30, 3, /templates/test_pricing2.drl); listeners.add(l2); converter.compile(/data/ExamplePolicyPricing.xls, InputType.XLS, listeners); This example assumes two sets of data in the one sheet, however they could both have been applied to the same set (ie. the second listener could also point to row 10, column 3). Would that accomplish what you need? Steve On 2/20/07, Olenin, Vladimir (MOH) [EMAIL PROTECTED] wrote: Thanks, Steve. That really seems to do the trick. Are there any wiki pages on this new functionality? Or for now one should refer to the source code unit tests? I also wonder what other functionality the new templating engine has? Is it possible to define different 'types' of rules in the same 'rule' template and refer to these types from 'Excel' data fields (eg, have one column per rule where you can refer 'rule template XXX' from drl file; this value can override some default value for example). If not, how such situations can be handled? (ie, when one needs several type of rules driven by the same data?) Thanks, Vlad -- *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] *On Behalf Of *Steven Williams *Sent:* 17 February 2007 04:25 *To:* Rules Users List *Subject:* Re: [rules-users] conditional insert of 'exist' or 'not' keywords in decision table s Hi Vlad, With the new decision table handling you could use the following template to do it: Given a table as follows: exists, 21, 25 , comprehensive not, 64, 100 exists, comprehensive the following template does what you want: template header driver[] policy[] package This_is_a_ruleset; #generated from Decision Table import example.model.Driver; import example.model.Policy ; template Driver policy driver policy rule driver policy $row.rowNumber$ when $driver0$ Driver(age = $driver1$, age = $driver2$) $policy0$ Policy(type = $policy1$) then //do smth end end template the code to call it was: public void testColumnKeywords() { final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler(); final String drl = converter.compile( /data/TestWorkbook.xls, /templates/test_keywords.drl, InputType.XLS, 1, 1 ); // DT starts at Row 1, Column 1 System.out.println(drl); } cheers Steve On 2/17/07, *Olenin, Vladimir (MOH)* [EMAIL PROTECTED] wrote: Hi, I wonder if it's possible to pass some Column keywords as parameters from template values, eg: Condition Condition $1 Driver $1 Policy age = $2, age = $3 type exists, 21, 25 , comprehensive not, 64, 100 exists, comprehensive I'd expect the above table would generate two rules like: Rule 1 When exists Driver (age = 21, age = 25) Policy(type == comprehensive) Then // do smth End Rule 2 When not Driver (age = 64, age = 100) exists Policy (type == comprehensive) then // do smth End The above example is just a mock up derived from one of the examples in the documentation to demonstrate the point (meaning, the rules themselves might not make sense from business point of view or can be implemented differently for this particular case). So, any way to achieve this? Whether in current version (3.0.x) or the upcoming release (3.2) Thanks, Vlad ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 [EMAIL PROTECTED] www.objectconsulting.com.au consulting | development | training | support our experience makes the difference ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 [EMAIL PROTECTED] www.objectconsulting.com.au consulting | development | training | support our experience makes the difference
RE: [rules-users] Using JBoss Rules for implementing sparse lookuptables
Drools 3.1 has the a new conditional element called from. You can do queries on your database (hibernate) or any other data structure: e.g. $r : Restaurant( $postCode ) from hbSession.getNamedQuery( some query ).setProperties( [ key1 : value2, key2 : value ] ).list() The rule per row doesn't work very well. I've had a discussion with Michael Neale about this and got some good advice. I've added my conversation with Michael below. Regards, Alan Ho See this thread: From: Michael Neale yeah you can emulate backwards type chaining approaches by writing rules who assert control facts like assert(new RequestLookup(key info)); - there is then another rule which actually performs the lookup, and pulls the data from the DB, and asserts it into the working memory as needed (and retracts the request control fact). On 6/20/06, Ho, Alan [EMAIL PROTECTED] wrote: Thanks !!! It makes a lot of sense to have a set of rules to load facts, and another set of rules to operate on those facts. Regards, Alan Ho From: Michael Neale Sent: Thursday, June 15, 2006 4:46 PM To: Ho, Alan Subject: Re: Dealing with thousands of rules Hi Alan. Yes I think follow what you are saying. On a practical note, many many thousands of rules would hurt, as at present java semantics are compiled into little classes behind the scenes (and JVMs can only take so much !) - soon - if no java semantics are used, no java classes will be created so that problem goes away. Still, millions of rules doesn't feel right does it. There are often ways you can rewrite it so that you just have a few rules, but millions of facts (hard to explain in abstract !) - so you have a rule that joins 2 unrelated facts together, and asserts the combination, and another rule that handles that combination. but anyway... I think when you are talking about data wrangling like this, SQL DBs are the best proven system in the world, so its sensible to use it. Backwards chaining maybe: you can simulate this now by having a RequestForData fact object, and a rule that responds to one of those objects, and then runs the query to retrieve the results - this is kind of how Jess compiles in backward chaining support (we will probably do something different - more like prolog from what Mark tells me). BUT, Mark has been working in his spare time in a from keyword feature, so it can reason over facts that are not in working memory (like from a database) - yet do all the usual things. Some thing like when r: RequestingCustomer() from lookup.getCustomers() with lookup being some global utility you pass in, or else another bound fact, anything really (its like JRules). It saves asserting lots of things into working memory. Not sure how this would exactly solve your problem, as I haven't quite understood it. But at the end of the day, I think perhaps having that database table is sensible - even if you had a to have a pure java system, HSQLDB could easily cope with that sort of load (all in memory) - SQL DBs are born for that stuff ! Does that help at all? On 6/16/06, Ho, Alan [EMAIL PROTECTED] wrote: Hi Michael, I've been quite interested with the Jboss Rules project for a while now, but I'm running into a use case that is not quite working out for our team. Imagine a service that controls what kind of books people can buy : Here is the rule that I want to implement: when RequestingCustomer == Sally and interestingBook = Bible then RequestingCustomer can by interestingBook end The problem is there maybe thousands of customers and thousands of books, hence potentially millions of rules. Instead to implement the rule, we end up having to use a SQL statement: when eval( (ExecuteSQL(select count(*) from CustomerRuleTable where customer = RequestingCustomer and book=interestingBook)) 1 ) then RequestingCustomer can by interestingBook End The CustomerRuleTable will only have two columns - customer and book. I wish there was a way to implement this more elegantly ( backwards chaining ?). Thanks, Alan Ho -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Varakin Sent: Monday, February 19, 2007 2:41 PM To: Drools Users List Subject: [rules-users] Using JBoss Rules for implementing sparse lookuptables Hi, I am thinking of using JBoss Rules for implementing sparse lookup tables, e.g. suppose I have a lookup table which contains data like this: PostalCodeOrZIP StateOrProvince Country DistanceFromNorthPole 07645NJ USA1200 -NJ USA1100 -- USA1000 - Ontario CA 600 - - CA500 The objective is to find a best matching row in the table, given PostalCodeOrZIP,
Re: [rules-users] Using JBoss Rules for implementing sparse lookuptables
Alan, Thanks for your reply! The main reason I was considering creating a rule per row is because it allows flexible matching: it will allow matching records with different level of details. I was also thinking of asserting rows of my lookup table as facts, would that work? What kind of performance should I expect in this case? Alex Ho, Alan wrote: Drools 3.1 has the a new conditional element called from. You can do queries on your database (hibernate) or any other data structure: e.g. $r : Restaurant( $postCode ) from hbSession.getNamedQuery( some query ).setProperties( [ key1 : value2, key2 : value ] ).list() The rule per row doesn't work very well. I've had a discussion with Michael Neale about this and got some good advice. I've added my conversation with Michael below. Regards, Alan Ho See this thread: From: Michael Neale yeah you can emulate backwards type chaining approaches by writing rules who assert control facts like assert(new RequestLookup(key info)); - there is then another rule which actually performs the lookup, and pulls the data from the DB, and asserts it into the working memory as needed (and retracts the request control fact). On 6/20/06, Ho, Alan [EMAIL PROTECTED] wrote: Thanks !!! It makes a lot of sense to have a set of rules to load facts, and another set of rules to operate on those facts. Regards, Alan Ho From: Michael Neale Sent: Thursday, June 15, 2006 4:46 PM To: Ho, Alan Subject: Re: Dealing with thousands of rules Hi Alan. Yes I think follow what you are saying. On a practical note, many many thousands of rules would hurt, as at present java semantics are compiled into little classes behind the scenes (and JVMs can only take so much !) - soon - if no java semantics are used, no java classes will be created so that problem goes away. Still, millions of rules doesn't feel right does it. There are often ways you can rewrite it so that you just have a few rules, but millions of facts (hard to explain in abstract !) - so you have a rule that joins 2 unrelated facts together, and asserts the combination, and another rule that handles that combination. but anyway... I think when you are talking about data wrangling like this, SQL DBs are the best proven system in the world, so its sensible to use it. Backwards chaining maybe: you can simulate this now by having a RequestForData fact object, and a rule that responds to one of those objects, and then runs the query to retrieve the results - this is kind of how Jess compiles in backward chaining support (we will probably do something different - more like prolog from what Mark tells me). BUT, Mark has been working in his spare time in a from keyword feature, so it can reason over facts that are not in working memory (like from a database) - yet do all the usual things. Some thing like when r: RequestingCustomer() from lookup.getCustomers() with lookup being some global utility you pass in, or else another bound fact, anything really (its like JRules). It saves asserting lots of things into working memory. Not sure how this would exactly solve your problem, as I haven't quite understood it. But at the end of the day, I think perhaps having that database table is sensible - even if you had a to have a pure java system, HSQLDB could easily cope with that sort of load (all in memory) - SQL DBs are born for that stuff ! Does that help at all? On 6/16/06, Ho, Alan [EMAIL PROTECTED] wrote: Hi Michael, I've been quite interested with the Jboss Rules project for a while now, but I'm running into a use case that is not quite working out for our team. Imagine a service that controls what kind of books people can buy : Here is the rule that I want to implement: when RequestingCustomer == Sally and interestingBook = Bible then RequestingCustomer can by interestingBook end The problem is there maybe thousands of customers and thousands of books, hence potentially millions of rules. Instead to implement the rule, we end up having to use a SQL statement: when eval( (ExecuteSQL(select count(*) from CustomerRuleTable where customer = RequestingCustomer and book=interestingBook)) 1 ) then RequestingCustomer can by interestingBook End The CustomerRuleTable will only have two columns - customer and book. I wish there was a way to implement this more elegantly ( backwards chaining ?). Thanks, Alan Ho -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Varakin Sent: Monday, February 19, 2007 2:41 PM To: Drools Users List Subject: [rules-users] Using JBoss Rules for implementing sparse lookuptables
Re: [rules-users] Need Help: Errors while running FibonacciExample
Hi Marcus, Thanks for the response, I have not tried with Sun JDK, let me try it out and keep you posted. Thanks, Venkatesh On Mon, 2007-02-19 at 14:24 +0100, Marcus Ilgner wrote: Hi Venkatesh, On 2/19/07, venkatesh devalapura nagabhushana [EMAIL PROTECTED] wrote: Hi, After successfully compiling the example code FibnacciExample.java, I tried to run it, I get the following error, let me know how to solve it: java FibonacciExample Exception in thread main java.lang.ExceptionInInitializerError at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0) at org.drools.semantics.java.RuleBuilder.clinit() (Unknown Source) at java.lang.Class.initializeClass () (/usr/lib/libgcj.so.6.0.0) at org.drools.compiler.PackageBuilder.addRule(org.drools.lang.descr.RuleDescr) (Unknown Source) at org.drools.compiler.PackageBuilder.addPackage(org.drools.lang.descr.PackageDescr ) (Unknown Source) at org.drools.compiler.PackageBuilder.addPackageFromDrl(java.io.Reader) (Unknown Source) at FibonacciExample.main(java.lang.String[]) (Unknown Source) at gnu.java.lang.MainThread.call_main () (/usr/lib/libgcj.so.6.0.0) at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0) Caused by: java.util.regex.PatternSyntaxException: At position 2 in regular expression pattern: expected end of character class (.*)\bmodify\s*\(([^)]+)\)(.*) ^ at java.util.regex.Pattern.Pattern(java.lang.String, int) (/usr/lib/libgcj.so.6.0.0) at java.util.regex.Pattern.compile(java.lang.String, int) (/usr/lib/libgcj.so.6.0.0) at org.drools.semantics.java.KnowledgeHelperFixer.clinit() (Unknown Source) at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0) ...8 more Is it require to place .drl file in the same directory as that of the source code ? Thanks, Venkatesh What JDK are you using? /usr/lib/libgcj.so.6.0.0 and gnu.java.lang makes me think that it's GNU Classpath or something like that. It is quite possible that there are incompatibilities with that runtime. Have you tried running it with Sun's JDK? Best regards Marcus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Need Help for jbossruleseclipse Configuration
hi, i'm doing a project using jbossrules eclipse on fedora core 4 platform.i've tried to configure jboss eclipse.the steps i've followed is written below, 1.install j2sdk-1_4_2_13-linux-i586-rpm.bin and set the classpath 2.extract jbossrules-3.0.5-bin-withdeps.zip 3.extract eclipse-SDK-3.2.1-linux-gtk.tar.gz 4.put the org.drools.ide_1.0.0.jar plugin into the plugin directory of eclipse 5.put the GEF plugins into the eclipse plugin directory now i've gone to eclipse directory and run the eclipse using ./eclipse.it ran but when i tried to test the sample programs it compiled and threw errors.i've found the sample programs in the file named jbossrules-examples-3.0.5-src.zip. and put it into the default workspace of eclipse.i've followed the Drools Documentation 3.0.5 (Mark Proctor,Michael Neale,Peter Lin,Michael Frandsen) during the installation process. please guide me what i'll do now.i've noted one thing in the documentation that i need to have these tools installed,Eclipse 3.2,Subversion Client 1.3,Ant 1.6.i've only installed eclipse.do i need to install other two things?if yes then how do i install configure that? moreover please tell me whether i am going right way or not. thanking you, Niloy Debnath - Heres a new way to find what you're looking for - Yahoo! Answers ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Need Help: Errors while running FibonacciExample
Hi, I shifted to Sun JDK. Now, I am seeing a new problem while trying to run FibonacciExample: java org.drools.examples.FibonacciExample Exception in thread main java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/env/INameEnvironment at org.drools.compiler.PackageBuilder.loadCompiler(Unknown Source) at org.drools.compiler.PackageBuilder.init(Unknown Source) at org.drools.compiler.PackageBuilder.init(Unknown Source) at org.drools.examples.FibonacciExample.main(FibonacciExample.java:18) Could any one please let me know how to solve this problem ? Thanks, Venkatesh Snip earlier e-mail The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users