[jboss-jira] [JBoss JIRA] (DROOLS-702) Rule Inheritance fired the sub rule even the condition doen't match

Davide Sottara (JIRA) issues at jboss.org
Fri Jan 30 15:55:49 EST 2015


     [ https://issues.jboss.org/browse/DROOLS-702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davide Sottara resolved DROOLS-702.
-----------------------------------
      Assignee: Davide Sottara  (was: Mark Proctor)
    Resolution: Rejected


When a rule extends another, patterns will not be merged. 
If you have:

{code} rule "parent" when $p : Person() then end {code}
and
{code} rule "child" when Person() then end {code}

the engine cannot safely infer that those two patterns should match the 
SAME fact, so you end up with a cross-product of two patterns.
In your reproducer, the number of firings is consistent with the cross 
product of the facts you inserted, so I don't see any bug here.

As an alternative to "from", you can use unification:
{code} $p := Person() {code}
in both rules (parent and child) to ensure the two patterns are linked.

> Rule Inheritance fired the sub rule even the condition doen't match
> -------------------------------------------------------------------
>
>                 Key: DROOLS-702
>                 URL: https://issues.jboss.org/browse/DROOLS-702
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 6.1.0.Final
>         Environment: Windows, Java6.0.29
>            Reporter: Yacine Jaber
>            Assignee: Davide Sottara
>            Priority: Critical
>         Attachments: wod-drools-test.7z
>
>
> You can find the attached a simple maven project that shows this error.
> You can run ExampleDrools class as main java application.
> The sub rules are fired even if the condition is not matched.
> There are a work arround by using <from $fact> into a sub rule to avoid firing this one.
> This simple project shows the failed and work arround test.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jboss-jira mailing list