Skip to content

feat(core-spec): multi-file models, one semantic model stored as a model document plus dataset documents - #827

Open
ZmeiGorynych wants to merge 8 commits into
apache:mainfrom
MotleyAI:egor/dev-2484-ossie-multi-file-models-one-semantic-model
Open

ZmeiGorynych wants to merge 8 commits into
apache:mainfrom
MotleyAI:egor/dev-2484-ossie-multi-file-models-one-semantic-model

Conversation

@ZmeiGorynych

@ZmeiGorynych ZmeiGorynych commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

Today one Ossie model is one file, so in git every dataset edit by every team member lands in the same file. This PR lets one semantic model be stored as a folder: a split model document that holds the model-level properties and lists dataset documents, one dataset each, in the same folder. This implements the "multi-file models" proposal from the dev@ thread, with the model → dataset reference direction Chris and Damian argued for.

# sales.semantic_model.yaml
version: 0.3.0.dev0
name: sales
dataset_refs:
  - name: orders
    iri: orders.dataset.yaml
  - name: customers
    iri: customers.dataset.yaml
relationships:
  - name: orders_to_customers
    from: orders
    to: customers
    from_columns: [customer_id]
    to_columns: [id]
# orders.dataset.yaml
version: 0.3.0.dev0
dataset:
  name: orders
  source: sales.public.orders
  fields: [...]

Resolution appends the referenced datasets after any inline ones, in dataset_refs order, and the result is an ordinary single document. Every existing check, converter and catalog reads that resolved document unchanged: the exchange unit stays one model per document. ossie-schema.json is unchanged, so a consumer handed an unresolved split model fails schema validation instead of silently reading a model with no datasets.

What the change adds:

  • Spec: a new "Multi-file Models" section in core-spec/spec.md covering the two document shapes, the same-folder rule for iri (one path segment, strict percent-decoding, exact-case match, no escaping symlinks), resolution and its errors, and splitting with its round-trip property. Also updates to the Semantic Model intro, spec.yaml, and one sentence in ontology/ontology.md (a mapping's semantic_model_ref may name a split model).

  • Schemas: core-spec/ossie-split-model-schema.json and core-spec/ossie-dataset-schema.json, both $refing the core definitions rather than copying them.

  • Validator: validate.py resolves a split model before every existing check, so --vendor and --report see the referenced datasets. A mapping whose semantic_model_ref is a split model is cross-checked against the resolved model. Resolution errors name the files involved:

    $ uv run validation/validate.py models/sales.semantic_model.yaml
    [Reference] models/sales.semantic_model.yaml: dataset_refs -> 1 names 'customers' but models/customers.dataset.yaml declares dataset 'clients'
    

    A dataset document validated on its own fails with a pointer to validate a model document that lists it. Routing applies only under the core schema; any other --schema reads both kinds as they are. File reading for mapping references and for dataset_refs now shares one routine, so both report problems the same way.

  • Python SDK: OssieSplitSemanticModel, OssieDatasetDocument and OssieDatasetReference, plus:

    model = OssieSemanticModel.from_ossie_path("models/sales.semantic_model.yaml")  # resolves a split model
    model.to_ossie_folder("models", "sales.semantic_model.yaml", overwrite=True)    # writes the split
    document, datasets = model.split()                                              # in memory
    resolved = document.resolve(load)                                               # load: iri -> text
  • Example: examples/tpcds_split/ is the TPC-DS example split this way. A test in each suite pins that it resolves to examples/tpcds_semantic_model.yaml, and make validate and Validation CI validate it.

Decisions taken on the open questions from the thread: references point from the model to its datasets; iri is required and names a file in the same folder; relationships stay in the model document; dataset documents are recognized by their content (a top-level dataset), and *.dataset.yaml is only a recommendation; sharing a dataset document between models is left to future work.

No breaking changes: every existing document validates as before.

Related Issues

Discussion #46 (multi-file models), dev@ thread "multi-file models" (25 Nov 2026).

Checklist

Specification

  • Spec changes are included in core-spec/ and follow the existing structure
  • Spec changes have a [DISCUSS] thread on dev@ with a stated end date, and reach lazy consensus (or pass a [VOTE]) before merge
  • Breaking changes to the spec are clearly called out in the summary (none)
  • For a material spec change, docs/spec_changes.md records rationale, compatibility and migration impact, or the PR explains why no entry is needed

Ontology

  • Ontology changes in ontology/ are consistent with spec changes
  • New or modified terms are defined and documented

Converters

  • Spec or ontology changes that affect converters have a matching issue or PR in apache/ossie-converters (none needed: converters read the resolved document)

Validation

  • Validation rules in validation/ are updated if the spec changed
  • New validation cases are covered by tests

Documentation

  • docs/ is updated to reflect any user-facing changes
  • New features or behaviors are documented with examples where appropriate
  • CONTRIBUTING.md is updated if the contribution process changed (unchanged)

Examples

  • examples/ are added or updated for any new spec constructs

Tests

  • All existing tests pass (pytest / CI green)
  • New functionality is covered by tests

Compliance

  • ASF license headers are present on all new source files
  • New third-party dependencies follow Third-Party Dependencies (none)
  • If third-party source code is vendored/copied (not just declared as a dependency), NOTICE and/or LICENSE have been updated per ASF policy (none)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant