<div>Hello&nbsp;Wolfgang,</div><div><br></div>Index is just like the index in an array. the value can be any from 0 to the array length.&nbsp;<div>for the previous example, the length is 1 so index can be either 0 or 1. but in the real case, the length can be an arbitrary number.</div>
<div><br></div><div>another question, there are 2 rules here, do both of them have to be applied?</div><div><br></div><div>Best Regards,</div><div>Kevin Zhao<br><br><div class="gmail_quote">2010/10/28 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Kindly state your requirements precisely.<br><br>Perhaps <br>&nbsp;&nbsp; not ( EventB ( index != $index,... )<br>is what you need.<br>
-W<br><br><div class="gmail_quote">2010/10/28 ΥΤΩ©Ω© <span dir="ltr">&lt;<a href="mailto:kevin223@gmail.com" target="_blank">kevin223@gmail.com</a>&gt;</span><div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">I haven&#39;t tested this rule, but what about the case that property index would have arbitrary number of possible values?<br>

<br><div class="gmail_quote">2010/10/27 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Omitting the Entry &nbsp;Points:<br>
<br>
rule &quot;B-0-1-not OK&quot;<br>
when<br>
 &nbsp; &nbsp;$b : EventB( $index: index )<br>
 &nbsp; &nbsp;not ( PatternConsumer( id == &quot;B01&quot;, events contains $b ) )<br>
 &nbsp; &nbsp;not ( EventB( index == (1 - $index), this after[0s,2m] $b ) )<br>
then<br>
 &nbsp; &nbsp;System.out.println( &quot;B:&quot; + $index + &quot;, but no B:&quot; + (1-$index) );<br>
end<br>
<br>
rule &quot;B-0-1&quot;<br>
when<br>
 &nbsp; &nbsp;$b1 : EventB( $index: index )<br>
 &nbsp; &nbsp;$b2 : EventB( index == (1 - $index), this after[0s,2m] $b1 )<br>
then<br>
 &nbsp; &nbsp;insert( new PatternConsumer( &quot;B01&quot;, $b1, $b2 ) );<br>
 &nbsp; &nbsp;System.out.println( &quot;B:&quot; + $index + &quot;+B:&quot; + (1-$index) );<br>
end<br>
<br>
-W<br>
<br>
2010/10/27 ΥΤΩ©Ω© &lt;<a href="mailto:kevin223@gmail.com" target="_blank">kevin223@gmail.com</a>&gt;:<br>
<div><div></div><div>&gt; Hello,<br>
&gt; With the help from the community I managed to get my first rule working, and<br>
&gt; I&#39;m trying to write my second rule on my own but it just doesn&#39;t seem to<br>
&gt; work correctly.<br>
&gt; Here is the scenario, what I want is to identify a pattern that there&#39;s no<br>
&gt; EventB coming in within 2 minutes with a particular index value.<br>
&gt; For example, EventB would have a property named index and assume the value<br>
&gt; of index would be either 0 or 1.<br>
&gt; Before firing the rules, I would manually insert facts of possibleIndex with<br>
&gt; value 0 and 1 into the workingMemory.<br>
&gt; Within 2 minutes, if there only comes one EventB with index valued 0 then<br>
&gt; the system should report no EventB coming in with index value 1 in last 2<br>
&gt; minutes.<br>
&gt; Vice versa, in the case of only coming one EventB with index valued 1 then<br>
&gt; the system should report no EventB coming in with index value 0 in last 2<br>
&gt; minutes.<br>
&gt; If within 2 minutes, there comes 2 EventB with both value 0 and 1 then<br>
&gt; nothing should report.<br>
&gt; Here is what I wrote, but it doesn&#39;t seem to work correctly.<br>
&gt; I used a timer to fire this rule every 10 seconds because I don&#39;t think the<br>
&gt; rule would run automatically if I don&#39;t add that. (not too sure though)<br>
&gt; rule &quot;no B in 2 minutes&quot;<br>
&gt; timer (0 10s)<br>
&gt; when<br>
&gt; possibleIndex( $index : index ) from entry-point &quot;Event stream&quot;<br>
&gt; $p : PatternConsumer ( name == &#39;no B&#39; &amp;&amp; index == $index )<br>
&gt; not ( EventB( index == $index &amp;&amp; this after[0ms,2m] $p) over window:time(2m)<br>
&gt; from entry-point &quot;Event stream&quot; )<br>
&gt; then<br>
&gt; PatternConsumer pc = new PatternConsumer( &quot;no B&quot;, $index );<br>
&gt; insert(pc);<br>
&gt; System.out.println(&quot;no B in 2 minutes &quot; + $index);<br>
&gt; end<br>
&gt; Best Regards,<br>
&gt; Kevin Zhao<br>
</div></div>&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div></div></div><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>
<br></blockquote></div><br></div>