Skip to content

Commit 843147b

Browse files
Shao Xieclaude
andcommitted
Document mapping documents as the only shape; embedded mappings deprecated
Lead the Mapping documents section with the standalone mapping document and reduce the embedded ontology_mappings shape to a short deprecation note, so embedding no longer reads as a reasonable alternative. Align the field table, version history, and ontology.json description with the same wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PEsT5t9mcXM6fF4QUC8Y7V
1 parent 1e7e650 commit 843147b

2 files changed

Lines changed: 20 additions & 43 deletions

File tree

‎ontology/ontology.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"ontology_mappings": {
4040
"type": "array",
41-
"description": "Collection of ontology maps from logical models, each embedding its own semantic model. Kept for backward compatibility; see ontology/mapping.json for the standalone mapping document, the recommended shape when more than one semantic model maps to this ontology.",
41+
"description": "Deprecated. Embedded ontology maps, accepted only so existing documents continue to validate; write mappings as standalone documents validated against ontology/mapping.json instead.",
4242
"deprecated": true,
4343
"items": {
4444
"$ref": "#/$defs/OntologyMap"

‎ontology/ontology.md‎

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ hierarchically, grouping each relationship under the concept that plays its firs
8888
| `description` | string | No | Human-readable description |
8989
| `ai_context` | string/object | No | Additional context for AI tools |
9090
| `ontology` | list | Yes | Concepts and relationships they group that form this ontology |
91-
| `ontology_mappings` | list | No | Embedded ontology maps (legacy shape, kept for backward compatibility); see [Mapping documents](#mapping-documents) for the standalone alternative |
91+
| `ontology_mappings` | list | No | Deprecated; accepted only so existing documents continue to validate. Write mappings as [mapping documents](#mapping-documents) instead |
9292

9393
Each component of an ontology declares a concept and lists the relationships where that
9494
concept plays the first role. The concept's name is the value of the `concept` field, and
@@ -388,28 +388,9 @@ mappings that group by some concept.
388388

389389
### Mapping documents
390390

391-
An ontology mapping can be expressed two ways. It can be embedded inside the ontology document
392-
itself, as an entry in the top-level `ontology_mappings` list; this is the original shape and
393-
remains valid for backward compatibility. Each entry has the following schema, mirroring
394-
`OntologyMap` in `ontology.json`:
395-
396-
| Field | Type | Required | Description |
397-
|---------------|---------|-----|-------|
398-
| `name` | string | No | Name of this ontology map |
399-
| `description` | string | No | Human-readable description of this ontology map |
400-
| `semantic_model` | object | Yes | A complete, embedded semantic model document (see the core specification) |
401-
| `concept_mappings` | list | Yes | Maps logical model constructs to concepts and relationships in this ontology |
402-
403-
Embedding a full semantic model inside the ontology document works cleanly when exactly one
404-
semantic model maps to the ontology. It does not compose: if a second team wants to bring a second
405-
semantic model to the same ontology, the natural next step is another entry in the same
406-
`ontology_mappings` list, which means duplicating the embedded model or coordinating changes
407-
through a file the second team does not otherwise own.
408-
409-
Alternatively, and the recommended approach when more than one semantic model maps to an ontology,
410-
or when the mapping is owned by a different team than the ontology itself, a mapping can be written
411-
as its own standalone document, validated against `ontology/mapping.json`. Instead of embedding a
412-
semantic model, it references both the ontology and the semantic model it maps between:
391+
A mapping is written as its own document, validated against `ontology/mapping.json`. It maps the
392+
constructs of one semantic model onto one ontology, and references both rather than embedding
393+
either:
413394

414395
| Field | Type | Required | Description |
415396
|---------------|---------|-----|-------|
@@ -421,27 +402,24 @@ semantic model, it references both the ontology and the semantic model it maps b
421402
| `concept_mappings` | list | Yes | Maps logical model constructs to concepts and relationships in the referenced ontology |
422403
| `custom_extensions` | list | No | Vendor-specific attributes for extensibility, matching the core specification's mechanism |
423404

424-
Both `ontology` and `semantic_model` are references, not embedded documents. A reference is an
425-
object with a `name`, which must equal the referenced document's own `name` and carries this
426-
reference's checkable identity, and an `iri`, which says where to resolve it from: a relative
427-
reference such as `./flights.ontology.yaml` when the two documents sit alongside each other, or an
428-
absolute IRI once a catalog resolves names to locations.
405+
A reference is an object with a `name`, which must equal the referenced document's own `name`, and
406+
an `iri`, which says where to resolve it from: a relative reference such as
407+
`./flights.ontology.yaml` when the documents sit alongside each other, or an absolute IRI once a
408+
catalog resolves names to locations.
429409

430-
A mapping document references exactly one ontology and exactly one semantic model. When an
431-
ontology has more than one semantic model mapped to it, each mapping is its own document; nothing
432-
in this specification lets a single mapping document reference two semantic models at once, so
433-
there is no need for `concept_mappings` expressions to disambiguate which semantic model a dataset
434-
belongs to.
410+
A mapping document references exactly one ontology and exactly one semantic model. When more than
411+
one semantic model maps to an ontology, each mapping is its own document.
435412

436413
A mapping document is recognized by having `concept_mappings`, a field no ontology or semantic
437-
model document has; there is no separate field declaring which of the three document kinds a given
438-
file is. Tooling that needs to know a document's kind ahead of validating it, as
439-
`validation/validate.py`'s `--schema` flag does today, still needs to be told explicitly, the same
440-
as it does today for the two existing document kinds.
414+
model document has; there is no separate field declaring a document's kind.
441415

442416
See `examples/flights.ontology.yaml`, `examples/flights.semantic_model.yaml`, and
443-
`examples/flights.mapping.yaml` for the canonical `flights.yaml` example split into its three
444-
parts.
417+
`examples/flights.mapping.yaml` for a complete example.
418+
419+
**Deprecated:** mappings were originally embedded, each with a full copy of its semantic model,
420+
in the ontology document's `ontology_mappings` list (`OntologyMap` in `ontology.json`). That list
421+
is still accepted so existing documents continue to validate, but it is deprecated and will be
422+
removed in a future version. New mappings must be written as mapping documents.
445423

446424
### Concept mappings
447425

@@ -648,9 +626,8 @@ though `Store` plays a role in three of the relationships.
648626
- **0.2.0.dev0** (2026-05-29): Basic support for ontologies and logical schema mappings
649627
- Core ontology structure: Concepts, relationships, and business rules (requires and derived_by)
650628
- Schema mappings from one or more logical models into an ontology
651-
- Standalone mapping documents (`ontology/mapping.json`) as an alternative to embedding a
652-
semantic model inside `ontology_mappings`, for ontologies mapped to more than one semantic
653-
model or mappings owned by a different team than the ontology
629+
- Mapping documents (`ontology/mapping.json`) that reference one ontology and one semantic
630+
model; embedded `ontology_mappings` is deprecated
654631

655632
---
656633

0 commit comments

Comments
 (0)