The three terms get used interchangeably because each describes business meaning in a form software can read. They hold different things, though, and an AI agent missing any one of them fails in its own way: it picks the wrong meaning, misses a related record or calculates a number nobody in finance recognizes.
Mactores has built data platforms and AI agents on AWS since 2008. This guide draws on our context ontology work: the delivery method and platform choices we publish for context ontology engagements, a knowledge graph built from code during The New York Times' move off Oracle, and how we run the open-source Context Ontology Accelerator. The standards and research it cites were checked on November 17, 2026.
An ontology defines what things mean, a knowledge graph holds the connected data that follows those meanings, and a semantic layer calculates governed numbers from that data. Each answers a different kind of question, and an agent often asks all three kinds in the same request.
|
Ontology |
Knowledge graph |
Semantic layer |
|
|---|---|---|---|
|
What it is |
A model of the types of things in your business, how they relate and the rules that apply |
Your actual records stored as entities and relationships, organized by the ontology |
A governed set of metric and dimension definitions |
|
What it holds |
Classes, relationships, attributes, rules and permissions |
Customers, accounts, parts, orders and the links between them |
Formulas, dimensions, joins, filters and time grains |
|
Question it answers |
"What counts as an active customer, and who may see one?" |
"Which orders depend on this part, and for which customers?" |
"What was on-time delivery last quarter, by region?" |
|
Standards and formats |
OWL for classes, SHACL for rules, R2RML for mappings |
RDF with SPARQL, or a property graph with openCypher |
dbt MetricFlow definitions, Apache Ossie YAML |
|
Common choices on AWS |
The Context Ontology Accelerator, with experts approving each element |
Amazon Neptune or Neo4j, or a virtual knowledge graph over source databases |
dbt, Cube, AtScale or Amazon Redshift |
|
Who we'd have own it |
A named business steward for each definition |
Data engineering, for mappings and data quality |
The team that reports each metric, reconciled to the report of record |
|
What breaks without it |
Each system's meaning wins in turn, so answers disagree |
Agents guess joins and miss related records |
Dashboards and agents give different numbers for one metric |
The ontology vs knowledge graph line is the one that blurs most, because many teams store both in the same graph database. The ontology changes when the business changes a definition or a rule, while the knowledge graph changes with every new order, customer or shipment. A taxonomy is simpler than either, and the ontology vs taxonomy difference comes down to whether relationships and rules are modeled at all.
The ontology is the agreed description of your business that software can read: the kinds of things that exist, how they relate, what each term means and which rules and permissions apply. It usually holds definitions rather than records, and it tells every system and agent how to interpret the records.
Most of the work is agreement. Data ontology work usually starts with identity, meaning which records in which systems describe the same real thing, before it moves on to definitions and rules. That sequence is the core of ontology in AI, where a customer in the CRM, an account in billing and a tenant in the product become one concept with one owner.
Ontologies are written in open W3C standards. OWL defines classes and relationships, SHACL checks data against rules, and R2RML maps relational tables to graph terms, so the model stays yours rather than belonging to the tool that drafted it.
Drafting has become the quick part. The open-source Context Ontology Accelerator uses AI to draft an ontology from your databases and documents, and domain experts review, edit and approve every element before it's stored in a knowledge graph you own. AWS released it under Apache 2.0 on July 31, 2026. It shortens the drafting, but it doesn't settle ownership disputes or decide which system wins when two disagree, and those calls still need named business owners.
A knowledge graph is connected data stored as entities and relationships, organized by an ontology so a system can traverse it, from a part to every order that uses it and from each order to its customer and contract. Where the ontology says a customer can hold contracts, the knowledge graph records which customer holds which contract.
A knowledge graph and a graph database are different things. The database is storage, such as Amazon Neptune or Neo4j, and a knowledge graph can live in one or be virtual, querying source databases in place by translating graph queries into SQL instead of copying the data. A virtual knowledge graph is often the faster start, because the data stays in the systems that already govern it.
A graph earns its place when relationships, traversals and impact analysis are central to the questions. We don't force a graph database into every problem, because sometimes a well-governed semantic layer and catalog are enough, and sometimes graph-enhanced retrieval is what separates an AI system that guesses from one that can explain its answer.
Graphs are also how hidden rules come to light. At The New York Times, a knowledge graph built from the code surfaced rules in the PLATO subscription engine that nobody knew existed, which is part of how our legacy modernization with AI approach moved it off Oracle in 12 weeks against a 12 to 15 month manual estimate.
Knowledge graphs also carry provenance, which an agent needs to explain an answer. In April 2026, W3C invited implementations of RDF 1.2, whose main addition lets one triple be used as a term inside another, so a graph can record who asserted a relationship, from which source and when, on the relationship itself.
One more distinction keeps graph projects in scope. A knowledge graph holds what is true now, while a context graph holds what was decided and on what basis, and both use the ontology's terms.
A semantic layer is a governed set of metric and dimension definitions that BI tools and agents use to calculate numbers the same way. It fixes what revenue, churn or on-time delivery means as a formula, along with the joins, filters and grain each calculation uses.
It's strong on quantities and thin on relationships and permissions. A semantic layer usually carries no tenant, entitlement or policy rules, and it doesn't describe the entities behind a metric or how they relate. Its metrics layer holds the formulas themselves, such as dbt MetricFlow definitions.
Its role is growing. Gartner's data and analytics predictions for 2026 state that "By 2030, universal semantic layers will be treated as critical infrastructure, alongside data platforms and cybersecurity."
The line between a semantic layer and an ontology is narrowing in the standards too. Open Semantic Interchange, renamed Apache Ossie when it entered the Apache Incubator in June 2026, describes itself as "an open specification for both semantic layer and ontology", and more than 50 organizations have joined its coalition. We map to it wherever a client's tools support it.
That's why we keep the metrics a company already trusts. Our approach to context ontology for software leaves the dbt models and metrics layer where they are, and the ontology reads those definitions instead of duplicating them, then adds what a metrics layer never held, such as which customer owns which tenant, what each plan entitles and which data a given agent may touch.
That combination is what a context layer for AI means in practice, and the semantic layer usually becomes part of it rather than a competitor to it.
An agent uses the ontology to interpret the question, the knowledge graph to find the records it involves and the semantic layer to calculate any number in the answer, while the ontology's rules decide what it may show. You can see the split on your own stack with one question and the people who own the answer.
Pick a question that crosses systems, such as "Which open orders will miss their promised date because of a late part, and what does that do to this quarter's on-time delivery rate?" Ask your agent, then trace which layer had to supply each part of the answer.
|
Part of the question |
Layer that answers it |
What it supplies |
What the agent does without it |
|---|---|---|---|
|
"a late part" |
Ontology |
Which part codes in the ERP, the MES and the warehouse system are the same part |
Checks one code and misses stock or orders filed under another |
|
"promised date" and "open orders" |
Ontology |
Which date counts as promised and which order statuses count as open |
Uses whichever date column it finds first |
|
"which open orders" |
Knowledge graph |
The path from part to work order to sales order to customer |
Guesses joins across systems and drops orders it can't connect |
|
"on-time delivery rate" |
Semantic layer |
The governed formula, grain and filters for the metric |
Writes its own formula, so its number disagrees with the dashboard |
|
Who may see the answer |
Ontology rules, enforced at query time |
Which customers and contracts this user is entitled to see |
Shows records the user shouldn't see, or refuses everything |
The Context Ontology Accelerator is built around the same split. It answers agents in three tiers: governed metrics that need no model call, then structured queries over a virtual knowledge graph generated from the governed formula and checked by a SQL firewall, then document retrieval and synthesis. Tier 1 deliberately declines a question that carries a filter, a time window or a different aggregate it can't apply, so a governed number is never stretched to fit a question it wasn't defined for.
We put the ontology underneath the other two for that reason. The semantic layer's metrics and the graph's relationships both use its terms, so when operations changes which date counts as promised, the change is made once and both layers follow.
Start with the question your agents or analysts keep getting wrong, then build the layer that question is missing. If the numbers disagree, start with the semantic layer. If the answer depends on which records are the same thing, how they relate or which rules apply, start with the ontology and let a focused knowledge graph follow.
|
If the recurring problem is |
Start with |
Why |
Add next |
|---|---|---|---|
|
Dashboards and agents give different numbers for the same metric |
Semantic layer |
One governed formula per metric fixes the disagreement where it starts |
An ontology, once agents need more than numbers |
|
The same customer, product or part has different IDs in different systems |
Ontology |
Identity has to be agreed before anything can be connected |
A knowledge graph over the resolved entities |
|
Questions cross more than two or three systems through relationships |
Ontology and a knowledge graph |
Traversals need both the model and the connected data |
The semantic layer's metrics inside those answers |
|
Agents act on records instead of only reporting on them |
Ontology rules and permissions |
Authority and access must be enforced where the agent reads |
Graph and metrics as the questions require |
|
A governed semantic layer and catalog already work well |
Possibly nothing new |
Sometimes they're enough |
An ontology when agents start needing rules and relationships |
Keep the first release small. A first release built around 10 to 20 business questions on a small set of sources usually takes 8 to 12 weeks from discovery to production, and larger programs ship as further dated releases.
Our context ontology services run in five phases: context and decision discovery, ontology and semantic modeling, knowledge graph and data integration, agent and application integration, then validation and handoff. Each phase ends with a signed exit, and nothing goes live until golden questions pass, access policies are tested and every definition has a named steward.
Ownership decides whether any of it lasts. We'd give each definition a named business steward, the mappings and data quality to data engineering, and each governed metric to the team that reports it, reconciled to the report of record.
If you're unsure which layer is missing, bring one question and three answers your agent gave, and walk through them with a forward-deployed engineer in a single working session. Within a week, you receive a diagnosis, a draft first-release scope and a target production date.