Now that I see this code I wonder why you don't simply promote MyFact<br>to an event?<br><br>But, given the current situation, which removes MyEvent facts after 1m,<br>and assuming that you insert the MyEvent *before* its corresponding<br>
MyFact, you can<br><br>rule "fact-without-event"<br>when<br> $f: MyFact($entity : entity)<br> not MyEvent( entity == $entity )<br>then<br> retract( $f );<br>end<br><br>and the obsolete MyFact will be gone, too.<br>
<br>-W<br><br><br><div class="gmail_quote">On 12 November 2010 11:02, Ayush <span dir="ltr"><<a href="mailto:ayush.vatsyayan@alcatel-lucent.com">ayush.vatsyayan@alcatel-lucent.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>
Thanks. Actually I did it in different way what I did is I declared my fact<br>
into drl file as declare MyFact and then I'd added an @expires to it. It<br>
<div><div></div><div class="h5">works fine but now the problem is that for every fact inserted I'd also<br>
inserted an event for it.<br>
<br>
Now as the drl file can be updated by user so say he'd defined expiry time<br>
for events as 1m and for facts as 10s in this case since I'm using sliding<br>
window for events and based on this event I'm fetching the fact. So now I'll<br>
be getting the event but facts will not be available as the 2nd fact came<br>
after 20s hence the rule will not be fired. below is the sample rule.<br>
<br>
declare MyEvent<br>
@role(event)<br>
@expires( 1m )<br>
end<br>
<br>
declare MyFact<br>
@expires( 10s )<br>
end<br>
rule "MyCorrelation"<br>
no-loop true<br>
dialect "mvel"<br>
lock-on-active<br>
when<br>
$E1 : MyEvent( prop1 == 2, $entityA : entity ) over window:time(60s) from<br>
entry-point NotificationStream<br>
$E2 : MyEvent( this != $E1, prop1 == 1, $entityB : entity ) over<br>
window:time(60s) from entry-point NotificationStream<br>
$F2 : MyFact(this.entity == $entityB)<br>
$F1 : MyFact(this.entity == $entityA)<br>
then<br>
System.out.println("I'm executed successfully");<br>
end<br>
<br>
Now what I want is that I can define the @expires time at a single location<br>
or I can verify the logic of these rules?<br>
<br>
Also if say I'd defined the @expires for event as 10s while in sliding<br>
window I'm using over:time(1m) then also it is not same.<br>
</div></div><font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1887987.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1887987.html</a><br>
</font><div><div></div><div class="h5">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>
</div></div></blockquote></div><br>