[rules-users] Unexpected token "." in primary - Rule Compilation Error

Michael Neale michael.neale at gmail.com
Sat Jun 30 01:18:08 EDT 2007


hmm.. there is a problem with the action of the 2nd rule, so, converting it
to vanilla DRL:

rule "SpeCodeSpeValProdPlan12"
salience 50

 when
  ...
 then
  if(common.getProd() == "{prodCode1}" || common.getPlan() ==
"{planCode1}"){System.out.println("Error");}
end

That doesn't look quite right - you are doing == on strings - .equals would
be better). I would try that rule on its own, without a DSL - to see what is
causing it. Also - why are you doing the if on the RHS? I would get rid of
that if at all possible to save confusion later.

On 6/30/07, McShiv <rajesh_sachin10 at yahoo.co.in> wrote:
>
>
> DRL Syntax
> package com.policy;
> expander SpeCodeSpeValProdPlan.dsl;
> #list any import classes here.
> import com.viking.common.transferbeans.CommonInformation;
> import com.sentry.common.entitybeans.EntityBean;
> import com.sentry.common.entitybeans.Selected;
> import java.util.ArrayList;
> import java.util.List;
> #declare any global variables here
>
> rule "SpeCodeSpeValProdPlan11"
> salience 100
>
> when
>   The EntityBean Contains Selected List
> then
>   Assert All The Selected
> end
>
> rule "SpeCodeSpeValProdPlan12"
> salience 50
>
> when
>   The Question Code Is "License" And The Selected Value is "Y"
> then
>   Remove The Product "09" And Plan "CD"
> end
>
> DSL Syntax:
>
> [when] The EntityBean Contains Selected List = entity : EntityBean();
> eval(entity.getSelected() != null);
> [then] Assert All The Selected = Object[] quoSelList = entity.getSelected
> ();
> for(int i = 0; i < quoSelList.length; i++){ Selected queSel =
> (Selected)quoSelList[i]; assert(queSel); System.out.println(queSel); }
>
> [when] The Question Code Is "{speCode1}" And The Selected Value is
> "{speValue1}" = common : CommonInformation(); Selected(stateSpecificCode
> ==
> "{speCode1}", stateSpecificValue == "{speValue1}");
> [then] Remove The Product "{prodCode1}" And Plan "{planCode1}" =
> if(common.getProd() == "{prodCode1}" || common.getPlan() ==
> "{planCode1}"){System.out.println("Error");}
>
>
> The Selected Class is an Object Array inside EntityBean Class.
> CommonInformation is a seperate class. CommonInformation & EntityBean will
> be available in Working Memory(asserted earlier in java class).
>
> I need to remove the Selected Classes in the Object array and assert into
> the working memory. Thats what I am doing in the First Rule.
>
> In the Second rule I check for some condition and print the error
> according
> to the condition.
> Thanks,
> McShiv
>
> Fernando Meyer Camargo wrote:
> >
> > howdy,
> >
> >       is your package name right? please paste your rule code.
> >
> > Fernando Meyer
> > fmcamargo at gmail.com
> > GPG: 5A6D 3374 B055 A513 9A02  A03B 3DB3 7485 D804 DDFB
> >
> >
> > On Jun 29, 2007, at 10:16 PM, McShiv wrote:
> >
> >>
> >> com.package.FatalSystemException
> >>      at org.drools.rule.Package.checkValidity(Unknown Source)
> >>      at org.drools.reteoo.RuleBaseImpl.addPackage(Unknown Source)
> >>      at
> >> com.sentry.underwriting.ruleexecutor.DroolsExecutor.executeRules
> >> (DroolsExecutor.java)
> >>      at
> >> com.sentry.underwriting.ruleexecutor.RulesExecutionProcessor.callRules
> >> Executor(RulesExecutionProcessor.java:82)
> >>      at
> >> com.sentry.underwriting.ruleexecutor.RulesExecutionProcessor.rulesExec
> >> utionprocess(RulesExecutionProcessor.java:65)
> >>      at
> >> com.sentry.underwriting.ruleprocessor.RulesProcessor.processRules
> >> (RulesProcessor.java)
> >>      at
> >> com.sentry.underwriting.test.UnderwritingDemo.main
> >> (UnderwritingDemo.java:21)
> >> Caused by: org.drools.rule.InvalidRulePackage: Rule Compilation
> >> error File
> >> com/policy/Rule_SpeCodeSpeValProdPlan12_0.java, Line 12, Column 176:
> >> Unexpected token "." in primary
> >>
> >>      ... 7 more
> >>
> >>
> >> I am using Drools 3.0.6 version.
> >>
> >> I got the above message when the drl files are added to the
> >> RuleBase class.
> >>
> >> I debugged the code. The error was thrown when
> >> ruleBase.addPackage(packageBuilder.getPackage()); line was called
> >> in the
> >> DroolsExecutor class.
> >>
> >> Can anyone please suggest me any sollution for this problem.
> >>
> >> Thanks in addvance.
> >>
> >> Thanks,
> >> McShiv.
> >> --
> >> View this message in context: http://www.nabble.com/Unexpected-
> >> token-%22.%22-in-primary---Rule-Compilation-Error-
> >> tf4002948.html#a11369488
> >> 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
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Unexpected-token-%22.%22-in-primary---Rule-Compilation-Error-tf4002948.html#a11369670
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070630/d2517729/attachment.html 


More information about the rules-users mailing list