Thanks, Edson. That explains it. Regarding your #1 point, I can try to help,
especially if it's smth that won't require digging deeply into DROOLS
implementation details (and would help me to implement the rule I mentioned
in the previous post :) )... How much time do you think it will take
providing I'm not familiar with DROOLS codebase? (DROOLS dev-t environment
setup + this feature implementation)
I'm subscribed to dev-t list (from what I recall), so we can move this
discussion there...
Thanks,
Vlad
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: 07 March 2007 17:43
To: Rules Users List
Subject: Re: [rules-users] 'from accumulate' doesn't work on multiple
columns?..
Vlad,
Trying to answer both of your e-mails in this one.
1. Right now, accumulate supports only a single Pattern (column), as you
already realized. That is a limitation we want to remove before the next
final release, but it is not done yet. I already know how to fix that,
but didn't had the time to do it yet. We are working hard in the BRMS
side now. If anyone is willing to help with that, I can provide the
instructions on how to do the implementation for that feature.
2. Regarding matching the same fact multiple times in a single tuple,
this is a configuration. In 3.0.x, the default is to not allow the same
fact to be matched multiple times in a single tuple. In 3.1, the default
was changed to allow multiple matches. That is why your tested matched
multiple times. This is one of the BIG warnings we need to add to the
upgrade documentation.
3. Regarding the distinct, I'm not sure if it would be good to have such
"feature". Need further discussion I guess. But on of the ways to work
around that is just to have a "driver" fact. I mean, if "f1" means a
financial account, for instance, have a Financial Account fact:
rule ...
when
FinancialAccount( $id : id )
Double( doubleValue > 0 ) from accumulate(
Record( finId == $id, $f2 : f2, $val : value )
init( double sum = 0; )
action( sum += ( $f2 < 10 ) ? $val : -$val; )
result( new Double( sum ) ) )
then
// do something
end
Hope it helps.
[]s
Edson
Olenin, Vladimir (MOH) wrote:
This is as a follow up for the previous question.... It looks like I
made a wrong assumption that 'accumulate' can work on multiple columns:
Integer ( intValue > 0) from accumulate (
Record ( f1 == $f1, f2 < 10, $value1 : value )
Record ( f1 == $f1, f2 >= 10, $value2 : value )
Init ( int sum = 0; ),
Action ( sum += $value1 - $value2 ),
Result ( new Integer (sum) )
)
I'm getting an error ('then' is expected or smth like that at the
point where the second 'Record' is defined) and the only way to remove
the error is to declare one and only one Column constraint... So, it is
not possible then to use multiple columns in 'accumulate'? If not,
then it would be even more interesting to get some idea on how to
approach the kind of problem I mentioned in the previous post.....
Thanks,
Vlad
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users