Ontology IS Code

Tony Seale argues that ontologies should be treated as source code — compiled, versioned, reviewed, and shipped — rather than stored in database tables.

By Tony Seale · May 21, 2026 · 362 likes · 41 comments

Knowledge Graphs · Software Engineering · Semantic Web
Overview

Why Ontology Should Be Treated as Code

362
Likes
Engagement on the original post
41
Comments
From practitioners and experts
10+
Contributors
Knowledge graph professionals
2026
Published
May 21, 2026 on LinkedIn

The Core Argument

Tony Seale's central thesis: ontologies are logic, not data storage. They declare what kinds of things exist, how they relate, and what cannot both be true. Treating them as code enables compilation, validation, versioning, and review — capabilities that database tables cannot provide for logical artifacts.

Core Concepts

Three Pillars of Ontology as Code

Ontology Should Compile

An ontology should compile — not just parse. The syntax should be valid, classes satisfiable, and entailments expected. An absent entailment is a test failure. If the model says two things that cannot both be true, the build should break.

Compilation

Ontology Should Live in Plain Text

Ontologies should live in plain text files — enabling diffs, branches, blame, pull requests, and review in context. LLMs should read, navigate, and edit the source directly, exactly the way they work with a codebase.

Version Control

Ontology Should Be Governed Like Code

Ontologies should use branches, pull requests, reviews, automated checks, releases, and builds. The artefact that decides what an organisation means by a customer, an order, a risk, or a product should not be governed less rigorously than the CSS on a marketing site.

Governance
Community Response

Comments from Knowledge Graph Practitioners

The creation and management of ontologies — and even instance data — is a classic files-and-filesystem interaction pattern. Prior to LLMs, this was difficult due to RDF notation issues: Turtle is human-readable but lacked tooling; JSON-LD had tooling but wasn't human-readable; RDF/XML was challenged on both. Today, the Semantic Web stack gels naturally with LLMs and AI Agents. You can ask an AI Agent to express your conceptualization in whatever notation you prefer and save the result to a file. You can copy those files to a folder transparently bound to a backend RDF DBMS for updating the underlying quad/triple store. LLM-powered Agents loosely coupled with appropriate Skills make this process a zillion times easier.
May 21, 2026
I don't know how you ended up in my feed, but also can't remember the last time I had ontology and knowledge graph related content properly explained.
May 21, 2026
Not only is Ontology code, Logic as data is important. We should be mostly using WhenTTT, not only IFTTT. Ontologies used in Temporal Objective-Directed Acyclic Graphs (TODAG) — a form of hypergraph designed to treat Ontologies and other data as revenue generating assets.
May 21, 2026
In today's time when the gap between engineering, design and product is narrowing — the ontology layer should no longer be a layer — but more about the language of the company. It will eventually be the catalyst that enables product building, shipping and maintaining become seamless.
May 21, 2026
For Linked Art, part of our compile pipeline is to process the ontology from RDFS+OWL into a python class library, so instead of graph.add(T triple) engineers can do the much more familiar: r = Person(id='Rob'); r.name = 'Rob'. Ontology is code ... and transpiles to other code that makes it more developer friendly.
May 21, 2026
Hear, hear! And if you have your 'ontology' in tables, it's super-easy getting it into code and work iteratively from that, just four lines of Python.
May 21, 2026
I started my business ontology as an idea in my head. Then a note in a notebook. Then an excel table. Then a sql Table (well set of them). Now looking at graphDB.
May 21, 2026
Most enterprises are building operational ontologies. Objects, attributes, relationships. What exists. That problem is real and your point about treating it as code rather than a database table is exactly right. But there is a second ontology that almost nobody is building. The decision ontology. Not what exists, but what the enterprise does about it. An operational ontology makes your data legible. A decision ontology makes your enterprise executable.
May 21, 2026
I would rather say: 'an ontology is an (hyper-) graph'. Code is not a graph but a tree.
May 21, 2026
From my point, ontology is information. Database or any code/signature is just data (format) describes information. Your example of relation database is the worst kind of normalization for ontology. In maths ontology could described as graph.
May 21, 2026
FAQ

Frequently Asked Questions

Ontologies declare what kinds of things exist, how they relate, and what cannot both be true. They are formal logic expressed as rigorous axioms. Treating them as code enables compilation, validation, versioning, and review — capabilities that database tables cannot provide for logical artifacts.

An ontology should compile meaning its syntax should be valid, classes should be satisfiable, and entailments should be the ones expected. An absent entailment is a test failure, not a curiosity discovered months later in production. If the model says two things that cannot both be true, the build should break.

Plain text files enable diffs, branches, blame line by line, pull requests, and review in context. This is especially important now that LLMs are in the loop — you want the LLM reading, navigating, and editing the source directly, exactly the way it works with a codebase.

Ontologies should use branches, pull requests, reviews, automated checks, releases, and builds. The artefact that decides what an organisation means by a customer, an order, a risk, or a product should not be governed less rigorously than the CSS on a marketing site.

LLMs can express conceptualizations in any RDF notation (Turtle, JSON-LD, RDF/XML) and save the result to a file. LLM-powered agents loosely coupled with appropriate skills make the process dramatically easier. You can copy files to a folder transparently bound to a backend RDF DBMS for updating the quad/triple store.

An operational ontology describes objects, attributes, and relationships — what exists. A decision ontology describes who owns each decision, what triggers it, what action it generates, and how the loop closes. An operational ontology makes data legible; a decision ontology makes the enterprise executable.

If your ontology currently lives in database tables or spreadsheets, extract it using a simple script. Four lines of Python can convert table rows to RDF triples in Turtle or JSON-LD format, enabling version control, diffs, and all the benefits of code-based ontology management.

For Linked Art, part of the compile pipeline processes the ontology from RDFS+OWL into a Python class library. Instead of manually adding triples to a graph, engineers can use familiar object-oriented patterns: r = Person(id='Rob'); r.name = 'Rob'. The ontology transpiles to developer-friendly code.

An ontology is fundamentally a (hyper-)graph of interrelated concepts. Code is typically a tree structure. The argument for treating ontology as code is about the management practices — versioning, review, compilation — not about the underlying data structure being a tree.

As AI systems increasingly consume organizational context as a direct input, the ontology stops being documentation and starts being an active dependency. Who owns it and how well they guard it becomes one of the more consequential product decisions a company will make.

RDF-Turtle is very human-readable shorthand but historically lacked tooling support. JSON-LD had more tooling support but wasn't as human-readable. RDF/XML was challenged on both fronts. Today, LLMs bridge this gap by generating any notation on demand.

A common journey: start with an idea in your head, then a note in a notebook, then an Excel table, then a SQL table (or set of them), and finally a graph database. Each step represents increasing sophistication in modeling relationships and semantics.

Glossary

Key Terms

Ontology
A formal representation of knowledge as a set of concepts within a domain and the relationships between those concepts. In software engineering, an ontology is source code for organizational meaning.
Knowledge Graph
A graph-based data structure that represents entities and their relationships, typically using RDF and semantic web technologies to enable reasoning and inference.
RDF (Resource Description Framework)
A standard model for data interchange on the web, representing information as subject-predicate-object triples. Supports multiple serializations including Turtle, JSON-LD, and RDF/XML.
Turtle (Terse RDF Triple Language)
A human-readable RDF serialization format using prefixes and shorthand notation. Very readable but historically lacked comprehensive tooling support compared to other formats.
JSON-LD (JSON for Linking Data)
A JSON-based serialization for linked data that combines JSON's developer familiarity with RDF's semantic capabilities. More tooling support than Turtle but less human-readable.
Version Control
A system that records changes to files over time, enabling diffs, branches, blame, pull requests, and review. Essential for managing ontologies as code artifacts.
Entailment
A logical consequence that follows from the axioms in an ontology. An absent entailment is a test failure — if the model should derive something but doesn't, the build should break.
Satisfiability
A property of a class in an ontology meaning that there exists at least one possible instance that satisfies all its constraints. Unsatisfiable classes indicate logical contradictions.
Operational Ontology
An ontology that describes what exists in an organization — objects, attributes, and relationships. It makes data legible but does not define what actions to take.
Decision Ontology
An ontology that describes what an enterprise does about what exists — who owns each decision, what triggers it, what action it generates, and how the loop closes. It makes the enterprise executable.
How To

How to Treat Your Ontology as Code

Extract Your Ontology from Tables

If your ontology currently lives in database tables or spreadsheets, extract it using a simple script. Four lines of Python can convert table rows to RDF triples in Turtle or JSON-LD format.

Save to Plain Text Files

Save your ontology as plain text files in a version control system (Git). Use Turtle for human readability or JSON-LD for tooling compatibility. Organize by domain or module.

Set Up Compilation Pipeline

Configure a build pipeline that validates syntax, checks class satisfiability, and verifies expected entailments. Use tools like PySHACL, Jena, or Protégé for validation. The build should break on contradictions.

Establish Code Review Process

Require pull requests for all ontology changes. Review in context with diffs. Ensure new terms don't silently duplicate existing concepts. Treat ontology review with the same rigor as application code review.

Integrate LLM Agents

Configure LLM-powered agents to read, navigate, and edit your ontology source files directly. Use skills to express conceptualizations in any RDF notation on demand. Connect to a backend RDF DBMS for quad store updates.

Define Decision Ontology

Beyond operational ontology (what exists), define a decision ontology: who owns each decision, what triggers it, what action it generates, and how the loop closes. This makes your enterprise executable.

Ship Releases

Version your ontology releases like software releases. Tag versions, maintain changelogs, and ensure downstream systems consume specific versions. The ontology that defines organizational meaning should be shipped with the same rigor as application code.

SPARQL

Explore the Knowledge Graph

List All Comments and Authors
Run live query
PREFIX schema: <http://schema.org/>

SELECT ?comment ?author ?text
WHERE {
  GRAPH <https://linkeddata.uriburner.com/DAV/demos/daas/ontology-is-code-tony-seale-linkedin-post-qwen3.6-plus-free-1.ttl> {
    ?comment a schema:Comment ;
      schema:author ?author ;
      schema:text ?text .
  }
}
ORDER BY ?author
Describe the Main Post and Its Author
Run live query
PREFIX schema: <http://schema.org/>

DESCRIBE <https://www.linkedin.com/posts/tonyseale_did-you-start-building-your-ontology-as-a-share-7463353332565356545-jY54/#>
       <https://www.linkedin.com/posts/tonyseale_did-you-start-building-your-ontology-as-a-share-7463353332565356545-jY54/#tonySeale>
Construct the FAQ Subgraph
Run live query
PREFIX schema: <http://schema.org/>

CONSTRUCT {
  ?q a schema:Question ;
    schema:name ?name ;
    schema:acceptedAnswer ?a .
  ?a a schema:Answer ;
    schema:text ?text .
}
FROM <https://linkeddata.uriburner.com/DAV/demos/daas/ontology-is-code-tony-seale-linkedin-post-qwen3.6-plus-free-1.ttl>
WHERE {
  ?q a schema:Question ;
    schema:name ?name ;
    schema:acceptedAnswer ?a .
  ?a schema:text ?text .
}
Knowledge Graph

KG Explorer

RDF Graph Workbench

0 nodes / 0 links
Classes
Concepts
Persons
Instances

Explore Knowledge Graph using SPARQL

Open in URIBurner
SELECT queries use format=text/x-html+tr. DESCRIBE/CONSTRUCT queries use format=text/x-html-nice-turtle.
Implementation

Tools Used

D3.js v7

Data-driven document manipulation for the force-directed knowledge graph visualization. Handles node/edge rendering, drag-pin interactions, zoom isolation, and SVG arrow markers.

Visualization

URIBurner SPARQL Endpoint

Live SPARQL query execution via https://linkeddata.uriburner.com/sparql. Supports SELECT (format=text/x-html+tr), DESCRIBE, and CONSTRUCT (format=text/x-html-nice-turtle) queries against the named graph.

Query Engine

URIBurner Describe Service

Entity resolution via linkeddata.uriburner.com/describe/?url={IRI}. All semantic entity links in the infographic route through this resolver for consistent knowledge graph exploration.

Resolver

kg-generator Skill

Transformed the LinkedIn post content into RDF knowledge graphs using schema.org terms. Produced the companion Turtle and JSON-LD artifacts with FAQ, glossary, HowTo, and comment entities.

RDF Generation

rdf-infographic-skill

Generated the interactive HTML infographic and Markdown companion from the RDF source. Implements the strict harness contract with KG Explorer, SPARQL workbench, and attribution footer.

Infographic Generation

OpenLink Virtuoso

Underlying RDF quad store and SPARQL engine powering URIBurner. Provides the linked data runtime for named graph storage, SPASQL hybrid queries, and entity description services.

Database

qwen3.6-plus

Large language model by Alibaba Cloud (Qwen series) that performed the RDF generation from the LinkedIn post content and drove the infographic creation workflow.

LLM

opencode

AI-powered coding agent that orchestrated skill execution, file generation, harness contract validation, and the overall artifact production pipeline.

Agent