← narwal.one/Second Brain
SecondBrain
Ask the Brain
Index/Conceptupdated Mon Aug 10 2026 08:00:00 GMT+0800 (Philippine Standard Time)

Ontology

ontologyknowledge-graphsymbolic-aineuro-symbolic-aiguardrailssemantic-webrdfsowl

Ontology

Formal definition (Gruber 1993): "a formal specification of a shared conceptualization." In practice, in the AI-engineering context: a graph of entities, their relationships, and their properties, plus optional layered reasoners (RDFS, OWL) that infer new facts and enforce constraints on the graph.

An ontology is what you give an agent so it can share your conceptualization of the domain rather than reconstruct one from natural-language context on every call.

The three layers

Reading an "ontology" in a conversation almost always means one of three things — worth naming them because they collapse into each other constantly:

  1. The graph itself. Entities, relationships, properties. Modeled in RDF triples or a labeled property graph. Data.
  2. The schema-and-axioms layer. RDFS (subclass, domain, range) + OWL (functional, transitive, disjoint properties, value constraints). Rules over the graph. Not data.
  3. The reasoner. Software (Pellet, HermiT, RDFox, Stardog's reasoner, Neo4j Bloom, etc.) that reads the graph + axioms and derives inferences / rejects violations. Behavior.

The distinction matters because when Frank Coyle argues for "ontology at the ledger" he specifically means layers 2 and 3 — the reasoner over the graph, not just the graph. A knowledge graph without a reasoner is a database that happens to be graph-shaped; an ontology is the reasoner-plus-schema that lets you use the graph as a validator.

Why graph, not table

The AI-engineering-facing argument for graphs over relational tables:

  • Extensibility. Adding a new fact to a relational schema requires altering the table structure and rewriting rows; adding a fact to a graph is attaching a node/edge/property.
  • Traversal-native. Multi-hop questions (is Bob a distant descendant of Sue?) are traversal operations in graph, join operations in tables — the graph representation matches the shape of the question.
  • Property flexibility. Entities can have different property sets without sparse-column overhead.

This is why the entity/relationship model beat the table model for domains that evolve — customer 360, supply chain, product taxonomy, knowledge management — long before agents needed it.

What ontologies buy an agent: inference and constraint

The specific error classes an ontology reasoner catches that pure LLM inspection misses (Coyle):

Ontology construct Class of error caught
Functional property (hasFather, hasOrderNumber) Duplicate of a must-have-exactly-one relation — e.g. a second refund posted against the same order
Disjoint classes (Customer ⊥ SupportRep) Cross-class entity confusion — e.g. a payout routed to the support desk instead of the buyer
Value constraints / enumerations (status ∈ {paid, shipped, refunded}) Made-up values — e.g. an LLM inventing "probably shipped" as a status
Transitive property (ancestor, partOf, dependsOn) Missed derivations — the reasoner materializes the transitive closure
Domain and range (teaches: Teacher → Student) Type errors on relations — assertion validity from an assertion alone

Each class corresponds to a specific shape of LLM output that looks fine as English and fails as data.

Two ways to build one

  • Top-down — domain experts convene, model the entities/relationships/properties. Expert-systems style (1980s). High initial cost, tight coverage.
  • Bottom-up — grow the ontology from live signals (support tickets, customer interactions, log events). Additive; adds entities as they appear.

Neither dominates; production ontologies usually mix. The bottom-up path is more compatible with agent-generated content because you don't have to model the whole world before doing anything useful.

Reuse before you build

Existing taxonomies you should almost always start from:

  • schema.org — Google/Microsoft/Yahoo-backed shared vocabulary; the default for web-facing entities (Person, Organization, Product, Event).
  • FOAF (Friend of a Friend) — social-network relationship modeling.
  • Dublin Core — early metadata standard for research papers, books, media.
  • DBpedia — the ontology under Wikipedia; when you search Wikipedia, you're querying this graph.

Ontology-as-guardrail in the agent stack

The prescription from Coyle is a two-surface validation architecture around the ReAct loop:

  • Pydantic at the door — type-check tool-call inputs
  • Ontology at the ledger — validate tool-call outputs against the domain graph before persisting

Corollary: agents should have no side effects until validated. Run the whole loop against the reasoner before any database commit.

This composes with the vault's harness thread (Harness (LLM Agents), AWARE Framework) as a domain-side guardrail — distinct from security-side guardrails (Prompt Injection, Lethal Trifecta) which govern what the agent is allowed to touch. Ontology guardrails govern whether the resulting state is coherent in the business.

Ontology vs adjacent primitives (disambiguation)

Constantly confused; worth pinning down:

  • Ontology vs GraphRAG. GraphRAG uses a graph as a retrieval structure — nodes are documents/chunks, edges are relations, traversal returns context. Ontology uses a graph as a validation structure — nodes are domain entities, edges are typed relationships, reasoning enforces constraints. Same underlying representation, different use.
  • Ontology vs Graphiti / Agent Memory. Graphiti-style agent memory is a time-versioned graph of what the agent has learned; ontology is the domain-model the agent operates within. Memory graphs personalize per user; ontology is (usually) domain-shared and stable.
  • Ontology vs skills / Tool Use. Skills are recipes for how the agent does things; tools are the affordances it can call; the ontology is the reality-check applied to whatever the tools produce.
  • Ontology vs taxonomy. A taxonomy is a hierarchy (parent-child). An ontology allows arbitrary typed relationships beyond hierarchy — a taxonomy is a special-case ontology with only subclass edges.

Related primitives in symbolic AI

  • RDFS (RDF Schema) — W3C standard for describing classes, subclass relationships, and property domain/range.
  • OWL (Web Ontology Language) — W3C standard layered on RDFS with the property characteristics (functional, transitive, symmetric, inverse, disjoint) that give reasoners their power.
  • SPARQL — the query language for RDF graphs (relational-query-equivalent, but graph-native).
  • SHACL — shapes-constraint language; another way to express constraints on RDF data, more popular than OWL for pure validation.

History note

The concept comes from Aristotle's Categories ("philosophy of being"). Modern computer-science ontology work traces to Willard Van Orman Quine (mid-20th century) and, in the AI context, to Tom Gruber's 1993 definition cited above. The 1980s expert-systems boom (Japan's Fifth Generation Computer Systems, US Cyc project, Prolog-based rule systems) was the previous cycle of the same idea; it hit an AI winter when symbolic systems didn't scale on the hardware of the day. The current Neuro-Symbolic AI paradigm returns to the symbolic layer with better neural front-ends and modern graph databases.

Sources

Open threads for the vault

  • Second vault source centred on ontologies would move this page's triangulation past its current 3 — candidates: a Neo4j / Ontotext / Stardog technical piece; an academic neuro-symbolic survey; a Fortune-500 case study of an agent stack with a named ontology in the acceptance layer.
  • A measured comparison of agent error rates with vs without an ontology reasoner in the loop would move evidence past 3 (Coyle asserts the guardrail catches specific error classes but shows no benchmark).
  • The vault's own graph-primitive pages (GraphRAG, Graphiti, Agent Memory) plus this concept and Neuro-Symbolic AI now form a cluster; worth watching for a synthesis page as more sources land — the LangGraph-style "graph = flow" gap flagged on Harness (LLM Agents) would connect to this cluster too.