company logo

OSI Select statement

The OSI select statement has been introduced because of compatibility reasons. Practically any select statement as

  • SELECT(...) FROM(...) WHERE(...) GROUP BY(...) HAVING(...) ORDER BY(...) AGGREGATE(...)

Can be expressed as an access path like

  • FROM(...).WHERE(...).GROUP(...).SELECT(...).HAVING(...).ORDER(...).AGGREGATE(...)

where only the from and the select part are mandatory. Since the access path provides more features it is suggested to use the access path rather than OSI select statement.

In contrast to the standard OQL select statement (ODMG), the ODABA select statement requires parenthesis after each keyword. Calling aggregate is required in order to provide higher level aggregations.

Definition: 

OQLSelect := sel_spec [sel_extensions(*)] [output_spec]

Aggregation specification

Aggregations may be defined within the select statement. Values may be calculated via aggregation functions or expressions (operands). Expressions are evaluated in the context of the calling object (countries in the example below). Aggregation functions obtain a parameter, which defines a value in the context of the aggregation instance. Aggregation functions must be preceded by a collection property or expression, that defines the aggregation collection. When no aggregation collection is defined, partition is assumed as aggregation collection property, which is either defined implicitly by GRUOP clause of assigned explicitly in the SELECT statement as in the example below).

An ordinary view provided instances on grouping level (GROUP clause), only. in order to provide instances for higher aggregation levels, an AGGREGATE clause is required, which defines the way how to evaluate higher aggregation levels.

countries.SELECT( set< Persons > partition = persons,

                  INT(10,2) sum_inc = sum(income),

                  STRING[80] country = name,

                  INT(10,2) avr = average(children.count) )

Notes:

Following aggregation functions are currently supported:

  • minimum
  • maximum
  • average
  • sum
  • variance
  • deviation