<div>is there any restriction in terms of using custom function in condition etc. </div>
<div>If I add function evaluation to conditions its messing up with dsl. For pattern matching if I use custom function defined in drl then its not able to parse that properly</div>
<div> </div>
<div>[when][] {attr:\S+} follows pattern {pattern:\S+} =  funcToEvalPattern({attr},( {pattern} )<br></div>
<div>in this case it is getting translated to  </div>
<div>exists(Person:Person(subordinate != null <font size="2">, funcToEvalPattern( </font><b><font color="#960000" size="2"><font color="#960000" size="2">eval</font></font></b><font size="2">( name, </font><font color="#008000" size="2"><font color="#008000" size="2">&quot;I&quot;</font></font><font size="2"> ) ) )</font></div>

<div>where as I was hoping this to be 
<div>exists(Person:Person(subordinate != null <font size="2">, <strong><font color="#960000">eval </font></strong>(funcToEvalPattern</font><font size="2">( name, </font><font color="#008000" size="2"><font color="#008000" size="2">&quot;I&quot;</font></font><font size="2"> ) ) )</font></div>
</div>
<div><br>Regards,</div>
<div>-Maverik</div>
<div> </div>
<div class="gmail_quote">On Tue, Jan 4, 2011 at 12:24 PM, maverik j <span dir="ltr">&lt;<a href="mailto:maverikj348@gmail.com">maverikj348@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>cool...this was of great help, I will try this out I think it shoudl solve the purpose.</div>
<div> </div>
<div>Thanks once again,</div>
<div>Maverik <br><br></div>
<div class="gmail_quote">2011/1/3 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> 
<div>
<div></div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Try using eval as a last resort. A better (smaller, more robust) DSL can be designed around facts and their attributes.<br>
<br>&quot;||&quot; (and &quot;OR&quot;) can be used, but setting parentheses in order to get the priority right is difficult. In constraints, you may have to resort to &quot;memberof&quot; or &quot;not memberof&quot;.<br>
<br>Your sample isn&#39;t self-contained. But I think that the following DSL and the DSLR might give you some ideas how to proceed.<br><br>[keyword][]check that {conditions}= eval( {conditions} )<br>[keyword][]AND = &amp;&amp;<br>
[keyword][]OR  = ||<br><br>[when][][Tt]here is an? {entity}= {entity}: {entity}()<br>[when][][Tt]here is at least one {entity}= exists {entity}: {entity}()<br><br>[when][]the {entity:\w+}&#39;s {attr:\w+} = {entity}.get{attr}()<br>
<br>[when][]- with a valid {attr} = {attr}: {attr} != null<br>[when][]- with {attr} not equal to {value} = {attr} != {value}<br>[when][]- eval\( {whatever} \)=eval( {whatever} )<br><br>[when][] {attr:\S+} follows pattern {pattern:\S+} =  {attr}.matches( {pattern} )<br>
[when][] {attr:\S+} not equals? {value:\S+} = ! {attr}.equals( {value} )<br>[when][] {attr:\S+} is valid  =  {attr} != null<br> <br>rule &quot;Rule 5&quot;<br>when<br>    There is a Department<br>    There is at least one Person<br>
    - with name not equal to &quot;xxx&quot;<br>    - with a valid subordinate <br>    - check that the Person&#39;s Id is valid AND the Department&#39;s Id follows pattern &quot;I&quot; AND the Department&#39;s HeadOfDpt not equal name<br>
then<br>end<br><br>Notice that &quot;-check that...&quot; must be written as a single line.<br><br>-W<br><br><br><br><br>
<div class="gmail_quote">2011/1/3 maverik j <span dir="ltr">&lt;<a href="mailto:maverikj348@gmail.com" target="_blank">maverikj348@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div>
<div></div>
<div>
<div>Hi,</div>
<div> </div>
<div> We are planning to use DSL/DSRL approach with generic DSL template like say</div>
<div><font size="2">
<p align="left">[condition][]The {object} has valid {field}={object}({field} != null )</p>
<p align="left">[condition][]there is object {<u>obj</u>} that = {<u>obj</u>}()</p>
<p align="left">[condition][]- has {<u>attr</u>} equal {<u>val</u>} = {<u>attr</u>} == {<u>val</u>}</p>
<p align="left">[condition][]- has valid {<u>attr</u>} = {<u>attr</u>} != null</p>
<p>[condition][]- and has {<u>attr</u>} equal {value}= &amp;&amp; {<u>attr</u>} == {value}</p></font></div>
<div> </div>
<div>But there are quite few of requirements like to have DSL rules that can generate expression as follows:</div>
<div>exists Employee(<br>   attribute name not equals &quot;xxx&quot;<br>   &amp;&amp; the attribute subOrdinate is not null<br>   &amp;&amp; eval(<br>   the attribute $dept.getId() is not null   <br>   &amp;&amp; attribute $dept.getId() follows pattern &quot;I&quot; <br>
   &amp;&amp; ( ! (the attribute $dept.getHeadOfDpt() equals name)<br>   )<br>)</div>
<div> </div>
<div>I am not sure if this is possible with DSL. Using &#39;-&#39; operator we cannot really add &#39;&amp;&amp;&#39;, &#39;||&#39; conditions it by-default expands to &#39;,&#39; separated and conditions. And wirtting generic rules with and/or is not really dynamic to allow any number of expressions in evaluation.</div>

<div> </div>
<div>i am struggling to get this run since long time so any help/thoughts on this would be  highly appriciable !!!</div>
<div> </div>
<div>Thanks &amp; Regards,</div>
<div>-Maverik</div><br></div></div>_______________________________________________<br>rules-users mailing list<br><a href="mailto: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>
<br></blockquote></div><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto: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>
<br></blockquote></div></div></div><br></blockquote></div><br>