<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>No.<br>You can't use $obs before you bind it (2nd pattern)<br>The binding done for accumulate pattern must be used in some accumulate fonction in order to be seen outside.<br><br>Instead of trying to fix your rule, may be you can describe (with simple phrases) what you are trying to do ?<br><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Matteo Cusmai" &lt;cusmaimatteo@gmail.com&gt;<br><b>À: </b>"Rules Users List" &lt;rules-users@lists.jboss.org&gt;<br><b>Envoyé: </b>Mardi 22 Mai 2012 12:33:16<br><b>Objet: </b>[rules-users] Accumulate function<br><br>Hi all,<br>i am going to use a custom accumulate function like that:<br><br>rule "CrowdInAreaEvent-event"<br>&nbsp;&nbsp;&nbsp; no-loop<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $RFIDReader : SensorFixed(type == Sensor.SENSOR_TYPE_RFID, $coverageArea : areaOfInterest )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; not CrowdInAreaEvent( sensor == $RFIDReader, this meets[ 5s ] $obs )<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $count : Integer( intValue &gt; 10 ) <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from accumulate(<span style="color:rgb(255,0,0)"> $obs : </span>RFIDObservation( $tagid : tagid, sensor == $RFIDReader ) <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; over window:time( 60s ) from entry-point lowLevelSensorStream, countDistinct( $tagid ) );<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; insert( SituationManager.createCrowdInAreaEvent( "Crowd, number people: " + $count, Event.THREAT_LOW, $coverageArea, $RFIDReader, $count, 60, 10 ) );<br>
end<br><br>I need to refer $obs object in order to compare timing of new observation with last event. Is it possible to do that?<br><br>Thanks a lot,<br>Matteo.<br>
<br>_______________________________________________<br>rules-users mailing list<br>rules-users@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/rules-users<br></div><br></div></body></html>