[rules-users] first steps with drools.....first errors
Nicola Benaglia
nicola.benaglia at tecno-progetti.eu
Fri Sep 12 12:28:54 EDT 2008
Hi,
I am moving my first steps with Drools 4.0.7.
In my case I have an exam result to valuate.
I can pass an ExamDetailas fact containing (value, authLimit, lawLimit)
where authLimit may or may not be present.
How can I force to valuate a rule only if a property exists?
Here an example:
rule "Rule n.1"
dialect "mvel"
no-loop true
salience 10
when
exists ExamDetail(authLimit);
$examDetail : ExamDetail( $value: value < authLimit);
then
System.out.println( "1 Exam passed!" + $value);
end
rule "Rule n.2"
dialect "mvel"
no-loop true
salience 10
when
not exists ExamDetail(authLimit);
ExamDetail( $value: value < lawLimit);
then
System.out.println( "2 Exam passed! + $value);
end
With these 2 rules I expected to cover my 2 cases:
1) When I have authLimit --> rule #1
2) When authLimit is absent --> rule #2
But I get this error (when I don't have authlimit):
Exception in thread "main" org.drools.rule.InvalidRulePackage: [14,21]:
unknown:14:21 Unexpected token 'authLimit'[25,6]: unknown:25:6
Unexpected token 'exists'[25,24]: unknown:25:24 Unexpected token 'authLimit'
at org.drools.rule.Package.checkValidity(Package.java:424)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
at eu.tecnoprogetti.rules.seam.ExamCheck.main(ExamCheck.java:23)
Any suggestions?
Thank you for your time.
Nico
More information about the rules-users
mailing list