我有多种用途,每个传感器都有一个发送计步器数据的传感器。我有一个基于 macAddress 的规则文件,它触发规则:
declare Steps
@role(event)
end
declare User
@role(fact)
end
rule "MAC"
when
User( $mac: macAddress ) from entry-point "entrySteps"
then end
rule "ACC STEPS RULE" extends "MAC"
when
accumulate( Steps( $s : steps , macAddress == $mac )
over window:time( 1h ) from entry-point "entrySteps";
$fst: min( $s ), $lst: max( $s );
$lst - $fst < 50 )
then
System.out.println($lst + " " + $fst);
Action.handleAction($mac,"STEPS RULE: get moving!");
end
我的用户只有一个字段macAddress
,步骤事件有以下字段:
double steps;
Date timeStamp;
String macAddress;
现在,当我为每个macAddress插入一个事件时,如果在过去一小时内使用该 macAddress 的用户的步数少于 50,则该规则将触发。因此,如果满足此条件,该规则将为每个 macAddress 触发。但我希望该规则只能为插入的 Step 事件的 macAddress 触发。如何调整我的规则?