-
Feature Request
-
Resolution: Done
-
Major
-
3.0-rc2
-
None
If two objects A and B are asserted, where A != B, but A.eqals(B) is true, then drools adds both of them to working memory, creating two fact handles. Behaviour is based on using org.drools.util.IdentityMap as identityMap in Reteoo workingMemoryImpl
My request is to add another behaviour and customizable which to use.
Drools should assert an object B, if there is not already an object A in working memory where A.equals(B) is true. (Basically this behaviour is achieved by using HashMap instead of IdentityMap)
Customization should be possible via setting properties on workingMemory creation. In JSR94 it would be a property for createRuleSession:
HashMap properties = new HashMap();
properties.put("org.drools.objectequality", "equals");
//properties.put("org.drools.objectequality", "identity"); //default value
StatefulRuleSession session = (StatefulRuleSession)ruleRuntime.createRuleSession(executionSetName, properties, RuleRuntime.STATEFUL_SESSION_TYPE);
- Currently, properties are used to set global variables. So "org.drools.objectequality" would yield unknown global error.
logical assertions are always equality based. Stated facts can now use identity and equality - using your configuration settings. I have added another configuration setting to dictate how logical over-ride works. Does it discard the original fact, or turn it into two stated fact handles.