Definition
Referential integrity requires a stored reference to correspond to a valid referenced key, subject to the chosen null and lifecycle rules. A relational database can enforce this with foreign keys. In commerce, an order line can reference its order and variant, while a return line references the specific purchased line.
Why It Matters
- An orphaned return cannot reliably inherit its purchase context, making product and service analysis incomplete.
- Two merchants may reuse the same order number. Relationship keys need the correct organization scope before they can support shared analytics.
- The commerce ontology describes which entities relate; integrity checks help establish whether actual records obey those relationships.
How It Works
- Define entity keys and relationship boundaries, including merchant scope. Document which links are mandatory and which may legitimately be unknown.
- Enforce suitable foreign-key and uniqueness constraints inside a database. For separate systems, validate incoming references and reconcile unresolved records explicitly.
- Define update and deletion behavior deliberately. Historical order context should survive product retirement according to the retention model; do not choose cascading deletion simply to silence errors.
- Measure unmatched relationships and their age. Distinguish a delayed parent record from an invalid identifier, repair from authoritative evidence, and rerun affected analytics.
Ecommerce Example
Context: Illustrative example: a return feed contains line R7 pointing to purchase line L42, but the purchase-line import has not arrived.
Recommended move: Hold the relationship as unresolved and retry reconciliation after the purchase feed completes. Do not attach R7 to a similar product name as a substitute for the missing reference.
Why it matters: If L42 never arrives, assign an investigation owner. This data design example is not a statement about iKawn's current database implementation.
iKawn Framework
Model
The iKawn framework names order, order-line, variant, and return relationships.
Validate
Check references at the correct merchant and entity scope.
Reconcile
Separate delayed records from unsupported relationships.
Explain
Retain resolution evidence for downstream commerce decisions.
Concise Summary
Referential integrity validates record relationships. Explicit keys, lifecycle rules, and unresolved-reference handling protect the context behind commerce decisions.