Skip to main content
Whitepaper · 02Version 1.0August 202612Pages

The ontology outgrew the context window.

Enterprise agents rarely fail at writing SPARQL. They fail at picking the handful of schema entities a question actually needs. We measured that failure across five models and three benchmarks, then replaced the prompt with retrieval and two deterministic graph expansions. Recall of 0.89 to 0.90, at $0.015 per 100 questions instead of $11.72.

Abstract

An agent that turns a natural-language question into an executable query needs the schema as ground truth. Generating the query is seldom the hard part. The hard part comes first: mapping the concepts in the question onto the right classes and properties in the ontology.

The obvious approach puts the entire ontology in the prompt. This paper measures what that costs once the ontology reaches enterprise size: recall and F1 fall while latency and spend rise. As an alternative, we evaluate semantic retrieval over ontology entities followed by two deterministic expansion steps over the graph. On our enterprise benchmarks the pipeline reaches 0.89 to 0.90 recall at a per-question cost that stays effectively flat as the ontology grows.

01Chapter · 7 Pages

Grounding is where the pipeline breaks.

Reporting layers made structured data usable by curating views around questions someone had already anticipated. If you knew the question, you could prepare the answer. Language models move that boundary. An agent can take an arbitrary question, treat the schema as ground truth, and produce an executable query against it.

Three steps sit behind that: interpret the question, identify the schema entities it refers to, generate and run the query. The second step is the difficult one. Once the right classes and properties are on the table, assembling SPARQL is usually straightforward.

Modeling the data as a knowledge graph and handing the agent the ontology simplifies this considerably. Entities and their relationships are explicit, so the agent does not have to infer structure from fragmented and inconsistent context.

What breaks at enterprise scale.

The standard approach hands the model the full ontology and asks it to pick the relevant entities. It is the simplest thing to build, and it scales badly. Three effects arrive together.

  • Cost: input grows with the ontology, so every question gets more expensive.
  • Latency: more tokens have to be processed before the first entity is identified.
  • Retrieval quality: the model has to locate a few relevant entities inside a long catalog of mostly irrelevant schema. Long-context retrieval is a known weak spot.Modular enterprise ontologies add a fourth. As more modules enter the context, some questions pick up plausible but incorrect competing readings, because similar concepts recur across domains and namespaces under different names.

An ontology is not a document that has to fit inside a prompt. It is a semantic system that can narrow, complete, and constrain the context an agent receives.

What follows from that.

Full-ontology prompting remains a useful baseline. It does not hold up as an operating model once the enterprise schema grows. The alternative is to retrieve a small candidate set first, then recover the missing local structure from the graph itself, without asking the model to reread the whole schema every time.

How large the effect is, which models we measured it on, and what the alternative costs in production: the remaining chapters.

02 — 06Five more chapters in the PDF

The measurement, the pipeline, and the numbers behind both.

Chapter 01 makes the case that entity selection is the bottleneck. The rest of the paper measures it: five models, three benchmarks, a controlled context-growth experiment, and a pipeline whose per-question cost stays flat. Request the full PDF.

  1. 02
    Prior art: four ways to bind a question to a schema

    Non-agentic entity and relation linking, retrieval-augmented prompting, agentic inspection such as SPINACH and ARUQULA.

  2. 03
    The experiment: isolating ontology size from question difficulty.

    Fixed questions and gold entities in a central anchor block, with unrelated real ontologies added symmetrically.

  3. 04
    What five models lose as context grows.

    Claude Haiku 4.5, Gemma 4 27B, Qwen3.6-27B, Qwen3.6-35B-A3B, and gpt-oss-120b. Recall and F1 curves against each other.

  4. 05
    Retrieve and expand: semantic search plus two deterministic steps.

    Index every class, object property, and datatype property once, using name, labels, and comments.

  5. 06
    Results, limits, and the division of labor they imply.

    Recall of 0.89 to 0.90 on ENT-M and ENT-L, in English and German. Why falling precision is the correct trade here.

Request PDF by email

I consent to Digetiers GmbH processing the data I have provided in order to make the requested document available to me. I can revoke this consent at any time with effect for the future. More in our privacy policy.

About this whitepaper

Edition, licence, version status.

Edition
Whitepaper 02 · August 2026
Version
1.0 · 12 pages · EN
Licence
On request, no redistribution of the PDF
Authors
Anastasiia Alekseeva and Julius Hollmann