Apama 10.3 | Apama Documentation | Developing Apama Applications | EPL Reference | Queries | Query definition
Query definition
A query searches for an event pattern that you specify. You define a query in a file with the extension ".qry". Each .qry file contains the definition of only one query.
If specified, any package or using statements must be before the query declaration. See Packages and The using declaration.
You must specify an identifier for the query name. See Identifiers. The convention for specifying the name of a query is to use UpperCamelCase, as shown in the example below.
Specification of metadata is optional. See Metadata section. The convention for specifying the key in the key-value pair of the metadata is to use lowerCamelCase as shown in the example below.
Specification of query parameters is optional. See Parameters section.
An inputs section is required. It specifies at least one event type. These are the event types that the query operates on. See Inputs section.
The find statement is required. It specifies the event pattern of interest and a block that contains procedural code. See Find statement.
Action definitions, in the same form as actions in events, are optional. See Event actions.
query ImprobableWithdrawalLocations {
metadata {
parameters {
float period;
inputs {
Withdrawal() key cardNumber within (period);
Withdrawal as w1 -> Withdrawal as w2
where w2.country != w1.country {
log "Suspicious withdrawal: " + w2.toString() at INFO;

Copyright © 2013-2018 | 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.