[rules-users] Extend Guvnor
Hi all, Long time user of Drools (dated back in xml syntax days). We are looking to revamp our in house rules product which is based on Drools 3.x. We have built a Swing thick client that provides similar functionality as Guvnor such as rule editing, versioning, deployment (with approval system). One major feature we do have is rule simulation. We allow user to simulate rules and display results while user save or seek approval of their rules before deploy to production system. The simulation feature allows user to run against production or testing environment to ensure it provide correct results. I wonder if Guvnor has such extensibility interface build in which I could add my own functionality such as simulation and result browsing? Since Guvnor is based on Seam and GWT (i think), I could probably fork the source and tweak the UI, but I much rather code against an interface supported by Drools. Thoughts? TIA. PS: I am curious how are existing Drools user test their rules currently? Andy ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] set System property drools.compiler=JANINO does not work
Hi, We are experiencing JVM crash in 64 bits windows server. JVM core dump indicated that Eclipse compiler is the culprit. Current CompileTask: C2:3096 org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType([CLorg/eclipse/jdt/internal/compiler/lookup/ReferenceBinding;)Lorg/eclipse/jdt/internal/compiler/lookup/ReferenceBinding; (665 bytes) However, we already specified Drools to use Janino rather than Eclipse ( http://blog.athico.com/2006/12/dynamically-generated-class-beans-as.html). -Ddrools.compiler=JANINO Any idea? Thanks. Andy ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Custom EvaluatorFactory
Hi Mark, >> what you are using there is a return value constraint, to the engine its effectively a black box, and is evaluated by the chosen dialect; mvel or java. So if you want ot be able to do that type of arithmetic, work with the MVEL author to make sure its incuded in his engine. I think Mvel do support return value constraint, no? http://docs.codehaus.org/display/MVEL/Basic+Syntax On Dec 20, 2007 11:04 AM, Mark Proctor <[EMAIL PROTECTED]> wrote: > Andy Mei wrote: > > Hi Edson, > > This is exactly what I am looking for, thanks! > > One comment, is it possible to expand on list of operators Drools > support? Better yet, make it plugable just like EvaluatorDefinition. > > Not yet, this is something we want, but our current approach to using > antlr has limited our flexability there. We would need to rewrite the > grammar, using an antlr-tree parser, then we should be able to have user > definable list of operators. > > > Correct me if I am wrong, but here are list of operators Drools support: > > http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/Operator.java > > > Would it be possible if I could add additional operators like '+', '-', > '/', '%'... to any objects. For example, I would love to allow users to > write syntax below, where user could subtract 3 days from the current day. > > $p : Position ( settlementDate < ( $TODAY - '3D' ) ) > > what you are using there is a return value constraint, to the engine its > effectively a black box, and is evaluated by the chosen dialect; mvel or > java. So if you want ot be able to do that type of arithmetic, work with the > MVEL author to make sure its incuded in his engine. > > > I love the project, keep up the good work. I am negotiating with > management to purchase support contract from Redhat. > > great :) > > > Andy > > On Dec 19, 2007 6:26 PM, Edson Tirelli <[EMAIL PROTECTED]> wrote: > > > > >Andy, > > > >I just added support for that in trunk (drools-4.1.0.SNAPSHOT). > > Although trunk is a work in progress, you are welcome to try it out and > > check if it meets your needs and provide feedback. Look for the interface: > > org.drools.base.evaluators.EvaluatorDefinition and its subclasses as > > examples. > > > >[]s > >Edson > > > > 2007/12/19, Andy Mei < [EMAIL PROTECTED] >: > > > > > > Hi, > > > > > > Is there a way I could register my own custom EvaluatorFactory? > > > Drools ships with DateFactory what compares only dates, but no time > > > is included. I would like to compare time as well. > > > I see that it would be very helpful to include capability to > > > register custom EvaluatorFactory. > > > Thanks. > > > > > > Andy > > > > > > ___ > > > rules-users mailing list > > > rules-users@lists.jboss.org > > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > > > > > > > > -- > > Edson Tirelli > > JBoss Drools Core Development > > Office: +55 11 3529-6000 > > Mobile: +55 11 9287-5646 > > JBoss, a division of Red Hat @ www.jboss.com > > ___ > > rules-users mailing list > > rules-users@lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > -- > > ___ > rules-users mailing [EMAIL > PROTECTED]://lists.jboss.org/mailman/listinfo/rules-users > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Custom EvaluatorFactory
Hi Edson, This is exactly what I am looking for, thanks! One comment, is it possible to expand on list of operators Drools support? Better yet, make it plugable just like EvaluatorDefinition. Correct me if I am wrong, but here are list of operators Drools support: http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/Operator.java Would it be possible if I could add additional operators like '+', '-', '/', '%'... to any objects. For example, I would love to allow users to write syntax below, where user could subtract 3 days from the current day. $p : Position ( settlementDate < ( $TODAY - '3D' ) ) I love the project, keep up the good work. I am negotiating with management to purchase support contract from Redhat. Andy On Dec 19, 2007 6:26 PM, Edson Tirelli <[EMAIL PROTECTED]> wrote: > >Andy, > >I just added support for that in trunk (drools-4.1.0.SNAPSHOT). > Although trunk is a work in progress, you are welcome to try it out and > check if it meets your needs and provide feedback. Look for the interface: > org.drools.base.evaluators.EvaluatorDefinition and its subclasses as > examples. > >[]s >Edson > > 2007/12/19, Andy Mei <[EMAIL PROTECTED] >: > > > > Hi, > > > > Is there a way I could register my own custom EvaluatorFactory? > > Drools ships with DateFactory what compares only dates, but no time is > > included. I would like to compare time as well. > > I see that it would be very helpful to include capability to register > > custom EvaluatorFactory. > > Thanks. > > > > Andy > > > > ___ > > rules-users mailing list > > rules-users@lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > > > -- > Edson Tirelli > JBoss Drools Core Development > Office: +55 11 3529-6000 > Mobile: +55 11 9287-5646 > JBoss, a division of Red Hat @ www.jboss.com > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Custom EvaluatorFactory
Hi, Is there a way I could register my own custom EvaluatorFactory? Drools ships with DateFactory what compares only dates, but no time is included. I would like to compare time as well. I see that it would be very helpful to include capability to register custom EvaluatorFactory. Thanks. Andy ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Constants on LHS?
Try global VAR Sent from my iPhone. PLs excuse typing mistake. On Dec 9, 2007, at 12:48 PM, J Michael Dean <[EMAIL PROTECTED]> wrote: I have not been able to figure out how to define "constants" that can be used replace numbers, etc. on the LHS of rules, and am not quite at the stage where I can set up a DSL. Is there a way to accomplish this? For example, I have a simple rule to determine if glucose is below the targeted range; the lower limit of the target is 80. Quickest solution: when decision : GlucoseDecision(serumGlucoseConcentration < 80) then DO something But I want to be able to write: when decision : GlucoseDecision(serumClucoseConcentration < lowTargetLimit) then Do something so that I can set all these constants in one place, etc. Is there a way to accomplish this inside the DRL? - Mike ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] From accumulate compilation error :java.Math.BigDecimal cannot be resolved to a type
Duh, thanks Kris! On Nov 16, 2007 10:58 AM, Kris Verlaenen <[EMAIL PROTECTED]> wrote: > Have you tried java.math (math should not be capitalized)? > > Kris > > > - Original Message - > From: "Andy Mei" <[EMAIL PROTECTED]> > To: > Sent: Friday, November 16, 2007 4:44 PM > Subject: [rules-users] From accumulate compilation error > :java.Math.BigDecimal cannot be resolved to a type > > > > Hi, > > > > I am getting compilation error when I tried to use > > java.Math.BigDecimal object within from accumulate clause. I am not > > sure why Drools does not regonize full qualify namespaces for > > BigDecimal. > > > > Here is my LHS: > > > >>$netDailyPnl : Number ( ) > >> from accumulate ( Position ( secId == $pos.secId, $baseRealizedPnl : > > baseRealizedPnl, $baseUnrealizedPnl : baseUnrealizedPnl ), > >> init ( java.Math.BigDecimal netDailyPnl = new java.Math.BigDecimal ( > >> 0 ); ), > >> action ( netDailyPnl.add($baseRealizedPnl); > > netDailyPnl.add($baseUnrealizedPnl); ), > >> reverse ( ), > >> result ( netDailyPnl ) > >> ) > > > > Here is compilation log: > > > > Caused by: org.drools.compiler.DroolsParserException: Rule Compilation > > error : [Rule name=Extreme Single Position (TID) PL Movement, > > agendaGroup=MAIN, salience=43, no-loop=false] > > com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java > > (12:370) : java.Math.BigDecimal cannot be resolved to a type > > com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java > > (21:557) : netDailyPnl cannot be resolved > > com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java > > (21:575) : java.Math.BigDecimal cannot be resolved to a type > > com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java > > (31:1030) : netDailyPnl cannot be resolved > > com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java > > (31:1065) : netDailyPnl cannot be resolved > > com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java > > (47:1667) : netDailyPnl cannot be resolved > > > > at > > com.trg.ruleengine.util.RuleBaseBuilder.readRule(RuleBaseBuilder.java:104) > > at > > com.trg.ruleengine.impl.DroolsRuleEngineBuilder.getRuleBase(DroolsRuleEngineBuilder.java:109) > > ... 10 more > > > > Thanks! > > > > Andy > > ___ > > rules-users mailing list > > rules-users@lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] From accumulate compilation error : java.Math.BigDecimal cannot be resolved to a type
Hi, I am getting compilation error when I tried to use java.Math.BigDecimal object within from accumulate clause. I am not sure why Drools does not regonize full qualify namespaces for BigDecimal. Here is my LHS: >$netDailyPnl : Number ( ) > from accumulate ( Position ( secId == $pos.secId, $baseRealizedPnl : baseRealizedPnl, $baseUnrealizedPnl : baseUnrealizedPnl ), > init ( java.Math.BigDecimal netDailyPnl = new > java.Math.BigDecimal ( 0 ); ), > action ( netDailyPnl.add($baseRealizedPnl); netDailyPnl.add($baseUnrealizedPnl); ), > reverse ( ), > result ( netDailyPnl ) > ) Here is compilation log: Caused by: org.drools.compiler.DroolsParserException: Rule Compilation error : [Rule name=Extreme Single Position (TID) PL Movement, agendaGroup=MAIN, salience=43, no-loop=false] com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java (12:370) : java.Math.BigDecimal cannot be resolved to a type com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java (21:557) : netDailyPnl cannot be resolved com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java (21:575) : java.Math.BigDecimal cannot be resolved to a type com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java (31:1030) : netDailyPnl cannot be resolved com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java (31:1065) : netDailyPnl cannot be resolved com/trg/pnl/Rule_Extreme_Single_Position__TID__PL_Movement_0.java (47:1667) : netDailyPnl cannot be resolved at com.trg.ruleengine.util.RuleBaseBuilder.readRule(RuleBaseBuilder.java:104) at com.trg.ruleengine.impl.DroolsRuleEngineBuilder.getRuleBase(DroolsRuleEngineBuilder.java:109) ... 10 more Thanks! Andy ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Adding constraints to facts in DSL
Ok, i took the liberty and created a ticket for this. http://jira.jboss.com/jira/browse/JBRULES-1186 On 9/12/07, Edson Tirelli <[EMAIL PROTECTED]> wrote: > > >All, > >This is a limitation of the current DSL engine implementation. The > problem is not really the "or", but the "-" implementation. The LHS and RHS > of a DSL rule are processed line by line, so, to allow the behavior you are > requesting, we will need to implement some look ahead mechanism with smart > interpolation that does not exist today. >I'm not sure if someone already opened a ticket for that, but in case > not, may I ask you please to open? We will look into supporting that in the > future. > >[]s >Edson > > > 2007/9/12, Andy Mei <[EMAIL PROTECTED]>: > > > > I am having the same problem as Stephane does. > > > > It's pretty bad if I need to hard code the 'or' constraint within a > > single DSL constraint. I guess I could split a complex OR constraint to > > multiple rules with the same consequences, it just an ugly hack. Also, how > > does this work if we need a Or constraint within another group constraint? > > > > I just don't understand why the following doesn't work. > > > > [condition][]There is a Cheese with=Cheese() > > [condition][]- age is less than {low} =age < {low} > > [condition][]Or=or > > [condition][]- age is more than {high}=age > {high} > > > > On 9/11/07, [EMAIL PROTECTED] < > > [EMAIL PROTECTED]> wrote: > > > > > Hi Vincent, > > > > > > Thanks for your answer but I would really like to use my synthax. > > > > > > I need to write "or" between 2 constraints and not in a single complex > > > constraint. > > > > > > If someone else could help me ... > > > > > > DELBART Vincent <[EMAIL PROTECTED]> a écrit : > > > > > > > > > > Hello Stephane, > > > > > > > > I think it's difficult to do that. Could you try this : > > > > There is a Cheese with > > > >- age is less than 42 or age is more than 60 > > > >- type is 'stilton' > > > > with in your DSL > > > > [condition][]There is a Cheese with=Cheese() > > > > [condition][]- age is less than {low} or age is more than {high}=age > > > > > > > < {low} || age > {high} > > > > [condition][]- type is '{type}'=type == "{type}" > > > > > > > > I don't see other solution... > > > > > > > > vdelbart > > > > > > > > > > > > > > > > > > > > > > > > De : [EMAIL PROTECTED] > > > > [mailto:[EMAIL PROTECTED] De la part de > > > > [EMAIL PROTECTED] > > > > Envoyé : mardi 11 septembre 2007 10:16 > > > > À : rules-users@lists.jboss.org > > > > Objet : [rules-users] Adding constraints to facts in DSL > > > > > > > > > > > > > > > > Hello, > > > > > > > > I'm using JBossDrools in my company and I have some problems with > > > DSL. > > > > > > > > Actually, I would like to write something like this : > > > > > > > > There is a Cheese with > > > >( - age is less > > > > than 42 > > > > or > > > > - age is more than 60 ) > > > >- type is > > > > 'stilton' > > > > > > > > Unfortunately, It's the drools parser which manage "-" char. > > > > > > > > Also this previous synthax don't work in the LHS. > > > > > > > > Anyone could help me to do an equivalent condition in my DSL ? If > > > > possible with "-" sugar char. > > > > > > > > Stephane. > > > > > > > > PS : Sorry, for my very bad english. > > > > > > > > > > > > > > > > This message was sent using IMP, the Internet Messaging Program. > > > > > > > > > > > > > > > > > > > > > > > This message was sent using IMP, the Internet Messaging Program. > > > > > > ___ > > > 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 > > > > > > > -- > Edson Tirelli > Software Engineer - JBoss Rules Core Developer > Office: +55 11 3529-6000 > Mobile: +55 11 9287-5646 > JBoss, a division of Red Hat @ www.jboss.com > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Adding constraints to facts in DSL
I am having the same problem as Stephane does. It's pretty bad if I need to hard code the 'or' constraint within a single DSL constraint. I guess I could split a complex OR constraint to multiple rules with the same consequences, it just an ugly hack. Also, how does this work if we need a Or constraint within another group constraint? I just don't understand why the following doesn't work. [condition][]There is a Cheese with=Cheese() [condition][]- age is less than {low} =age < {low} [condition][]Or=or [condition][]- age is more than {high}=age > {high} On 9/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi Vincent, > > Thanks for your answer but I would really like to use my synthax. > > I need to write "or" between 2 constraints and not in a single complex > constraint. > > If someone else could help me ... > > DELBART Vincent <[EMAIL PROTECTED]> a écrit : > > > > Hello Stephane, > > > > I think it's difficult to do that. Could you try this : > > There is a Cheese with > >- age is less than 42 or age is more than 60 > >- type is 'stilton' > > with in your DSL > > [condition][]There is a Cheese with=Cheese() > > [condition][]- age is less than {low} or age is more than {high}=age > > < {low} || age > {high} > > [condition][]- type is '{type}'=type == "{type}" > > > > I don't see other solution... > > > > vdelbart > > > > > > > > > > > > De : [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] De la part de > > [EMAIL PROTECTED] > > Envoyé : mardi 11 septembre 2007 10:16 > > À : rules-users@lists.jboss.org > > Objet : [rules-users] Adding constraints to facts in DSL > > > > > > > > Hello, > > > > I'm using JBossDrools in my company and I have some problems with DSL. > > > > Actually, I would like to write something like this : > > > > There is a Cheese with > >( - age is less > > than 42 > > or > > - age is more than 60 ) > >- type is > > 'stilton' > > > > Unfortunately, It's the drools parser which manage "-" char. > > > > Also this previous synthax don't work in the LHS. > > > > Anyone could help me to do an equivalent condition in my DSL ? If > > possible with "-" sugar char. > > > > Stephane. > > > > PS : Sorry, for my very bad english. > > > > > > > > This message was sent using IMP, the Internet Messaging Program. > > > > > > > > > This message was sent using IMP, the Internet Messaging Program. > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] DSL field constraint question
Hi Vdelbart, Awesome, you nailed it! Thanks! Andy On 9/3/07, vdelbart <[EMAIL PROTECTED]> wrote: > > > Hi Andy Mei, > > In your DSL file you put some parentheses. I think it's the problem. Try > with this : > > > [when]There is a person with=person:Person() > > [when]-age is at least {age} years old=age >= {age} > > [when]-age is less than {age} years old=age < {age} > > [when]-must has a name=name != "" && name != null > > [when]-id must be positive integer=id > 0 > > Good luck, > > vdelbart > -- > View this message in context: > http://www.nabble.com/DSL-field-constraint-question-tf4360996.html#a12457145 > Sent from the drools - user mailing list archive at Nabble.com. > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Re: DSL field constraint question
Any idea? I really appreciate any help or pointers! Andy On 8/31/07, Andy Mei <[EMAIL PROTECTED]> wrote: > > Hi, > > I am new to Drools and working with 4.0.1 version. > I am playing with DSL and having trouble with conditional field > constraints. > I really appreciate any help, i like drools a lot and would love to use > it. > > Here is the simple rule i have: > > rule "Credit Approved" > salience 5 > when > //notice here we are using our own domain specific language that's > defined within > #credit.dsl file > There is a person with > #-must has a name > -age is at least 18 years old > then > >System.out.println( "[ALLOW] Credit approved for " + > person.getName()); > end > > Here is my dsl definition: > [when]There is a person with=person:Person() > [when]-age is at least {age} years old=(age >= {age}) > [when]-age is less than {age} years old=(age < {age}) > [when]-must has a name=(name != "" && name != null) > [when]-id must be positive integer=id > 0 > > Everything works fine if i use only 'age is least 18 years old' or 'must > has a name'. > However, if i try to do a connective and between these two constraints, i > am getting > package build errors: > Package build error found: > [13,43]: unknown:13:43 mismatched token: [EMAIL > PROTECTED],331:331=',',<11>,13:43]; > expecting type RIGHT_PAREN[13,59]: unknown:13:59 mismatched token: > [EMAIL PROTECTED],347:347=')',<12>,13:59]; expecting type THEN > Exception in thread "main" org.drools.rule.InvalidRulePackage: [13,43]: > unknown:13:43 mismatched token: [EMAIL PROTECTED],331:331=',',<11>,13:43]; > expecting type > RIGHT_PAREN[13,59]: unknown:13:59 mismatched token: > [EMAIL PROTECTED],347:347=')',<12>,13:59]; expecting type THEN > at org.drools.rule.Package.checkValidity(Package.java:419) > at org.drools.common.AbstractRuleBase.addPackage ( > AbstractRuleBase.java:292) > at com.trg.play.rules.PersonTest.readRule(PersonTest.java:103) > at com.trg.play.rules.PersonTest.main(PersonTest.java:51) > > I have attached my test program for your review. > > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users