[rules-users] Any easy way to avoid inserting same id object into memory?

2013-12-04 Thread Sonata
Hi, I have a rule that on its RHS, it creates new objects with random content and inserts them. How do you check if the object already exists in drools memory? I am thinking to use kcontext.getKnowledgeRuntime().getObjects() in the RHS to loop for all the objects and stop inserting if an object wi

Re: [rules-users] Any easy way to avoid inserting same id object into memory?

2013-12-04 Thread Wolfgang Laun
Quote from the Expert manual: "A Working Memory may operate in two assertion modes, i.e., equality or identity, with identity being the default." Search for the keyword to see all references; you'll need "equality". -W On 05/12/2013, Sonata wrote: > Hi, I have a rule that on its RHS, it crea

Re: [rules-users] Any easy way to avoid inserting same id object into memory?

2013-12-09 Thread Sonata
Thanks I made a search and it seems it is controlled by a config to switch between identity or equality. Since I can only write rules, I can't enjoy the advantage of that. I ended up writing a retract rule to retract the same (equal) object from memory with higher salience. So everytime some rules