[rules-users] looking for more information on drools expert
Edson Tirelli
tirelli at post.com
Thu Jul 16 09:34:15 EDT 2009
Very good! :)
Just FYI, in the case of accumulate, you could also use the collectList()
function to simplify your rule. This:
$alarmList : LinkedList()
from accumulate ( ($e : Element(parentindex!=0) and
$a : Alarm( origin matches
$e.name&& probablecause==45)),
init( LinkedList alarmList = new
LinkedList();),
action( alarmList.add($a);),
reverse( alarmList.remove($a);),
result( alarmList ) );
Is the same as:
$alarmList : List()
from accumulate ( ($e : Element(parentindex!=0) and
$a : Alarm( origin matches
$e.name&& probablecause==45)),
collectList( $a ) );
Also, you can always implement your own functions for accumulate:
http://blog.athico.com/2009/06/how-to-implement-accumulate-functions.html
Finally, I see you are using "matches" operator to compare equal strings.
Not sure if that is what you want, because "==" has different semantics and
better performance than "matches" if what you really want is compare
equality. Remember that in regexps, some characters have special meaning,
for instance, "." is a wildcard for any character. Meaning:
"abc" matches "a.c" -> true
"abc" == "a.c" -> false
Cheers,
Edson
2009/7/16 Gab Aldian <aldian.gp at gmail.com>
> After some more investigation, I managed also to make it work with
> collect: http://drools.pastebin.com/m14f0e329
>
> I would rather not multiplicate rules, because we probably will have
> dozens for our system which is very big and can supervise around a
> thousand equipements in some cases
>
> Thank you very much for the advices
>
> Aldian
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> http://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090716/f5a1e014/attachment.html
More information about the rules-users
mailing list