I mean

workingMemory.assertObject(new String("A"));
workingMemory.assertObject(new String("A"));

would currently assert both strings into working memory, whereas if it would check not for identityHashCode but with equals, the second assert would have no effect.

When during experimentation with rule engines I switched from jess (where it is done with equals I think) to drools 2 I first experienced problems due to this differences (also did not find much in both engines docu), leading to my question if I could customize drools behaviour.

As one can always write a wrapper for drools assertObject to make such checks, and lots of other users probably dont need, my request is not important.

Juergen


Michael Neale wrote:
so you mean
p1 : Person()
p2 : Person()
eval ( p1.equals(p2) )

(but presumably a shorthand form?)



On 4/8/06, Mark Proctor <[EMAIL PROTECTED]> wrote:

We hadn't planned it, not promising  anything - but  I'll see how things
pan out, may be we will get time.

Mark
Juergen wrote:

ad. Can object equality for assertion be customized?
Drools 3 still seems to use IdentityMap with System.identityHashCode().
Is it planned to be customizeable e.g. with equals() in 3.0?

Michael Neale wrote:

Short answer, not easily with Drools 2. But yes, with Drools 3.

On 3/22/06, Juergen <[EMAIL PROTECTED]> wrote:


I recently looked into drools after experimenting with JESS and got a
few questions I could not look up in the drools documentation:

- Exists a condition to test for non-existence of a matching
object/fact?
-- If yes, how to use it for own domain specific language conditions

- How is sharing of conditions/nodes between productions implemented

in

drools, one of the main benefits of the rete algorithm?
-- How is the equality of conditions defined for java smf? via textual
equality of the condition's java code?
-- How can equality of conditions for sharing be defined for domain
specific language conditions?
e.g. Conway's game of life (slightly modified dsl)
<rule name="kill the overcrowded">
      <conway:cellIsAlive cellName="cell"/>
      <conway:cellIsOverCrowded cellName="cell"/>
      <conway:killCell cellName="cell"/>
</rule>
<rule name="kill the lonely">
      <conway:cellIsAlive cellName="cell"/>
      <conway:cellIsLonely cellName="cell"/>
      <conway:killCell cellName="cell"/>
</rule>

The conway:cellIsAlive condition could be shared between these two
productions. Would it?

- When will the properties map be supported in drools implementation

of

JSR 94 javax.rules API?
-- e.g. to be able to set conflict resolver of a rule base and other
settings that can be set via drools native API

- Can object equality for assertion be customized?
-- Currently, org.drools.util.IdentityMap
(org.drools.reteoo.WorkingMemoryImpl) makes use of
System.identityHashCode(). There seems to be no way to customize that,
e.g. make drools use equals() instead, neither via native nor JSR 94
API.

My apologies if some questions have already been answered in other
postings, I made no thorough search in this newsgroup yet.

Thanks a lot, Juergen

Reply via email to