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

executable-model doesn't split Ampersand constraint

    XMLWordPrintable

Details

    • Enhancement
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 7.53.0.Final
    • None
    • executable model
    • None
    • 2021 Week 19-21 (from May 10), 2021 Week 25-27 (from Jun 21), 2021 Week 37-39 (from Sep 13), 2021 Week 40-42 (from Oct 4), 2021 Week 49-51 (from Dec 6th), 2022 Week 11-13 (from Mar 14)
    • NEW
    • NEW

    Description

      exec-model doesn't split constraint connected with "&&" into multiple AlphaNodes:

      Person(name == "Edson" && age == 35)
      
          @Test
          public void testAmpersandConstraint() {
              String str =
                      "import " + Result.class.getCanonicalName() + ";" +
                           "import " + Person.class.getCanonicalName() + ";" +
                           "rule R1 when\n" +
                           "  $p : Person(name == \"Edson\" && age == 35)\n" +
                           "then\n" +
                           "end";
      
              KieSession ksession = getKieSession(str);
      
              ReteDumper.dumpRete(ksession);
      
              Person mark = new Person("Mark", 37);
              Person edson = new Person("Edson", 35);
      
              ksession.insert(mark);
              ksession.insert(edson);
              assertEquals(1, ksession.fireAllRules());
          }
      

      non-exec-model: 2 AlphaNodes

      [EntryPointNode(1) EntryPoint::DEFAULT ]
          [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ]
          [ObjectTypeNode(3)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.modelcompiler.domain.Person] expiration=-1ms ]
              [AlphaNode(4) constraint=name == "Edson"]
                  [AlphaNode(5) constraint=age == 35]
                      [AlphaTerminalNode(6)]
                          [RuleTerminalNode(7): rule=R1]
      

      exec-model : 1 AlphaNode

      [EntryPointNode(1) EntryPoint::DEFAULT ]
          [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ]
          [ObjectTypeNode(3)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.modelcompiler.domain.Person] expiration=-1ms ]
              [AlphaNode(4) constraint=Constraint for 'GENERATED_50C0B56DC5FB7B9267D7BE9256F72D5F' (index: null)]
                  [AlphaTerminalNode(5)]
                      [RuleTerminalNode(6): rule=R1]
      

      This may not be a bug but a little annoying when confirming exec-model / non-exec-model behavior compatibility (e.g. node sharing test assertion)

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: