[rules-users] "Or" and Collect

Edson Tirelli tirelli at post.com
Tue May 29 20:13:21 EDT 2007


   Hey Dirk,

    Trunk already supports || and && without sub-rule generation.


rule "severe bugs for which a member of your group is dev or support owner"
when
    $group : UserGroup( )
    $badBugs : List() from
         collect( Bug( (devOwner memberOf $group || supportOwner memberOf
$group),
                             severity == "hair-on-fire" )
then
    $group.runAroundInStarkRavingPanicOver($badBugs)
end

   Just remember that collect is heavy. :) Other than that you are fine. And
use || and && for connecting constraints (no sub-rule generation) and "and"
and "or" for connecting CE's.

  []s
  Edson

2007/5/29, Dirk Bergstrom <dirk at juniper.net>:
>
> In my ongoing efforts to abuse Drools syntax, I would like to write rules
> like this:
>
> rule "severe bugs for which a member of your group is dev or support
> owner"
> when
> $group : UserGroup( )
> $badBugs : List() from
> collect( Bug( (devOwner memberOf $group or supportOwner memberOf $group),
>   severity == "hair-on-fire" )
> then
> $group.runAroundInStarkRavingPanicOver($badBugs)
> end
>
> Will that work?  Is that the right syntax?  Will it be performant if I've
> got
> 10000 Bugs and 1000 UserGroups?
>
> According to Mark's "What's New in JBoss Rules 4.0" presentation, you can
> use &&
> and || without subrule generation, and I have a vague memory of seeing
> something
> about "and" & "or" as well, but I can't remember where I saw it.
>
> Thanks.
>
> --
> Dirk Bergstrom               dirk at juniper.net
> _____________________________________________
> Juniper Networks Inc.,          Computer Geek
> Tel: 408.745.3182           Fax: 408.745.8905
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070529/af18231c/attachment.html 


More information about the rules-users mailing list