我很难使用自定义类型的属性来编写诸如上下文之类的语句。例如,这是有效的:
create context TripContext
context PartionBySource
partition by source from EventCreated,
context ContextBorders
initiated by EventCreated(
type="c8y_SwitchPowerReport") as startEvent
terminated by EventCreated(
type="c8y_SwitchPowerReport") as endEvent;
然而这还不够,我需要检查我的一些自定义属性以更好地定义上下文。我希望能够做这样的事情:
create context TripContext
context PartionBySource
partition by
source,
getString(????, "customProp1"),
getNumber(????, "customProp2"),
...
from EventCreated,
context ContextBorders
initiated by EventCreated(
type="c8y_SwitchPowerReport",
getString(startEvent, "c8y_SwitchPower.newStatus") = "ON") as startEvent
terminated by EventCreated(
type="c8y_SwitchPowerReport",
getString(endEvent, "c8y_SwitchPower.newStatus") = "OFF") as endEvent;
我不知道该放什么而不是 ???? 参考事件。它对于源、时间、类型等“本机”属性是透明的,但是一旦有自定义属性,我就不知道如何访问它。
至于启动/终止语法,有一些我不明白的非常奇怪的东西,但也许它更像是一个 Esper 而不是 Cumulocity 问题。这是有效的:
terminated by EventCreated(
type="c8y_SwitchPowerReport",
getString(endEvent, "c8y_SwitchPower.newStatus") = "OFF") as endEvent
但这不是:
initiated by EventCreated(
type="c8y_SwitchPowerReport",
getString(startEvent, "c8y_SwitchPower.newStatus") = "ON") as startEvent
我收到一条错误消息:
无法验证单行函数参数表达式“startEvent”:名为“startEvent”的属性在任何流中均无效
任何见解将不胜感激。