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

Behavior of multiple updates in executable model is different from non-executable model.

XMLWordPrintable

    • False
    • None
    • False
    • Hide
      $ unzip reproducer_update_1a.zip
      $ cd reproducer_update_1a
      $ ./run_mvn
      === generateModel=NO ===
          :
          :
      ***** start
      ***** Rule 1: $account=com.example.reproducer.Account{id=1, currentCard=null, newCard=null}, $card1=com.example.reproducer.Card{id=10}, $card2=com.example.reproducer.Card{id=11}
      ***** Rule 2a: $account=com.example.reproducer.Account{id=1, currentCard=com.example.reproducer.Card{id=10}, newCard=com.example.reproducer.Card{id=11}} --> OK
      ***** end
          :
          :
      
      === generateModel=YES ===
          :
          :
      ***** start
      ***** Rule 1: $account=com.example.reproducer.Account{id=1, currentCard=null, newCard=null}, $card1=com.example.reproducer.Card{id=10}, $card2=com.example.reproducer.Card{id=11}
      ***** Rule 2b: $account=com.example.reproducer.Account{id=1, currentCard=com.example.reproducer.Card{id=10}, newCard=com.example.reproducer.Card{id=11}} --> NG    <---------- (*)
      ***** end
          :
          :
      

      Expected behavior: rule "Rule 2a" is fired in executable model (generateModel=YES).
      Actual behavior: rule "Rule 2b" is fired in executable model (generateModel=YES).

      Show
      $ unzip reproducer_update_1a.zip $ cd reproducer_update_1a $ ./run_mvn === generateModel=NO === : : ***** start ***** Rule 1: $account=com.example.reproducer.Account{id=1, currentCard=null, newCard=null}, $card1=com.example.reproducer.Card{id=10}, $card2=com.example.reproducer.Card{id=11} ***** Rule 2a: $account=com.example.reproducer.Account{id=1, currentCard=com.example.reproducer.Card{id=10}, newCard=com.example.reproducer.Card{id=11}} --> OK ***** end : : === generateModel=YES === : : ***** start ***** Rule 1: $account=com.example.reproducer.Account{id=1, currentCard=null, newCard=null}, $card1=com.example.reproducer.Card{id=10}, $card2=com.example.reproducer.Card{id=11} ***** Rule 2b: $account=com.example.reproducer.Account{id=1, currentCard=com.example.reproducer.Card{id=10}, newCard=com.example.reproducer.Card{id=11}} --> NG <---------- (*) ***** end : : Expected behavior: rule "Rule 2a" is fired in executable model (generateModel=YES). Actual behavior: rule "Rule 2b" is fired in executable model (generateModel=YES).
    • 2024 Week 07-09 (from Feb 12), 2024 Week 10-12 (from Mar 4)

      When we run the rules (one of those has multiple update(s) for the same fact object) like (*1) and (*2) below, rule "Rule 2a" is fired in non-executable model but rule "Rule 2b" is actually fired in executable model. In both non-executable model and executable model, rule "Rule 2a" should be fired.

      (*1) Problematic rules

      dialect "mvel"
      
      rule "Rule 1"
      when
          $account : Account( id == "1" )
          $card1 : Card( id == "10" )
          $card2 : Card( id == "11" )
      then
          System.out.println("***** " + drools.getRule().getName() + ": $account=" + $account + ", $card1=" + $card1 + ", $card2=" + $card2);
      
          $account.currentCard = $card1;
          update($account);   // ..... (*1-1)
          $account.newCard = $card2;
          update($account);   // ..... (*1-2)
      end
      
      rule "Rule 2a"
      when
          $account : Account( newCard != null )
      then
          System.out.println("***** " + drools.getRule().getName() + ": $account=" + $account + " --> OK");
      end
      
      rule "Rule 2b"
      when
          $account : Account( newCard == null )
      then
          System.out.println("***** " + drools.getRule().getName() + ": $account=" + $account + " --> NG");
      end
      

      (*2) Java code inserting fact objects and calling KieSession#fireAllRules()

      Account account = new Account();
      account.setId(new String("1"));
      kSession.insert(account);
      
      Card card1 = new Card();
      card1.setId(new String("10"));
      kSession.insert(card1);
      
      Card card2 = new Card();
      card2.setId(new String("11"));
      kSession.insert(card2);
      
      System.out.println("***** start");
      kSession.fireAllRules();
      System.out.println("***** end");
      

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-myoshida Masato Yoshida
              Paolo Bizzarri Paolo Bizzarri
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: