Daanse Tutorial - Level Small Int As Boolean Type
Minimal Cube with level with smallInt column as boolan type Cube have level which use smallInt column and have boolean ColumnType
Database Schema
DatabaseSchema includes physical table Fact
. Table, named Fact
, contains 3 columns: KEY
, VALUE
and FLAG
.
<roma:DatabaseSchema id="_databaseSchema">
<tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_key" name="KEY"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_value" name="VALUE" type="Integer"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_flag" name="FLAG" type="SmallInt"/>
</tables>
</roma:DatabaseSchema>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Query Fact
This example uses a TableQuery, as it directly references the table Fact
.
<roma:TableQuery id="_table_factQuery" table="_table_fact"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Level
The Level uses the column attribute to specify the primary key column. Column have SMALLINT type but level have ColumnType attribute with boolean type. This makes it possible to use level as boolean.
<roma:Level id="_level_Level" name="_Level" column="_column_fact_flag" columnType="Boolean"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Hierarchy
This hierarchy consists of level Level.
- The primaryKey attribute specifies the column that contains the primary key of the hierarchy.
- The query attribute references the queryHierarchy Join-query used to retrieve the data for the hierarchy.
<roma:ExplicitHierarchy id="_hierarchywithhasall" name="HierarchyWithHasAll" primaryKey="_column_fact_key" query="_table_factQuery" levels="_level_Level"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Dimension
The Dimension has only one hierarchy.
<roma:StandardDimension id="_dimension" name="Dimension" hierarchies="roma:ExplicitHierarchy _hierarchywithhasall"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Measure
Measure use fact table column with sum aggregation.
<roma:SumMeasure id="_measure" name="Measure" column="_column_fact_value"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Cube
In this example uses cube with level which have "boolean" type. But in database we have "smallInt". This makes it possible to use level as boolean.
<roma:PhysicalCube id="_cube" name="Cube" query="_table_factQuery">
<dimensionConnectors dimension="roma:StandardDimension _dimension" overrideDimensionName="Dimension" id="_dc_dimension"/>
<measureGroups>
<measures xsi:type="roma:SumMeasure" id="_measure" name="Measure" column="_column_fact_value"/>
</measureGroups>
</roma:PhysicalCube>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Definition
This files represent the complete definition of the catalog.
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:roma="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping">
<roma:Catalog description="Level using small integer as boolean type" name="Daanse Tutorial - Level Small Int As Boolean Type" cubes="_cube" dbschemas="_databaseSchema"/>
<roma:DatabaseSchema id="_databaseSchema">
<tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_key" name="KEY"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_value" name="VALUE" type="Integer"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_flag" name="FLAG" type="SmallInt"/>
</tables>
</roma:DatabaseSchema>
<roma:TableQuery id="_table_factQuery" table="_table_fact"/>
<roma:Level id="_level_Level" name="_Level" column="_column_fact_flag" columnType="Boolean"/>
<roma:ExplicitHierarchy id="_hierarchywithhasall" name="HierarchyWithHasAll" primaryKey="_column_fact_key" query="_table_factQuery" levels="_level_Level"/>
<roma:StandardDimension id="_dimension" name="Dimension" hierarchies="_hierarchywithhasall"/>
<roma:PhysicalCube id="_cube" name="Cube" query="_table_factQuery">
<dimensionConnectors dimension="_dimension" overrideDimensionName="Dimension" id="_dc_dimension"/>
<measureGroups>
<measures xsi:type="roma:SumMeasure" id="_measure" name="Measure" column="_column_fact_value"/>
</measureGroups>
</roma:PhysicalCube>
</xmi:XMI>
Tutorial Zip
This files contaisn the data-tables as csv and the mapping as xmi file.