(Deprecated) Defining global entity aggregates
You define a global entity aggregate by specifying an aggregate expression, an evaluation schedule, and an optional default value.
Before you begin
Create a global aggregate definition file (.agg).
About this task
A global entity aggregate can find the total, minimum, maximum, or average value of a collection of entities and their attributes, as well as the number of entities. For example, if your business model has aircraft entities, you can determine the average load of all the aircraft and evaluate that average daily.
The calculations are launched according to the schedule and are run as batch jobs that occur in each of the nodes of your solution. The results from the individual partitions are therefore not initially consistent. Over time, however, a feedback mechanism ensures that the results become consistent.
define '<same_name_as_file>' as <expr>An expression can reference a related entity, but the processing time might increase substantially.
If only a few entities exist, a global entity aggregate might not have a meaningful value. Therefore, you can specify a default value and the condition for when the default applies. The default value applies unless enough entities exist for the aggregate calculations, and any rules that are based on them, to have meaningful results. You might need to test and experiment with the default value and the condition to obtain optimal results for your particular solution.
In the editor, you can type Space or Ctrl+Space to display the available constructs, and then double-click a construct to select it.
Procedure
Results
The global aggregate is verbalized and you can use its
variable name in rules and Java™ agents
in your solution. In a Java agent
and in the REST API, you must prefix defvar to the
variable name.
Examples
define 'average_capacity' as the average business class capacity of all aircraft,
evaluated daily at 2:00 PMThis statement defines
the variable average_capacity,
which can then be used in the rules in a solution. The calculation
is run every day at the specified time to account for periodic changes
to entities in the model. At each node, a local average is calculated,
and the partial results are aggregated across the data grid to obtain
the overall average capacity.
define 'numAvailTerminalsOfAllFlights' as the total available terminals of the destination airports of all flights,
evaluated every day at 3:00 PMdefine 'average_capacity' as the average business class capacity of all aircraft, defaulting to 50 if there are less than 5 aircraft,
evaluated at intervals of 24 hours