[rules-users] depicting array in rules

Esteban Aliverti esteban.aliverti at gmail.com
Wed Jun 9 15:27:51 EDT 2010


One way could be:

*
*

*when*



      Fire($room : room)

      $sprinkler : Sprinkler(room contains $room)

      Room (this == $room, someField == "SomeValue")

      *then*

            *modify*($sprinkler){

                  setStatus(true)

                  };

End

If you dont have the Room as a Fact Type, then:

*when*



      Fire($room : room)

      $sprinkler : Sprinkler(room contains $room)

      Room (someField == "SomeValue")from $room

      *then*

            *modify*($sprinkler){

                  setStatus(true)

                  };

End


I'm not 100% sure about this, but at least you can start from here

Best
2010/6/9 Fnu Mahalakshmi <FMahalakshmi at nyx.com>

>  Hi,
>
>
>
> Is there any way I can represent an array of values in my rules??
>
> I want to do this:
>
> Fire{
>
> Room,
>
> Status}
>
> Sprinkler{
>
> Object [] Room = new Room[]{new Room(),new room()}
>
> Status
>
> }
>
> Room{
>
> Name,
>
> Number}
>
>
>
> Rule “ if fire in room start sprinkler if room has sprinkler”
>
> No-loop true
>
> *when*
>
>
>
>       Fire($room : room)
>
>       $sprinkler : Sprinkler( room == $room) # how can I search through the
> array of room values here???????
>
>       *then*
>
>             *modify*($sprinkler){
>
>                   setStatus(true)
>
>                   };
>
> End
>
>
>
>
>
> Any Idea if that is possible to implement in rules???
>
> I could do it with adding different instances of sprinkler and rooms. But I
> want to minimize the amount of repetition in data stored and loaded into the
> working memory.
>
>
>
> Any idea??
>
> Thank you,
>
> M
>
> ------------------------------
>
> *Please consider the environment before printing this email.*
>
> *Visit our website at http://www.nyse.com
> *****************************************************************************
>
> Note: The information contained in this message and any attachment to it is
> privileged, confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify the sender immediately by replying to
> the message, and please delete it from your system. Thank you. NYSE
> Euronext. *
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100609/fa3af594/attachment.html 


More information about the rules-users mailing list