DSL uses regular expression parsing, but the LHS is recursive.  (Chomsky type-3 vs. type-2, if you want the comp. sci. background.) This means that using DSL restricts you to a subset of the LHS language, although you may map arbitrarily complex LHS expressions to a single DSL sentence. (In your case, you would have to have three mappings, one for name, one for tag and one for name and tag.)<br>
<br>Heuristics might be use to alleviate certain cases, but this would merely be a band-aid on a very deep gash.<br><br>There&#39;s another trick to avoid eval as you use it: Create (what I call:) &quot;virtual attributes&quot; by adding methods to your fact classes. You have<br>
   String name;<br>   String getName(){ return name; }<br>and if you add<br>   boolean isNameBlank(){ return StringUtils.isBlank( name ); }<br>you can use<br>   Asset( nameBlank == true )<br>and define a straightforward DSL sentence which can be merged with others into the fact pattern.<br>
<br>-W<br><br><br><div class="gmail_quote">2010/8/27 Patricia Bogoevici <span dir="ltr">&lt;<a href="mailto:patriciabogoevici@yahoo.com">patriciabogoevici@yahoo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Thx for your answer, Wolfgang.<br><br>To be honest, when I first ran into this, I was in doubt whether that is a parsing error in Drools (or  mvel)? Or is an error that I got into because of how I constructed the DSL expression?<br>
It seems that it is an error in Drools and I wonder if that should be reported as an issue in Jira.<br><br>--- On <b>Fri, 8/27/10, Wolfgang Laun <i>&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</i></b> wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;<br>Subject: Re: [rules-users] Drools Guvnor: DSL with multiple fact fields conditions using &quot;-&quot; and eval<br>
To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>Date: Friday, August 27, 2010, 2:58 AM<br><br><div>It seems that the initial hyphen merges the
 DSL definition&#39;s right hand side into the parenthesis of the last preceding term, even if that one is an eval, which itself is meant to go into some preceding pattern.<br><br>
You could work around that by making all evals Conditional Elements rather than Inline Eval Constraints. The disadvantage is that you&#39;ll have to use full object qualification, e.g., <br><br>[when]where name is empty=eval(StringUtils.isBlank( asset.getName() )<br>

<br>Patricia:<br>True. But, that is a test case, and does not affect the result of what I was testing<br><br>I think that your variant<br><br>   [when]-name empty=name==&quot;&#39;&#39;&quot;<br><br>has to be written without the apostrophes:<br>
<br>   [when]-name empty=name==&quot;&quot;<br><br>-W<br><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top"><br>
<br>
</td></tr></tbody></table><br><br><div>2010/8/27 Patricia Bogoevici <span dir="ltr">&lt;<a rel="nofollow" href="http://mc/compose?to=patriciabogoevici@yahoo.com" target="_blank">patriciabogoevici@yahoo.com</a>&gt;</span><br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">

Thx for your answer.<br><br>I tried again the rule, removing the extra space after hyphen from DSL expresion. No luck. So, I tried a few more cases, and the only one that worked correctly was #3. <br>It seems to me that is somehow related to the parenthesis, although it might be something else. Hope this info helps. <br>

<br>1) only eval:<br>DSL:<div><br>[when] There is an Asset=asset:Asset()<br></div>[when]-name is empty=eval(name==&quot;&#39;&#39;&quot;)<br>[when]-tag is empty=eval(tag==&quot;&#39;&#39;&quot;)<br><br>Rule source:<br>
    rule &quot;test_rule&quot;<br>    dialect &quot;mvel&quot;<br>        when<br>            asset:Asset( eval(name==&quot;&#39;&#39;&quot;, eval(tag==&quot;&#39;&#39;&quot;) ) )<br>        then<br>    end<br><br>2) no eval, but with the parenthesis:<br>

DSL:<div><br>[when] There is an
 Asset=asset:Asset()<br></div>[when]-name is empty=(name==&quot;&#39;&#39;&quot;)<br>[when]-tag is empty=(tag==&quot;&#39;&#39;&quot;)<br><br>Rule source<br>    rule &quot;test_rule&quot;<br>    dialect &quot;mvel&quot;<br>

        when<br>            asset:Asset( (name==&quot;&#39;&#39;&quot;, (tag==&quot;&#39;&#39;&quot;) ) )<br>        then<br>    end<br><br>3) simple case<br>DSL<div><br>[when] There is an Asset=asset:Asset()<br>
</div>[when]-name empty=name==&quot;&#39;&#39;&quot;<br>[when]-tag empty=tag==&quot;&#39;&#39;&quot;<br><br>Rule Source:<br>    rule &quot;test_rule&quot;<br>    dialect &quot;mvel&quot;<br>        when<br>             asset:Asset( name==&quot;&#39;&#39;&quot;, tag==&quot;&#39;&#39;&quot; )<br>

        then<br>    end<br><br>Thanks,<br><br>--- On <b>Thu, 8/26/10, Mauricio Salatino <i>&lt;<a rel="nofollow" href="http://mc/compose?to=salaboy@gmail.com" target="_blank">salaboy@gmail.com</a>&gt;</i></b>
 wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Mauricio Salatino &lt;<a rel="nofollow" href="http://mc/compose?to=salaboy@gmail.com" target="_blank">salaboy@gmail.com</a>&gt;<br>

Subject: Re: [rules-users] Drools Guvnor: DSL with multiple fact fields conditions using &quot;-&quot; and eval<br>To: &quot;Rules Users List&quot; &lt;<a rel="nofollow" href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>

Date: Thursday, August 26, 2010, 10:43 PM<div><div></div><div><br><br><div>can you try with this:<br>[when] There is an Asset=asset:Asset()<br>[when] -name is 
empty=eval(StringUtils.isBlank(name))<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">

<br>[when] -tag is 
empty=eval(StringUtils.isBlank(tag))</td></tr></tbody></table><br><br><div>2010/8/26 Patricia Bogoevici <span dir="ltr">&lt;<a rel="nofollow" href="http://mc/compose?to=patriciabogoevici@yahoo.com" target="_blank">patriciabogoevici@yahoo.com</a>&gt;</span><br>


<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">


Hi all,<br><br>I am using the latest Guvnor release (5.1), and I have the following DSL expression where I use &quot;-&quot; to have conditions on multiple lines:<br><br>[when] There is an Asset=asset:Asset()<br>[when]- name is empty=eval(StringUtils.isBlank(name))<br>


[when]- tag is empty=eval(StringUtils.isBlank(tag))<br><br>Having these DSL expressions, I wanted to create a rule, but I ran into some issues. <br>To summarize: There seems to be a parsing error, when conditions are added in DSL using &quot;-&quot;.  Did anybody else run into this problem? I wonder if I do something wrong, but, re-creating the DSL to have the 2 conditions into one expression, is all working fine. It may be a combination of &quot;-&quot; and eval? <br>


<br>Below, is the description of rules created, and error I got.<br><br>First, I created a rule using the above DSL expressions in the BRL editor. While the
 rule looked ok in the editor, and it validated fine, only when I checked the source I noticed is wrong. So, the rule source looks like this:<br>rule &quot;test_dsl&quot;<br>        dialect &quot;mvel&quot;<br>        when<br>


            asset:Asset( eval(StringUtils.isBlank(name, eval(StringUtils.isBlank(tag)) )) )<br>        then<br>            asset.setStatus(&quot;INVALID&quot;)<br>    end<br><br>It looks that the conditions are parsed incorrectly, and the second eval condition is added as a parameter to the StringUtils.isBlank from the first eval. Also, all the right parenthesis are added at the end of the expression. If I add one condition at a time, it all works fine. The error is when I have more than 1 condition. <br>


<br>So, I created a new DSL, that contains both
 conditions into one line, eliminating the hyphen between conditions:<br><br>[when] There is an asset with name empty AND tag empty =asset:Asset(eval(StringUtils.isBlank(name)),eval(StringUtils.isBlank(tag)))<br><br>Using  BRL editor, I created a second rule using the DSL above. The rule validated ok, and the rule source looks fine:<br>


<br>rule &quot;test_dsl_1&quot;<br>        dialect &quot;mvel&quot;<br>        when<br>            asset:Asset(eval(StringUtils.isBlank(name)),eval(StringUtils.isBlank(tag)))<br>        then<br>            asset.setStatus(&quot;INVALID&quot;)<br>


    end<br><br>I created a test for this rule, that ran correctly.<br><br><br>Thanks,<br>Patricia<br></td></tr></tbody></table><br>

      <br>_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> - CTO @ <a rel="nofollow" href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a>  <br> - MyJourney @ <a rel="nofollow" href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>


 - Co-Founder @ <a rel="nofollow" href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br> <br> - Salatino &quot;Salaboy&quot; Mauricio -<br>
</div><br></div></div>-----Inline Attachment Follows-----<div><br><br><div>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>

<a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></div></div></blockquote></td></tr></tbody></table><br>







      <br>_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>
</div><br>-----Inline Attachment Follows-----<br><br><div>_______________________________________________<br>rules-users mailing list<br><a href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></div></blockquote></td></tr></tbody></table><br>

      <br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>