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
2007/11/13, Sikkandar Nawabjan [EMAIL PROTECTED]:
Hi,
am passing list of objects to working memory. i want to fire the
rule if there is any duplicate objects in the list
i write code like this
when
$obj1:Object1($id:id,$name:name)
$obj2:Object1(id==$id,$name:name==$name,this!=$obj1)
then
fire rule
Now the problem lies at this!=objj1(a highlighted check). i put
this to avoid a object check with itself.
But this is internally calling equals method of the corresponding
object and always return true. Because i overriden equals method in the
Object itself
so at the end the rule won't fire even if there is a duplicate
object. how i can solve this
equals(Object obj){
if(this.id=obj.id this.name==obj.name)
return true;
else
return false;
}
From: [EMAIL PROTECTED] on behalf of
[EMAIL PROTECTED]
Sent: Tue 11/13/2007 2:04 AM
To: rules-users@lists.jboss.org
Subject: rules-users Digest, Vol 12, Issue 27
Send rules-users mailing list submissions to
rules-users@lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more
specific
than Re: Contents of rules-users digest...
Today's Topics:
1. Re: Drools and jBPM integration (Fabian Weisensee)
2. Re: java.lang.OutOfMemoryError: Java heap space (Edson
Tirelli)
3. Re: Drools and jBPM integration (Mark Proctor)
4. Re: Drools and jBPM integration (Mark Proctor)
--
Message: 1
Date: Mon, 12 Nov 2007 18:23:06 +0100
From: Fabian Weisensee [EMAIL PROTECTED]
Subject: Re: [rules-users] Drools and jBPM integration
To: Rules Users List rules-users@lists.jboss.org mailto:
rules-users@lists.jboss.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Yes, thanks for your help. I'll try your suggestion for #2.
I resolved the deployment problem by myself. It was just a mistake
with
the JBoss ESB deploying...
But now I have another problem. The rule file is found, but there
seem
to be some problems with the parser.
The FireRulesActionHandler class from the jbpm wiki uses the
following code:
RuleBaseImpl ruleBase = new RuleBaseImpl();
ruleBase.addPackage(pkg);
But the RuleBaseImpl class doesn't seem to be part of drools
anymore. I
looked at the javadocs to find a replacement. I've found the
RuleBaseLoader class which looked like what I needed. I replaced
the two
lines with this: