I think that the simplest solution would be to either store the sum of
the children's values into each Node, or to create and insert
additional facts containing these sums, in parallel to non-leaf Node
On 28/02/2013, mcyrb <cyrille.martins(a)thalesgroup.com> wrote:
I have a tree, with each leaf containing a random value.
The value of each node is the sum of its children value.
I would like to write a rule which looks like this:
nodeValue == 18 (e.g.)
// do something with this node
The accumulate conditional element looked adequate for this, so I wrote
something like this
accumulate( Leaf( parentNode == n, v : value ); nodeValue : sum( v );
nodeValue == 18 )
// do something with n
So... the problem is that this works only for nodes where its direct childs
are leafs, and not for upper nodes.
Have you got an idea to solve this ?
View this message in context:
Sent from the Drools: User forum mailing list archive at Nabble.com
rules-users mailing list