Mario just got a first cut working for fine grained property change listeners. Previously when you call update() it will trigger revaluation of all Patterns of the matching object type in the knowledeg base.
As some have found this can be a problem, forcing you to split up your objects into smaller 1 to 1 objects, to avoid unwanted evaluation of objects – i.e. recursion or excessive evaluation problems.
The new approach now means the pattern’s will only react to fields constrained or bound inside of the pattern. This will help with performance and recursion and avoid artificial object splitting. We previously discussed this here:
You can see the unit test here:
The implementation is bit mask based, so very efficient. When the engine executes a modify statement it uses a bit mask of fields being changed, the pattern will only respond if it has an overlapping bit mask. This does not work for update(), and is one of the reason why we promote modify() as it encapsulates the field changes within the statement. You can follow Mario’s chain of work on this at his github activity feed:
The adventerous amoung you can pick this up from hudson, or from maven, and start playing now. My hope is that this will make drools much easier to use:
Btw we are after a name. Drools is not a frame based system, so “slot specific” doesn’t seem appropropriate. Property Specific seems a bit of a mouth full. I’m quite liking High Fidelity Change Listeners 🙂 any other suggestions?
slot-specific is the name used by Jess for this feature, . It’s also the standard way that Clips COOL works, which is the Clips OO module. Although that’s partly a side effect of the triple representation of properties used in COOL, and the modifications are triple based. I don’t know what mechanism Jess is using to enable this.