[jboss-jira] [JBoss JIRA] Commented: (JBRULES-577) Please add "contained by" syntax for constraints
Dirk Bergstrom (JIRA)
jira-events at lists.jboss.org
Mon Apr 30 19:23:30 EDT 2007
[ http://jira.jboss.com/jira/browse/JBRULES-577?page=comments#action_12360950 ]
Dirk Bergstrom commented on JBRULES-577:
----------------------------------------
FYI, my app has evolved, and my use case now looks like this:
when
$user : User( $reports : reports )
$bug_list : BugSet( size > 0 ) from
collect( BugRecord( responsible memberOf $reports,
otherField == "whatever" ) )
then
...
This would be used to collect all the bugs belonging to User's employees and matching some other criteria.
I'm currently using a predicate to "fake" the memberOf operator, and it's evidently causing some problems. I'm hoping that this new syntax would alleviate the problems that Edson describes here:
http://jira.jboss.com/jira/browse/JBRULES-740#action_12358933
(though in fact it's not nearly as bad as he makes it out to be).
> Please add "contained by" syntax for constraints
> ------------------------------------------------
>
> Key: JBRULES-577
> URL: http://jira.jboss.com/jira/browse/JBRULES-577
> Project: JBoss Rules
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: Drl Parser/Builder
> Reporter: Dirk Bergstrom
> Assigned To: Edson Tirelli
>
> I'd like to be able to write a constraint to determine if a field's value is a member of some collection. This is the inverse of the "contains" keyword. The proposed syntax is:
> [bindingVar :] <fieldName> in <someCollection>
> (I'm not picky about the keyword, other possibilities are "containedBy" or "memberOf", but "in" is a single word)
> Use case:
> I have a container class with a field that exposes a collection of record
> numbers. In the working memory, I have a bunch of record objects, and one
> container object. I want to write a rule that fires when it encounters a
> container that has records matching some criteria:
> when
> Container( $recordNums : records )
> Record( number in $recordNums, otherField == "somevalue" )
> then
> doStuff();
> The current workaround is:
> Record( num : number -> ( $recordNums.contains(num) ) )
> Which is problematic, as the predicate may not be time-constant.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list