Daanse Tutorial - Parent Child Minimal
Catalog with Minimal Cube with Parent Child Hierarchy Parent Child Hierarchy is self-referencing hierarchy where members can have parent-child relationships within the same table, creating variable-depth structures.
Database Schema
The Database Schema contains the Fact
table with two columns: DIM_KEY
and VALUE
. The DATE_KEY
column is used as the discriminator in the Hierarchy definitions.
Hier_One_Top_Member
table with 3 columns: KEY
, NAME
, PARENT_KEY
<roma:DatabaseSchema id="_databaseSchema_parentChildMinimal">
<tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_dimKey" name="DIM_KEY" type="Integer"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_value" name="VALUE" type="Integer"/>
</tables>
<tables xsi:type="roma:PhysicalTable" id="_table_member" name="Hier_One_Top_Member">
<columns xsi:type="roma:PhysicalColumn" id="_column_member_key" name="KEY" type="Integer"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_member_name" name="NAME"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_member_parentKey" name="PARENT_KEY" type="Integer"/>
</tables>
</roma:DatabaseSchema>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Fact Query
The Query is a simple TableQuery that selects all columns from the Fact table to use in the measures.
<roma:TableQuery id="_query_fact" table="_table_fact"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Query
The Query is a simple TableQuery that selects all columns from the Hier_One_Top_Member
table.
<roma:TableQuery id="_query_member" table="_table_member"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Level
This Example uses Level1 level bases on the KEY column and name column NAME
of table Hier_One_Top_Member
.
<roma:Level id="_level_parentChild" name="Level" column="_column_member_key" nameColumn="_column_member_name" uniqueMembers="true"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Hierarchy1
The Hierarchy1 defined parentColumn to PARENT_KEY column of Hier_One_Top_Member table. ParentColumn containing the parent reference for each member, establishing the self-referencing relationship. This column typically contains the primary key value of the parent member, or the nullParentValue for root members. The column enables the recursive traversal that defines the hierarchy structure. Also Hierarchy1 defined the level Level1. Level is Single level definition that applies to all members in this parent-child hierarchy. Unlike explicit hierarchies with multiple levels, parent-child hierarchies use one level definition that describes the properties and behavior of all members regardless of their position in the tree structure.
<roma:ParentChildHierarchy id="_hierarchy_parentChild" name="Hierarchy1" primaryKey="_column_member_key" query="_query_member" parentColumn="roma:PhysicalColumn _column_member_parentKey" level="_level_parentChild"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Diml1
The time dimension is defined with the one hierarchy.
<roma:StandardDimension id="_dimension_parentChild" name="Dimension1" hierarchies="roma:ParentChildHierarchy _hierarchy_parentChild"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Cube
The cube with with Parent Child Hierarchy.
<roma:PhysicalCube id="_cube_parentChildMinimal" name="Cube" query="_query_fact">
<dimensionConnectors foreignKey="roma:PhysicalColumn _column_fact_dimKey" dimension="roma:StandardDimension _dimension_parentChild" overrideDimensionName="Dimension1" id="_dimensionConnector_parentChild"/>
<measureGroups>
<measures xsi:type="roma:SumMeasure" id="_measure_sum" name="Measure1" 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="Minimal parent-child hierarchy" name="Daanse Tutorial - Parent Child Minimal" cubes="_cube_parentChildMinimal" dbschemas="_databaseSchema_parentChildMinimal"/>
<roma:DatabaseSchema id="_databaseSchema_parentChildMinimal">
<tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_dimKey" name="DIM_KEY" type="Integer"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_fact_value" name="VALUE" type="Integer"/>
</tables>
<tables xsi:type="roma:PhysicalTable" id="_table_member" name="Hier_One_Top_Member">
<columns xsi:type="roma:PhysicalColumn" id="_column_member_key" name="KEY" type="Integer"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_member_name" name="NAME"/>
<columns xsi:type="roma:PhysicalColumn" id="_column_member_parentKey" name="PARENT_KEY" type="Integer"/>
</tables>
</roma:DatabaseSchema>
<roma:TableQuery id="_query_fact" table="_table_fact"/>
<roma:TableQuery id="_query_member" table="_table_member"/>
<roma:Level id="_level_parentChild" name="Level" column="_column_member_key" nameColumn="_column_member_name" uniqueMembers="true"/>
<roma:ParentChildHierarchy id="_hierarchy_parentChild" name="Hierarchy1" primaryKey="_column_member_key" query="_query_member" parentColumn="_column_member_parentKey" level="_level_parentChild"/>
<roma:StandardDimension id="_dimension_parentChild" name="Dimension1" hierarchies="_hierarchy_parentChild"/>
<roma:PhysicalCube id="_cube_parentChildMinimal" name="Cube" query="_query_fact">
<dimensionConnectors foreignKey="_column_fact_dimKey" dimension="_dimension_parentChild" overrideDimensionName="Dimension1" id="_dimensionConnector_parentChild"/>
<measureGroups>
<measures xsi:type="roma:SumMeasure" id="_measure_sum" name="Measure1" 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.