Thanks for replying.<br><br>1. Yes isDeltaFlag(flag) should eventually return false. But when it does so is dependent on when the Sensor's flag value changes. If the Sensor remains flagged for long periods of time, the rule will continue to activate for each update to the Sensor. There are several<br>
other types of flags, which may also exist for long periods of time.<br><br>2. The truth to be maintained here is simply that a Sensor has a particular flag, in this case a Delta flag, set on it. I'm using such rules to reduce the need to eval() in other rules that react to the presence of a flag in more meaningful ways. I'm using eval() with a function because the flags are originally encoded by setting bits at specific positions to 1. I have not seen a better way of doing this yet.<br>
<br>3. The ultimate purpose for DeltaFlagged, and other similar facts, is to be used for triggering other rules which take more complicated actions. Again, I have taken this approach to avoid repeating eval() in many different rules, and to abstract what a flag is.<br>
<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">rule "Example Flag Rule"<br> when<br> $station: Station($stationId : stationId)<br>
$test: DeltaFlaggedTest(stationId == $stationId, $sensorId : sensorId)<br> $flag: DeltaFlagged($sensor : sensor)<br> Sensor(this == $sensor, station == $stationId, id == $sensorId)<br>
then<br> // Send messages, make database changes, etc.<br>end<br></blockquote><br>By using insertLogical() I was hoping to ensure that one and only one DeltaFlagged fact was inserted for a Sensor, and was automatically retracted, using only one rule. In addition, I have used logical inserts for other possibly-long-running facts. Based on my research so far, I will need to alter my approach to avoid any long-term logically asserted facts that are frequently updated. My original email was to ask about how fact equality plays a role in logical inserts. But now I think I have clarified to myself that equality was not the problem. Using logical inserts under these long-term scenarios was my problem.<br>
<br>-B<br>