[jboss-jira] [JBoss JIRA] (DROOLS-688) coincides temporal operator issue when combined with not and duration

Mark Proctor (JIRA) issues at jboss.org
Thu Jul 23 09:07:05 EDT 2015


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

Mark Proctor reassigned DROOLS-688:
-----------------------------------

    Assignee: Edson Tirelli  (was: Mark Proctor)


> coincides temporal operator issue when combined with not and duration
> ---------------------------------------------------------------------
>
>                 Key: DROOLS-688
>                 URL: https://issues.jboss.org/browse/DROOLS-688
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 6.1.0.Final, 6.2.0.CR4
>            Reporter: Matteo Mortari
>            Assignee: Edson Tirelli
>         Attachments: 20150115.drools6test-duration-not-coincides.zip, 20150115bis.drools6test-duration-not-coincides.zip
>
>
> _Premise_: this is assuming in case of Point/Point event comparison, the combination of {{after\[delta\]}} + {{before\[delta\]}} could be simplified into {{coincides\[delta\]}}. If not the case, there is still one case failing (using 6.2.0.CR4) and imho worth reporting.
> h5. Executive summary
> I would like to report two issues
> _Main Issue_. Given the following condition in LHS:
> {code:java}
> not Yang( this after[10s] $yin || this before[10s] $yin ) 
> {code}
> I understood this could have been simplified into
> {code:java}
> not Yang( this coincides[10s] $yin )
> {code} assuming Yang and $yin are both Point events (start coincides with end). The reproducer I will attach demonstrate IFF I put in the first form, it does work as expected and all test are passing; however if using the latter form, test would fail.
> _Second issue_. Even assuming the first form, using version 6.2.0.CR4 would fail when using phreak and TimedRuleExectionOption because NETWORK_EVALUATOR.evaluateNetwork() in RuleExecutor would not terminate.
> h5. Description
> Reference is made to attached reproducer. Assume the following KB:
> {code:java}
> declare Yin
> 	@role(event)
> end
> declare Yang
> 	@role(event)
> end
> declare ErrorToken
> 	@role(event)
> 	origin : Yin
> end
> rule "Yin is missing Yang balance"
> duration 10000
> agenda-group "USERSPACE"
> no-loop
> when
>   $yin : Yin()
>   not ErrorToken(origin : $yin)
>   not Yang( this after[10s] $yin || this before[10s] $yin ) // shouldn't this be equivalent to: not Yang( this coincides[10s] $yin ) ?
> then
>   System.out.println("Rule RHS: Yin is missing Yang balance");
>   ErrorToken token = new ErrorToken();
>   token.setOrigin($yin);
>   insert(token);
> end
> {code}
> In other words, if a Yin event is detected, there shall be a Yang event either 10s before or 10s after, otherwise an ErrorToken is inserted because of this missing balance.
> Hence the test suite is aimed at verifying two main use-cases.
> First use case, in case Yin is followed by a Yang, the balance is correct, hence no ErrorToken shall be issued:
> {code:java}
> advance(clock, 1, TimeUnit.MINUTES);
> insert(session, new Yin());
> fire(session);
> assertEquals("I fired an Error too early", 0, session.getObjects(errorTokenFilter).size());
> advance(clock, 1, TimeUnit.SECONDS);
> insert(session, new Yang());
> fire(session);
> assertEquals("As I provided an Yang, there should be no errors", 0, session.getObjects(errorTokenFilter).size());
> {code}
> Second use case, in case Yin is issued and NO Yang is issued, an ErrorToken shall indeed be present signifying the first Yin has no balance
> {code:java}
> advance(clock, 1, TimeUnit.MINUTES);
> insert(session, new Yin());
> fire(session);
> assertEquals("I fired an Error too early", 0, session.getObjects(errorTokenFilter).size());
> advance(clock, 30, TimeUnit.SECONDS);
> insert(session, new Yin());
> fire(session);
> assertEquals("Now I should be certain for the first Yin there should be 1 error", 1, session.getObjects(errorTokenFilter).size());
> {code}
> You can also check that even without inserting the second Yin, the test suite is passing all test as intended.
> h5. Reproduce the problem.
> _Main Issue_. Change the following condition in LHS:
> {code:java}
> not Yang( this after[10s] $yin || this before[10s] $yin ) 
> {code}
> into
> {code:java}
> not Yang( this coincides[10s] $yin )
> {code}
> which basically should signify: _There is missing a Yang in the temporal neighbourhood of 10s when Yin happened_. Now the test suite will fail the tests.
> _Second issue_. Even assuming the first form, hence leaving UNchanged the KB as originally provided in the reproducer. Now go to the pom.xml and change drools-version property in order to be using version 6.2.0.CR4 . Then test suite would fail when using phreak and TimedRuleExectionOption because NETWORK_EVALUATOR.evaluateNetwork() in RuleExecutor would not terminate.
> Can you kindly advise, please?
> Thank you



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list