[rules-users] java.lang.IllegalArgumentException: Could not parse knowledge.

Lindy hagan lindyhagan at gmail.com
Tue Aug 25 14:45:41 EDT 2009


Getting below error for each and every rule in Vote.drl . Using Drools 5 and
eclipse 3.4.

Trying this example
http://www.developer.com/java/ent/article.php/10933_3821101_3


Rule Compilation error : [Rule name='VeryGoodValue – between 6-9']
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (3:79) : Syntax error
on tokens, delete these tokens
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (3:92) : The public
type Rule_VeryGoodValue_ must be defined in its own file
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (3:127) : Syntax
error, insert "}" to complete Block
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (4:134) : Syntax error
on tokens, delete these tokens
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:202) : Syntax error
on token "void", @ expected
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:234) : Syntax error
on token "KnowledgeHelper", ( expected after this token
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:284) : Syntax error
on token "m", delete this token
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:287) : Syntax error
on token(s), misplaced construct(s)
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert ")" to complete MethodInvocation
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert ")" to complete SingleMemberAnnotation
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert "enum Identifier" to complete EnumHeaderName
 com/examples/Rule_VeryGoodValue_–_between_6_9_0.java (6:309) : Syntax
error, insert "EnumBody" to complete EnumDeclaration

*Vote.drl*

package com.examples

import com.examples.drools.Vote;

rule "WrongValue – less than 0"
     when
          m : Vote( average < 0.0, vote : vote )
     then
          m.setAverage(0.0f);
          update( m );
end

rule "WrongValue – bigger than 10"
     when
          m : Vote( average > 10.0, vote : vote )
     then
          m.setAverage(10.0f);
          update( m );
end

rule "BadValue – between 0-3"
     when
          m : Vote( average >= 0.0 && average <=3.0, vote : vote )
     then
           m.setVote("Bad!");
          System.out.println( m.getVote() );
end

rule "GoodValue – between 3-6"
     when
          m : Vote( average >3.0 && average <=6.0, vote : vote )
     then
           m.setVote("Good!");
          System.out.println( m.getVote() );
end

rule "VeryGoodValue – between 6-9"
     when
          m : Vote( average >6.0 && average <=9.0, vote : vote )
     then
           m.setVote("Very Good!");
          System.out.println( m.getVote() );
end

rule "ExcellentValue – between 9-10"
     when
          m : Vote( average >9.0 && average <=10.0, vote : vote )
     then
           m.setVote("Excellent!");
          System.out.println( m.getVote() );
end
*

*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090825/1844df5c/attachment.html 


More information about the rules-users mailing list