Database Reference
In-Depth Information
many of the hierarchies we study next are not present in the Northwind data
cube of Fig. 4.2 , we will introduce new ad hoc examples when needed.
4.2.1 Balanced Hierarchies
A balanced hierarchy has only one path at the schema level, where all
levels are mandatory. An example is given by hierarchy Product
Category
in Fig. 4.2 . At the instance level, the members form a tree where all the
branches have the same length, as shown in Fig. 4.3 . All parent members
have at least one child member, and a child member belongs exactly to one
parent member. For example, in Fig. 4.3 , each category is assigned at least
one product, and a product belongs to only one category.
All
all
Beverages
...
Seafood
Category
Chai
Chang
..
.
Ikura
Konbu
.
..
Product
Fig. 4.3 Example of instances of the balanced hierarchy Product Category in
Fig. 4.2 (repeated from Fig. 3.3 )
4.2.2 Unbalanced Hierarchies
An unbalanced hierarchy has only one path at the schema level, where at
least one level is not mandatory. Therefore, at the instance level, there can
be parent members without associated child members. Figure 4.4 ashowsa
hierarchy schema in which a bank is composed of several branches, where
a branch may have agencies; further, an agency may have ATMs. As a
consequence, at the instance level, the members represent an unbalanced
tree, that is, the branches of the tree have different lengths, since some
parent members do not have associated child members. For example, Fig. 4.4 b
shows a branch with no agency and several agencies with no ATM. As in the
case of balanced hierarchies, the cardinalities in the schema imply that every
child member should belong to at most one parent member. For example, in
Fig. 4.4 , every agency belongs to one branch.
Unbalanced hierarchies include a special case that we call recursive
hierarchies , also called parent-child hierarchies . In this kind of hierarchy,
the same level is linked by the two roles of a parent-child relationship (note the
difference between the notions of parent-child hierarchies and relationships).
 
Search WWH ::




Custom Search