Skip to content

OntoDoc: Can a Four-Stage Agent Pipeline Write Ontology Descriptions?

THE ARGUMENT

OntoDoc's leverage is not a longer prompt but an intermediate assumption layer that grounds every description in explored triples and retrieved background; the gain shows up as completeness, not accuracy.

On this page

You have 11 annotators, a knowledge graph, and hundreds of ontology terms, but almost none of the terms carry a human-readable comment. Should your team pay annotators, or let a model write the descriptions? Most people assume the model can do it: hand a large language model a handful of triples and it will produce a tidy rdfs:comment. In practice, that shortcut produces descriptions that look fluent and miss what the term actually means. The reason is structural: a term's meaning is often scattered across its instances and their attributes, not recoverable from a single local neighbourhood. Manual authoring does not scale either, because large graphs can contain hundreds of distinct classes and properties and the expertise to describe them sits with a small group of contributors [1]. OntoDoc attacks this gap with a four-stage agent pipeline: adaptive SPARQL exploration, web retrieval, structured assumption generation, and description synthesis. It is evaluated on three knowledge graphs covering biomedical, agricultural and cross-domain settings.

Why the Default Approach Falls Short

The standard move is to hand an LLM a few triples around the target term and ask it to explain the term [1]. That produces descriptions that look plausible yet are systematically incomplete, because a class's meaning is often recoverable only by inspecting its instances and the attributes those instances share. Template-based ontology verbalizers take the opposite extreme: they follow OWL axioms faithfully and produce sentences such as "Class A is a type of Class B and is distinct from Class C."

OntoDoc replaces both extremes. It runs one agent that probes the SPARQL endpoint and collects the most semantically informative triples, then a second agent that pulls encyclopedic background from Wikipedia and the open web. Both contexts feed an assumption generator, which produces a structured, evidence-grounded list of assumptions before any English sentence is written.

The Four-Stage Pipeline, Step by Step

The four agents communicate through a shared key-value session state. Each agent writes its output to a designated key (database_context, web_context, assumptions, description), so no agent calls another directly and any stage can be swapped or ablated in isolation.

The Database Context agent is an agentic SPARQL explorer with a default budget of 50 triples and 10 tool calls. It follows a four-phase protocol: orient, initial scan, targeted follow-up, and summarise. Table 1 lists its five tools.

ToolWhat it does
get_iri_informationReads rdf:type, rdfs:label, rdfs:comment, dcterms:description, skos:definition; checks whether the IRI is used as a predicate
get_outgoing_triplesReturns triples where the IRI is subject, capped at 200
get_incoming_triplesReturns triples where the IRI is object, capped at 200
get_predicate_usageFor property IRIs, returns sample triples and distinct rdf:type values of subjects and objects
execute_sparqlRuns SPARQL SELECT/ASK with filtering, grouping, aggregation and arbitrary patterns

The Web Context agent splits the human-readable label out of the IRI (for example http://dbpedia.org/ontology/LacrosseLeague becomes LacrosseLeague), applies a two-stage filter, and then decides between two retrieval tools. fetch_wikipedia_context uses the Wikipedia Search API and re-ranks results with Cohere Rerank 3.5, keeping at most 3 results above a 0.75 relevance threshold. fetch_tavily_context uses the Tavily web search API for more technical terms.

The Assumption Generation agent receives both contexts and emits JSON facts: reasoning and assumptions for each item. In the paper's own example for the DBpedia class LacrosseLeague, one assumption reads "LacrosseLeague is a class representing organized sports leagues specifically for the sport of lacrosse", with the reasoning citing triples 1 and 3. The stage is inspired by chain-of-thought prompting: reason explicitly before writing.

The Description Generation agent turns the grounded assumption list into the final natural-language description.

How the Three-Graph Evaluation Was Set Up

The evaluation covers three knowledge graphs: biomedical, agricultural, and cross-domain. Automatic scoring uses an LLM judge; human evaluation uses 11 annotators. Both settings score four dimensions: accuracy, clarity, completeness, and cruciality.

Two baselines are compared. One is a naive LLM baseline that receives the target term's local triples and is asked to explain it. The other is a template-based ontology verbalizer that maps OWL axioms into template sentences [1].

Results: Accuracy Holds, Completeness Pulls Ahead

On accuracy, OntoDoc matches or exceeds both baselines. The real gap opens on completeness: a 12% average improvement over the naive baseline across all domains, and up to 2.8 points on a 5-point scale over the ontology verbalizer. The direction matches the abstract: OntoDoc wins by folding instance data and web background into the description, not by writing prettier prose.

Read together, the two numbers carry a useful signal. Flat accuracy means the "say less, say it wrong less often" problem is close to its ceiling under existing methods, while the completeness gap says "say enough" is the current bottleneck. For a downstream team that will use these comments for retrieval or data onboarding, a description that is accurate but incomplete is usually harder to work with than one with slightly lower accuracy.

When the Method Does Not Apply

The method fails or degrades when the graph carries very sparse instance data. With few instances to inspect, the Database Context agent has little to describe, and quality falls back to whatever the web context can retrieve. Graphs available only as OWL files, with no SPARQL endpoint, still allow the Web Context agent to run, but the adaptive exploration stage is out of scope.

Terms whose labels are generic stopwords (name, type, id, date) are rejected by the web filter and must rely on the database context alone. The default budget of 50 triples and 10 tool calls is a design ceiling, not an adaptive allocation: on a very large or very dense graph, that budget may be too small and needs retuning per graph.

Finally, the evaluation covers biomedical, agricultural and cross-domain graphs, so the 12% completeness gain does not automatically transfer to other domains. To compare against the paper's numbers you need your own rerun with the same 11 annotators and the same four dimensions [1]. If your comments are consumed by machine filters rather than human readers, accuracy deserves more weight than completeness, and the "matches or exceeds" result needs its own sample check.

References

  1. OntoDoc: Automatically Generating Ontology Resource Descriptions

Sign in to Padda

A code in your inbox. No password to remember.

Connecting to sign-in…