![]() Previous |
![]() Next |
The DEFINE command with the AGGMAP keyword adds a new aggmap object to an analytic workspace. An aggmap object is a specification for how Oracle OLAP allocates or aggregates variable data.
Defining an aggmap merely creates an aggmap object in the analytic workspace; it does not define the calculation specification. The aggmap specification can either specify how to aggregate or how to allocate data:
For information on coding an aggregation specification, see the AGGMAP command.
For information on coding an allocation specification, see the ALLOCMAP command.
Syntax
DEFINE aggname AGGMAP [<dims...>][AW workspace][SESSION]
Parameters
The name of the object that you are defining. For general information about this argument, see the main entry for the DEFINE command.
The object type when you are defining an aggmap.
(Optional; retained for compatibility with earlier software versions.) When defining an aggmap object for aggregation (that is, an AGGMAP-type aggmap), the names of the dimensions. You cannot specify a conjoint dimension as a base dimension in the definition or specification for the aggmap.
The name of an attached workspace in which you want to define the object. For more about this argument, see the main entry for the DEFINE command.
Specifies that the object exists only in the current session. For more information about this argument, see the main entry for the DEFINE command.
Examples
Creating an Aggmap for Aggregation
Suppose you define a sales
variable with the following statement.
DEFINE sales VARIABLE <time, product, geography>
Assume also that you have defined an aggmap named sales.agg
with the following definition and specification.
DEFINE sales.agg AGGMAP <time, product, geography> AGGMAP RELATION time.r PRECOMPUTE (time NE 'Year99') RELATION product.r PRECOMPUTE (product NE 'All') RELATION geography.r CACHE STORE END
The sales.agg
aggregation specification contains the preceding three RELATION statements and a CACHE statements. In this example, you are specifying that all of the data for the time.r
hierarchy of the time
dimension should be aggregated, except for any data that has a time
dimension value of Year9
9. All of the data for the product.r
hierarchy of the product
dimension should be aggregated, except for any data that has the product
dimension value of ALL
. (In this example, the product
dimension has a dimension value named ALL
that represents all products in the hierarchy.) All geography
dimension values are aggregated. The CACHE STORE statement specifies that any data that is rolled up on the fly should be calculated just once and stored in the cache for other access requests during t he same session.
Note that users should not have write access to the analytic workspace when CACHE STORE is set, because the data calculated during the session may be saved inadvertently.
In this example, any data value that dimensioned by a Year99
time
value or an ALL
product
dimension value is calculated on the fly.
You can now use the sales.agg
aggmap with an AGGREGATE command, such as the following.
AGGREGATE sales USING sales.agg
Creating an Aggmap for Allocation
Suppose you have a sales
variable that you defined with the following statement.
DEFINE sales VARIABLE <time, product, geography>
To allocate data from a source to cells in the sales
variable that are specified by the time
and product
dimension hierarchies, you have created an ASCII disk file called salesalloc.txt
, which contains the following aggmap definition and specification.
DEFINE sales.alloc AGGMAP ALLOCMAP RELATION time.r OPERATOR EVEN RELATION product.r operator EVEN NAOPERATOR HEVEN SOURCEVAL ZERO CHILDLOCK DETECT END
To include the sales.alloc
aggmap in your workspace, execute the following statement.
INFILE 'salesalloc.txt'
The sales.alloc
aggmap is now defined, and it contains the preceding two RELATION statements, the SOURCEVAL statement and the CHILDLOCK statement. You end the entry of statements into the aggmap with the END statement. In this example, you are specifying that the first allocation of source values occurs down the time
dimension hierarchy and that the source value is divided evenly between the target cells at each level of the allocation. The second allocation occurs down the product
dimension hierarchy, with the source value again divided evenly between the target cells at each level of the allocation, and when the allocation encounters a deadlock, the source values is divided evenly between the target cells of the hierarchy including cells that have a basis value of NA
. With the SOURCEVAL statement you specify that after the allocation, ALLOCATE sets the value of each source cell to zero. With the CHILDLOCK statement you specify that ALLOCATE detects the existence of locks on both a parent and a child element of a dimension hierarchy.
You can now use the sales.alloc
aggmap with an ALLOCATE command, such as the following.
ALLOCATE sales USING sales.alloc
The preceding statement does not specify a basis or a target object so ALLOCATE uses the sales
variable as the source, the basis, and the target of the allocation.