Querying History

When performing historical reads over OPC UA, the client can specify a ContentFilter.

In Apis Management Studio, similar filtering can be performed in the "Event History" view using a text expression comparable with a SQL WHERE-clause.

Simple filter expressions:

1) Timestamp>NOW-1m
2) Type=DiscreteAlarm
3) Type is DiscreteAlarm
4) Source="ApisHive/Areas/AlarmArea/Equipment-01"
5) Source is "ApisHive/Areas/AlarmArea/Equipment-01"
6) Message like "Level is [12]00*"
7) UnshelveTime=ActiveTime+1h
8) State&2=2
NoExplanation
1Return events with a timestamp from the last minute.
2Return events of type DiscreteAlarm, excluding subtypes
3Return events of type DiscreteAlarm, including subtypes
4Return events from the source 'ApisHive/Areas/AlarmArea/Equipment-01', excluding child sources
5Return events from the source 'ApisHive/Areas/AlarmArea/Equipment-01', including child sources
6Return events where the Message field starts with the string "Level is 100" or "Level is 200"
7Return events where the UnshelveTime is exactly 1 hour after the ActiveTime
8Return events where the 'Active' state bit is high

All such simple expressions can be combined with and and or, and grouped into subexpressions with parentheses.

NB: If multiple event types define fields with the same name, such field names must be prefixed by its event type, e.g. 'TrackingEvent.Status'.

Syntax

This is the formal1 definition of the syntax used in textual query filters:

expr    ::= andExpr ('or' expr)?
andExpr ::= relExpr ('and' andExpr)?
relExpr ::= bitExpr (relOp bitExpr)?
bitExpr ::= addExpr (bitOp bitExpr)?
addExpr ::= mulExpr (addOp addExpr)?
mulExpr ::= term (mulOp mulExpr)?
term    ::= unaryOp? symbol | string | number | list | subExpr
unaryOp ::= [!+-~]
symbol  ::= [a-zA-Z_][a-zA-Z_0-9.]*
string  ::= ["] [^"]* ["]
number  ::= [0-9]+ (("." [0-9]+)|([dhms]))?
subExpr ::= "(" expr ")"
list    ::= "[" expr ("," expr)* "]"
relOp   ::= [<>=] | "<=" | ">=" | "!=" | "is" | "in" | "like"
bitOp   ::= [&|^] | "<<" | ">>"
mulOp   ::= [*%/]
addOp   ::= [+-]

A symbol is either "NOW", an event type, or an event field optionally prefixed by its event type.

NB: list expressions and the keyword "in" are not yet supported.

1

the notation used is a custom BNF extension