ontoloji.orgOpen Reference Hub

Schema & Chasm-Trap Join Hallucination

When an LLM either invents nonexistent column names or joins two independent 1:N detail tables (ORDER_LINES and PAYMENTS) in one flat SQL query, multiplying totals silently.

Why It Matters for Enterprise AI

Syntax errors fail loudly; chasm-trap fan-out queries succeed and inflate revenue by 3x without raising any database warning.

Architectural Context & Execution Mechanics

Because an ontology declares relationship cardinalities (one_to_many, many_to_many), its query compiler aggregates each grain safely before joining.

Typical Production Failure Without an Ontology

A $100,000 order paid in three installments is joined directly against PAYMENTS, reporting $300,000 in order value.

Cardinality-safe aggregation via ontology
query CustomerBalance(c: Customer) {
  booked_total: c.orders.sum(net_amount)     // aggregated at order grain
  paid_total:   c.payments.sum(paid_amount)  // aggregated at payment grain
}
Related Engineering Guide

Enterprise Ontology Design Patterns for ERP, CRM & Manufacturing (MES)

Field-tested patterns for polymorphic movement tables, undeclared foreign keys, quarantine inventory, and chasm-trap prevention.

Read guide (10 min read)

Related Ontology Concepts

Open License (CC BY 4.0) · Cite This Page

Free to reference in engineering docs, ADRs, articles, and course syllabi with attribution.

[Schema & Chasm-Trap Join Hallucination — Ontoloji.org](https://ontoloji.org/en/glossary/schema-and-join-hallucination)