[jboss-jira] [JBoss JIRA] Created: (JBRULES-577) Please add "contained by" syntax for constraints

Dirk Bergstrom (JIRA) jira-events at jboss.com
Tue Dec 5 16:14:55 EST 2006


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: Mark Proctor


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