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

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Wed May 2 15:13:30 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-577?page=all ]

Edson Tirelli resolved JBRULES-577.
-----------------------------------

    Resolution: Done

Support to memberOf operator was added to the core engine. So, now you can write field constraints with the following syntax:

[ <bindvar> : ] <fieldName> [not] memberOf <collectionsVariable>

Example for "memberOf":

Cheese( type memberOf $cheeses )

Exemple for "not memberOf":

Person( id not memberOf $brazilianEmployees )

The bound variable against which the field is restricted must be an object of a class that implementes java.util.Collections.

Any question or problem, just let me know plz.



> 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