[rules-users] Hippo drools
Friend of mine wanted to know if Hippo uses Drools. He used Google. He found a nice description of how hippos drool. dagdag Christine -- dagdag is just a two-character rotation of byebye. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to write regular expressions in drools..
Chanti, what exactly is your question? I think that checking zipcode and credit card formats is easier to do in java than with rules. Rules are more efficient in more complex situations, like when you have multiple objects that need to meet various conditions. Christine On Fri, May 30, 2008 09:24, Nagaraju runkana wrote: > HI Guys, > > present i am using drools 4.0 in this case.now, i am writting some rules > validation using regular expression ZIPCODE,EMAIL,CREDIT CARD number.like > this.. > > validation.dslr > > rule "email.mandatory:[insert][update][ui]" > when > There is an Order > Order email address checking for first letter > then > Reject with response : "email address must not start with @ " > end > rule "phone.mandatory:[insert][update][ui]" > when > There is an Order > Order phone number format should checking > then > Reject with response : "The phone number you entered is not valid.Please > enter a phone number with the format xxx-xxx-."\ > end > --- > validation.dsl > > [*][]Order email address checking for first letter= OrderBean(email > matches > "@[A-Za-z0-9]*") > [*][]Order phone number format should checking=OrderBean( phone not > matches > "(/\d{3}\-\d{3}\-\d{4}/)==-1)") > this rules are not working ...any one can help me.ASAP > > thanks, > chanti > ___ > 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] Re: To know about correct Drools rule file (drl)syntaxes
On Thu, May 29, 2008 16:17, Hareendra Pelige wrote: > According to your experience, which rule file language is commonly used? I would say that this syntax from your email is easiest to use. As Mark explained, the xml-type language is old, version 2.0. You can define a domain specific language, but that's worth the effort only in larger projects, I'd say. Christine rule "Hello World" when m : Message( status == Message.HELLO, message : message) then System.out.println( message ); modify ( m ) { message = "Goodbyte cruel world", status = Message.GOODBYE }; System.out.println( message ); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Matching on instanceof without eval?
On Fri, May 23, 2008 15:47, Barry Kaplan wrote: > > I would like to match on the class of a field. I know I can use > "eval(option instanceof OptionInstrument)", Is what you do like when option : Option ( option instanceof OptionInstrument, .. ) ? why not when option : OptionInstrument ( . ) ? Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Nested Rules
On Thu, May 22, 2008 11:30, Vishal Deshmukh wrote: > Can i write nested rules like Sure. rule "rule 1 " when condition is true then set property in some object rule "rule 2 " when property in some object has been set then action However, if you need "nested rules", you probably need to rethink the way you use rules. It would be easier to write rule 1 if condition for rule 1 is true and condition for rule 2 is true then action for rule 2. end the way the rule engine works makes this work exactly as you intended: it checks condition 1, and only if true, it checks condition 2. As a general design consideration, you want to combine as little conditions as possible. Suppose you have ten parameters, and you have all your rules test all paameters. In that case. you're better off hard coding the procedure. If you come up with the right set of rules that test only one or two of the parameters and still produce the desired behavior, then you make efficient use of the rule engine. I suggest you do some reading on how rule engines work, it helps you design better rulebases. Don't go into detail about the Rete algorithm in the Drools documentation, but rather find some more general guide. I don't know one off the top of my head, when I find one I'll post it. dagdag Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Define a time event
> All the above, just to tell you all users that time is not a simple > concept to support. With a few limitations, it shouldn't be that difficult. Of course, re-running a rule base with the same results can't be done if you incorporate time, but other than that, I don't see the difficulty. Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Define a time event
Talking about date and time, how do I get current date in a when condition? dagdag Christine >Exactly. Also, you need to make sure you "tell the engine" everytime > your > Time object change, as well as ensure that fireAllRules will be called at > the exact time: 22:00, because if it is called 1 minute later or before, > the > constraint will evaluate to false. > >Edson > > > 2008/5/7 Christine <[EMAIL PROTECTED]>: > >> > Hi everyone, >> >> > For example: >> > when Time(hour==22,minute==0) Lamp(status==1) >> > then >> > Console.Writeline("It's late,turn off the light and go to bed") >> > where time is a class that return the current hour; >> >> Claudio, this would probably work if you fire the rules every hour or >> every minute or every time your Time object changes. Just having the >> rules >> sitting in your rulebase doesn't mean they get executed. >> >> Christine >> >> >> ___ >> 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
Re: [rules-users] Date arithmetic in âÂÂwhenâ session
> > I tried this approach, but I get compilation errors for tokens '-' and '+' > I > get similar errors for any arithmetic symbols (*, + or -) > > What is the right way to add or subtract or multiply with in "when" > session? I don't know why the example doesn't work. Try this: rule "ITR Discard" when req : LowFareRequest( $reqTime : requestedDeparture.time) itr : AirItinerary( discarded == false ) flight : Flight( departure.time < ($reqTime / 360 + 2), departure.time > ($reqTime / 360 - 4)) then System.out.println("discard true"); end Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Date arithmetic in âwhenâ session
Hi, you shouldn't put part of the "if" or "when" part after the "then". Put all conditions after the "when" so the rule engine will evaluate them. I guess you mean to write something like (although I haven't tested this): rule "ITR Discard" when req : LowFareRequest( $reqTime : requestedDeparture.time) itr : AirItinerary( discarded == false ) flight : Flight( departure.time - 2 * 360 < $reqTime, departure.time + 4 * 360 > $reqTime) then System.out.println("discard true"); end Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Define a time event
> Hi everyone, > For example: > when Time(hour==22,minute==0) Lamp(status==1) > then > Console.Writeline("It's late,turn off the light and go to bed") > where time is a class that return the current hour; Claudio, this would probably work if you fire the rules every hour or every minute or every time your Time object changes. Just having the rules sitting in your rulebase doesn't mean they get executed. Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] never mind iterator.....
made a silly mistake, sorry. Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] facthandle iterator
Hi All, I thought this: public void retractFacts() { Iterator iter = workingMemory.iterateFactHandles(); while (iter.hasNext()) { FactHandle handle = iter.next(); workingMemory.retract(handle); } } would retract all facts, but in fact I get a compilation error because iter.next is an object, not a factHandle. How do I retract facts using an iterator iterating all facts? kind regards Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] mvel error?
>My suggestion for you and Chris to try 4.0.7 is that if you have a > problem with it, we can fix it before it is released. Once we release it, > unless something really bad is found in the community version, there will > be > no 4.0.8. Next release will probably be 5.0.0. I will test it this weekend, I'll let you know. Christine > >The status with 4.0.7 is that it is ready to be released, since no one > reported any serious problem with it. So it will happen any moment now. > >Please note that all these applies only to the community version. The > Red > Hat's enterprise supported version release cycle, QA, patches, etc is > following different path now. > >[]s >Edson > > > 2008/4/25 Christine <[EMAIL PROTECTED]>: > >> >> >Did you guys tried 4.0.7, that is about to be released? Does the >> error >> > still happens there? >> > >> >> We didn't try 4.0.7 because we're on a very tight schedule. No time for >> experiments. I will try this weekend, in another project that I'm doing. >> >> Christine >> >> ___ >> 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
Re: [rules-users] mvel error?
>Did you guys tried 4.0.7, that is about to be released? Does the error > still happens there? > We didn't try 4.0.7 because we're on a very tight schedule. No time for experiments. I will try this weekend, in another project that I'm doing. Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] mvel error?
Thanks Chris. Just replacing "product.type == ProductType.WA" by the same as an eval works. But it is strange that in one place the original line works while three lines down the same line doesn't. Christine > Hi, > I found out I had this king of errors when I was using nested accessors > like > : > > Number () from accumulate ( > $person : Person( > age > 18, > dog.weight > 50 > ), > sum($person) > ) > > I found I could get rid of these this way : > > Number () from accumulate ( > $person : Person( > age > 18 > )&& eval($person.getDog().getWeight()>50), > sum($person) > ) > > I guess it is not optimized at all, but at least it does not raise strange > exception. > Chris > > > > 2008/4/25 Christine <[EMAIL PROTECTED]>: > >> Hi, >> does anyone know what this error means? >> It happens when I put an enum constant in a rule. I use the same enum >> constant in another part of the same rule with no problem. >> >> Christine >> >> org.drools.RuntimeDroolsException: Exception executing predicate >> [EMAIL PROTECTED] >>at >> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216) >>at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:132) >>at >> >> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318) >>at >> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153) >>at org.drools.reteoo.Rete.assertObject(Rete.java:175) >>at >> org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192) >>at >> org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71) >>at >> >> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909) >>at >> >> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881) >>at >> >> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682) >>at >> >> nl.ing.towardsdeepdrive.rules.SalesRules.assertCompetitorProduct(SalesRules.java:42) >>at rules.SalesRulesTest.TestRules(SalesRulesTest.java:53) >>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>at >> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>at >> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>at java.lang.reflect.Method.invoke(Method.java:585) >>at >> org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) >>at >> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) >>at >> org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) >>at >> >> org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) >>at >> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) >>at >> org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) >>at >> >> org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) >>at >> >> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) >>at >> >> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) >>at >> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) >>at >> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) >>at >> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) >>at >> >> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) >>at >> >> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) >>at >> >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) >>at >> >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) >>at >> >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) >>at >> >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) >> Caused by: org.mvel.CompileException: cannot invoke getter: getType >> [declr.class: nl.ing.towardsdeep
Re: [rules-users] Who's Using Drools out there?
I use drools as the rule engine in a chatterbot project. The rule engine is just a small part of the project. Christine > Hi - > > I'm looking for some list of companies and projects that are built on > Drools. I've found references to Cisco in the blog, but what else is > there? (Obviously this mailing list sees a lot of activity) > > To get the ball rolling, we use drools at Citi to power our Municipal > Bid Wanted and Order Management systems. > > > Thanks, > -tk > > ___ > 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] mvel error?
Hi, does anyone know what this error means? It happens when I put an enum constant in a rule. I use the same enum constant in another part of the same rule with no problem. Christine org.drools.RuntimeDroolsException: Exception executing predicate [EMAIL PROTECTED] at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216) at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:132) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153) at org.drools.reteoo.Rete.assertObject(Rete.java:175) at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192) at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682) at nl.ing.towardsdeepdrive.rules.SalesRules.assertCompetitorProduct(SalesRules.java:42) at rules.SalesRulesTest.TestRules(SalesRulesTest.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: org.mvel.CompileException: cannot invoke getter: getType [declr.class: nl.ing.towardsdeepdrive.data.model.Product; act.class: null] at org.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:52) at org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39) at org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22) at org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21) at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21) at org.mvel.MVELRuntime.execute(MVELRuntime.java:88) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111) at org.mvel.MVEL.executeExpression(MVEL.java:235) at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36) at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:210) ... 33 more Caused by: java.lang.NullPointerException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:42) ... 42 more ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] maven
> http://repository.jboss.com/maven2/org/drools/ Thanks! Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] maven
We use mvn in our project, but maven can only find drools-core up to version 3.0.4, is that correct? Should I create our own repository and put the drools jars there, or is there a way mvn can find them? Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] rules-users] guided rule editor
hi, just out of curiosity, and because one of our customers wants to use it, I tried to open a rule file in the guided rule editor. I get an error: "content not allowed in prolog". I opened the default rule file that you get in a new project. I didn't know Drools has anything to do with prolog? Christine ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users