Apama 10.15.0 | Developing Apama Applications | EPL Reference | Queries | Find statement | Pattern
 
Pattern
In a query definition, the find statement specifies the event pattern of interest followed by a procedural block that specifies what you want to happen when a pattern match is found.
A coassignment variable specified in an event pattern is within the scope of the find block and it is a private copy in that block. Changes to the content that the variable points to do not affect any values outside the query. Unlike EPL event expressions, you need not declare this identifier before you coassign a value to it.
In an event pattern in a find statement, each coassignment variable identifier must be unique. You must ensure that an identifier in an event pattern does not conflict with an identifier in the parameters section or inputs section.
If a pattern specifies a wait operator, then it must be at the beginning of a pattern, at the end of a pattern, or both. It cannot be in the middle of a pattern. The followed-by operator (->) must be after or before each instance of the wait operator. For example:
wait(1) as w -> (A as a and B as b) // Allowed
{(A as a and B as b) -> wait(1) as w } // Allowed
wait(1) as w1 -> (A as a and B as b) -> wait(1) as w2 // Allowed
wait(1) as w and A as a // Not allowed
A as a -> wait(1) as w -> B as b // Not allowed
A wait operator must specify a positive float value or a time literal. A float value always indicates a number of seconds.
Optionally, specify and, or or -> and then specify an event_type and coassignment variable. Parentheses are allowed in the pattern specification and you can specify multiple operators, each followed by an event_type and coassignment variable. For example, the following is a valid find statement:
find (A as a1 -> ((A as a2)) -> (A as a3) ->
(A as a4 -> A as a5 -> A as a6) ->
(((A as a7) -> A as a8) -> A as a9) -> A as a10 {
print "query with 10: "+a1.toString()+ " - "+a10.toString();
}