[rules-users] Compilation Error in Drools

Edson Tirelli tirelli at post.com
Thu Jul 12 18:17:59 EDT 2007


   Best way to investigate this is to expand your DSL to the DRL to check
how the expansion is working.

        DrlParser parser = new DrlParser();
        String expanded = parser.getExpandedDRL( drlSourceString, dslReader
);

   Check what is wrong in the expanded DRL. I see your map has an error:

$stud : Student(name == "{studName}")

   The comparison must be made with '==' as above instead of '=' as in your
template. But I don't know if that is the only problem.

   []s
   Edson

2007/7/12, McShiv <rajesh_sachin10 at yahoo.co.in>:
>
>
> Hi All,
>
>     I used the following code in the dsl file.
>
> DSL:
>
>     [when] Check whether the name is present as "{studName}" = $stud :
> Student(name = "{studName}");
>     [then] Set the Error Code {errorCode} = String string =
> $stud.getName();
> Error(errorCode, string);
>
> DRL:
>
>     package com.policy;
>     expander StudendProgram.dsl;
>     import java.util.Iterator;
>     import com.class.Student;
>     import com.class.Error;
>
>    rule "StudendProgram_1"
>
>         when
>                 Check whether the name is present as "Stephen"
>         then
>                 Set the Error Code 88
>     end
>
>
> When I try to run this program I got the following error.
>
>    Caused by: org.drools.rule.InvalidRulePackage: Rule Compilation error
> File com/policy/Rule_SpeCodeSpeValProdPlan12_0.java, Line 12, Column 176:
> Unexpected token "." in primary
>
> When I remove the Line "$stud.getName();" in the then part and set the
> error
> code alone its working fine. The "." inbetween $stud and getName() may be
> the problem. But I don't know the solution for this.
>
> Any suggessions on this.
>
> Thanks,
> McShiv....
> --
> View this message in context:
> http://www.nabble.com/Compilation-Error-in-Drools-tf4071029.html#a11569413
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070712/bd8a11bd/attachment.html 


More information about the rules-users mailing list