Daanse Tutorial - Hierarchy Has All
In a hierarchy, the top level can sometimes be a special case. Typically, levels are created using a Level object, along with a reference to a column and a query on the hierarchy. However, there are situations where no dedicated column or table entry exists for the top level. For example if you want to represent a grand total. In such cases, you can generate a generic top level that serves as a final aggregation for all members of the level below.
To manage the creation of this top level, the hierarchy provides specific attributes:
hasAllA Boolean attribute that indicates whether a so-called “HasAll” level is needed. If hasAll is set to true, a top level will be generated.allLevelNameSpecifies the name for the top level itself.allMemberNameSpecifies the name of the member within this top level. If this attribute is not set, the default name is used in the form:All <HierarchyName>s.
By configuring these attributes, you can control whether a top-level aggregation appears, as well as how it is labeled in your hierarchy.
Database Schema
The cube defined in this example is based on three table: Fact.
- The Fact table contains measures and a reference to the Level.
<relational:Schema xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmi:id="_schema">
<ownedElement xsi:type="relational:Table" xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</ownedElement>
</relational:Schema>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Query
This Query references the Fact table and will be udes for the Cube and all Hierarchies in same way.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<relational:Table xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</relational:Table>
</xmi:XMI>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Level
The Level object uses the column attribute to specify the column names KEY that represents the level and its members. This the only Level that exists in this example and will be used in all hierarchies the same way.
<rolaplev:Level xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmi:id="_level_thelevel" name="theLevel">
<column href="_column_fact_key"/>
</rolaplev:Level>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Hierarchy without hasAll Level
This Hierarchy sets the attribute hasAll to false, which means that no top level will be generated. The hierarchy will only contain the levels defined in the Level object.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolaphier="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_without_hasall" name="Hierarchy - Without HasAll" hasAll="false" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<relational:Table xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</relational:Table>
<rolaplev:Level xmi:id="_level_thelevel" name="theLevel" column="_column_fact_key"/>
</xmi:XMI>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Hierarchy with hasAll Level and defaut names
This hierarchy sets the attribute hasAll to true, which means that a top level will be generated. The hierarchy will contain the levels defined in the Level object and an additional top level with the default Name for the All-Level and the All-Member.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolaphier="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall" name="Hierarchy - with HasAll" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<relational:Table xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</relational:Table>
<rolaplev:Level xmi:id="_level_thelevel" name="theLevel" column="_column_fact_key"/>
</xmi:XMI>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Hierarchy with hasAll Level and custom names
tHis hierarchy sets the attribute hasAll to true, which means that a top level will be generated. The hierarchy will contain the levels defined in the Level object and an additional top level with the custom Name for the All-Level and the All-Member.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolaphier="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall_and_names" name="Hierarchy - with HasAll and Names" allLevelName="theAllLevelName" allMemberName="theAllMemberName" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<relational:Table xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</relational:Table>
<rolaplev:Level xmi:id="_level_thelevel" name="theLevel" column="_column_fact_key"/>
</xmi:XMI>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Dimension
The Dimension that containes all the hierarchies.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolapdim="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension" xmlns:rolaphier="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<rolapdim:StandardDimension xmi:id="_standarddimension_dimension1" name="Dimension1" hierarchies="_explicithierarchy_hierarchy_with_hasall _explicithierarchy_hierarchy_with_hasall_and_names _explicithierarchy_hierarchy_without_hasall"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_without_hasall" name="Hierarchy - Without HasAll" hasAll="false" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall" name="Hierarchy - with HasAll" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall_and_names" name="Hierarchy - with HasAll and Names" allLevelName="theAllLevelName" allMemberName="theAllMemberName" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<relational:Table xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</relational:Table>
<rolaplev:Level xmi:id="_level_thelevel" name="theLevel" column="_column_fact_key"/>
</xmi:XMI>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Cube and DimensionConnector and Measure
The cube contains only one Measure in a unnamed MeasureGroup and references to the Dimension.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolapcube="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/cube" xmlns:rolapdim="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension" xmlns:rolaphier="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmlns:rolapmeas="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/cube/measure" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<rolapcube:PhysicalCube xmi:id="_physicalcube_hasall_cube" name="HasAll Cube" source="_tablesource_fact">
<dimensionConnectors xmi:id="_dimensionconnector_dimension1" dimension="_standarddimension_dimension1"/>
<measureGroups xmi:id="_measuregroup">
<measures xsi:type="rolapmeas:SumMeasure" xmi:id="_summeasure_themeasure" name="theMeasure" column="_column_fact_value"/>
</measureGroups>
</rolapcube:PhysicalCube>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_without_hasall" name="Hierarchy - Without HasAll" hasAll="false" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall" name="Hierarchy - with HasAll" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall_and_names" name="Hierarchy - with HasAll and Names" allLevelName="theAllLevelName" allMemberName="theAllMemberName" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<relational:Table xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE"/>
</relational:Table>
<rolapdim:StandardDimension xmi:id="_standarddimension_dimension1" name="Dimension1" hierarchies="_explicithierarchy_hierarchy_with_hasall _explicithierarchy_hierarchy_with_hasall_and_names _explicithierarchy_hierarchy_without_hasall"/>
<rolaplev:Level xmi:id="_level_thelevel" name="theLevel" column="_column_fact_key"/>
</xmi:XMI>Note: This is only a symbolic example. For the exact definition, see the Definition section.
Definition
This file represents 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:relational="http://www.omg.org/spec/CWM/1.1/resource/relational" xmlns:rolapcat="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/catalog" xmlns:rolapcube="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/cube" xmlns:rolapdim="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension" xmlns:rolaphier="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy" xmlns:rolaplev="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/dimension/hierarchy/level" xmlns:rolapmeas="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/olap/cube/measure" xmlns:rolapsrc="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping/database/source">
<relational:SQLSimpleType xmi:id="_sqlsimpletype_character_varying" name="CHARACTER VARYING" structuralFeature="_column_fact_key" typeNumber="12"/>
<relational:SQLSimpleType xmi:id="_sqlsimpletype_integer" name="INTEGER" structuralFeature="_column_fact_value" typeNumber="4"/>
<rolapcat:Catalog xmi:id="_catalog_hierarchy_has_all" description="Hierarchy with all-member configuration" name="Daanse Tutorial - Hierarchy Has All" cubes="_physicalcube_hasall_cube" dbschemas="_schema"/>
<relational:Schema xmi:id="_schema">
<ownedElement xsi:type="relational:Table" xmi:id="_table_fact" name="Fact">
<feature xsi:type="relational:Column" xmi:id="_column_fact_key" name="KEY" type="_sqlsimpletype_character_varying"/>
<feature xsi:type="relational:Column" xmi:id="_column_fact_value" name="VALUE" type="_sqlsimpletype_integer"/>
</ownedElement>
</relational:Schema>
<rolapsrc:TableSource xmi:id="_tablesource_fact" table="_table_fact"/>
<rolaplev:Level xmi:id="_level_thelevel" name="theLevel" column="_column_fact_key"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall" name="Hierarchy - with HasAll" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_with_hasall_and_names" name="Hierarchy - with HasAll and Names" allLevelName="theAllLevelName" allMemberName="theAllMemberName" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolaphier:ExplicitHierarchy xmi:id="_explicithierarchy_hierarchy_without_hasall" name="Hierarchy - Without HasAll" hasAll="false" primaryKey="_column_fact_key" source="_tablesource_fact" levels="_level_thelevel"/>
<rolapdim:StandardDimension xmi:id="_standarddimension_dimension1" name="Dimension1" hierarchies="_explicithierarchy_hierarchy_with_hasall _explicithierarchy_hierarchy_with_hasall_and_names _explicithierarchy_hierarchy_without_hasall"/>
<rolapcube:PhysicalCube xmi:id="_physicalcube_hasall_cube" name="HasAll Cube" source="_tablesource_fact">
<dimensionConnectors xmi:id="_dimensionconnector_dimension1" dimension="_standarddimension_dimension1"/>
<measureGroups xmi:id="_measuregroup">
<measures xsi:type="rolapmeas:SumMeasure" xmi:id="_summeasure_themeasure" name="theMeasure" column="_column_fact_value"/>
</measureGroups>
</rolapcube:PhysicalCube>
</xmi:XMI>Tutorial Zip
This file contains the data-tables as csv and the mapping as xmi file.