MdmHierarchy Class

MdmHierarchy is a subclass of MdmHierarchicalDimension, which is an abstract subclass of MdmDimension.

Description of an MdmHierarchy

An MdmHierarchy is an MdmHierarchicalDimension that includes all the elements of one or more hierarchical structures. That is, all the parents and children are within the MdmHierarchy.

Even though the parent-child relationships exist in the MdmHierarchy, its elements are represented as a simple list. The relationships among the elements are recorded in the parent and ancestors attributes, which you can obtain by calling the getParentRelation and getAncestorsRelation methods on the MdmHierarchy. You can obtain the region for each element by calling the getRegionAttribute method on the MdmDimensionDefinition of the MdmHierarchy. Sometimes the parent, ancestors, and region attributes are referred to as parent, ancestors, and region relations.

Typically, an MdmHierarchy is one of the following types:

Level MdmHierarchy, which represents a hierarchical structure whose regions are MdmLevel objects. For example, a level MdmHierarchy for calendar year might have as its regions MdmLevel objects for year, quarter, month and day.

A level MdmHierarchy has an MdmUnionDimensionDefinition, and its regions are MdmLevel objects. The return value from its getHierarchyType method is LEVEL_HIERARCHY. A level MdmHierarchy is based on a hierarchy that was defined by a database administrator using the OLAP Metadata APIs.

Union MdmHierarchy, which represents a dimension that has one or more subordinate hierarchical structures. These structures are represented by one or more level or value MdmHierarchy objects. An example, of an MdmHierarchy with two structures is a union MdmHierarchy for time that has two regions, one for the calendar year and another for the fiscal year. Each region is a level MdmHierarchy.

A union MdmHierarchy has an MdmUnionDimensionDefinition and its regions are MdmHierarchy objects. The return value from its getHierarchyType method is UNION_HIERARCHY. A union MdmHierarchy is based on a dimension that was defined as having one or more hierarchies by a database administrator using the OLAP Metadata APIs.

Value MdmHierarchy, which represents a hierarchical structure whose elements have parents and children but no levels and therefore no regions. For example, a company's employee reporting structure can be represented with parent/child relationships but without levels.

A value MdmHierarchy has an MdmBaseDimensionDefinition. The return value from its getHierarchyType method is VALUE_HIERARCHY. A value MdmHierarchy is based on a dimension that was flagged as a value hierarchy by a database administrator using the OLAP Metadata APIs.

When working with MdmHierarchy objects in the current release of the OLAP API, keep the following points in mind.

Call the getAttributes method on a union MdmHierarchy, not on its subordinate level or value MdmHierarchy objects or on MdmLevel objects.

Create queries on Source objects that are based on a level or value MdmHierarchy, not on a union MdmHierarchy.

Call the getParentRelation and getAncestorsRelation methods on a level or value MdmHierarchy, not on a union MdmHierarchy.

Call the getRegionAttribute method on the MdmUnionDimensionDefinition of a level MdmHierarchy, not of a union MdmHierarchy. This method returns the MdmAttribute that records the MdmLevel to which each MdmHierarchy element belongs.

Elements of a Level MdmHierarchy

The elements of a level MdmHierarchy include all of the elements of all of its regions. The values of the elements in a particular level MdmHierarchy must be unique. The following examples present the elements of two level MdmHierarchy objects, one for calendar year and the other for fiscal year.

Level MdmHierarchy for Calendar Year

The following table lists the values of the elements for a level MdmHierarchy called mdmTimesDimCalHier, which includes the elements from four MdmLevel objects: mdmYear, mdmQuarter, mdmMonth, and mdmDay. The number of elements is 1529: 4 year elements, 16 quarter elements, 48 month elements, and 1461 day elements.

Elements ofmdmTimesDimCalHier

1998

1998-Q1

1998-01

01-JAN-98

02-JAN-98

03-JAN-98

. . .

01-FEB-98

02-FEB-98

03-FEB-98

. . .

1998-Q2

1998-04

01-APR-98

02-APR-98

03-APR-98

. . .

1999

1999-Q1

1999-01

01-JAN-99

02-JAN-99

03-JAN-99

. . .

Level MdmHierarchy for Fiscal Year

The following table lists the values of the elements for a level MdmHierarchy called mdmTimesDimFisHier, which includes the elements from four MdmLevel objects: mdmFisYear, mdmFisQuarter, mdmFisMonth, and mdmFisDay. The number of elements is 1529: 4 fiscal year elements, 16 fiscal quarter elements, 48 fiscal month elements, and 1461 fiscal day elements.

In this example, the mdmFisDayMdmLevel is based on the same relational database column on which the mdmDayMdmLevel is based (see the earlier example for calendar year). Therefore, the values of the elements for these two MdmLevel objects are identical. However, this does not mean that the elements themselves are identical. The elements in mdmDay are distinct from the elements in mdmFisDay; only the values of the two sets of elements are the same.

Elements oftimesDimFisHier

FIS-1998

FIS-1998-Q1

FIS-1998-01

01-JUL-98

02-JUL-98

03-JUL-98

. . .

01-AUG-98

02-AUG-98

03-AUG-98

. . .

FIS-1998-Q2

FIS-1998-04

01-OCT-98

02-OCT-98

03-OCT-98

. . .

FIS-1999

FIS-1999-Q1

FIS-1999-01

01-JUL-99

02-JUL-99

03-JUL-99

. . .

Terminology: Nodes and leaves

A level MdmHierarchy represents a tree structure with parent-child relationships. Elements in the lowest MdmLevel are referred to as leaves, and the elements in the MdmLevel objects above the lowest level are referred to as nodes. Nodes have children; leaves do not.

Elements of a union MdmHierarchy

The elements of a union MdmHierarchy include all of the elements of all of its regions. Another way to say this is that a union MdmHierarchy includes all of the elements of all of the MdmLevel objects in all of its subordinate MdmHierarchy objects. In hierarchical terms, the set of elements includes all of the leaves (the elements at the lowest level) and all of the nodes (the elements at the levels above the lowest one) for all the hierarchies.

Distinct elements in the regions of a union MdmHierarchy

The elements in the regions of a union MdmHierarchy are totally distinct. That is, a given element does not appear in more than one region of a union MdmHierarchy. This is the case even if the database administrator specified the same level in two different hierarchies of a dimension. When this happens, Oracle OLAP creates two different MdmLevel objects, one for each level MdmHierarchy.

Though the elements of a union MdmHierarchy are distinct, the values of the elements are not required to be unique. Therefore in the example below, the leaf elements of the two regions of the union MdmHierarchy have values that are identical.

Union MdmHierarchy for Time

Consider a union MdmHierarchy called mdmTimesDim, which has two regions. The first region is the MdmHierarchy called mdmTimesDimCalHier, which has 1529 elements. The second region is the MdmHierarchy called mdmTimesDimFisHier, which also has 1529 elements. The set of elements for mdmTimesDim is the union of the elements from its two MdmHierarchy objects. Because no element can appear in both MdmHierarchy objects, mdmTimesDim has 3058 elements. Note that a calendar year begins on January 1, while a fiscal year begins on July 1.

The following table lists the values of the elements of the union MdmHierarchy called mdmTimesDim. To distinguish the elements of mdmDay and mdmFisDay, whose values are identical, the word "(fiscal)" appears next to the values for mdmFisDay. The mdmDay and mdmFisDay objects were introduced earlier in the examples for the elements of a level MdmHierarchy.