<div dir="ltr"><div><div><div>Have a question using drools 6 - I am following the example:<br><br></div>Repo looks fine, rules and artifact in:<br>.m2/repository/org/acme/brms/acmepoc/1.0<br><br></div>code seems straightforward:<br>
// Install example1 in the local maven repo before to do this<br> KieContainer kContainer = ks.newKieContainer(ks.newReleaseId("org.acme.brms", "acmepoc", "1.0"));<br><br></div>but get:<br>
Exception in thread "main" java.lang.RuntimeException: Cannot find KieModule: org.acme.brms:acmepoc:1.0<br> at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)<br>
at com.sample.KieContainerFromKieRepoExample.go(KieContainerFromKieRepoExample.java:15)<br> at com.sample.KieContainerFromKieRepoExample.main(KieContainerFromKieRepoExample.java:26)<br><br><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Dec 5, 2013 at 5:22 PM, IK81 <span dir="ltr"><<a href="mailto:ml@kofler.me" target="_blank">ml@kofler.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<br>
<br>
I am currently stuck with a problem concerning the use of not and<br>
conincide. I want to analyze a stream of error code events from a set of<br>
devices and detect the following situations. Every event has a timestamp<br>
(long), a device id (String) and an error code (String).<br>
<br>
What I want to detect is the following<br>
- If I get two events, one with code C1 and one with C2 from a single<br>
device within 1 minute, it represents a special event combination. The<br>
order of their appearence is not relevant.<br>
- If I just get C1 (without the C2 within the time frame), just report<br>
C1<br>
- If I just get C2 (without the C1 within the time frame), just report<br>
C2<br>
<br>
<br>
I can successfully detect the special event combination with the<br>
following rule<br>
<br>
rule "Detect combination"<br>
when<br>
$e1 : Event ($d: device, code == "C1")<br>
$e2 : Event (device == $d, code == "C2", this coincides [1m] $e1)<br>
then<br>
... do some output<br>
end<br>
<br>
<br>
Then I tried to implement the detection of C1 only as follows<br>
<br>
rule "Detect code C1"<br>
when<br>
$e1 : Event ($d: device, code == "C1")<br>
not ( $e2 : Event (device == $d, code == "C2", this coincides [1m]<br>
$e1))<br>
then<br>
... do some other output<br>
end<br>
<br>
My understanding of the rule is that it should fire, if I get the event<br>
with code C1 and there is no other event with error code C2 for the same<br>
device that happens within one minute before and after the C1 event. To<br>
my surprise, the rule fires immediately when I insert an event with<br>
error code C1. Shouldn't the implementation wait at least 1 minute to be<br>
sure that no C2 error event will be inserted?<br>
<br>
<br>
BTW this is how I insert the events in my test case:<br>
<br>
clock.advanceTime(70, TimeUnit.SECONDS);<br>
FactHandle handle1 = ksession.insert( new Event(65000, "A", "C1") );<br>
ksession.fireAllRules();<br>
clock.advanceTime( 10, TimeUnit.SECONDS );<br>
FactHandle handle2 = ksession.insert( new Event(75000, "A", "C2") );<br>
ksession.fireAllRules();<br>
clock.advanceTime( 2, TimeUnit.SECONDS );<br>
<br>
And this is mainly the output I get:<br>
<br>
detected code C1 @ 70000<br>
event id=44b895e5-7287-404b-8204-3de5690b2360 timestamp=65000<br>
device=A code=C1<br>
detected combination @ 80000<br>
event id=44b895e5-7287-404b-8204-3de5690b2360 timestamp=65000<br>
device=A code=C1<br>
event id=fc89715b-fc30-4b12-ab31-a3884dcd4886 timestamp=75000<br>
device=A code=C2<br>
<br>
Any ideas concerning an alternative solution are highly welcomed.<br>
<br>
Thanks,<br>
Ingo<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>