Analyzing requirements for logical relationships

When a business process needs to associate segments from different hierarchies, logical relationships can make that possible.

Defining logical relationships lets you create a hierarchical structure that does not exist in storage but can be processed as though it does. You can relate segments in separate hierarchies. The data structure created from these logical relationships is called a logical structure. To relate segments in separate hierarchies, store the segment in the path by which it is accessed most frequently. Store a pointer to the segment in the path where it is accessed less frequently.

In the hierarchy shown in the figure in Designing a conceptual data structure, two possible parents exist for the STUDENT segment. If the CUST segment is part of an existing database, you can define a logical relationship between the CUST segment and the STUDENT segment. You would then have the hierarchies shown in the following figure. The CUST/STUDENT hierarchy would be a logical structure.

Figure 1. Education hierarchies
Course hierarchy: Root is COURSE. Below COURSE is CLASS. Below CLASS are STUDENT and INSTR. Customer hierarchy: Root is CUST. Logical relationship to STUDENT in Course hierarchy.

This kind of logical relationship is called unidirectional, because the relationship is one way.

The other conflict you can see in the figure in Designing a conceptual data structure, is the one between COURSE and INSTR. For one course there are several classes, and for one class there are several instructors (COURSE ◄─────►► CLASS ◄─────►► INSTR), but each instructor can teach several courses (INSTR ◄─────►► COURSE). You can resolve this conflict by using a bidirectional logical relationship. You can store the INSTR segment in a separate hierarchy, and store a pointer to it in the INSTR segment in the course hierarchy. You can also store the COURSE segment in the course hierarchy, and store a pointer to it in the COURSE segment in the INSTR hierarchy. This bidirectional logical relationship would give you the two hierarchies shown in the following figure, eliminating the need to carry duplicate data.

Figure 2. Bidirectional logical relationships
Course hierarchy: Root is COURSE. Below COURSE is CLASS. Below CLASS are STUDENT and logical relationship to INSTR. Instructor hierarchy: Root is INSTR. Below INSTR is logical relationship to COURSE.