Cube Factory: Single File
This is one of the simplest ways to create a cube within icCube.
The cube is fully defined using a single table contained within a single file. Each line defines one or more measures indexed by all the dimensions. Let's imagine we have statistics about the number of icCube licenses sold per country over time. Such a file might look like this:
Spain, 2010, icCube Server, 256
France, 2011, icCube Server, 512
In order to define the dimensions (i.e. hierarchies, levels, etc.), we must have a way to define some sort of meta-information. This is currently done using a header line. As we'll see later in this document, this is a common way of defining dimensions in icCube.
To be more concrete, we're going to describe the MDX Benchmark cube (available within the icCube cubes directory). This cube contains the actual run of our MDX functions and language features tests as presented in this documentation:
Header Definition
The header definition (i.e. the first line of the file) consists of a list of column definitions. Each column represents the meta-information which allows you to specify different attributes related to dimension, hierarchy, level and property. Here is an extract of the actual header definition of the MDX Benchmark cube. For the sake of clarity, each field (separated by a ; character) is displayed on a separate line:
[Test].[Test].[Type];
[Test].[Test].[Group];
[Test].[Test].[Function];
[Test].[Test].[Scenario].[Name];
[Test].[Test].[Scenario].[Key];
[Test].[Test Type].[Type];
[Measures].[Count]@Aggregation(SUM)<Type.Integer>
Here we're defining a dimension called 'Test' with two hierarchies: 'Test' and 'Test Type'. The first hierarchy defines the levels: 'Type', 'Group', 'Function' and 'Scenario'. Within the terminal level 'Scenario', we're explicitly defining the attributes NAME and KEY of its members (NAME is defaulted when not defined). The second hierarchy 'Test Type' defines a single level 'Type'. For the sake of simplicity, the syntax of the header fields look like MDX delimited names.
Similarly, we're defining a single measure named 'Count'. The @ notation allows you to define some options. Here, we're defining the aggregation operator for this measure: SUM. Eventually, we'll say that the values for this measure are of type integer. Other values currently are: Date, Double, Long and String.
Value Description
Once the header line is defined, each line of the file contains the actual dimensions and facts values. Again, for the sake of clarity, each field (separated by a ; character) is displayed on a separate line:
Function;
set;
AddCalculatedMembers;
Adding calculated measures;
AddCalculatedMembers. Adding calculated measures;
Regular;
1;
Here we're defining a single fact ([Measures].[Count]) for a given [Test].[Test].[Scenario] member: [Function].[set].[AddCalculatedMembers].[Adding calculated measures]. This line defines both the dimensions content and the indexed fact.
Cube Factory
To register this cube within the icCube server, we must create a very simple XML wrapper indicating we want to create a cube from this single file. Here is the factory file of the MDX Benchmark cube:
<cubeBasedSchemaFactory
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.crazy-development.com/schemas/icSchemaFactory.xsd">
<schemaName>OLAP Benchmark (Single File)</schemaName>
<schemaDescription>A schema example defining a single cube built from a single file.</schemaDescription>
<schemaGroup>Examples</schemaGroup>
<cubeFactories>
<!-- Indices Cube (weights) -->
<singleFileCubeFactory>
<cubeName>Benchmark</cubeName>
<directory>data</directory>
<fileDef>
<fileName>mdxBenchmark.csv</fileName>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
</fileDef>
</singleFileCubeFactory>
</cubeFactories>
</cubeBasedSchemaFactory>
This factory example defines a single cube called 'Benchmark' built from the CSV file . Reload this factory example using the icCube monitoring console:
Now, the cube is ready for MDX query processing:
Next chapter: Cube Factory : Multi Files for defining a cube from a bunch of dimension files and one fact file.