Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in Java | Defining Event Expressions | About event templates | Specifying positional syntax
 
Specifying positional syntax
In positional syntax, the event template must define a value (or a wildcard) to match against for every parameter of that event's type, in the same order as the parameter's definition in the event type definition. Therefore, for the event type,
public class MobileUser extends Event {
   public long userID;
   public Location position;
   public String hairColour;
   public String starsign;
   public long gender;
   public long incomeBracket;
   public String preferredHairColour;
   public String preferredStarsign;
   public long preferredGender;
   // ... Constructors
}
a suitable event template definition might look like
MobileUser(*,*, "red", "Capricorn", *, *, *, *, 1)
This can get unwieldy when you are working with event types with a large number of parameters and very few of them are actually being used to filter on. An alternative syntax can be used that addresses this. The above can instead be expressed as:
MobileUser(hairColour="red", starsign="Capricorn",
  preferredGender=1)
This is known as named parameter syntax and in this style all other non-specified fields are set to wildcard.
Given the following event types:
public class A extends Event {
   public long a;
   public String b;
 
   // ... Constructors
}
 
public class B extends Event {
   public long a;
 
   // ... Constructors
}
 
public class C extends Event {
   public long a;
   public long b;
   public long c;
 
  // ... Constructors
}
Here are some equivalent event expressions that demonstrate how to use the two syntaxes:
Positional Syntax
Name/Value Syntax
Using constants and literals
on A(3,"string")
on A(=3,="string")
on A(a=3,b="string")
on A(b="string",a=3)
Relational comparisons
on B(>3)
on B(a>3)
Ranges
on B([2:3])
on B(a in [2:3])
Wildcards
on C(*,4,*)
on C(*,*,*)
on C(b=4)
on C(a=*,b=4,c=*)
on C()
More details about the operators and expressions possible within event templates are given in the next section.
Note that it is possible to mix the two styles as long as you specify positional parameters before named ones. There cannot be any positional parameters after named ones. Therefore the following syntax is legal:
D(3,>4,i in [2:4])
while the following is not:
E(k=9,"error")

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.