The negated existence is represented by a "not" CE.<br><br> $event1 : Event(eventNo == "A")<br>
not Event(eventNo == "B", this after[5s] $event1 )<br><br>A negated condition with respect to time still requires an EventB to be present,<br>but with a constraint on (relative) timestamps.<br><br>Also, note that the startedby operator has a semantic that implies durations<br>
for both events, which is not in your requirement.<br><br>-W<br><br><div class="gmail_quote">On 26 October 2010 07:11, david.bao <span dir="ltr"><<a href="mailto:david.lg.bao@gmail.com">david.lg.bao@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hi,<br>
<br>
I'm a newbie of Drools Fusion. I have a requirement as following:<br>
<br>
If Event A is inserted into the working memory and in the following 5<br>
seconds there is no Event B, some action will be performed.<br>
<br>
Here is my rule script<br>
<br>
import com.foo.event.Event<br>
<br>
rule "test"<br>
when<br>
$event1 : Event(eventNo == "A")<br>
Event(eventNo == "B", this not startedby [5s] $event1 )<br>
then<br>
System.out.println("there is no Event B in 5 seconds");<br>
end<br>
<br>
Java code:<br>
session.insert( event1 );<br>
clock.advanceTime( 6, TimeUnit.SECONDS );<br>
session.insert(event2);<br>
session.fireAllRules();<br>
<br>
this works. But if i do not insert event2 and the rule will not be fired.<br>
<br>
I also tried<br>
not Event(eventNo == "B", this startedby [5s] $event1 )<br>
<br>
not work also<br>
<br>
Thanks<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/CE-not-tp1771908p1771908.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/CE-not-tp1771908p1771908.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>