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

Executable model only fires once for FROM patterns in OR

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 8.39.0.Final
    • None
    • None
    • 2023 Week 24-26 (from Jun 12)
    • NEW
    • NEW
    • ---
    • ---

      The rule below will fire twice when run with the non-executable model but only once with the executable model. It should fire twice in the executable model to match the behavior of the non-executable model.

      rule "Only Fires Once"
      when
          (or
              $val: String() from "foo"
              $val: String() from "bar")
      then
      ...
      end 

      For comparison, the following rule will fire twice regardless of the model:

      rule "Setup"
      when
      then
        insert("foo");
        insert("bar");
      end
      
      rule "Fires Twice"
      when
        (or
            String(this == "foo", $val: this)
            String(this == "bar", $val: this))
      then
      ...
      end  

      Even if each branch of the OR matches unique facts in working memory, the rule will only fire once in the executable model:

      rule "Setup"
      when
      then
        insert("foo");
        insert("bar");
      end
      
      rule "Fires Only Once"
      when
        (or
          (and String(this == "foo") $val: String() from "baz")
          (and String(this == "bar") $val: String() from "qux"))
      then
      ...
      end 

              mfusco@redhat.com Mario Fusco
              jstewmon Jonathan Stewmon (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: