Yogu Compass
Open App
Back to blog
Business ontology
11 min read

Text-to-SQL Works in the Demo. Why Does It Break on the Shop Floor?

Wire an LLM to your data warehouse and it answers last quarter's revenue easily. Ask what happens to tomorrow's shipments if CNC-04 overheats, and it starts guessing. Here are the four structural blind spots of raw-table AI—and how to ship a thin-slice business ontology in four weeks without replacing your ERP.

Yogu Compass Product Team· Ontology Architecture

Over the past two years, almost every manufacturing and supply chain team pursuing "AI + Data" started in the exact same place: feed warehouse DDLs and column comments into an LLM, and ship a Text-to-SQL assistant.

Week one usually looks impressive. Ask for the top five accounts by shipment volume in East China last quarter, and the model writes a clean aggregation query and renders a chart. Everyone leaves the review believing natural-language analytics has arrived.

Then you hand the same tool to a planner, materials controller, or dispatch supervisor for two weeks, and the cracks open up immediately:

  • Ask for "available inventory of material A032" and the answer depends on which wide table the model picks—finance reads ledger balance, the warehouse subtracts allocated picks, and production excludes lots pending QA. The same question returns two different numbers between morning and afternoon;
  • Ask a cross-system operational question—"if CNC-04 overheats and we move work order WO-2048 to CNC-06, will it collide with tomorrow's rush delivery?"—and column comments are nowhere near enough for the model to infer the join path across MES, ERP, and EAM;
  • Even when the model gets the impact right, it stops at a paragraph of prose. The supervisor still opens MES to reassign the job, EAM to file a maintenance ticket, and chat to warn assembly and sales.

Most teams first reach for longer system prompts or a larger reasoning model. Yet even the newest frontier model still fails on live shop-floor questions.

The reason is structural: data warehouses and wide tables are designed for retrospective reporting, while live operations depend on objects, relationships, and governed rules.

Comparison between raw-table Text-to-SQL and a Business Ontology layer

Figure 1: Raw-table Text-to-SQL versus a unified Business Ontology layer bridging semantics and governed execution.

Four Kinds of Operational Knowledge Raw Tables Cannot Hold

Lay an ERP ord_hdr table next to an MES wip_job table and a WMS inv_bal table. The schemas describe how bytes are stored, not how the factory actually runs. In production, four gaps show up every time:

1. Metric Drift and Tribal Filter Rules

Any ERP or MES running for more than five years accumulates operational scar tissue: status = '9' means voided rather than completed; legacy plants use two-digit plant_id codes while new plants use four letters; internal trial builds have no boolean flag and are excluded by matching a keyword inside a free-text notes column.

Those rules live across hundreds of BI scripts, nightly ETL jobs, and veteran planners' heads. Pointing an LLM at raw tables hands the dirtiest, least error-tolerant semantic translation work to a probabilistic model on every turn.

2. Multi-Hop Traversals Should Not Be Improvised

When QA flags an incoming material lot as out of spec, which customer deliveries will slip? Answering that requires walking Material Lot → Issue Slip → Work Order → Finished Goods → Sales Order → Shipment across three or four heterogeneous systems, handling split lots and approved substitute materials along the way.

In relational terms, that means five or six cross-database joins plus domain branching. Without an explicit object graph, every conversation reinvents the traversal—and missing one hop produces a silent false negative.

3. Missing State Machines and Process Invariants

Raw tables do not enforce that a machine locked for preventive maintenance cannot accept a new job, or that a five-axis precision step can only route to certified spindles. Tables store static columns, not operational invariants. An LLM reading raw rows will routinely propose plans that sound fluent and violate shop-floor physics.

4. The Read-Only Cliff

Most high-leverage operational work is not reading—it is state change: locking stock, reassigning a work order, throttling a machine, splitting a shipment. A warehouse is a read-only replica. If AI stops at printing "consider transferring 200 units," humans still copy order IDs across four tabs and re-key updates manually.

DimensionRaw Tables + Text-to-SQLBusiness Ontology
Primary abstractionTables, wide views, metric definitionsBusiness objects (Equipment, WorkOrder, Material, Order, Customer)
RelationshipsImprovised SQL joins at query timeExplicit directed links with cardinality and lineage
Business rulesScattered across BI scripts and tribal knowledgeEncoded in object definitions, derived logic, and action preconditions
Access boundariesCoarse table grants; multi-hop leaksObject-, row-, and property-level policy filtering before prompt
After the answerRead-only text summaryNamed approval followed by governed write-back to ERP / MES / EAM

Inside the Ontology Layer: Three First-Class Primitives

"Ontology" can sound academic, yet in systems engineering it is concrete. It models core operations around three computable, verifiable primitives:

  1. Object Types & Inheritance: For instance, Equipment extends Asset, unifying asset IDs, plant ownership, live status, and health scores while insulating applications from how each plant's MES names its columns.
  2. Directed Links: Relationships such as WorkOrder runsOn Equipment, WorkOrder consumes Material, and Equipment deployedOn Line become traversable edges carrying source lineage and sync freshness—so reasoning knows which signals are real-time and which are hourly batches.
  3. Executable Actions: Operations such as reassigning a work order, reallocating inventory, or filing a repair ticket are defined as typed contracts with preconditions, approval roles, and downstream write-back connectors.

Here is a trimmed contract for reassigning a work order:

actionType: ReassignWorkOrder
targetObject: WorkOrder
parameters:
  - name: targetEquipmentId
    type: ObjectRef<Equipment>
    required: true
  - name: reason
    type: string
    required: true
preconditions:
  - targetEquipment.status == 'IDLE'
  - targetEquipment.capabilities.includes(workOrder.requiredProcess)
  - workOrder.status in ['QUEUED', 'RUNNING']
approval:
  required: true
  approverRole: DispatchSupervisor
sideEffects:
  - system: MES
    operation: workOrder.reassign
  - system: EAM
    operation: maintenanceTicket.createIfOverheated

The highest-leverage sections here are preconditions and approval.

When an AI assistant proposes moving WO-2048 to CNC-06, it is not emitting an unconstrained HTTP script—it is populating a typed contract. If CNC-06 lacks the required process capability or is locked for inspection, deterministic code blocks the proposal before it ever reaches the floor. Valid proposals go to the dispatch supervisor alongside projected impact and the exact downstream side effects.

Yogu Compass three-layer business ontology runtime architecture

Figure 2: The business ontology sits above existing ERP, MES, WMS, and EAM systems as a semantic and action orchestration layer—connecting them rather than replacing them.

Three Practical Questions Every CIO and Architect Asks

In architecture reviews, three grounded questions come up in almost every conversation:

1. Does adopting an ontology mean replacing our ERP, MES, or data warehouse?

No—and it shouldn't. Your ERP, MES, and WMS carry a decade of financial compliance, accounting controls, and transactional stability. Nobody should rewrite systems of record to adopt AI.

The ontology acts as a connective and orchestration layer: syncing incremental records and live events upward into unified objects, and routing approved actions back down through governed connectors. Authoritative ledgers stay right where they belong.

2. Will ontology modeling turn into a three-year master data governance quagmire?

That is the single biggest anti-pattern to avoid. Trying to model 200 enterprise object types up front before shipping a single workflow almost always stalls in cross-department committees.

What works in practice is a scenario-driven thin slice:

  1. Pick one high-friction, cross-system operational loop (such as equipment-exception rescheduling or shortage reallocation);
  2. Model only the 5–8 objects directly involved (Equipment, WorkOrder, Material, Order, Warehouse) and 2–3 high-frequency actions;
  3. Run read-only impact scoping and plan recommendations first, then enable approved write-back once frontline teams trust the numbers.

Once that first loop saves dispatchers real time within 2–4 weeks, the ontology expands organically with each new workflow—and every additional workflow reuses a larger share of the objects already modeled.

3. Where is a business ontology overkill?

Being honest about boundaries matters more than overselling:

  • Weekly KPI decks and financial closes—a modern warehouse and BI stack already do this well;
  • Searching SOPs, manuals, and contract PDFs—standard document RAG is cheaper and faster to deploy;
  • Single-system form approvals—configure them directly inside your ERP or workflow tool.

An ontology pays compound returns where work is cross-system, constantly shifting, and requires humans and AI to weigh trade-offs before writing back to execution.

Closing Thought

LLMs excel at reasoning over clean context and comparing bounded options. They struggle when asked to guess undocumented enterprise rules out of legacy tables.

A business ontology turns the object links, semantic definitions, and operational guardrails that previously lived only in experienced operators' heads into one shared system model that both people and AI can inspect and verify. That is the bridge between an impressive chat demo and production-grade operational AI.

KEEP READING

Business ontology

We Already Built a Modern Lakehouse. Why Do We Still Need a Business Ontology?

After investing heavily in a Bronze-Silver-Gold lakehouse and BI stack, most CIOs ask why another layer is needed. Here is how a business ontology complements—rather than replaces—your cloud data platform by turning analytical tables into governed operational actions without duplicating storage.

Business OntologyCloud Data WarehouseLakehouse
Yogu Compass Product Team10 min read
Field practice

The Three Hours After an Alert: Turning Cross-System Firefighting into Auditable Actions

Factories and supply chains rarely lack alert dashboards; they lack a governed way to act after the alarm rings. Tracing a real spindle-overheat incident, we show why both manual firefighting and fully autonomous write-back fail—and how human-in-the-loop actions close the loop cleanly.

Human-AI CollaborationException HandlingManufacturing & Supply Chain
Yogu Compass Solutions Team10 min read