Apama 10.3.1 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Defining Queries | Finding and acting on event patterns | Defining event patterns | Query and operator
 
Query and operator
In a find statement, you can specify the and operator in the event pattern. The events on both sides of the and operator must be matched for the query to fire. The condition on each side of an and operator can be a single event template or a more complex expression.
In the next example, assuming that an X event and a Y event have already been added to their respective windows, adding an A event to its window causes a match.
(X as x -> A as a1) and (Y as y -> A as a2)
In the second example, suppose events were added to their windows in this order: X(1), A(1), Y(1), A(2). The A(1) event is not included in the match set. Only A(2) is in the match set because it is the most recent A event to follow X(1) as well as the most recent A event to follow Y(1).
When a single event is used in more than one coassignment you must coassign the event, A in these examples, to distinct identifiers, a1 and a2 in these examples.
Specification of an and operator implies that there are no requirements regarding the order in which the events specified in the event pattern are added to the window. For example, events specified in the right-side condition can be added to their windows before events specified in the left-side condition. When conditions specify multiple events, the events that cause one side of the and operator to evaluate to true:
*can all be added to their windows before the events that cause the other side to evaluate to true;
*can all be added to their windows after the events that cause the other side to evaluate to true;
*can arrive in their windows at times interleaved with the arrival of the events that cause the other side to evaluate to true;
*can contain the events that cause the other side to evaluate to true;
*can be contained by the events that cause the other side to evaluate to true.
When there is an order requirement or when you require multiple instances of the same event type, specify the followed-by (->) operator.
The and operator has a higher precedence than the followed-by (->) operator, and lower precedence than the or operator. For clarity, use brackets in expressions that specify more than one type of operators.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.