QueryParserLanguage
QueryParserLanguage overcomes the complexity of providing filter condition for Event Notifications. The objective is to help in writing and running filter conditions for Event Notifications.
It provides a more convenient way to write and manipulate filter condition. By using QueryParser, user can specify filter condition in a query format for Event Notification. It supports most of FilterOperators specified as part of OPC UA Part 4 - Services 1.03 Specification.
Operator | Symbol | Usage Example |
equals | == | Operand0 == Operand1 |
IsNull | IsNull | IsNull(operand) |
GreaterThan | > | Operand0 > Operand1 |
LessThan | < | Operand0 < Operand1 |
GreaterThanOrEqual | >= | Operand0 >= Operand1 |
LessThanOrEqual | <= | Operand0 <= Operand1 |
Like | Like | Like(Operand0 , Operand1) |
Not | Not | Not(Operand) |
Between | Between | Between(operand0 , operand1, operand2) |
InList | InList | InList(Operand [2..n]) |
And | And | Operand0 && Operand1 |
Or | Or | Operand0 || Operand1 |
Cast | Cast | Cast(operand0 , operand1) |
BitwiseAnd | BitwiseAnd | BitwiseAnd(operand0 , operand1) |
BitwiseOr | BitwiseOr | BitwiseAnd(operand0 , operand1) |
InView | InView | InView(Operand) |
OfType | OfType | OfType(Operand) |
RelatedTo | RelatedTo | RelatedTo(Operand0 , Operand1 ,Operand2 ,Operand3, Operand4 ,Operand5) |
QueryParserLanguage supports two ways to provide operand values in the filter query.
Literal Operand : User can directly provide known values as operand that is treated as Literal Operand. Example : 800 , 75 , -3 , 'MyLevel'
SimpleAttributeOperand : User can specify names of condition parameter as operand in the query.
For Example,
Severity==800
HighLimit >= 300
In this case, the value attribute is considered to be evaluated for Severity(Value attribute is compared with 800) and HighLimit(Value attribute is compared with 300).
To verify any specific attribute and indexRanges, certain format is used:
OperandName{attributeName, {IndexRange}}
Few more query examples:
Severity == 800
Between(Severity , 100, 200)
SuppressedState.Id == 8
(SuppressedState.Id == 8) && (Severity == 700)
(SuppressedState.Id == 8) && (Severity == 700) && (HighLimit == 200)
Severity > 700
Severity >= 700
Severity < 700
Severity <= 700
Not((SuppressedState.Id == 8) && (Severity == 700))
Not(Severity <= 700)
OfType(i=2048)
OfType(ns=5;s=OPCSampleNode)
(SuppressedState.Id == 200) && (Between(Severity , 100, 200))
Not(Severity == 800) && (SourceName=='MyLevel') && (HighLimit >= 300)
Not(EnabledState.Id == false) && ((Severity == 500) || (Severity == 700))
HighLimit >= LowLimit
ActiveState.Id && EnabledState.Id
SourceName == 'Severity{NodeId} == 500'
ActiveState.Id || EnabledState.Id
InList(Severity , 500 , 600 , 700)
SourceName{DisplayName} == 'SourceName'
((Severity == 500) || (Severity == 700)) && (SourceName{DisplayName} == 'SourceName')