OLAP Server User Guide
MDX Documentation

Cube Factory: Multi Files

Creating a cube using several files (e.g. CSV) is very similar to the approach described in the single files chapter. The difference is that each dimension (as well as the measures) is defined within its own file. Otherwise, the header line is identical. The Indices working example uses this approach. This cube contains the weights of securities of financial indices over time by location and GICS classification.

Header Definition

We may note the header field option @DefaultHierarchy when there are several hierarchies within a dimension. This option allows you to define the main hierarchy from which other hierarchies are derived. In our example we're defining the hierarchy [Security].[Geo] as being the main hierarchy and, therefore, [Security].[GICS] is a derived hierarchy:

[Geo].[World]@DefaultHierarchy, ..., [GICS].[All-Sector], ...
    

We may notice several other options related to the time dimension @Level(...). The time dimension is a somewhat special and requires more options. In our example, we're explicitly specifying 'Year' and 'Month' levels:

[Calendar].[Year]@Level(Year), [Calendar].[Month]@Level(Month)
    

Measures/Facts file: Here we're defining the [Measures].[Weight] as being a double value and using the SUM aggregation operator. The other fields of the header are terminal level definitions of each main hierarchy of all the dimensions as defined in their own file.

[Calendar].[Month]@Level(Month), [Geo].[Security], [Measures].[Weight]@Aggregation(SUM)<Type.Double>
    

Value Description

The value lines within each file are identical to the ones in the single file cube approach.

Cube Factory

To register this cube within the icCube server, you must create a very simple XML wrapper indicating you want to create a cube from the files. One entry for each dimension is then defined. Here is the factory file of the Indices cube:

<cubeBasedSchemaFactory
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://www.crazy-development.com/schemas/icSchemaFactory.xsd">

    <schemaName>Indices</schemaName>

    <cubeFactories>

        <!-- Indices Cube (weights) -->

        <fileCubeFactory>

            <cubeName>Indices</cubeName>

            <directory>indices</directory>

            <facts>
                <name>FactsIndices</name>
                <fileName>FactsIndices.txt</fileName>
                <columnSeparator>,</columnSeparator>
                <commentMarker>#</commentMarker>
            </facts>

            <dimension>
                <dimensionInfo>
                    <name>Security</name>
                </dimensionInfo>
                <fileName>Security.txt</fileName>
                <columnSeparator>,</columnSeparator>
                <commentMarker>#</commentMarker>
            </dimension>

            <dimension>
                <dimensionInfo>
                    <name>Index</name>
                </dimensionInfo>
                <fileName>Index.txt</fileName>
                <columnSeparator>,</columnSeparator>
                <commentMarker>#</commentMarker>
            </dimension>

            <dimension>
                <dimensionInfo>
                    <name>Time</name>
                    <isDefaultTimeDimension>true</isDefaultTimeDimension>
                </dimensionInfo>
                <fileName>Time.txt</fileName>
                <columnSeparator>,</columnSeparator>
                <commentMarker>#</commentMarker>
            </dimension>

        </fileCubeFactory>

    </cubeFactories>

</cubeBasedSchemaFactory>
    

Next chapter: Cube Factory: Excel describes how to setup a cube right from Excel sheets.