Correction:
EmNumberRestriction(this == ($constr.getRestrictions () [0] ),...

On 5 October 2011 14:44, Wolfgang Laun <wolfgang.l...@gmail.com> wrote:
> Write this like so:
>   EmNumberRestriction(this == ($constr.getRestrictions[0]),...
> -W

>> part from last line of LHS. Again, it worked well in 5.1.1.
>>
>> On 10/05/2011 12:14 PM, Swindells, Thomas wrote:
>>
>> Why do you need the and in the rule?
>> Have you tried
>>
>> rule "enabled paramId: 1, id: 0"
>> salience 50
>> when
>>
>>       def0: EmParamDefinition(paramName == "p2", listIndex == -1)
>>       EmParamValue(paramDefinitionId == def0, requiredValue == 1)
>>       $param : EmParamValue(id == 1, enabled == false)
>>       not ParentDisabled(id == 1)
>>  then
>>       $param.setEnabled(true);
>>       update($param);
>>  end
>>
>> Thomas
>>
>> -----Original Message-----
>> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
>> boun...@lists.jboss.org] On Behalf Of Waclaw Borowiec
>> Sent: 05 October 2011 10:55
>> To: rules-users@lists.jboss.org
>> Subject: [rules-users] Compilation errors with 5.3.0.CR1
>>
>> Hello
>>
>> I'm sending the message once again due to problems with code samples
>> visibility in the previous one.
>>
>> I've got following rule:
>>
>> rule "enabled paramId: 1, id: 0"
>> salience 50
>> when
>>      (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>>      $param : EmParamValue(id == 1, enabled == false)
>>      not ParentDisabled(id == 1)
>> then
>>      $param.setEnabled(true);
>>      update($param);
>> end>
>>
>> It compiles fine under Drools 5.1.1, but after switching to 5.3.0.CR1 I get
>> following exception:
>>
>> [Error: unexpected end of statement]
>> [Near : {... def ....}]
>>                  ^
>> [Line: 1, Column: 4]
>>      at
>> org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1470)
>>      at
>> org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:14
>> 46)
>>      at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:421)
>>      at
>> org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:1
>> 28)
>>      at
>> org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62
>> )
>>      at org.mvel2.MVEL.analysisCompile(MVEL.java:668)
>>      at org.mvel2.MVEL.analysisCompile(MVEL.java:672)
>>      at
>> org.drools.rule.builder.PatternBuilder.setInputs(PatternBuilder.java:854)
>>      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:595)
>>      at
>> org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternB
>> uilder.java:397)
>>      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:309)
>>      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:132)
>>      at
>> org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.jav
>> a:65)
>>      at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
>>      at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2241)
>>      at
>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:802)
>>      at
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
>> :388)
>>      at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder
>> .java:566)
>>      at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
>> va:35)
>>      at
>> com.proximetry.elmgr.services.DependenciesBean$Expander.addDrl(Depen
>> denciesBean.java:110)
>>
>>
>> It is
>>
>> (def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>> EmParamValue(paramDefinitionId == def0, requiredValue == 1))
>>
>>
>> line that causes the problem - the exeption disappears after removing it.
>> What's interesting, when I add '$' sign to binding variable name, and the 
>> line
>> looks like:
>>
>> ($def0: EmParamDefinition(paramName == "p2", listIndex == -1) and
>> EmParamValue(paramDefinitionId == $def0, requiredValue == 1))
>>
>>
>> instead of the exception I get DRL error:
>>
>> [DialectError message='Unable to wire compiled classes, probably related to
>> compilation failures:sun.reflect.generics.reflectiveObjects.WildcardTypeImpl
>> cannot be cast to java.lang.Class']
>>
>>
>> For completness, this is how I add DRL resources:
>>
>> public void addDrl(Reader rdr) {
>>               KnowledgeBuilder kBuilder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();
>>
>>               kBuilder.add( ResourceFactory.newReaderResource(rdr),
>> ResourceType.DRL);
>>               if( kBuilder.hasErrors() ){
>>                   for( KnowledgeBuilderError err: kBuilder.getErrors() ){
>>                       StackTrace.error(this, err);
>>                   }
>>                   throw new IllegalStateException( "DRL errors" );
>>               }
>>               knowledgeBase.addKnowledgePackages(
>> kBuilder.getKnowledgePackages() );
>>               }
>>
>>
>> I would be grateful if someone has an idea, why after switching Drools
>> version such problem exists.
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>> **************************************************************************************
>> This message is confidential and intended only for the addressee. If you 
>> have received this message in error, please immediately notify the 
>> postmas...@nds.com and delete it from your system as well as any copies. The 
>> content of e-mails as well as traffic data may be monitored by NDS for 
>> employment and security purposes. To protect the environment please do not 
>> print this e-mail unless necessary.
>>
>> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 
>> 4EX, United Kingdom. A company registered in England and Wales. Registered 
>> no. 3080780. VAT no. GB 603 8808 40-00
>> **************************************************************************************
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to