[rules-users] Identity Mode?

rjr201 rich.j.riley at gmail.com
Thu Jun 20 10:05:56 EDT 2013


If I have a rule such as:

When 
   Person()
   Person()
Then
   System.out.println("There are two people!")
End

I only want this to fire if there are two (or more) Person objects inserted
into the session, however as default drools will fire even when there is
just one Person object inserted (i.e. both Person patterns get matched to
the same fact).

I seem to remember there is a flag I can set that swaps between these two
types of behavior, and seem to remember it's to do with Identity/Equality
mode. However, I can't remember how or where to do this. 

Any help on this would be greatly appreciated..

Cheers,
Rich. 

P.S I realise that I could add constraints to the patterns to explicitly
check that the facts aren't the same.. however I'd rather not have to do
that as I'm trying to make it as simple as possible for users to create
rules..



--
View this message in context: http://drools.46999.n3.nabble.com/Identity-Mode-tp4024428.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list