On this page
What is a semantic layer?
A semantic layer sits between your data and the tools that query it. It gives tables and columns business-friendly names, defines metrics and dimensions once (revenue, margin, region), and specifies how tables join. BI tools and AI assistants query the semantic layer instead of raw tables, so they compute the same number the same way. Examples include Power BI semantic models, dbt's semantic layer, Databricks metric views and Snowflake semantic views.
Raw tables
- fct_inv_l
Semantic layer
- RevenueSUM(net_amount)
Tools
Revenue4.2M
Revenue4.2M
Revenue4.2M
Same number
What is a context layer?
A context layer contains the semantic layer, plus the business knowledge the semantic layer assumes is already settled:
Metric and KPI calculations, and how business terms map to tables and fields in every system (the semantic layer)
Semantic layerDefinitions in plain language, such as what counts as an active customer
Business rules, such as “discounts above 10% need a manager's approval” or “intercompany sales are excluded from revenue”
Data-quality rules, such as “every supplier needs a valid VAT number”
Where each item came from (a policy, a procedure, a system) and who approved it
Key point
Most of what sits outside the semantic layer was never in your data. It lives in procedures, policies, wikis and people's heads.
What does a context layer add?
Answers
Semantic layer
How do we calculate this?
Context layer
How do we calculate it, what does it mean, and which rule applies?
Contains
Semantic layer
Metrics, dimensions, joins
Context layer
The semantic layer, plus definitions, business rules, data-quality rules, sources and approvals
Comes from
Semantic layer
Your data model
Context layer
Your data model, documents, systems, regulations and people
Built by
Semantic layer
Data engineers and analysts
Context layer
Business owners decide; data teams curate
Format
Semantic layer
Query logic (SQL, YAML, DAX)
Context layer
Query logic plus plain-language definitions, linked to data
Breaks when
Semantic layer
Two tools return different numbers
Context layer
AI uses the wrong definition, or data breaks a rule nobody checks
Why does AI need a context layer?
AI finds and reads data through names, descriptions and sample values. When the same customer is KUNNR in SAP, CustomerID in your CRM and client_no in a spreadsheet, it can't tell they're the same thing. When a column called status holds the values 1 to 5, it has to guess what they mean. And it can't see the rules at all, because they live in documents and people's heads.
What AI sees
GuessingKUNNR?
CustomerID?
- client_no?
With a context layer
LinkedKUNNR
CustomerID
- client_no
Term
Customer
Intercompany sales are excluded from revenue
A semantic layer fixes part of this. It tells the AI how to calculate revenue, but it doesn't say that finance excludes intercompany sales, that two subsidiaries count customers differently, or which of two discount rules still applies. The AI then gives an answer that fits everything it could see and is still wrong for your business, and it has no way of knowing.
Does a context layer replace your semantic layer?
It can. The calculation for net revenue and the fields it uses sit inside the context layer, next to the definition the business agreed and the rules that apply to it. Keeping them together means a definition and the metric built on it can't drift apart: when finance changes what counts as net revenue, every metric that depends on it follows. The context layer can run the queries itself, or hand the definitions to the semantic layer and BI tools you already use. Either way, the numbers rest on the agreed definition and on data that follows your rules.
Agreed definition
Net revenue
Metrics on it
- Net revenue
Runs queries
Answers on the agreed definition
Or hands off


How do you start building a context layer?
- 01
Pick one domain that causes pain, such as customer, supplier or product.
- 02
Collect what already exists: definitions in your systems, procedures, policies and regulations.
- 03
Find where they disagree.
- 04
Have the business owner decide, starting with the definitions behind your most important reports and processes.
- 05
Link each agreed definition to the fields behind it, and check the data against the rules.
- 06
Make the result available to your AI tools and semantic layer, and re-check it when sources change.
Frequently asked questions
- Is a context layer the same as a data catalog?
- No. A data catalog inventories your data assets and who owns them. A context layer holds what the business means and the rules it runs on, filled from documents as well as data. Many catalogs can store definitions. Building a context layer is the work of finding them, getting them agreed and keeping them current.
- Is a context layer the same as a knowledge graph?
- A knowledge graph is one way to store a context layer. The context layer is the content itself: agreed definitions and rules, linked to their sources and to your data.
How Metagem builds a context layer
Metagem's context layer includes your semantic layer and runs queries on it, so your agents get answers calculated on the definitions the business agreed. It keeps metric and KPI definitions, and their mapping to fields in every system, next to the business definitions and rules they depend on. It reads your documents and data, proposes definitions and rules using a ready-made model, and sends conflicts to the owner who should decide. You can query through Metagem directly, or sync the metric definitions to the BI tools and platforms you already run.
Last updated October 2026.

