Copy-pasted from the Expert manual:
kBase Attribute:
equalsBehavior identity identity, equality
Defines the behavior of Drools when a new fact is inserted into the
Working Memory. With identity it always create a new FactHandle unless
the same object isn't already present in the Working Memory, while
with equality only if the newly inserted object is not equal
(according to its equal method) to an already existing fact.
-W
PS: Grammar and wording could be improved, but you'll guess what it's
trying to say.
On 04/03/2014, Brecht De Rooms <bderooms(a)vub.ac.be> wrote:
Dear drools users,
when using a rule to add events such as the rule below, I noticed that
they are not inserted if the event has identical field values. When I
change one of the values to another number they are inserted. Is this
normal behavior? I assumed that the timestamp would determine them to be
unique.
rule "insertevents0"
when
then
insert(new (TestFloatEvent(0));
insert(new (TestFloatEvent(0));
end
I figured it might be that the timestamp is equal since they are inserted
in the same rule. To be sure I waited and entered a second rule to be
picked up by the scanner.
rule "insertevents1"
when
then
insert(new (TestFloatEvent(0));
insert(new (TestFloatEvent(0));
end
Yet, the amount of events when I query the factbase is still 1 where I
thought it would ahave been 4.
Is the best way to fix this to add an explicit time attribute?
The TestFloatEvents are declared as:
package dynamictypesnetworktest
declare TestFloatEvent
@role(event)
value : float @key
end
---
Dit e-mailbericht bevat geen virussen en malware omdat avast!
Antivirus-bescherming actief is.
http://www.avast.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users