# 语义层

语义层是企业数据架构中的一种抽象层，位于物理数据源与使用这些数据的用户、应用或AI模型之间，在一个受统一治理的位置上定义指标、维度和关系等业务概念，使每一个使用方都以相同的方式计算和解读相同的数字。<sup>[1](https://motherduck.com/glossary/semantic-layer/)</sup> 据麻省理工学院信息系统研究中心（MIT CISR）的研究人员所述，它由一系列技术和方法构成，用于整理和维护来自不同数据源的统一、一致的数据视图，并以人和机器都能解读的形式呈现。<sup>[2](https://dspace.mit.edu/entities/publication/cd34778d-52db-4c8e-bd58-8bafb584bd22)</sup> 在大量从业者文献中，该层也被称为指标层或业务层。<sup>[3](https://www.aifordatabase.com/glossary/semantic-layer/)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 位于原始数据与使用方之间的业务抽象，一次性定义指标、维度和关系，使所有工具都查询一致且经各方认可的定义<sup>[1](https://motherduck.com/glossary/semantic-layer/)</sup> |
| 典型组件 | 指标存储（KPI与计算逻辑）、维度目录（实体与属性）和关系图（实体之间如何连接）<sup>[4](https://semantic.io/glossary/semantic-layer)</sup> |
| 首个商业形态 | 1990年：BusinessObjects（现为SAP的一部分）推出Skipper SQL，引入后来被称为Universe的BI语义层概念<sup>[5](https://www.ssp.sh/brain/semantic-layer/)</sup> |
| 部署形式 | 逻辑层、物理层、混合层、数据虚拟化层和通用语义层<sup>[6](https://www.ibm.com/think/topics/semantic-layer)</sup> |
| 开放工具 | dbt语义层（由MetricFlow驱动）和Cube Core（后端以Apache 2.0许可证授权）<sup>[7](https://docs.getdbt.com/docs/use-dbt-semantic-layer/dbt-sl)</sup><sup> • </sup><sup>[8](https://github.com/cube-js/cube)</sup> |
| 开放标准 | 开放语义交换（OSI），2025年9月启动；首份规范于2026年1月27日以Apache 2许可证发布；2026年7月以Apache Ossie之名被接纳进入Apache孵化器<sup>[9](https://www.techradar.com/pro/salesforce-snowflake-and-other-tech-giants-team-up-to-solve-one-of-the-biggest-business-data-problems-today)</sup><sup> • </sup><sup>[10](https://www.snowflake.com/en/blog/open-semantic-interchanges-specs-finalized/)</sup><sup> • </sup><sup>[11](https://ossie.apache.org/updates/)</sup> |
| 对AI的可测量影响 | 在三款前沿大语言模型上进行的配对基准测试中，语义层文档的有无几乎解释了文本转SQL准确率和幻觉方面全部显著方差<sup>[12](https://arxiv.org/abs/2604.25149)</sup> |

## 功能与组件

该层将表、列、字段等技术结构转换为收入、活跃客户、流失率等具名业务术语，并规定每项指标如何计算、取自哪个数据源、使用哪些筛选条件。<sup>[13](https://www.collibra.com/blog/what-is-a-semantic-layer-how-shared-business-meaning-powers-better-ai-and-analytics)</sup> 当BI工具或AI模型查询数据时，它首先针对语义层解析查询，以理解各术语的含义，然后将其转换为针对底层数据源的相应SQL或API调用。<sup>[4](https://semantic.io/glossary/semantic-layer)</sup>

**它定义什么。** 语义层通常定义四类内容：具名且可复用的指标（例如将收入定义为订单金额之和、不计退款订单）、用于切分和筛选的维度（如地区或产品类别）、描述哪些键以何种方式连接哪些表的关系，以及归属方、描述和访问规则等治理元数据。<sup>[1](https://motherduck.com/glossary/semantic-layer/)</sup> IBM的参考架构将元数据视为支柱：一个将技术数据项映射到业务友好术语的存储库，预定义的指标和KPI嵌入逻辑数据模型，通过基于角色的访问控制、掩码和加密来实施安全，并具备缓存和预聚合等性能特性。<sup>[6](https://www.ibm.com/think/topics/semantic-layer)</sup>

在底层，多数语义层会将诸如“按地区统计的月度收入”这类指标请求转换为针对数仓或查询引擎生成的SQL，这意味着该层的效果取决于它所查询的建模表的质量；它建立在转换工作之上，而非取代转换工作。<sup>[1](https://motherduck.com/glossary/semantic-layer/)</sup>

## 与业务术语表的区别

语义层与业务术语表并非同一种产物。术语表是词汇表：是业务术语及其定义的权威登记处，回答的是一个术语是什么意思。语义层则是这些术语与实例化它们的物理数据资产之间的实时映射，回答的是一个术语存在于数据的何处、如何计算，以及使用方系统要正确查询它需要具备什么。数据治理厂商Collibra认为，组织两者都需要：术语表提供词汇，语义层使之可操作。<sup>[13](https://www.collibra.com/blog/what-is-a-semantic-layer-how-shared-business-meaning-powers-better-ai-and-analytics)</sup>

## 类型与部署形式

IBM的分类法区分五种部署形式。<sup>[6](https://www.ibm.com/think/topics/semantic-layer)</sup>

- **逻辑层。** 呈现物理数据的业务友好逻辑视图而不物化数据；常见于BI和可视化平台，用户在平台上查询层中定义的销售、客户等实体。
- **物理层。** 物化视图或数据集市，预先计算聚合结果，减轻底层数据库负载；适合大规模、高查询量的报表场景。
- **混合层。** 将逻辑抽象与物化视图相结合，在性能需要时使用物化视图。
- **数据虚拟化层。** 在不移动数据的情况下跨异构数据源创建统一的虚拟视图，实现实时访问。
- **通用语义层。** 一种与工具无关的标准化接口，旨在跨BI平台和分析应用为整个组织服务。

在基于本体的数据集成学术研究中，语义集成方法按一条相关的结构轴被分为物化式、虚拟式和混合式，其中虚拟系统又细分为中介器-包装器系统和联邦系统；一项综述按照八项比较标准评述了约30项此类工作。<sup>[14](https://doi.org/10.1145/3653317)</sup>

## 历史

这一概念早于其当前的流行。1990年，[SAP BusinessObjects](https://www.edgepedia.org/zh/sap-businessobjects)（当时名为BusinessObjects）推出Skipper SQL，引入了后来以Universe之名营销的BI语义层理念，让设计者能够将事实和维度映射到业务用户可理解的模型。<sup>[5](https://www.ssp.sh/brain/semantic-layer/)</sup> 随后是OLAP立方体时代：1997年的Microsoft SQL Server Analysis Services和MDX在结构化的逻辑建模层中定义业务指标和维度。<sup>[5](https://www.ssp.sh/brain/semantic-layer/)</sup> 在整个2000年代和2010年代，语义建模主要存在于BI产品内部，例如Looker的LookML，其定义与单一工具的前端绑定。<sup>[1](https://motherduck.com/glossary/semantic-layer/)</sup> 大约在2022年，随着数据工具生态的扩展，涌现出一批现代语义层、指标层或无头BI工具，包括MetriQL、MetricFlow、Minerva和dbt。<sup>[5](https://www.ssp.sh/brain/semantic-layer/)</sup>

独立语义层之所以历经时日才成熟，一个原因是构建它要求很高。企业语义层厂商AtScale表示，一个可行的层必须支持任何具备实时数据连接的查询工具或协议，能将最复杂的业务逻辑表达为语义模型，在2秒内交付查询结果，对每次查询实施访问治理，并能连接任何后端数据存储。<sup>[15](https://www.atscale.com/wp-content/uploads/2022/04/The-Semantics-of-a-Semantic-Layer.pdf)</sup>

## 实施格局

**dbt语义层。** dbt Labs的实现由MetricFlow引擎驱动，让数据团队在现有dbt模型之上定义指标，连接关系自动处理；当指标定义发生变化时，所有调用该指标的地方都会刷新。Claude和ChatGPT等AI工具可通过dbt MCP服务器连接，使其回答基于受治理的指标而非原始表。<sup>[7](https://docs.getdbt.com/docs/use-dbt-semantic-layer/dbt-sl)</sup> MetricFlow自0.209.0版本起采用Apache 2.0许可证，此前曾使用AGPL和BSL许可证<sup>[16](https://github.com/dbt-labs/metricflow)</sup>，而托管服务层则需要dbt平台。<sup>[17](https://github.com/hong-chu/dbt-semantic-wiki/blob/main/wiki/comparisons/semantic-layer-options.md)</sup>

**Cube。** Cube Core后端采用Apache 2.0许可证。<sup>[8](https://github.com/cube-js/cube)</sup> Cube Core将定义层与一个独立服务器相结合，提供预聚合、带列掩码的访问策略、26种数据源，以及Postgres-wire SQL API。<sup>[17](https://github.com/hong-chu/dbt-semantic-wiki/blob/main/wiki/comparisons/semantic-layer-options.md)</sup><sup> • </sup><sup>[18](https://motley.ai/compare/)</sup>

**BI原生与数仓原生模式。** 许多组织是通过BI工具内部的语义模型接触到这一概念的。Power BI语义模型提供带有清晰名称、推断关系和预定义指标的业务友好层，微软将其描述为可信的单一事实来源，已部署数千万个活跃模型。<sup>[19](https://learn.microsoft.com/en-us/power-bi/connect-data/semantic-models-third-party)</sup> [Snowflake](https://www.edgepedia.org/zh/snowflake)和[Databricks](https://www.edgepedia.org/zh/databricks)提供作为数据库对象的数仓原生语义定义，无需单独的许可证或基础设施。<sup>[17](https://github.com/hong-chu/dbt-semantic-wiki/blob/main/wiki/comparisons/semantic-layer-options.md)</sup> 2026年对四种开源语义层的比较发现，它们分为两大流派：SLayer和Malloy在查询时组合，因此一个未建模的问题仍可通过一次查询解决；而Cube Core和MetricFlow在模型中组合，因此指标的新形态需要新的定义。<sup>[18](https://motley.ai/compare/)</sup>

## 在AI与智能体系统中的作用

查询分析数据的语言模型必须推断模式中未编码的业务语义，从而产生错误答案和言之凿凿的幻觉。2026年一项针对零售数据集上100个自然语言问题的三款前沿模型配对基准测试发现，语义层文档的有无几乎解释了准确率方面全部显著方差，并将这一结果解读为结构性的：明确的业务语义通过改变要求模型做的事情来抑制文本转SQL的主要错误类别，而非通过让模型本身更强。<sup>[12](https://arxiv.org/abs/2604.25149)</sup>

同一机制也是智能体架构的基础。面向智能体AI系统的从业者指南将语义层描述为提供规范定义、权限感知上下文和可审计性，供智能体据此行动。<sup>[20](https://builder.aws.com/content/3J5tR3cEDnmn3BQ968awjEM0rmO/semantic-layer-for-agentic-ai-ready-enterprises)</sup> MIT CISR的研究报告称，领导者感到有压力加大对语义技术的投资，以存储元数据并让数据资产对业务用户、AI模型和AI智能体即刻更有用。<sup>[2](https://dspace.mit.edu/entities/publication/cd34778d-52db-4c8e-bd58-8bafb584bd22)</sup>

## 开放标准与互操作性

业务逻辑历来被锁定在专有工具内部，迫使团队在每个平台上重建相同的语义上下文，并面临指标漂移的风险。2025年9月，[Salesforce](https://www.edgepedia.org/zh/salesforce)和Snowflake与dbt Labs、BlackRock和[RelationalAI](https://www.edgepedia.org/zh/relationalai)共同发起开放语义交换（OSI），这是一个厂商中立的框架，用于标准化指标、维度、层级和关系的定义与交换方式。<sup>[9](https://www.techradar.com/pro/salesforce-snowflake-and-other-tech-giants-team-up-to-solve-one-of-the-biggest-business-data-problems-today)</sup> Snowflake围绕五项核心原则构建该倡议：标准化、互操作性、可扩展性、开源开发和领域特定模型。<sup>[9](https://www.techradar.com/pro/salesforce-snowflake-and-other-tech-giants-team-up-to-solve-one-of-the-biggest-business-data-problems-today)</sup>

OSI规范的第一版于2026年1月27日发布在一个采用Apache 2许可证的Git仓库中，定义了一个厂商中立、可扩展的模型，用于数据集、指标、维度、关系和上下文等语义层构造，使其能够在工具、平台和智能体应用之间得到一致解读。<sup>[10](https://www.snowflake.com/en/blog/open-semantic-interchanges-specs-finalized/)</sup> 2026年7月，该项目以Apache Ossie（孵化中）之名被接纳进入Apache孵化器，规范、社区和使命均保持不变。<sup>[11](https://ossie.apache.org/updates/)</sup> 此后参与范围有所扩大，[AtScale](https://www.edgepedia.org/zh/atscale)、Denodo和Kyvos等厂商也加入了该倡议。<sup>[11](https://ossie.apache.org/updates/)</sup> 谷歌的一项配套研究工作探索使语义模型可直接在SQL中查询，提出扩展方案让用户定义封装业务逻辑的语义数据图视图，并与SQL/PGQ图查询标准相关联。<sup>[21](https://research.google/pubs/semantic-data-modeling-graph-query-and-sql-together-at-last/)</sup>

## 实用价值与局限

运营层面的好处是一致性：没有语义层，同一指标会在每个仪表盘和分析师查询中被略微不同地重新定义，一份报告排除退款，另一份用不同的日期字段定义月份，这些不一致会累积成对报表数字的不信任。<sup>[1](https://motherduck.com/glossary/semantic-layer/)</sup> 集中定义还能加快分析师上手速度，防止指标在BI工具之间泛滥。<sup>[13](https://www.collibra.com/blog/what-is-a-semantic-layer-how-shared-business-meaning-powers-better-ai-and-analytics)</sup>

该层存在已知的失效模式。4Analytics的词汇表列出了指标定义模糊、团队为一次性自定义逻辑绕过该层，以及在定义演变时对变更管理投入不足等问题。<sup>[22](https://www.4analytics.com/glossary/semantic-layer/)</sup> 比较研究指出了工具之间的权衡：查询时的表达力与服务基础设施之间的取舍，以及免费定义层与付费托管服务之间的取舍。<sup>[18](https://motley.ai/compare/)</sup><sup> • </sup><sup>[17](https://github.com/hong-chu/dbt-semantic-wiki/blob/main/wiki/comparisons/semantic-layer-options.md)</sup>

## References

1. [Semantic layer, MotherDuck glossary](https://motherduck.com/glossary/semantic-layer/)
2. [Lefebvre, Wixom, Legner, van der Meulen, Beath. The Case for a Semantic Layer. MIT CISR Research Briefing Vol. XXVI, No. 5](https://dspace.mit.edu/entities/publication/cd34778d-52db-4c8e-bd58-8bafb584bd22)
3. [Semantic Layer, AI for Database glossary](https://www.aifordatabase.com/glossary/semantic-layer/)
4. [Semantic Layer, Semantic.io glossary](https://semantic.io/glossary/semantic-layer)
5. [History and Evolution of the Semantic Layer, ssp.sh](https://www.ssp.sh/brain/semantic-layer/)
6. [What Is a Semantic Layer?, IBM Think](https://www.ibm.com/think/topics/semantic-layer)
7. [dbt Semantic Layer, dbt Developer Hub](https://docs.getdbt.com/docs/use-dbt-semantic-layer/dbt-sl)
8. [cube-js/cube README (License section), GitHub](https://github.com/cube-js/cube)
9. [Salesforce, Snowflake and other tech giants team up to solve one of the biggest business data problems today, TechRadar](https://www.techradar.com/pro/salesforce-snowflake-and-other-tech-giants-team-up-to-solve-one-of-the-biggest-business-data-problems-today)
10. [Open Semantic Interchange (OSI) Updates: Specification Now Live, Snowflake blog](https://www.snowflake.com/en/blog/open-semantic-interchanges-specs-finalized/)
11. [Index of updates, Apache Ossie (incubating)](https://ossie.apache.org/updates/)
12. [Semantic Layers for Reliable LLM-Powered Data Analytics: A Paired Benchmark of Accuracy and Hallucination Across Three Frontier Models, arXiv](https://arxiv.org/abs/2604.25149)
13. [What is a semantic layer? How shared business meaning powers better AI and analytics, Collibra](https://www.collibra.com/blog/what-is-a-semantic-layer-how-shared-business-meaning-powers-better-ai-and-analytics)
14. [Semantic Data Integration and Querying: A Survey and Challenges, ACM Computing Surveys](https://doi.org/10.1145/3653317)
15. [The Semantics of a Semantic Layer, AtScale](https://www.atscale.com/wp-content/uploads/2022/04/The-Semantics-of-a-Semantic-Layer.pdf)
16. [dbt-labs/metricflow README (license history), GitHub](https://github.com/dbt-labs/metricflow)
17. [Semantic Layer Options: dbt SL vs Cube vs Warehouse-Native vs LookML vs AtScale, dbt-semantic-wiki](https://github.com/hong-chu/dbt-semantic-wiki/blob/main/wiki/comparisons/semantic-layer-options.md)
18. [Semantic layer comparison: SLayer, Malloy, Cube, MetricFlow, Motley](https://motley.ai/compare/)
19. [Semantic models and third-party compatibility, Microsoft Learn](https://learn.microsoft.com/en-us/power-bi/connect-data/semantic-models-third-party)
20. [Semantic Layer for Agentic AI-Ready Enterprises, AWS Builder Center](https://builder.aws.com/content/3J5tR3cEDnmn3BQ968awjEM0rmO/semantic-layer-for-agentic-ai-ready-enterprises)
21. [Semantic Data Modeling, Graph Query, and SQL, Together at Last?, Google Research](https://research.google/pubs/semantic-data-modeling-graph-query-and-sql-together-at-last/)
22. [Semantic layer: definition, 4Analytics glossary](https://www.4analytics.com/glossary/semantic-layer/)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Data mining, warehousing, and big data › Data warehousing

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/semantic-layer

English original: https://www.edgepedia.org/semantic-layer
