i just use this sort of rule rule "Hello World"
dialect "mvel" when m : Message( $message1 : message ) mdup : Message($message2:message==$message1,eval(this!=m) ) then System.out.println("Rule Fired1111"+m +"::"+mdup ); System.out.println("Rule Fired"+$message1 +"::"+$message2 ); end if i put rule parameter dialect "MVEL" the error "this should be used in static context" is gone. But now the rule is firing whatever may be the data i assert 2 objects with message Hello and Hello11111. still the rule is firing(2 times). Thanks and regs, basha Message: 1 Date: Wed, 14 Nov 2007 09:48:02 -0200 From: "Edson Tirelli" <[EMAIL PROTECTED]> Subject: Re: [rules-users] RE: how to find duplicate inlineeval To: "Rules Users List" <email@example.com> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Sorry, you lost me. What is the error message? Can you send us a self contained test showing the problem you are having? s Edson 2007/11/14, Sikkandar Nawabjan <[EMAIL PROTECTED]>: > > Edson, > > As you said i used inline eval. But am getting erroe message like this > can't be used in static context.am using statelesssession to assert my > objects. > > i also put eval(this!=obj1) as follows. > > $obj1:Object1($id:id,$name:name) > $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 > )) eval($obj2!= $obj1) > > Though my references are different the rule is not firing > > > Thanks and Regs > > Basha > > From: [EMAIL PROTECTED] on behalf of Edson Tirelli > Sent: Tue 11/13/2007 9:35 PM > To: Rules Users List > Subject: Re: [rules-users] RE: how to find duplicate > > > > > Sikkandar, > > The only way to check for identity is to use an inline eval and use > java code to check that: > > when > $obj1:Object1($id:id,$name:name) > $obj2:Object1(id==$id,$name:name==$name, eval( this!=$obj1 )) > then > > Another option is to configure your rulebase to not allow the same > object to be matched by more than one pattern in your rules. To do that you > can either set a system property: > > drools.removeIdentities = true > > Or you can use drools API: > > RuleBaseConfiguration conf = new RuleBaseConfiguration(); > conf.setRemoveIdentities( true ); > RuleBase rulebase = RuleBaseFactory.newRuleBase( conf ); > > If you do that, your rule can be written as this: > > when > $obj1:Object1($id:id,$name:name) > $obj2:Object1(id==$id,$name:name==$name) > then > > Since the engine will never allow the same fact to simultaneously match > both patterns. > > s > Edson
_______________________________________________ rules-users mailing list firstname.lastname@example.org https://lists.jboss.org/mailman/listinfo/rules-users