HERE Technologies and Wherobots announce partnership Learn More

What is a Semantic Layer? Definition, Examples, Spatial Rules

Authors

A semantic layer is a shared set of definitions that sits between data tables and the tools people use to ask questions. It names each business term once, such as revenue or active customer, and says how to compute it. A dashboard, a spreadsheet and an AI agent then give the same answer. This article tests a claim: for location data, a semantic layer must also set spatial rules, such as which boundary and which distance count. The Chicago test below changes six choices, one at a time: category, boundary, stop type, confidence score, distance, and a walk or a straight line.

How many restaurants are near transit in Chicago? Wherobots counted 7,464 restaurant records on October 26, 2026, within 1 km in a straight line of a rail station inside the city limits. Changing one of those choices at a time moved that count by as much as 68%. The counts are records in Overture Maps, an open map dataset of places, not restaurants checked on the ground.

Adding seven food and drink categories to the restaurant category raised the count 68%, to 12,534. Counting the metro area in place of the city limits raised it 48%, to 11,050. Measuring a 1 km walk in place of a 1 km straight line lowered it 9%, to 6,793.

Key takeaways

  • A semantic layer stores the meaning of business terms and metrics, and how to compute them, in one place that every tool reads.
  • Semantic layers date to the 1990s, when the software company Business Objects sold one it called a "universe". Looker, dbt, Cube, AtScale, Databricks and Snowflake offer them today.
  • Location metrics also need a boundary, a distance measure, a category list and a coordinate system, the grid that turns positions into numbers.
  • In Chicago on October 26, 2026, Wherobots counted 7,464 restaurant records within 1 km in a straight line of a rail station inside the city limits. Changing one choice at a time moved that count by as much as 68%. Adding seven food and drink categories raised it 68%. Measuring half a mile in place of 1 km lowered it 11%. All counts are Overture records, not restaurants checked on the ground.
  • One 19-second Wherobots query measured the distance from each of 45,748 Overture food and drink records in the metro area to the nearest Overture transit stop. The same query tested each record against 734 walking areas from HERE, a mapping company, around 367 rail stations in or near the city.

What is a semantic layer?

A semantic layer maps business language to data in a database, which is queried with SQL (Structured Query Language). A metric is a calculated value, such as total sales. A dimension is an attribute used to group or filter results, such as region or product. The semantic layer records each one, along with the tables, joins and filters that compute them. A user or a tool requests "sales by region", and the semantic layer generates the SQL.

A semantic layer keeps numbers consistent. Without one, each team writes its own SQL. Two teams then report different numbers for the same term, and nobody can tell which one is right. Snowflake's announcement of Apache Ossie, an open project to share semantic definitions between tools, gives an example: monthly active users "is often defined inconsistently" (Snowflake's announcement of the new name).

A semantic layer usually holds four kinds of definitions:

  • Metrics: what to count or sum, and how, such as revenue as the sum of order totals minus refunds.
  • Dimensions: the attributes to group and filter by, such as date, store or region.
  • Joins: how tables connect, so a query on orders can pull in the matching customer and store records.
  • Access rules: who may see which rows and columns.
Diagram of a semantic layer. Four data tables on the left feed a semantic layer in the middle. The tables are Overture places, Overture city limits, the Census metro area and HERE walking areas. The semantic layer defines restaurant, Chicago, near transit and the metric. On the right, a dashboard, a spreadsheet and an AI agent all get the same count: 6,793 restaurants within a 1 km walk of a Chicago rail station.
A semantic layer between the tables and the tools. With these four definitions, every tool reports 6,793 restaurants within a 1 km walk of a Chicago rail station. Data: Overture Maps, US Census Bureau, HERE. Analysis: Wherobots.

How a semantic layer works

A semantic layer turns a request into SQL. The request names metrics and dimensions. The semantic layer software looks up their definitions, adds the joins and filters, and sends the SQL to the database that holds the data. That database can be a data warehouse or a lakehouse, a store of data files that can be queried like a warehouse. The result comes back computed the same way every time.

The definitions are stored in files or in the database's catalog, and changes are often tracked like code. Some products turn them into SQL views, saved queries that work like tables. Others run their own service that business intelligence (BI) tools and AI agents send requests to.

Current examples:

  • LookML: Looker's modeling language, which defines dimensions, measures (Looker's word for metrics) and joins.
  • dbt Semantic Layer: metric definitions kept in a dbt project, the SQL files dbt turns into tables, and converted to SQL by MetricFlow. dbt Labs agreed to acquire Transform, the company that built MetricFlow, in 2023.
  • Cube and AtScale: semantic layer products that work apart from any one data warehouse and serve several tools from one set of definitions.
  • Databricks metric views: metric definitions stored in Unity Catalog, the Databricks catalog that records each table and who may use it.
  • Snowflake semantic views: database objects in Snowflake that store business definitions of tables, metrics and relationships.

A short history of the semantic layer

The idea of separating what users ask from how data is stored is older than the name. Edgar Codd's relational model (Communications of the ACM, 1970) aimed to free users of large shared data banks from knowing how the data was organized in the machine. A study group of the American National Standards Institute (ANSI) followed with the ANSI/X3/SPARC framework, reported by Dennis Tsichritzis and Anthony Klug in 1978. It described three levels of schema, a schema being a description of how data is organized. An external view serves each group of users, a conceptual schema covers the whole organization, and an internal schema covers storage.

Business Objects, a software company, brought the idea to business users. Jean-Michel Cambot and Bernard Liautaud filed a patent in 1991 for a relational database access system using semantically dynamic objects, granted in 1996 as US 5,555,403. The Business Objects "universe" let users pick business terms, and the software generated the SQL. SAP, which now sells BusinessObjects, still describes the universe as the BusinessObjects semantic layer.

Data warehouse design added shared dimensions. In the Kimball Group's method, conformed dimensions mean the same thing in every table that uses them. A "store" or "date" can then be compared across tables about sales, inventory and other parts of the business. The method is set out in The Data Warehouse Toolkit, by Ralph Kimball and Margy Ross, 3rd edition, 2013.

Today the definitions also live inside data platforms, in products such as dbt, Databricks and Snowflake. In 2025, Snowflake, Salesforce, dbt Labs and other companies announced the Open Semantic Interchange. Their announcement describes it as "a common, vendor-neutral semantic model specification that standardizes how semantic metadata is defined and shared" (Snowflake press release). In July 2026, Snowflake announced that the project had been accepted into the Apache Incubator as Apache Ossie. The Apache Incubator is where the Apache Software Foundation starts new open source projects.

Semantic layer examples

A retail company defines "net revenue" once as the sum of order totals, minus refunds, in the reporting currency, by order date. Finance, marketing and the AI assistant on the sales team all get the same figure for last quarter.

A transit agency defines "riders near a station" once. It counts people whose home census block, the smallest area the Census counts, has its center within a set walking distance of a station entrance. Every planning study then counts riders the same way.

A delivery company defines "restaurants near transit" for a city, which needs the spatial rules tested in Chicago below.

Semantic layer vs data warehouse, ontology and context engine

These terms overlap:

  • Data warehouse or lakehouse: stores the data and runs the queries. The semantic layer sits on top and generates the SQL that the warehouse runs.
  • Ontology: a formal model of the kinds of things in a domain and how they relate, such as a place located in a building. See what an ontology is. A semantic layer is narrower: it maps terms and metrics to the tables and SQL that compute them.
  • Knowledge graph: a database of the entities themselves and the links between them, organized by an ontology. A semantic layer can read from one or feed one.
  • Context engine: gathers everything an AI system needs to answer a question, including definitions, documents, entity records and locations. A context engine can include a semantic layer as one source of context, and context engineering is the practice of choosing that context.

Why semantic layers matter for AI

Language models learn from large amounts of public text. That text does not include how one company defines an active customer or which table holds it. A semantic layer supplies that definition. An AI agent then requests the metric by name, and the semantic layer generates the SQL.

Juan Sequeda, Dean Allemang and Bryon Jacob of data.world, a company that sells a data catalog, built a benchmark of questions about a database in the insurance domain (arXiv, 2023). With questions sent straight against the SQL tables, OpenAI's GPT-4 language model "achieves an accuracy of 16%". With the same questions asked over a knowledge graph built on the same database, "this accuracy increases to 54%".

The study is a preprint, a paper not yet reviewed by outside experts, written by a company that sells in this field. It tested a knowledge graph, not a semantic layer, on one benchmark.

What location adds to a semantic layer

The examples above define metrics and dimensions as columns in a table. A location metric also depends on choices that no column records. Each choice below has more than one defensible answer. The Chicago test below measured how the boundary, distance, transit and category choices change a count.

Which boundary is "the city"?

A city can mean its legal limits or its metropolitan area. The US Office of Management and Budget (OMB) defines a metropolitan statistical area as a core urban area plus the counties tied to it (OMB Bulletin 23-01). For Chicago, that area reaches into Indiana.

Statisticians have known since 1934 that changing the areas used to group data changes the results (Gehlke and Biehl, Journal of the American Statistical Association). This is the modifiable areal unit problem, studied at length by Fotheringham and Wong (Environment and Planning A, 1991).

What counts as inside?

Spatial databases follow the Open Geospatial Consortium (OGC) Simple Features standard, also published by the International Organization for Standardization (ISO) as ISO 19125-1. It defines spatial tests such as "within" and "intersects" with a matrix of how two shapes' insides, edges and outsides meet. The matrix comes from work by Egenhofer and Franzosa (1991) and Clementini, Di Felice and van Oosterom (1993).

Under that standard, a point on a boundary line is not "within" the area, as the documentation for PostGIS, a widely used spatial database, shows. A restaurant on a city line counts as inside under "intersects" and outside under "within".

How is distance measured?

A circle drawn around a point and an area traced along the street network cover different ground. Lisa Oliver, Nadine Schuurman and Alexander Hall compared circular and street network areas (International Journal of Health Geographics, 2007). Javier Gutiérrez and Juan Carlos García-Palomares measured how the distance measure changes the area a transit stop serves (2008).

In Wherobots, the distance test ST_DWithin uses the units of the data's coordinate system by default. On longitude and latitude data, a distance of 1,000 means 1,000 degrees.

How far is "near transit"?

Transit planning often uses half a mile. The Federal Transit Administration (FTA) treats pedestrian improvements within one half mile of a stop or station as related to transit for funding (FTA policy, 2011). A study of 1,449 stations in 21 US cities supported a half-mile area around each station for counting the people it serves. The study found support for "a 0.5-mile catchment area for population" (Guerra, Cervero and Tischler, 2012).

Measured walks can be shorter. In Montreal, 85% of walks from home to bus service were about 524 m or shorter (El-Geneidy and others, 2014).

Which coordinate system?

A coordinate reference system is the grid that ties numbers to places on Earth and sets their units. Data from different publishers can use different ones. US Census boundaries use NAD 83, the North American Datum of 1983. Overture Maps uses WGS 84, the World Geodetic System 1984. A semantic layer should record which coordinate reference system every metric uses, and convert the data to it before measuring.

Which category counts?

Point of interest data, map records of businesses and other places, labels each place with a category. Overture Maps sorts places into a list of "roughly 2,300 categories". Each place also has a confidence score, "a value between 0 and 1 representing the likelihood that the place exists" (Overture places guide). Whether a café or a bar counts as a restaurant, and which minimum confidence score to require, are business decisions. See point of interest data for how these datasets are built.

Semantic layers in Wherobots: one question, many answers in Chicago

The test asked one question about Chicago: how many restaurants are near transit? The definitions varied what "restaurant", "Chicago", "transit" and "near" mean. The claim holds if definitions a team could defend change the answer by more than 5%, and fails if they agree within 5%.

The data came from open sources, all queried in Wherobots on October 26, 2026:

  • Places: Overture Maps places in Havasu, the Wherobots catalog of open data tables (places table), for restaurants and rail stations.
  • City limits: the Overture Maps boundary for the city of Chicago, from the Havasu divisions table, 606.8 km².
  • Metro area: the Chicago-Naperville-Elgin metropolitan area from the US Census Bureau, 17,931 km² of land.
  • Walking areas: the area reachable on foot within 1 km and within half a mile (805 m) of each rail station. The 367 rail station locations sit inside the city or within 1 km of it. HERE traced each walk along its street map with its isoline routing service.

An isoline is a line of equal value. HERE's service draws one at a set travel time or a set travel distance. An isoline of equal travel time is an isochrone. These walking areas use distance: 805 m and 1,000 m on foot.

One query computed every count in 19 seconds. The two shorter queries below reproduce six of them.

The base definition has five rules. A place has Overture's restaurant category. Its confidence score is 0.5 or more. It sits inside or on the city limits (the query uses "intersects"). It lies within 1 km in a straight line of a rail station.

Distances were measured in meters after converting the data to Universal Transverse Mercator (UTM) zone 16N, a grid in meters for this part of the United States. The test changed one choice at a time.

The query

This query computes four of the counts at once. It runs as printed on Wherobots Cloud:

-- Restaurants near rail stations in Chicago, counted under four definitions
WITH city AS (
  SELECT ST_SubDivideExplode(geometry, 200) AS g
  FROM wherobots_open_data.overture_maps_foundation.divisions_division_area
  WHERE country = 'US' AND region = 'US-IL' AND subtype = 'locality'
    AND names.primary = 'Chicago'
),
places AS (
  SELECT id, basic_category, taxonomy.primary AS category, confidence, geometry,
         ST_Transform(geometry, 'EPSG:4326', 'EPSG:26916') AS geom_m  -- meters, UTM zone 16N
  FROM wherobots_open_data.overture_maps_foundation.places_place
  WHERE bbox.xmin > -87.97 AND bbox.xmax < -87.50
    AND bbox.ymin > 41.62 AND bbox.ymax < 42.04
),
rail AS (
  SELECT geom_m FROM places
  WHERE basic_category IN ('public_transit_facility_or_service', 'train_station')
    AND category IN ('train_station', 'metro_station',
                     'light_rail_and_subway_stations', 'subway_station')
),
eat AS (
  SELECT DISTINCT p.id, p.basic_category, p.confidence, p.geometry, p.geom_m
  FROM places p JOIN city c ON ST_Intersects(c.g, p.geometry)
  WHERE p.basic_category IN ('restaurant', 'fast_food_restaurant', 'cafe', 'coffee_shop',
                             'bar', 'casual_eatery', 'food_truck_stand', 'smoothie_juice_bar')
),
nearest AS (
  SELECT e.id, MIN(ST_Distance(e.geom_m, r.geom_m)) AS meters
  FROM eat e JOIN rail r ON ST_DWithin(e.geom_m, r.geom_m, 1000)
  GROUP BY e.id
)
SELECT
  COUNT_IF(e.basic_category = 'restaurant' AND e.confidence >= 0.5 AND n.meters <= 1000) AS restaurants_1km,
  COUNT_IF(e.basic_category = 'restaurant' AND e.confidence >= 0.5 AND n.meters <= 805)  AS restaurants_half_mile,
  COUNT_IF(e.basic_category = 'restaurant' AND n.meters <= 1000)                        AS restaurants_1km_any_confidence,
  COUNT_IF(e.confidence >= 0.5 AND n.meters <= 1000)                                    AS food_and_drink_1km
FROM eat e JOIN nearest n ON e.id = n.id

It returns 7,464 restaurants within 1 km and 6,638 within half a mile. Keeping records with a confidence score below 0.5 gives 7,779. Counting all eight food and drink categories in the query gives 12,534.

The walking counts reuse the eat step. To run them, save the city, places and eat steps above as a temporary view named eat. The HERE walking areas sit in a table named walk, with one row per station and distance: the distance in meters (rng) and the area's shape (g). This query replaces the straight-line test with a test of whether a place falls inside a walking area:

-- First: CREATE OR REPLACE TEMPORARY VIEW eat AS WITH city AS (...), places AS (...) SELECT ... (the eat step above)
SELECT COUNT_IF(wmin <= 1000) AS restaurants_1km_walk,
       COUNT_IF(wmin <= 805)  AS restaurants_half_mile_walk
FROM (
  SELECT e.id, MIN(w.rng) AS wmin
  FROM eat e JOIN walk w ON ST_Intersects(w.g, e.geometry)
  WHERE e.basic_category = 'restaurant' AND e.confidence >= 0.5
  GROUP BY e.id
)

It returns 6,793 restaurants within a 1 km walk and 5,749 within a half-mile walk.

The results

With the base definition, 7,464 restaurants sit within 1 km in a straight line of a rail station. Changing one choice at a time gave these counts:

  • Restaurant includes seven other food and drink categories, such as cafés, bars and fast food: 12,534, 68% more.
  • Chicago means the metro area: 11,050, 48% more.
  • Transit means every place in Overture's public transit and train station categories, including 441 places in the city with Overture's bus station category: 8,438, 13% more.
  • Records with a confidence score below 0.5 count too: 7,779, 4% more.
  • Half a mile in place of 1 km: 6,638, 11% fewer.
  • A 1 km walk in place of a 1 km straight line: 6,793, 9% fewer.

With the distance held at 1 km in a straight line, the count ranges from 7,464 with the base rules to 24,065 with four rules changed together. Those four are all eight food and drink categories, records at any confidence score, any transit stop Overture lists and the metro area. The high count is 3.2 times the base count.

The walking areas come from HERE and cover only stations in or near the city. So the walking comparison stays inside the city: 7,464 in a straight line against 6,793 on foot.

An earlier version of this article set a half-mile walk against a 1 km straight line. This version compares counts only when they use the same distance measure.

The claim holds: five of the six single changes moved the count by more than 5%. The confidence score, at 4%, was the one that did not.

Map of the Chicago area. The city limits hold 7,464 restaurants within 1 km in a straight line of a rail station. The Census metro area, which reaches into Indiana, holds 11,050.
Which Chicago? Restaurants within 1 km in a straight line of a rail station: 7,464 inside the city limits and 11,050 in the metro area. Data: Overture Maps (places, city limits), US Census Bureau (metro area). Analysis: Wherobots.

Walking areas around Clark/Lake

Around Clark/Lake station in the Loop, Chicago's downtown, the 1 km walking area is 38% smaller than the 1 km circle and holds 32% fewer restaurants. The circle covers 3.14 km² and holds 974 restaurants. The walking area covers 1.94 km² and holds 665.

Map of the Chicago Loop around Clark/Lake station. A dashed 1 km circle holds 974 restaurants. The HERE 1 km walking area holds 665. The 309 restaurants inside the circle but outside the walking area are marked in orange.
Clark/Lake station: 974 restaurants within 1 km in a straight line, 665 within a 1 km walk. Places: Overture Maps. Walking area: HERE. Analysis: Wherobots. Basemap: OpenFreeMap, OpenMapTiles, OpenStreetMap contributors.

Across the city, the walk lowered the count by 9%, from 7,464 to 6,793, against 32% at Clark/Lake.

What the test does not show

Three limits apply:

  • Bus stops: Overture lists 441 places in Chicago with the bus station category, so the "every transit stop" count covers only the stops Overture lists. All 367 rail locations come from Overture's rail station categories, and none is named as a bus stop. The rail counts include no bus stops.
  • Walking areas: HERE walking areas were computed only for rail stations inside the city or within 1 km of it, so the walking counts apply inside the city limits only.
  • Real restaurants: the counts are Overture records. The 0.5 cutoff removes records that Overture rates as less likely to exist. Overture's guide says to treat the score "as a relative filtering tool rather than a precise probability", so no count here is a full count of real restaurants.

How to write spatial rules into a semantic layer

Each choice the test varied can be written down once:

  • Boundary: name the boundary dataset, its release and its identifier, such as the Overture Maps division for the city of Chicago.
  • Inside: name the spatial test, such as intersects or within, and say how places on the boundary count.
  • Distance: state the measure (straight line, walk or drive), the value and the unit, and, for a walk, the street map and routing service used.
  • Coordinate system: name the coordinate reference system for every measurement, such as UTM zone 16N for distances in Chicago.
  • Category: list the categories that count, and the minimum confidence score.

In Wherobots, these rules can be stored as SQL views, saved queries that work like tables. The same approach fits the medallion architecture for geospatial data, a pattern of raw, cleaned and business-ready tables. A view named for the metric holds the boundary, the spatial test, the distance and the categories. Every dashboard, notebook and AI agent then queries the view.

An AI agent can run the same queries through MCP (Model Context Protocol), a standard way for agents to call tools. See the Wherobots MCP server and agent tools.

Research on spatial definitions and scale

The metro-wide query in this article measured 45,748 food and drink records against transit stops and two boundaries in 19 seconds.

Jia Yu, Jinxuan Wu and Mohamed Sarwat introduced GeoSpark at the ACM SIGSPATIAL conference in 2015. The work grew into Apache Sedona, described in Spatial data management in Apache Spark: the GeoSpark perspective and beyond (GeoInformatica, 2019). Wherobots builds on that engine. A spatial join, which matches records by location, is the operation behind every count in this article.

Research on semantic layers and language models is newer. Dean Allemang and Juan Sequeda followed their benchmark with a study on using ontologies to check and repair answers (arXiv, 2024). Both are vendor preprints. We found few peer-reviewed tests of semantic layers for spatial questions, which is one reason this article runs its test on open data and prints its queries.

Conclusions

  1. A semantic layer is a set of definitions for business terms and metrics, kept in one place so every tool computes them the same way.
  2. For location data, a semantic layer needs spatial rules. In Chicago, changing one rule at a time moved the count of restaurants near transit by as much as 68% up and 11% down.
  3. The category and boundary rules moved the count most: 68% for seven more food and drink categories and 48% for the metro area, against 9% for walking distance. If a metric depends on a place category or a named area, define those first.
  4. If the question is about people on foot, define distance as a walk on a street network. Around Clark/Lake station, a 1 km walk covered 1.94 km² against 3.14 km² for the circle. The walking area counted 32% fewer restaurants.
  5. Record the coordinate reference system with every metric. The database runs a distance query in degrees or in meters without an error, and only meters match a question asked in meters.

Read more from Wherobots

Run the Chicago query with a Wherobots free trial at cloud.wherobots.com.

Frequently asked questions

What is a semantic layer in simple terms?

A semantic layer is a shared set of definitions that sits between your data tables and the tools people use to ask questions. It says what each business term means, such as revenue or active customer, and how to compute it from the tables. A dashboard, a spreadsheet and an AI agent that all go through it get the same number for the same question.

Is Databricks a semantic layer?

Databricks is a data platform. It includes a semantic layer feature called metric views, stored in Unity Catalog, the Databricks catalog that records each table and who may use it. A metric view stores a metric’s definition once, so queries and dashboards on Databricks compute it the same way. Snowflake offers a similar feature called semantic views.

What is the semantic layer in ETL?

ETL (extract, transform, load) moves and cleans data into a data warehouse. The semantic layer comes after it. ETL sets what the stored tables contain. The semantic layer records what each business term means when someone queries those tables, such as which records count as a restaurant and which boundary counts as the city.

What is the difference between a semantic layer and an ontology?

An ontology is a formal model of the kinds of things in a domain and how they relate, such as a place located in a building. A semantic layer is narrower and tied to queries. It maps business terms and metrics to tables and the SQL (Structured Query Language) code that computes them. Many teams build a semantic layer for metrics and use an ontology to describe the entities behind them.

What is the difference between a context layer and a semantic layer?

A semantic layer fixes the meaning of metrics and terms for queries. A context layer, or context engine, gathers everything an AI system needs to answer a question. That can include those definitions plus documents, entity records, locations and recent events. Data about real places, such as stores, roads and city boundaries, also needs spatial rules in that context. They set which boundary, which distance and what counts as inside.

What is the difference between a semantic layer and a data warehouse?

A data warehouse stores the data and runs the queries. A semantic layer stores definitions about that data: names, metrics, joins and access rules. When someone asks for restaurants within 1 km of a rail station, the semantic layer generates the SQL (database query) code, and the warehouse runs it.

What is the dbt Semantic Layer?

dbt is a tool that turns SQL files into tables in a data warehouse. The dbt Semantic Layer lets teams define metrics in those files and query them from other tools. It runs on MetricFlow, software that turns metric definitions into SQL. dbt Labs agreed in 2023 to acquire Transform, the company that built MetricFlow.