[rules-users] Re: Java vs mvel dialects

Krishna Satya krishna.ksatya at gmail.com
Thu May 15 10:00:41 EDT 2008


>
> Edson, Thanks so much for the reply.  It makes perfect sense to me.  I
> really appreciate it.

  - Krishna



>   Krishna,
>
>   The dialect configuration affects only semantic code blocks. I.e.,
> consequences, eval() blocks, etc.
>   They are designed to be interchangeable. That is why the examples have
> rules using each of the dialects.
>
>   It is mostly a matter of taste, but MVEL is a script language and as so
> has syntax sugar for nested object access, collections, maps, arrays etc...
> nothing more than that. Also, MVEL supports java syntax anyway. For
> instance, assuming you have a class:
>
>   Person {
>         Map<String, Address> addresses;
>         // gets/sets
>    }
>
>   The following consequence should run just fine, both in java and MVEL:
>
> then
>    $person.getAddresses().get("home").setStreetName("my street");
> end
>
>   Although, MVEL allows you to use a cleaner syntax:
>
> then
>    $person.addresses["home"].streetName = "my street";
> end
>
>   It is mostly a matter of taste.
>
>   []s
>   Edson
>
> 2008/5/14 Krishna Satya <krishna.ksatya at gmail.com>:
>
> > Hi, I am trying to understand the difference in how drl rules are
> expressed
> > via the java or mvel dialects.  Looking at the drools-examples it is not
> > exactly clear.  I was looking at the PetStore.drl which seems to specify
> the
> > dialects for various rules using both java and mvel.  Are there any
> > references to examples which showcase a rule that is expressed both
> through
> > java and mvel dialects so it is clear what the differences are.  The
> rules
> > in the PetStore.drl which specify java or mvel syntactically seem to look
> > the same.
> >
> > Also, are there any general suggestions as to when a rule author should
> use
> > the java or the mvel dialect.
> >
> > Thanks.
> > - K
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @ www.jboss.com
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20080514/57a78c73/attachment-0001.html
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080515/ce82eb80/attachment.html 


More information about the rules-users mailing list