2 Understanding OLAP Java API Metadata

This chapter describes the classes in the Oracle OLAP Java API that represent OLAP metadata objects. This chapter includes the following topics:

Overview of the OLAP Java API Metadata

Chapter 1 described the OLAP dimensional data model and briefly mentioned some of the classes in the OLAP Java API that represent OLAP objects. This chapter describes the OLAP Java API classes that represent metadata objects and discusses how an application uses them.

The OLAP Java API provides a metadata model called MDM (multidimensional metadata). The classes that implement the model are in the oracle.olapi.metadata.mdm package.

An application can use classes in that package to discover existing metadata objects or to create new ones. To have access to the metadata objects, the user specified in the connection to the Oracle Database instance must have the required system privileges. Before an application can create metadata objects, the data structures in the Oracle Database instance must conform to OLAP requirements. Those system privileges and requirements are described in Oracle OLAP User's Guide.

Some of the classes in the oracle.olapi.metadata.mdm package directly correspond to OLAP metadata objects. The following table presents some of these correspondences.

Oracle OLAP Metadata Objects MDM Metadata Objects
Cube MdmCube
Measure MdmBaseMeasure
Dimension MdmTimeDimension or MdmStandardDimension
Hierarchy MdmLevelHierarchy or MdmValueHierarchy
Level MdmDimensionLevel and MdmHierarchyLevel
Attribute MdmAttribute
Measure folder MdmOrganizationalSchema

Most of the classes in the oracle.olapi.metadata.mdm package are subclasses of MdmObject. The remainder of this chapter describes some of those classes.

MdmSchema Classes

MdmSchema objects are containers for MdmCube, MdmMeasure, MdmDimension, other MdmSchema objects. An MdmSchema has methods for getting all of the MdmMeasure, MdmPrimaryDimension, and MdmSchema objects that it contains. This section describes the subclasses of the MdmSchema class: MdmRootSchema, MdmDatabaseSchema, and MdmOrganizationalSchema.

MdmRootSchema Class

Data that is accessible through the OLAP Java API is arranged under a top-level MdmSchema, which is an instance of MdmRootSchema. Under the MdmRootSchema are MdmDatabaseSchema objects.

From the MdmRootSchema, an application can get List objects that contain all of the MdmCube, MdmDatabaseSchema, MdmDimension, and MdmMeasure objects that are in the data store. The MdmRootSchema also has a method for getting the MdmMeasureDimension, whose members are all of the MdmMeasure objects in the data store.

MdmDatabaseSchema Class

The MdmRootSchema has one MdmDatabaseSchema object for each Oracle Database user. The MdmDatabaseSchema corresponds to the relational schema that is owned by the user. The name of the MdmDatabaseSchema is the same as the name of the user.

The MdmRootSchema has a method for getting a list of all of the available MdmDatabaseSchema objects. It also has a method for getting an MdmDatabaseSchema by name.

An MdmDatabaseSchema owns the top-level OLAP metadata objects that are associated with a database user. Top-level objects include MdmCube and MdmDimension objects. An MdmDatabaseSchema can have one or more subschemas that group MdmCube, MdmMeasure, and MdmDimension objects. The subschemas are instances of MdmOrganizationalSchema.

An MdmDatabaseSchema has methods for finding top-level objects by name or creating the object if it does not already exist. Creating objects is described in Chapter 3.

MdmOrganizationalSchema Class

An MdmOrganizationalSchema is equivalent to a folder or directory that contains associated items. It does not correspond to a relational schema in the Oracle database. Instead, it corresponds to an Oracle OLAP measure folder, which can include data from several relational schemas.

An MdmOrganizationalSchema can contain MdmCube, MdmMeasure, and MdmDimension objects. It can also have other MdmOrganizationalSchema objects as nested subschemas.

The MdmDatabaseSchema class has a method for getting a list of all of the MdmOrganizationalSchema objects that it owns. It also has methods for finding an MdmOrganizationalSchema by name or creating the object if it does not already exist.

MdmSource Classes

MdmSource objects are the metadata objects that represent data that is available to an application. Subclasses of MdmSource include MdmDimension, MdmDimensionedObject, and MdmTable.

With the getSource method of an MdmSource, an application gets a Source object that it can use to create a query. The following line of code gets the Source for an MdmStandardDimension called mdmProductDim.

Source productDim = mdmProductDim.getSource();

A Source that is the result of the getSource method of an MdmSource is called a primary Source. An application derives new Source objects from this primary Source as it selects, calculates, and otherwise manipulates the data. When the application derives a Source that represents the query that it wants to make, it creates a Cursor for the Source. The Cursor retrieves the data.

For more information about working with Source and Cursor objects, see Chapter 5, "Understanding Source Objects" and Chapter 8, "Understanding Cursor Classes and Concepts".

MdmDimension Classes

MdmDimension is an abstract subclass of MdmSource that represents the general concept of a list of members that can organize a set of data. For example, if you have a set of figures that are the prices of product items during month time periods, then the unit price data is represented by an MdmMeasure that is dimensioned by dimensions for time and product values. The time dimension includes the month values and the product dimension includes item values. The month and item values act as indexes for identifying each particular value in the set of unit price data.

An MdmDimension can have one or more MdmAttribute objects. An MdmAttribute maps the value of each member of the MdmDimension to a value representing some characteristic of the member value. To obtain the MdmAttribute objects for an MdmDimension, call the getAttributes method or the methods that return specific attributes, such as the getHierarchyAttribute or the getParentAttribute method.

MdmPrimaryDimension Classes

MdmPrimaryDimension is an abstract subclass of MdmDimension. The concrete subclasses of the MdmPrimaryDimension class represent different types of data. The concrete subclasses of MdmPrimaryDimension are the following:

  • MdmMeasureDimension, which has all of the MdmMeasure objects in the data store as the values of the dimension members. A data store has only one MdmMeasureDimension. You can obtain the MdmMeasureDimension by calling the getMeasureDimension method of the MdmRootSchema. You can get the measures of the data store by calling the getMeasures method of the MdmMeasureDimension.

  • MdmStandardDimension, which has no special characteristics, and which typically represent dimensions of products, customers, distribution channels, and so on.

  • MdmTimeDimension, which has time periods as the values of the members. Each time period has an end date and a time span. An MdmTimeDimension has methods for getting the attributes that record that information.

An MdmPrimaryDimension has one or more component MdmDimensionLevel that organize the dimension members into levels. It also has one or more MdmHierarchy objects, which organize the levels into the hierarchies. An MdmPrimaryDimension has all of the members of the component MdmHierarchy objects, while each of the MdmHierarchy objects has only the members in that hierarchy.

You can get the all of the MdmPrimaryDimension objects that belong to an MdmDatabaseSchema or an MdmOrganizationalSchema by calling the getDimensions method of the object. An MdmDatabaseSchema has methods for finding an MdmTimeDimension or and MdmStandardDimension by name or creating the object if it does not already exist.

MdmSubDimension Classes

An MdmPrimaryDimension typically organizes the dimension members into hierarchical parent-child relationships. These hierarchical relationships are implemented by the subclasses of the abstract class MdmSubDimension. The subclasses of MdmSubDimension are MdmDimensionLevel, MdmHierarchy and MdmHierarchyLevel.

MdmDimensionLevel Class

An MdmDimensionLevel represents a set of dimension members that are at the same hierarchical level. MdmHierarchy objects organize dimension levels into a hierarchy. An MdmDimensionLevel is associated with an MdmHierarchy by an MdmHierarchyLevel object.

An MdmPrimaryDimension has a method for getting a list of all of the MdmDimensionLevel objects that it owns. It also has a method for finding an MdmDimensionLevel by name or creating the object if it does not already exist.

MdmHierarchy Class

MdmHierarchy is an abstract subclass of MdmSubDimension. An MdmHierarchy organizes the members of MdmDimensionLevel objects into a hierarchical structure. An MdmPrimaryDimension can have more than one hierarchy. For example, an MdmTimeDimension dimension might have two hierarchies, one organized by calendar year time periods and the other organized by fiscal year time periods. The MdmHierarchyLevel objects of one hierarchy associate MdmDimensionLevel objects of calendar year time periods with the hierarchy. The MdmHierarchyLevel objects of the other hierarchy associate MdmDimensionLevel objects of fiscal year time periods with that hierarchy. The MdmHierarchyLevel for the lowest level of each of these hierarchies associates the same MdmDimensionLevel with each hierarchy.

The parent-child relationships of an MdmHierarchy are recorded in a parent MdmAttribute, which you can get by calling the getParentAttribute method of the MdmHierarchy. The ancestor-descendent relationships are specified in an ancestors MdmAttribute, which you can get by calling the getAncestorsAttribute method.

An MdmPrimaryDimension has a method for getting a list of all of the MdmHierarchy objects that it owns. It also has methods for finding an MdmLevelHierarchy or MdmValueHierarchy by name or creating the object if it does not already exist.

MdmLevelHierarchy Class

MdmLevelHierarchy is a subclass of MdmHierarchy. An MdmLevelHierarchy has parent-child relationships that are defined between the values of the members at different levels. The different levels of an MdmLevelHierarchy are represented by MdmHierarchyLevel objects. An MdmLevelHierarchy can have up to 31 component MdmHierarchyLevel objects. An MdmLevelHierarchy has a tree-like structure. The members at the lowest level of the hierarchy are the leaves, and the members at higher levels are nodes. Nodes have children; leaves do not.

The MdmLevelHierarchy has all of the members of the hierarchy, and each of the component MdmHierarchyLevel objects has only the members at the level that it represents. Each member, except those at the highest level, can have a parent, and each member, except those at the lowest level, can have one or more children. The parent and children of a member of an MdmHierarchyLevel are in other MdmHierarchyLevel objects. An MdmLevelHierarchy can also represent a nonhierarchical list of members, in which case the MdmLevelHierarchy has one MdmHierarchyLevel, and both objects have the same members. You get the levels of an MdmLevelHierarchy by calling the getHierarchyLevels method.

An MdmLevelHierarchy has a method for getting a list of all of the MdmHierarchyLevel objects that it owns. It also has a method for finding an MdmHierarchyLevel by name or creating the object if it does not already exist.

MdmValueHierarchy Class

MdmValueHierarchy is the other subclass of MdmHierarchy. The members of an MdmValueHierarchy are not in an MdmDimensionLevel. The members typically come from a column in a relational embedded totals (ET) view. You can get the name of the view with the getETViewName method of the MdmValueHierarchy.

The MdmValueHierarchy defines the parent-child relationships of its members by the values of the members. An example of a value hierarchy is the employee reporting structure of a company, which can be represented with parent-child relationships but without levels.

MdmHierarchyLevel Class

MdmHierarchyLevel is a subclass of MdmSubDimension. An MdmHierarchyLevel associates an MdmDimensionLevel with an MdmLevelHierarchy.

MdmDimensionedObject Classes

MdmDimensionedObject is an abstract subclass of MdmSource that represents objects that have values that are specified by members of one or more dimensions. An MdmDimensionedObject has MdmDimensionality objects that associate the MdmPrimaryDimension objects with it. The subclasses of MdmDimensionedObject are MdmCube, MdmMeasure, and MdmAttribute.

MdmCube Class

An MdmCube is a container for MdmMeasure objects that are dimensioned by the same set of MdmPrimaryDimension objects. An application creates MdmBaseMeasure or MdmDerivedMeasure objects with the findOrCreateBaseMeasure and findOrCreateDerivedMeasure methods of an MdmCube.

An MdmCube has an associated CubeMap and a CubeOrganization. The CubeMap has MeasureMap and CubeDimensionality objects that map the measures and dimensions of the cube to data sources. The CubeOrganization deploys the cube in an analytic workspace or as a relational database object. An MdmCube also has a ConsistentSolveSpecification object, which specifies how Oracle OLAP aggregates the measures of the cube.

MdmMeasure Class

An MdmMeasure is an abstract class for an object that represents a set of data that is organized by one or more MdmDimension objects. The structure of the data is similar to that of a multidimensional array. Like the dimensions of an array, which provide the indexes for identifying a specific cell in the array, the MdmDimension objects that organize an MdmMeasure provide the indexes for identifying a specific value of an element of the MdmMeasure.

For example, suppose you have an MdmMeasure that has data that records the number of product units sold to a customer during a time period and through a sales channel. The data of the measure is organized by dimensions for products, times, customers, and channels (with channel representing the sales avenue, such as catalog or internet.). You can think of the data as occupying a four-dimensional array with the product, time, customer, and channel dimensions providing the organizational structure. The values of these four dimensions are indexes for identifying each particular cell in the array. Each cell contains a single data value for the number of units sold. You must specify a value for each dimension in order to identify a value in the array.

The values of an MdmMeasure are usually numeric, but a measure can have values of other data types. The concrete subclasses of MdmMeasure are MdmBaseMeasure and MdmDerivedMeasure.

An MdmBaseMeasure typically gets leaf-level data from a column in a fact table. The node-level data is calculated by Oracle OLAP. An MdmDerivedMeasure has values that result from mathematical calculations or a data transformations that Oracle OLAP performs on values from MdmBaseMeasure objects.

The set of elements that are in an MdmMeasure is determined by the structure of the MdmDimension objects of the MdmMeasure. That is, each element of an MdmMeasure is identified by a unique combination of members from the MdmDimension objects. That combination of dimension members is called a tuple.

The MdmDimension objects of an MdmMeasure are MdmStandardDimension or MdmTimeDimension objects. They usually have at least one hierarchical structure. Those MdmPrimaryDimension objects include all of the members of their component MdmHierarchy objects. Because of this structure, the values of the elements of an MdmMeasure are of one or more of the following:

  • Values from the fact table column, view, or calculation on which the MdmMeasure is based. These values belong to MdmMeasure elements that are identified by a combination of values from the members at the leaf level of an MdmHierarchy.

  • Aggregated values that Oracle OLAP has provided. These values belong to MdmMeasure elements that are identified by the value of at least one member from a node level of an MdmHierarchy.

  • Values assigned by an MdmModel for a custom dimension member.

As an example, imagine an MdmMeasure called mdmUnitCost that is dimensioned by an MdmTimeDimension called mdmTimeDim and an MdmStandardDimension of products called mdmProdDim. Each of the mdmTimeDim and the mdmProdDim objects has all of the leaf members and node members of the dimension it represents.

A unique combination of two members, one from mdmTimeDim and one from mdmProdDim, identifies each mdmUnitCost element, and every possible combination is used to specify the entire mdmUnitCost element set.

Some mdmUnitCost elements are identified by a combination of leaf members (for example, a particular product item and a particular month). Other mdmUnitCost elements are identified by a combination of node members (for example, a particular product family and a particular quarter). Still other mdmUnitCost elements are identified by a mixture of leaf and node members. The values of the mdmUnitCost elements that are identified only by leaf members come directly from the column in the database fact table (or fact table calculation). They represent the lowest level of data. However, for the elements that are identified by at least one node member, Oracle OLAP provides the values. These higher-level values represent aggregated, or rolled-up, data.

Thus, the data represented by an MdmMeasure is a mixture of fact table data from the data store and aggregated data that Oracle OLAP makes available for analytical manipulation. The data can include values that Oracle OLAP assigns as specified by an MdmModel.

MdmAttribute Class

MdmAttribute is an abstract subclass of MdmDimensionedObject. An MdmAttribute represents a particular characteristic of the members of an MdmDimension. An MdmAttribute relates a value to a member of the MdmDimension.

For example, mdmCustDim is the MdmPrimaryDimension for the Customer dimension. The MdmPrimaryDimension has a hierarchy that has levels that are based on shipment origination and destination values. The MdmAttribute returned by the getShortValueDescriptionAttribute method of mdmCustDim relates a short description to each the member of the dimension. The elements of the MdmAttribute have String values such as Europe, Italy, or Computer Services Athens.

The elements of an MdmAttribute might have String values (such as Italy), numeric values (such as 45), or objects (such as MdmHierarchyLevel objects).

Like an MdmMeasure, an MdmAttribute has elements that are organized by the MdmDimension associated with it. Sometimes an MdmAttribute does not have a value for every member of the MdmDimension. For example, an MdmAttribute that records the name of a contact person might have values only for the Ship To and Warehouse levels of the Shipments hierarchy of the mdmCustDim dimension, because contact information does not apply to the higher Region and Total Customers levels. If an MdmAttribute does not apply to a member of an MdmDimension, then the MdmAttribute element value for that member is null.

An MdmAttribute object can provide a mapping that is one-to-many, rather than one-to-one. Therefore, a member in an MdmDimension might map to a whole set of MdmAttribute elements. For example, the MdmAttribute that serves as the ancestors attribute for an MdmHierarchy maps each MdmHierarchy member to the set of MdmHierarchy members that are the ancestors of it.

The following table lists the values of a Cursor for a Source object that represents the members of a hierarchy of an MdmPrimaryDimension of products. The table also lists the values of the Source objects for two MdmAttribute objects that are dimensioned by the MdmPrimaryDimension. One attribute is the short description attribute for the dimension. Each member of the dimension has a related short description. The other is an attribute that relates a package to the values of some of the members at the lowest level of the hierarchy. The values of the package MdmAttribute are null for the aggregate Total Product, Class, and Family levels and for unassigned Item level values. In the table, null values appear as NA. In the first column of the table, the value does not include the PRODUCT_PRIMARY hierarchy component of the unique dimension member value.

Hierarchy Member Related Short Description Related Package
TOTAL_PRODUCT::TOTAL Total Product NA
CLASS::HRD Hardware NA
FAMILY::DISK CD/DVD NA
ITEM::EXT CD ROM External 48X CD-ROM NA
ITEM::EXT DVD External - DVD-RW - 8X Executive
ITEM::INT 8X DVD Internal - DVD-RW - 8X NA
ITEM::INT CD ROM Internal - DVD-RW - 8X Laptop Value Pack
ITEM::INT CD USB Internal 48X CD-ROM USB NA
ITEM::INT RW DVD Internal - DVD-RW - 6X Multimedia
... ... ...

Data Type and Type of MDM Metadata Objects

All MdmSource objects have the following two basic characteristics:

  • Data type

  • Type

MdmDimensionCalculationModel objects also have a data type and a type. MdmDimensionedObjectModel objects have a type but not a data type.

Data Type of MDM Metadata Objects

The concept of data type is a familiar one in computer languages and database technology. It is common to categorize data into types such as integer, Boolean, and String.

The OLAP Java API implements the concept of data type through the FundamentalMetadataObject and FundamentalMetadataProvider classes. Every data type recognized by the OLAP Java API is represented by a FundamentalMetadataObject, and you obtain this object by calling a method of a FundamentalMetadataProvider.

The following table lists the most familiar OLAP Java API data types. For each data type, the table presents a description of the FundamentalMetadataObject that represents the data type and the name of the method of FundamentalMetadataProvider that returns the object. The OLAP Java API data types appear in regular typeface, instead of monospace typeface, to distinguish them from java.lang data type classes.

OLAP Java API Data Type Description of the FundamentalMetadataObject Method of FundamentalMetadataProvider
Boolean Represents the data type that corresponds to the Java boolean data type. getBooleanDataType
Date Represents the data type that corresponds to the Java Date class. getDateDataType
Double Represents the data type that corresponds to the Java double data type. getDoubleDataType
Float Represents the data type that corresponds to the Java float data type. getFloatDataType
Integer Represents the data type that corresponds to the Java int data type getIntegerDataType
Short Represents the data type that corresponds to the Java short data type. getShortDataType
String Represents the data type that corresponds to the Java String class. getStringDataType

In addition to these familiar data types, the OLAP Java API includes two generalized data types (which represent groups of the familiar data types) and two data types that represent the absence of values. The following table lists these additional data types.

OLAP Java API Data Type Description of the FundamentalMetadataObject Method of FundamentalmetadataProvider
Number Represents a general data type that includes any or all of the following OLAP Java API numeric data types: Double, Float, Integer, and Short getNumberDataType
Value Represents a general data type that includes any or all of the OLAP Java API data types. getValueDataType
Empty Represents no data, for example when an MdmSource has no elements at all defined for it. getEmptyDataType
Void Represents null data, for example when an MdmSource has a single element that has a null value. getVoidDataType

When an MDM metadata object, such as an MdmMeasure, has a given data type, this means that each of the elements of it conforms to that data type. If the data type is numeric, then the elements also conform to the generalized Number data type, as well as to the specific data type (Double, Float, Integer, or Short). The elements of any MDM metadata object conform to the Value data type, as well as to their more specific data type, such as Integer or String.

If the elements of an object represent a mixture of several numeric and non-numeric data types, then the data type is only Value. The object has no data type that is more specific than that.

The MDM metadata objects for which data type is relevant are MdmDimensionCalculationModel objects and MdmSource objects, such as MdmMeasure, MdmLevelHierarchy, and MdmHierarchyLevel. The typical data type of an MdmMeasure is one of the numeric data types; the data type of an MdmLevelHierarchy or MdmHierarchyLevel is always String.

An MdmPrimaryDimension has a set of MdmDimensionCalculationModel objects, each of which has a different data type. If an MdmDimensionCalculationModel has an Assignment, then Oracle OLAP assigns the specified value to measures that have the same data type as the MdmDimensionCalculationModel. For example, the data type of the MdmDimensionCalculationModel returned by the getNumberCalcModel method of an MdmStandardDimension is the FundamentalMetadataObject for the Number data type. An Assignment specified by that MdmDimensionCalculationModel applies only to a measure that has a Number data type and that is dimensioned by the MdmStandardDimension.

Getting the Data Type of an MdmSource

To find the data type of an MdmSource or MdmDimensionCalculationModel, call the getDataType method of it. That method returns a FundamentalMetadataObject.

To find the OLAP Java API data type that is represented by the returned FundamentalMetadataObject, you could compare it to the FundamentalMetadataObject for each OLAP Java API data type. That is, you compare it to the return value of each of the data type methods in FundamentalMetadataProvider.

The following sample method returns a String that indicates the data type of an MdmSource. Note that this code gets the FundamentalMetadataProvider by calling a method of a DataProvider. Getting a DataProvider is described in Chapter 3, "Discovering Metadata".

Example 2-1 Getting the Data Type of an MdmSource

public String getDataType(DataProvider dp, MdmSource mdmSource) 
{
   String theDataType = null;
   FundamentalMetadataProvider fmp =
                              dp.getFundamentalMetadataProvider();

   if (fmp.getBooleanDataType() == mdmSource.getDataType())
       theDataType = "Boolean";
    else if (fmp.getDateDataType() == mdmSource.getDataType())
       theDataType = "Date";
    else if (fmp.getDoubleDataType() == mdmSource.getDataType())
       theDataType = "Double";
    else if (fmp.getFloatDataType() == mdmSource.getDataType())
       theDataType = "Float";
    else if (fmp.getIntegerDataType() == mdmSource.getDataType())
       theDataType = "Integer";
    else if (fmp.getShortDataType() == mdmSource.getDataType())
       theDataType = "Short";
    else if (fmp.getStringDataType() == mdmSource.getDataType())
       theDataType = "String";
    else if (fmp.getNumberDataType() == mdmSource.getDataType())
       theDataType = "Number";
    else if (fmp.getValueDataType() == mdmSource.getDataType())
       theDataType = "Value";

    return theDataType;
    }

Type of MDM Metadata Objects

An MDM metadata object, such as an MdmSource, is a collection of elements. The type of the object (as opposed to its data type) is another metadata object from which the metadata object draws elements. In other words, the elements of a metadata object correspond to a subset of the elements of the type object. There can be no element in the metadata object that does not match an element of the type.

Consider the following example of a MdmPrimaryDimension called mdmCustDim, which has the OLAP Java API data type of String. The mdmCustDim dimension has a hierarchy, which is an MdmLevelHierarchy object called mdmShipments, which in turn has levels, which are MdmHierarchyLevel objects. The MdmLevelHierarchy and the MdmHierarchyLevel objects represent subsets of the members of the MdmPrimaryDimension. In the following list, the hierarchy and the levels are indented under the MdmPrimaryDimension to which they belong.

mdmCustDim
    mdmShipments
       mdmTotalCust
       mdmRegion
       mdmWarehouse
       mdmShipTo

Because of the hierarchical structure, mdmWarehouse (for example) derives members from the members of mdmShipments. That is, the set of members for mdmWarehouse corresponds to a subset of members from mdmShipments, and mdmShipments is the type of mdmWarehouse.

Similarly, mdmShipments is a component hierarchy of mdmCustDim. Therefore, mdmShipments derives members from mdmCustDim, which is the type.

However, mdmCustDim is not a component of any other object. It represents the entire dimension. The pool of elements from which mdmCustDim derives members is the entire set of possible String values. Therefore, the type of mdmCustDim is the FundamentalMetadataObject that represents the OLAP Java API String data type. In the case of mdmCustDim, the type and the data type are the same.

The following list presents the types that are typical for the most common MdmSource objects:

  • The type of an MdmHierarchyLevel is the MdmLevelHierarchy to which it belongs.

  • The type of a MdmHierarchy is the MdmPrimaryDimension to which it belongs.

  • The type of an MdmPrimaryDimension is the FundamentalMetadataObject that represents the OLAP Java API data type of the MdmPrimaryDimension. Typically, this is the String data type.

  • The type of an MdmMeasure is the FundamentalMetadataObject that represents the OLAP Java API data type of the MdmMeasure. Typically, this is one of the OLAP Java API numeric data types.

An MdmModel also has a type, which is the Source from which Oracle OLAP draws the values that the MdmModel assigns. For example, the type of the MdmDimensionedObjectModel for the MdmAttribute for the short value description attribute of the Product dimension is the Source for the FundamentalMetadataObject for the String data type because the values of that attribute are String objects.

Getting the Type of an MdmSource

To find the type of an MdmSource, call the getType method of the MdmSource. That method returns the object that is the type of the MdmSource object.

Example 2-2 obtains the type of mdmWarehouse, which is an instance of an MdmHierarchyLevel. It also gets and displays the identifier of the object returned by the getType method, which is the hierarchy to which the level belongs.

Example 2-2 Getting the Type of an MdmSource

MetadataObject mdmWarehouseType = mdmWarehouse.getType();
println(mdmWarehouseType.getID());

The example displays the following:

GLOBAL.CUSTOMER_AWJ.SHIPMENTS

Other MDM Metadata Objects

Other classes in the oracle.olapi.metadata.mdm package include MdmDescriptionType and MdmModel.

MdmDescriptionType Class

An MdmDescriptionType represents a type of description for an MdmDescription. Static methods of the MdmDescriptionType class return standard types of descriptions such as name, plural name, description, long description, and others. An application can create other types of descriptions by constructing new MdmDescriptionType objects.

An application specifies an MdmDescriptionType when calling the findOrCreateDescription method of an MdmObject, which returns an MdmDescription.

MdmModel Class

The MdmModel class implements the Model interface for MdmSource objects. Because a Model is closely is associated with a Source, the Model interface is in the oracle.olapi.data.source package. The Model interface is discussed in the topic "Model Objects and Source Objects" in Chapter 5, "Understanding Source Objects".

The MdmModel classes are an advanced feature of the OLAP Java API. When an application creates an MdmMember object, Oracle OLAP automatically creates an MdmModel for the MdmMember or adds information to an existing MdmModel object.

You can get an MdmModel for an MdmPrimaryDimension or an MdmDimensionedObject and use the MdmModel to specify the calculation of a value for a dimension member and the assignment of that value to the Source for a measure or attribute that is dimensioned by the dimension.

The subclasses of MdmModel are MdmDimensionCalculationModel and MdmDimensionedObjectModel. An MdmDimensionedObject object has an associated MdmDimensionedObjectModel that represents the assignment of zero or more values for the Source for the MdmDimensionedObject. You can get the MdmDimensionedObjectModel for an MdmDimensionedObject by calling the getModel method of the MdmDimensionedObject. The concrete subclasses of MdmDimensionedObjectModel are MdmAttributeModel and MdmMeasureModel.

An MdmDimensionCalculationModel assigns values for a measure of a particular data type. An MdmPrimaryDimension object has MdmDimensionCalculationModel objects for the OLAP Java API data types Boolean, Date, Number, and String. The MdmMeasureDimension subclass of MdmPrimaryDimension has a MdmDimensionCalculationModel for the Value data type, as well. You get an MdmDimensionCalculationModel for a specific data type by calling a method of an MdmPrimaryDimension, such as the getStringCalcModel method. Calling the getModel method of an MdmPrimaryDimension returns null.

The subclasses of MdmSubDimension, and the MdmStandardMember and MdmTimeMember classes, do not have associated MdmModel objects. Calling the getModel method of an MdmSubDimension, MdmStandardMember, or MdmTimeMember returns null.