In ODL schema design, how should an association between two classes be specified to ensure consistent bidirectional navigation and integrity? Select the best practice regarding relationship declaration.
-
AOne direction starting with the first class
-
BOne direction starting with the second class
-
CNeither direction.
-
DBoth directions.
Answer
Correct Answer: Both directions.
Explanation
Introduction / Context:ODL supports relationships between classes and allows explicit declaration of inverse roles. Declaring both ends ensures that updates on one side are reflected on the other, enabling reliable navigation and consistency.
Given Data / Assumptions:
- Two classes are associated (e.g., Student–Course).
- We want consistent, bidirectional traversal.
- ODL offers an “inverse” clause to link roles.
Concept / Approach:
The recommended pattern is to declare the relationship on both classes with inverse clauses, e.g., relationship Set
Step-by-Step Solution:
Define relationship on Class A with an inverse pointing to Class B’s role.Define the reciprocal relationship on Class B referencing Class A’s role.Rely on the ODBMS to maintain integrity across both ends.Verification / Alternative check:
Inspect ODL examples; proper bidirectional modeling consistently uses “both directions” with inverse mapping.
Why Other Options Are Wrong:
One direction only: risks inconsistent navigation and stale links.
Neither: provides no navigable association.
Common Pitfalls:
Defining two unrelated one-way relationships without inverse; leads to duplication and drift.
Final Answer:
Both directions.