Geoffrey,
In trunk we have a feature called "accumulate", which is also in Jess.
This allows you to execute an action on all matching patterns, the
result is then returned as a bound variable. You can use this feature
to return a collection of matching facts or a calculated value over
those facts, thus a "sum". What we don't do is some form of "delta",
but that sounds very interesting for high volume transactional systems,
not entirely sure how it could be done and it won't make the Q1 release
next year - but if you want to work with us on building thus
functionality into drools, you know where to find us :)
Mark
Geoffrey De Smet wrote:
I am logically asserting a bunch of Routeobjects:
new Route(Object cause, int distance)
and I need the sum of all the distances of all the Routes.
so after the rules are fired I can fetch all Routes and sum the
distances.
Problem is... in my use case I am constantly (like +1k times a second)
changing one little fact, firing all rules and decide which fact to
change next based on the sum of the distances. Talk about stressing
drools's forward-chaining :)
So by constantly recalculating the sum of those distances starting
from 0, it loses a huge amount of scalability.
It would be a lot better if a sum would be calculated like this:
nextSum = lastSum - distanceFromAnyRetractedRoutes +
distanceFromAnyAssertedRoutes;
This would mean that the rules engine would need to support some sort
of sum query's.
What do you think? Is this feasible and in the scope of drools enough
to create a long term feature request in jira for this?
Thanks.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email