Example: Hierarchical (Parent-Child relationship) dependencies

Every order has at most one parent but may have multiple dependent orders. The application stores this hierarchical structure as one record per edge, identifying the child order and its parent. At each order, the depth of the order is maintained. The dependencies must be acyclic.

The root order has no parent and is marked as Hierarchy Level of 0. For every edge, the Hierarchy Level of the child is derived from its parent, incrementing it by 1. The assumption is that a parent order is always created first for any edge. For example, consider the following hierarchical dependency tree structure:
Figure 1. Parent-Child Dependency Relationship Example Tree Structure
Sample Tree Structure for Parent-Child Dependency Relationship
The application inserts the following records in the YFS_TRANSACTIONAL_RELATION table.
Table 1. Sample records in the YFS_TRANSACTIONAL_RELATION table for hierarchical dependencies
This Order Related Order Relationship Type Hierarchy Level
Order-1   PARENT 0
Order-11 Order-1 PARENT 1
Order-12 Order-1 PARENT 1
Order-13 Order-1 PARENT 1
Order-111 Order-11 PARENT 2
Order-112 Order-11 PARENT 2
Order-131 Order-13 PARENT 2
Order-132 Order-13 PARENT 2
Order-1321 Order-132 PARENT 3
Order-1322 Order-132 PARENT 3