<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">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&nbsp; 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;wolfgang.laun@gmail.com&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;wolfgang.laun@gmail.com&gt;<br>Subject: Re: [rules-users] Drools Guvnor: DSL with multiple fact fields conditions using "-" and eval<br>To: "Rules Users List" &lt;rules-users@lists.jboss.org&gt;<br>Date: Friday, August 27, 2010, 2:58 AM<br><br><div id="yiv453030925">It seems that the initial hyphen merges the
 DSL definition'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'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>&nbsp;&nbsp; [when]-name empty=name=="''"<br><br>has to be written without the apostrophes:<br><br>&nbsp;&nbsp; [when]-name empty=name==""<br><br>-W<br><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td style="font: inherit;" valign="top"><br><br>
</td></tr></tbody></table><br><br><div class="yiv453030925gmail_quote">2010/8/27 Patricia Bogoevici <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:patriciabogoevici@yahoo.com" target="_blank" href="/mc/compose?to=patriciabogoevici@yahoo.com">patriciabogoevici@yahoo.com</a>&gt;</span><br><blockquote class="yiv453030925gmail_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: 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 class="yiv453030925im"><br>[when] There is an Asset=asset:Asset()<br></div>[when]-name is empty=eval(name=="''")<br>[when]-tag is empty=eval(tag=="''")<br><br>Rule source:<br>
&nbsp;&nbsp;&nbsp; rule "test_rule"<br>&nbsp;&nbsp;&nbsp; dialect "mvel"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asset:Asset( eval(name=="''", eval(tag=="''") ) )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; end<br><br>2) no eval, but with the parenthesis:<br>
DSL:<div class="yiv453030925im"><br>[when] There is an
 Asset=asset:Asset()<br></div>[when]-name is empty=(name=="''")<br>[when]-tag is empty=(tag=="''")<br><br>Rule source<br>&nbsp;&nbsp;&nbsp; rule "test_rule"<br>&nbsp;&nbsp;&nbsp; dialect "mvel"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asset:Asset( (name=="''", (tag=="''") ) )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; end<br><br>3) simple case<br>DSL<div class="yiv453030925im"><br>[when] There is an Asset=asset:Asset()<br>
</div>[when]-name empty=name=="''"<br>[when]-tag empty=tag=="''"<br><br>Rule Source:<br>&nbsp;&nbsp;&nbsp; rule "test_rule"<br>&nbsp;&nbsp;&nbsp; dialect "mvel"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asset:Asset( name=="''", tag=="''" )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; end<br><br>Thanks,<br><br>--- On <b>Thu, 8/26/10, Mauricio Salatino <i>&lt;<a rel="nofollow" ymailto="mailto:salaboy@gmail.com" target="_blank" href="/mc/compose?to=salaboy@gmail.com">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" ymailto="mailto:salaboy@gmail.com" target="_blank" href="/mc/compose?to=salaboy@gmail.com">salaboy@gmail.com</a>&gt;<br>
Subject: Re: [rules-users] Drools Guvnor: DSL with multiple fact fields conditions using "-" and eval<br>To: "Rules Users List" &lt;<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
Date: Thursday, August 26, 2010, 10:43 PM<div><div></div><div class="yiv453030925h5"><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: 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" target="_blank" href="http://mc/compose?to=patriciabogoevici@yahoo.com">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: 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 "-" 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 "-".&nbsp; 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 "-" 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 "test_dsl"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dialect "mvel"<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asset:Asset( eval(StringUtils.isBlank(name, eval(StringUtils.isBlank(tag)) )) )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asset.setStatus("INVALID")<br>&nbsp;&nbsp;&nbsp; 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&nbsp; BRL editor, I created a second rule using the DSL above. The rule validated ok, and the rule source looks fine:<br>

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

&nbsp;&nbsp;&nbsp; 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" target="_blank" href="http://mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;- CTO @ <a rel="nofollow" target="_blank" href="http://www.plugtree.com">http://www.plugtree.com</a>&nbsp; <br>&nbsp;- MyJourney @ <a rel="nofollow" target="_blank" href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br>

&nbsp;- Co-Founder @ <a rel="nofollow" target="_blank" href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br>&nbsp;<br>&nbsp;- Salatino "Salaboy" Mauricio -<br>
</div><br></div></div>-----Inline Attachment Follows-----<div class="yiv453030925im"><br><br><div>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow" target="_blank" href="http://mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">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" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" href="/mc/compose?to=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></div></blockquote></td></tr></table><br>