[rules-users] "Or" and Collect

Dirk Bergstrom dirk at juniper.net
Wed May 30 01:33:13 EDT 2007


Edson Tirelli was heard to exclaim, On 05/29/07 17:13:
> $badBugs : List() from
> collect( Bug( (devOwner memberOf $group || supportOwner memberOf $group),
>          severity == "hair-on-fire" )
> And use || and && for connecting constraints
> and "and" and "or" for connecting CE's.

Ahh, ok.  From the examples I'd seen, it was hard to tell, and the docs still
show the two as equivalent for connecting CEs (section 3.15).

This will allow me to replace an ugly predicate hack with a clunky but workable
parenthetical grouping.  Of course, if you'd care to implement yet another handy
Collections-based constraint, I could make it really clean:

We've got "contains", and now "memberOf" (thanks for implementing my
suggestion), so how about "intersects"?

  CheeseCounter( stinkyCheeses intersects crumblyCheeses )

Then I could write my rule like so:

collect( Bug( (owners intersects $group), ...

This would save me from having to edit ten or twenty rules when management
inevitably decides that another kind of owner has to be included in the rules --
there are actually five "owners" now (which makes for a very ugly parenthetical).

Can I file a jira for "intersects", or should I quit being greedy, and enjoy the
shiny new "memberOf" that I am in fact very happy about? :)

-- 
Dirk Bergstrom               dirk at juniper.net
_____________________________________________
Juniper Networks Inc.,          Computer Geek
Tel: 408.745.3182           Fax: 408.745.8905



More information about the rules-users mailing list