<div dir="ltr"><br> You syntax is wrong. Fixing your syntax is as easy as saying:<br><br>exists ExamDetail( authLimit != null )<br><br> But I think that your rules can be simplified by simply writing:<br><br>rule "Rule n.1"<br>
dialect "mvel"<br>
no-loop true<br>
salience 10<br>
when<br>
$examDetail : ExamDetail( $value: value < authLimit);<br>
then<br>
System.out.println( "1 Exam passed!" + $value);<br>
end<br>
<br>
rule "Rule n.2"<br>
dialect "mvel"<br>
no-loop true<br>
salience 10<br>
when<br>
not ExamDetail( value < authLimit );<br>
then<br>
System.out.println( "2 Exam passed! + $value);<br>
end<br>
<br><br> This should cover both of your scenarios.<br><br> []s<br> Edson<br><br><div class="gmail_quote">2008/9/12 Nicola Benaglia <span dir="ltr"><nicola.benaglia@tecno-progetti.eu></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
I am moving my first steps with Drools <a href="http://4.0.7." target="_blank">4.0.7.</a><br>
<br>
In my case I have an exam result to valuate.<br>
I can pass an ExamDetailas fact containing (value, authLimit, lawLimit)<br>
where authLimit may or may not be present.<br>
<br>
How can I force to valuate a rule only if a property exists?<br>
<br>
Here an example:<br>
<br>
rule "Rule n.1"<br>
dialect "mvel"<br>
no-loop true<br>
salience 10<br>
when<br>
exists ExamDetail(authLimit);<br>
$examDetail : ExamDetail( $value: value < authLimit);<br>
then<br>
System.out.println( "1 Exam passed!" + $value);<br>
end<br>
<br>
rule "Rule n.2"<br>
dialect "mvel"<br>
no-loop true<br>
salience 10<br>
when<br>
not exists ExamDetail(authLimit);<br>
ExamDetail( $value: value < lawLimit);<br>
then<br>
System.out.println( "2 Exam passed! + $value);<br>
end<br>
<br>
<br>
With these 2 rules I expected to cover my 2 cases:<br>
1) When I have authLimit --> rule #1<br>
2) When authLimit is absent --> rule #2<br>
<br>
But I get this error (when I don't have authlimit):<br>
<br>
Exception in thread "main" org.drools.rule.InvalidRulePackage: [14,21]:<br>
unknown:14:21 Unexpected token 'authLimit'[25,6]: unknown:25:6<br>
Unexpected token 'exists'[25,24]: unknown:25:24 Unexpected token 'authLimit'<br>
at org.drools.rule.Package.checkValidity(Package.java:424)<br>
at<br>
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)<br>
at eu.tecnoprogetti.rules.seam.ExamCheck.main(ExamCheck.java:23)<br>
<br>
<br>
Any suggestions?<br>
Thank you for your time.<br>
Nico<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>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>