Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1571

"and exists" used in source-pattern part of accumulate statement matches multiple times in executable model.

    XMLWordPrintable

Details

    • Bug
    • Status: Verified (View Workflow)
    • Major
    • Resolution: Done
    • 7.1.0.GA, 7.9.0.GA
    • 7.10.1.GA
    • BRE
    • This issue occurs on releases from RHDM 7.1.0 to 7.9.1.

    • CR1
    • Hide
      1. Extract reproducer.
        $ unzip reproducer_model_compiler_16a.zip
        $ cd reproducer_model_compiler_16a
        
      2. Build and execute the rule.
        $ ./run_mvn    # mvn clean compile exec:exec -DgenerateModel=YES
            :
            :
        ***** start
        ***** Action of rule16a2 -- $list = [com.example.reproducer.Car@410ae9a3, com.example.reproducer.Car@410ae9a3, com.example.reproducer.Car@410ae9a3]
        ***** end
            :
            :
        

      Expected behavior: the size of $list is 1.

      Actual behavior: the size of $list is 3.

      Show
      Extract reproducer. $ unzip reproducer_model_compiler_16a.zip $ cd reproducer_model_compiler_16a Build and execute the rule. $ ./run_mvn # mvn clean compile exec:exec -DgenerateModel=YES : : ***** start ***** Action of rule16a2 -- $list = [com.example.reproducer.Car@410ae9a3, com.example.reproducer.Car@410ae9a3, com.example.reproducer.Car@410ae9a3] ***** end : : Expected behavior: the size of $list is 1. Actual behavior: the size of $list is 3.
    • Release Notes
    • 2021 Week 07-09 (from Feb 15)
    • +

    Description

      When executing a rule like (*1) that uses and exists in source-pattern part of accumulate statement like (*1-1) in executable model, the sub-pattern given by and exists matches multiple times. For example in rule (*1), we insert 1 Car object and 3 InspectionResult objects with the same value of number property as the Car object, the source-pattern in the accumulate statement matches 3 times. In this case, it should match only once.

      (*1)

      package com.example.reproducer
      
      import java.util.List
      
      dialect "java"
      
      rule "rule16a2"
          when
              $list : List() from accumulate ( $car : Car( $number : number )
                                               and exists InspectionResult( number == $number );    // ..... (*1-1)
                                               collectList($car) )
          then
              System.out.println("***** Action of rule16a2 -- $list = " + $list);
      end
      

      Attachments

        Issue Links

          Activity

            People

              mfusco@redhat.com Mario Fusco
              rhn-support-myoshida Masato Yoshida
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: