Database Reference
In-Depth Information
5.5.3 Generalized Hierarchies
Generalized hierarchies account for the case where dimension members are of
different kinds, and each kind has a specific aggregation path. For example,
in Fig. 4.6 , customers can be either companies or persons, where companies
are aggregated through the path Customer
Sector
Branch , while persons
are aggregated through the path Customer
Branch .
As was the case for balanced hierarchies, two approaches can be used for
representing generalized hierarchies at the logical level: create a table for
each level, leading to snowflake schemas, or create a single flat table for all
the levels, where null values are used for attributes that do not pertain to
specific members (e.g., tuples for companies will have null values in attributes
corresponding to persons). Alternatively, a mix of these two approaches can
be followed: create one table for the common levels and another table for the
specific ones. Finally, we could also use separate fact and dimension tables
for each path. In all these approaches, we must keep metadata about which
tables compose the different aggregation paths, while we need to specify
additional constraints to ensure correct queries (e.g., to avoid grouping Sector
with Profession in Fig. 4.6 ).
Profession
Sector
SectorKey
SectorName
Description
BranchKey
...
Customer
CustomerKey
CustomerId
CustomerName
Address
SectorKey (0,1)
ProfessionKey (0,1)
...
Branch
BranchKey
BranchName
Description
...
Profession
ProfessionKey
ProfessionName
Description
BranchKey
...
Fig. 5.7 Relations for the generalized hierarchy in Fig. 4.6
Applying the mapping described in Sect. 5.3 to the generalized hierarchy
in Fig. 4.6 yields the relations shown in Fig. 5.7 . Even though this schema
clearly represents the hierarchical structure, it does not allow one to traverse
only the common levels of the hierarchy (e.g., to go from Customer to Branch ).
To ensure this possibility, we must add the following mapping rule:
Rule 4: A table corresponding to a splitting level in a generalized hierarchy
has an additional attribute which is a foreign key of the next joining level,
Search WWH ::




Custom Search