The Data Warehouse Development Life Cycle
Oracle Data Warehouse DesignDealing With Recursive Data Relationships
Recursive many-to-many relationships contain a database object that
has a many-to-many relationship with other occurrences of the same
object. These relationships are often termed Bill-of-Materials (BOM)
relationships, and the graphical representation of the recursive
relationship is sometimes termed a Bill-of-Materials explosion.
These relationships are termed recursive because a single query
makes many sub-passes through the tables to arrive at the solution
(see Figure 4.8).
Figure 4.8 An example of recursive many-to-many relationships.
Bill-of-materials relationships are very common in data warehouses,
and they present a difficult problem with system performance. For
example, a part may consist of other parts, but at the same time, it
is a component in a larger assembly. A class at a university may
have many prerequisites, but at the same time, the class is a
prerequisite for another class. In the legal arena, a court case may
cite other cases, but at the same time, it is being cited by later
cases.
To illustrate, a BOM request for components of a Big Meal shows that
it consists of a hamburger, fries, and soda. Yet a hamburger
consists of a meat patty, bun, and pickles--and a meat patty
consists of meat and filler, and so on. Another example of a BOM
relationship would be the division of a carburetor into subparts,
although the carburetor itself is a subpart in a larger unit (the
engine, which is a subpart of the car).
Figure 4.9 describes the course-prerequisite
hierarchy for a university. Note that the IS-A prerequisite
relationships are relatively straightforward, indicating which
courses are required to be completed before taking other courses.
For example, the prerequisites for Linear Equations 445 are Business
400, Accounting 305, and Multivariate Statistics 450. These courses
all have prerequisites of their own, which may also have
prerequisites, and so on.
Figure 4.9 A recursive data relationship for course
prerequisites.
Each occurrence of a course object has different topics, and a
complete implementation must iterate through all courses until
reaching terminus, the point where the course has no further
prerequisites.