[rules-users] Help on using Drools with embedded objects

Sudhir M sudhir.cse at gmail.com
Mon Feb 23 06:02:21 EST 2009


Hi D,
I don't know which version of drools are you using. If u are using drools 4
or higher you can use 'from'  to write rules on nested objects. All u need
to do is insert the root pbject in the working memory

Regards,
sudhir.

On Mon, Feb 23, 2009 at 2:56 PM, Divya Rajendranath <
divya.rajendranath at gmail.com> wrote:

> Hi,
>
> I am planning to use Drools - JBoss Rules Engine. My requirement is to
> disburse mails from my application to different groups based on various
> criteria. I want to use Drools here.
>
> My object structure is as follows:
>
> class A{
>
> String B = "";
>
> B b;
>
> C c;
> }
>
> Hence Obj A has embedded objects within it, and obj B and C further has
> embedded objects.
>
> class B {
>
> String X;
>
> Z z;
>
> }
>
> class Z{
>
> String t;
>
> String s;
>
> }
>
> The decision on sending the mails based on the fields in embedded objects
> of A. I pass instance of A to Drools
>
> Format of drl file:
>
> package...;
>
> import ..;
>
> rule "Test"
>
> when $a:A(B(Z(s == "testvalue")))
>
> then
>
> $a.setSomething();
>
> update($a);
>
> end
>
> I wanted to know if this (accessing fields in embedded/child object) is
> feasible with Drools.
>
> I get an error saying "UNable to compile myfile.drl when i try to fo this.
>
> Could some one look into this issue and let me know the reason for this ?
>
>
>
> Thanks
>
> -D
>
> _______________________________________________
> 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/20090223/e844171e/attachment.html 


More information about the rules-users mailing list