Skip Headers

Oracle9i OLAP Developer's Guide to the OLAP API
Release 2 (9.2)

Part Number A95297-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Understanding OLAP API Metadata, 11 of 11


Data Type and Type of MDM Metadata Objects

All MdmSource objects have the following two basic characteristics:

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 API implements the concept of data type through the FundamentalMetadataObject and FundamentalMetadataProvider classes. Every data type recognized by the OLAP API is represented by a FundamentalMetadataObject, and you obtain this object by calling a method on a FundamentalMetadataProvider.

The following table lists the most familiar OLAP 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 in FundamentalMetadataProvider that returns the object.

OLAP API Data Type

Description of the FundamentalMetadataObject

Method in 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 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 API Data Type

Description of the FundamentalMetadataObject

Method in FundamentalMetadataProvider

Number

Represents a general data type that includes any or all of the following OLAP API numeric data types: Double, Float, Integer, and Short.

getNumberDataType

Value

Represents a general data type that includes any or all of the OLAP API data types.

getValueDataType

Empty

Represents missing 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 one of its elements 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 MdmSource objects, such as MdmMeasure, MdmHierarchy, and MdmLevel. The typical data type of an MdmMeasure is one of the numeric data types; the typical data type of an MdmHierarchy or MdmLevel is String.

Getting the Data Type of an MdmSource

If you have obtained an MdmSource from the data store, and you want to find out the data type of its elements, you call its getDataType method. This method returns a FundamentalMetadataObject.

To find out which OLAP API data type is represented by the returned FundamentalMetadataObject, you compare it to the FundamentalMetadataObject for each OLAP 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 constant that indicates the data type of the MdmSource that is passed in as a parameter. Note that this code creates a FundamentalMetadataProvider by calling a method on a DataProvider (dp). Getting a DataProvider is described in Chapter 4, "Discovering the Available Metadata". Also note that the constants referenced in this method are defined elsewhere in the class to which the method belongs. The constants are not supplied by the OLAP API.

Example 2-1 Getting the Data Type of an MdmSource

public int getDataType(MdmSource metaSource) {

   int theDataType = 0;
   FundamentalMetadataProvider fmp =
        dp.getFundamentalMetadataProvider();

   if (fmp.getBooleanDataType() == metaSource.getDataType())
       theDataType = BOOLEAN_TYPE;
    else if (fmp.getDateDataType() == metaSource.getDataType())
       theDataType = DATE_TYPE;
    else if (fmp.getDoubleDataType() == metaSource.getDataType())
       theDataType = DOUBLE_TYPE;
    else if (fmp.getFloatDataType() == metaSource.getDataType())
       theDataType = FLOAT_TYPE;
    else if (fmp.getIntegerDataType() == metaSource.getDataType())
       theDataType = INTEGER_TYPE;
    else if (fmp.getShortDataType() == metaSource.getDataType())
       theDataType = SHORT_TYPE;
    else if (fmp.getStringDataType() == metaSource.getDataType())
       theDataType = STRING_TYPE;
    else if (fmp.getNumberDataType() == metaSource.getDataType())
       theDataType = NUMBER_TYPE;
    else if (fmp.getValueDataType() == metaSource.getDataType())
       theDataType = VALUE_TYPE;

    return theDataType;
    }

Type of MDM Metadata Objects

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

Consider the following example of a union MdmHierarchy called mdmCustomersDim, which has the OLAP API data type of String. mdmCustomersDim has a region (a level MdmHierarchy called mdmCustomersDimGeogHier), which in turn has its own regions (MdmLevel objects). In each case, the region represents a subset of elements. In the following list, the regions are indented under the MdmHierarchy to which they belong.

mdmCustomersDim
      mdmCustomersDimGeogHier
            mdmGeogTotal
            mdmRegion
            mdmSubregion
            mdmCountry
            mdmState
            mdmCity
            mdmCustomer

Because of the hierarchical structure, mdmCountry (for example) draws its elements from the elements of mdmCustomersDimGeogHier. That is, the set of elements for mdmCountry corresponds to a subset of elements from mdmCustomersDimGeogHier, and mdmCustomersDimGeogHier is the type of mdmCountry.

Similarly, mdmCustomersDimGeogHier is a region of mdmCustomersDim. Therefore, mdmCustomersDimGeogHier draws its elements from mdmCustomersDim, which is its type.

However, mdmCustomersDim is not a region of any other object. It is the top of the hierarchy. The pool of elements from which mdmCustomersDim draws its elements is the entire set of possible String values. Therefore, the type of mdmCustomersDim is the FundamentalMetadataObject that represents the OLAP API String data type. In the case of mdmCustomersDim, the type and the data type are the same.

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

Getting the Type of an MdmSource

If you have obtained an MdmSource from the data store, and you want to find out its type, you call its getType method. This method returns the object that is the type of the MdmSource object.

For example, the following Java statement obtains the type of the MdmLevel called mdmCountry.

Example 2-2 Getting the Type of an MdmSource

MetadataObject mdmCountryType = ((MdmSource) mdmCountry).getType();

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2000, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback