There is a 1:1 relationship between EvemetierCalculDHF and EvemetierData objects. The reason for the EvemetierCalculDHF is that we want the EvemetierData structure to be independent from the rules, and therefore needed a declared fact (EvemetierCalculDHF) to type safely store some information. Ideally, we would like to add a trait to the EvemetierData instance, but is it possible on externally managed beans ?
The "null wrapping" is mostly historical and will be changed to an Option in a near future. We functionally want that null + null = null and that 0+null=0. Similarly null/any should return null. But this is not related to this "too many RightTuple" problem, sorry I did not clean up the rule before sending it over.
I did not quite understand your last paragraph on a "representative". Do you have an example I could study ?
In a more general way, if I have a LHS with the following conditions:
$x: A(someConditions)
accumulate ($y:A(someField==$x.somefield); ....)
It seems that the Drools engine will create one RightTuple per instance of A (and per rule with a similar accumulate), even if no instance of A matches the someConditions.
If I have many instances of A in the WM, is there a way to prevent Drools to create the RightTuples for $y until it has found a valid $x, and therefore create RightTuples only for the A matching someField ? I could use a "from" in the accumulate, but then the engine will not see updates on $y instances and won't recalculate the accumulate.