Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6428

var_xxx_sCoPe cannot be resolved to a variable in accumulate with exec-model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • 7.57.0.Final
    • 7.55.0.Final
    • executable model
    • None
    • 2021 Week 25-27 (from Jun 21)
    • Undefined
    • NEW
    • NEW

      A rule like this

      rule R when
              accumulate( LongFact( $longVal: longVal), $minVal : min($longVal))
              accumulate( LongFact( $longVal2: longVal, $longVal2 > $minVal), $minVal2 : min($longVal2))
      
              $minFact: LongFact( longVal == $minVal)
              $minFact2: LongFact( longVal == $minVal2)
      

      generates java code:

          public static org.drools.model.Rule rule_R() {
              final org.drools.model.Variable<org.drools.mvel.integrationtests.PropertySpecificTest.LongFact> var_GENERATED_$pattern_LongFact$1$ = D.declarationOf(org.drools.mvel.integrationtests.PropertySpecificTest.LongFact.class,
                                                                                                                                                                   DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.org_drools_mvel_integrationtests_PropertySpecificTest_LongFact_Metadata_INSTANCE,
                                                                                                                                                                   "GENERATED_$pattern_LongFact$1$");
              final org.drools.model.Variable<java.lang.Long> var_$longVal_1_sCoPe = D.declarationOf(java.lang.Long.class,
                                                                                                     DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.java_lang_Long_Metadata_INSTANCE,
                                                                                                     "$longVal_1_sCoPe");
              final org.drools.model.Variable<java.lang.Long> var_$minVal = D.declarationOf(java.lang.Long.class,
                                                                                            DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.java_lang_Long_Metadata_INSTANCE,
                                                                                            "$minVal");
              final org.drools.model.Variable<org.drools.mvel.integrationtests.PropertySpecificTest.LongFact> var_GENERATED_$pattern_LongFact$3$ = D.declarationOf(org.drools.mvel.integrationtests.PropertySpecificTest.LongFact.class,
                                                                                                                                                                   DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.org_drools_mvel_integrationtests_PropertySpecificTest_LongFact_Metadata_INSTANCE,
                                                                                                                                                                   "GENERATED_$pattern_LongFact$3$");
              final org.drools.model.Variable<java.lang.Long> var_$longVal2_2_sCoPe = D.declarationOf(java.lang.Long.class,
                                                                                                      DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.java_lang_Long_Metadata_INSTANCE,
                                                                                                      "$longVal2_2_sCoPe");
              final org.drools.model.Variable<java.lang.Long> var_$minVal2 = D.declarationOf(java.lang.Long.class,
                                                                                             DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.java_lang_Long_Metadata_INSTANCE,
                                                                                             "$minVal2");
              final org.drools.model.Variable<org.drools.mvel.integrationtests.PropertySpecificTest.LongFact> var_$minFact = D.declarationOf(org.drools.mvel.integrationtests.PropertySpecificTest.LongFact.class,
                                                                                                                                             DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.org_drools_mvel_integrationtests_PropertySpecificTest_LongFact_Metadata_INSTANCE,
                                                                                                                                             "$minFact");
              final org.drools.model.Variable<org.drools.mvel.integrationtests.PropertySpecificTest.LongFact> var_$minFact2 = D.declarationOf(org.drools.mvel.integrationtests.PropertySpecificTest.LongFact.class,
                                                                                                                                              DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.org_drools_mvel_integrationtests_PropertySpecificTest_LongFact_Metadata_INSTANCE,
                                                                                                                                              "$minFact2");
              org.drools.model.Rule rule = D.rule("com.sample.rules",
                                                  "R").build(D.accumulate(D.pattern(var_GENERATED_$pattern_LongFact$1$).bind(var_$longVal_1_sCoPe,
                                                                                                                             com.sample.rules.P47.LambdaExtractor479E9CC94586C45704E48CC19BB80796.INSTANCE),
                                                                          D.accFunction(org.drools.core.base.accumulators.LongMinAccumulateFunction::new,
                                                                                        var_$longVal_1_sCoPe).as(var_$minVal)),
                                                             D.accumulate(D.pattern(var_GENERATED_$pattern_LongFact$3$).bind(var_$longVal2_2_sCoPe,
                                                                                                                             com.sample.rules.P47.LambdaExtractor479E9CC94586C45704E48CC19BB80796.INSTANCE).expr("GENERATED_8405D5D73B462C0F984416207FB08017",
                                                                                                                                                                                                                 var_$longVal2_2_sCoPe,
                                                                                                                                                                                                                 var_$minVal_2_sCoPe,
                                                                                                                                                                                                                 com.sample.rules.PCF.LambdaPredicateCF77446DCCE77EBA5CD4A87288B48061.INSTANCE),
                                                                          D.accFunction(org.drools.core.base.accumulators.LongMinAccumulateFunction::new,
                                                                                        var_$longVal2_2_sCoPe).as(var_$minVal2)),
                                                             D.pattern(var_$minFact).expr("GENERATED_FB830797B7AD4A622CF48D005273C4E4",
                                                                                          var_$minVal,
                                                                                          com.sample.rules.PB8.LambdaPredicateB80BEBE0C7E8BAC8AD541E51900CB438.INSTANCE,
                                                                                          D.betaIndexedBy(java.lang.Long.class,
                                                                                                          org.drools.model.Index.ConstraintType.EQUAL,
                                                                                                          DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.org_drools_mvel_integrationtests_PropertySpecificTest_LongFact_Metadata_INSTANCE.getPropertyIndex("longVal"),
                                                                                                          com.sample.rules.P47.LambdaExtractor479E9CC94586C45704E48CC19BB80796.INSTANCE,
                                                                                                          com.sample.rules.P87.LambdaExtractor8785BF646B8A2C00B9E6137C62B26EFE.INSTANCE,
                                                                                                          java.lang.Long.class)),
                                                             D.pattern(var_$minFact2).expr("GENERATED_E0AEAB8F2ADE45F01C1ABF88B32E8F5C",
                                                                                           var_$minVal2,
                                                                                           com.sample.rules.P62.LambdaPredicate62BDBECEA35368E6A44DDDFAE5B516A5.INSTANCE,
                                                                                           D.betaIndexedBy(java.lang.Long.class,
                                                                                                           org.drools.model.Index.ConstraintType.EQUAL,
                                                                                                           DomainClassesMetadata803A16FEE01364D6C91AD8696C8DD4B6.org_drools_mvel_integrationtests_PropertySpecificTest_LongFact_Metadata_INSTANCE.getPropertyIndex("longVal"),
                                                                                                           com.sample.rules.P47.LambdaExtractor479E9CC94586C45704E48CC19BB80796.INSTANCE,
                                                                                                           com.sample.rules.P71.LambdaExtractor7165ACF2150B59FB9FBEF919528EE9AC.INSTANCE,
                                                                                                           java.lang.Long.class)),
                                                             D.on(var_$minFact2,
                                                                  var_$minFact,
                                                                  var_$minVal,
                                                                  var_$minVal2).execute(com.sample.rules.P53.LambdaConsequence53BDB47C57AE429C234D0EDE2EC2003C.INSTANCE));
              return rule;
          }
      

      fails with

      var_$minVal_2_sCoPe cannot be resolved to a variable
      

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: