Previous Topic: Refining the ModelNext Topic: Modeling History and Time


Modeling Hierarchies and Networks

Recall that a relationship is a reason relevant to the enterprise for associating entities of one or two entity types.

Up to now, this guide has used examples of relationships between two separate entity types. However, it is clear from the definition that entities from the same entity type can also be paired based on a relationship. The most frequent use of such a relationship is to represent either a hierarchy or a network of entities, for example, in an organizational hierarchy.

The following illustration represents a situation where one employee can supervise one or more other employees who can, in turn, supervise one or more other employees.

Modeling Hierarchies and Networks

Such a hierarchy of employee entities can be modeled as shown in the Entity Relationship Diagram fragment in the following illustration.

Modeling Hierarchies and Networks (2)

This involuted relationship is also called a looped relationship. Note that the relationship must be fully optional to avoid a situation in which the hierarchy continues forever. The employee at the top of the hierarchy has no pairing because of its IS SUPERVISED BY relationship membership. The employees at the bottom have no pairings based on their supervises relationship membership.

Each employee is supervised by at most one employee. By implication, it is also true that each employee entity can only appear once in the hierarchy.

The following illustration shows entity occurrences for a less formally structured business situation in which a single individual, named Lee, has multiple supervisors. These employee entities do not participate in a true hierarchy. Rather, they are arranged in a general network.

Modeling Hierarchies and Networks (3)

In a network, an entity can participate in multiple pairings based on either membership of its involuted relationship. Obviously, the model fragment presented in the following illustration of an involuted relationship is too restrictive to allow for such a condition.

The style of involuted, fully optional, M:N relationship shown in the following illustration can be used to support any general network and can also support the retention of successive occurrences of supervision over a period of time.

Modeling Hierarchies and Networks (4)

Consider a Bill of Materials structure. A Bill of Materials is generally shown as a hierarchy. In reality, however, it is a network, since a single part can appear multiple times, as shown below.

This structure is slightly different from the example of the general network.

Here, each time a part appears in the structure, it is accompanied by a piece of related information, Quantity Used. For example, in the table Bill of Materials Structure:

Obviously, Quantity Used is an attribute of something besides the entity type part. Otherwise, each part, with all of its attendant relationships and attributes, would have to be repeated each time it appeared in the structure, with the only difference being the value of Quantity Used.

To solve this problem, you can introduce an entity type whose sole function is to hold Quantity Used and any other attributes associated with the specific usage of a part in the structure. The following illustration shows a model fragment that uses this technique, and the set of occurrences that support this illustration.

Modeling Hierarchies and Networks