[rules-users] Querying for a particular object from working memory

Jai Vasanth jaivasanth at gmail.com
Fri Feb 1 11:32:17 EST 2008


Thanks.

On Feb 1, 2008 7:36 AM, Anstis, Michael (M.) <manstis1 at ford.com> wrote:

>  Hi,
>
> Yep, this can be done with the following:-
>
> rule "largest X"
>     when
>         X ( $v : value )
>         not X (value > $v)
>     then
>         // $v is the maximum
> end
>
>  rule "lowest X"
>     when
>         X ( $v : value )
>         not X (value < $v)
>     then
>         // $v is the minimum
>
> There are more examples on the wiki.
>
> Cheers,
>
> Mike
>
>  ------------------------------
> *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Jai Vasanth
> *Sent:* 01 February 2008 15:14
> *To:* Rules Users List
> *Subject:* [rules-users] Querying for a particular object from working
> memory
>
> Hi,
>
>   Is there a way to query for an object of type X among a pool of objects
> of type X in working memory that have the maximum/minimum value  of a
> particular attribute  a1 ?
>
> For example
>
> if I have a class C
>
> Class C {
>
> int a1;
> int a2;
>
> }
>
> As part of my rules evaluataion I have N instances of C inserted into
> working memory  c1,c2.....cn.  Now I would like to query for the object that
> the max value of attribute a1
>
> Is this possible?
>
> Thanks
> Jai
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080201/bc11a80c/attachment.html 


More information about the rules-users mailing list