Aggregation instances
The data type of aggregation instances includes all view dimensions and attributes as well as several implicit properties:
- level identifier - the level identifier ( L ) defines the aggregation level the instance belongs to. The level identifier is a character array (char[8]) with the name level_id.
- dimensions - Level dimension attributes ( K ) as being defined in the grouping clause.
- view properties - persistent and transient view properties as being defined in the SELECT statement or VIEW definition.
- partitions - collections (relationships) referring to subset of next lower level instances ( S(I,i) ). Partition names are derived from dimension attributes preceding attribute names with __ (e.g. __personId, __projectId, __iDate in the example)
Aggregation attributes are level identifier, dimension attributes, aggregation attributes and transient properties. Dimension attributes are all grouping attributes defined in the VIEW definition or SELECT. When no group clause has been defined, key components of the order key are supposed to define dimension attributes. Aggregation attributes listed in a VIEW definition's attribute list or in a SELECT clause are, typically, calculated by means of aggregation functions. Finally, attribute lists may contain a number of transient attributes, which are not result of aggregation functions.
Each aggregation instance is extended by a level identifier (char __level_id[8]) array, which defines the dimension levels for the grouping instance (the maximum number of dimensions is 8). Each element contains the dimension level for the corresponding dimension attribute in the hierarchy as character value. Dimension level 0 indicates that this dimension has reached its top aggregation level (dimension excluded) and key component values for this dimension will be ignored.
The "total" aggregation instance, which does not contain dimension attribute values (dimension key components are all excluded) has the character value 00000000. When, e.g. defining grouping attributes personId, projectId and iDate for time sheets, the aggregation on personId level gets the level identifier 10000000. Level personId|iDate(year,month,day) gets identifier 10300000 etc. In case of complex dimension attributes, the dimension level may also contain higher values than 1 (maximum is the number of attributes in the complex dimension). The maximum dimension level number is 9.
Dimension attributes K(i) with maximum level number (L(i) = Dim(i)) in the level identifier refer to non-aggregated dimensions (e.g. 10300000 refers to personId|(year,month,day) while 10100000 refers to personId|year). Dimension attributes with level less than Dim(i) refer to aggregated dimension levels, that may be aggregated further on. Dimension attributes with level number 0 in the level identifier refer to final aggregated dimensions.
In order to get aggregation instances for a certain aggregation level, a key filter condition (fixing level identifierkey component) may be set with the level identifier.
Level identifier conversion and naming functions are provided in order to simplify usage of level identifiers.
In an aggregation schema, all dimension attributes become key component attributes of the aggregation data type. The primary key for the aggregation data type consists of level identifier and dimension attributes. The sequence of dimension attributes defines the order key as long as no different sort order has been defined. Finally the sequence of the order key define the position of dimension level in the level identifier.
Since the attribute check is performed by name, the aggregation attribute list must not contain dimension attribute names, because than the dimension attribute will be added with its original dimension name, once more.
Transient properties are evaluated by an assigned operand or by means of context functions (read event handler). Operands assigned to transient properties in an aggregation (VIEW) schema or SELECT statement must be valid in the context of the result data type. Transient attributes with assigned operands are evaluated when accessing these attributes, i.e. after aggregations have been completed.
In order to be able to traverse aggregation hierarchies and for calculating higher aggregation levels, each instance in the aggregation collection provides a number of partition relationships. The number of partition relationships corresponds to the number of dimension attributes in grouping definition.
Names for partition relationships are derived from dimension attribute names preceding attribute names with __ (e.g. __personId, __projectId, __iDate in the example).
In order to provide links to related object instances (e.g. person or project in the example), one may also define transient references, which must be maintained in an appropriate read or update handler.