# Where to Find Example Ossie Semantic Models in Apache Ossie

> Discover example Ossie semantic models in the Apache Ossie repository's examples directory. Explore TPC-DS retail and minimal Flights models for your projects.

- Repository: [The Apache Software Foundation/ossie](https://github.com/apache/ossie)
- Tags: how-to-guide
- Published: 2026-07-19

---

**You can find production-ready example Ossie semantic models in the `examples/` directory at the root of the Apache Ossie repository, featuring both a comprehensive TPC-DS retail model and a minimal Flights model for rapid prototyping.**

The Apache Ossie project ships canonical examples that illustrate the full OSSIE Core Metadata Specification. These files demonstrate how to define datasets, relationships, and business metrics using validated YAML structures. Whether you are implementing your first semantic layer or extending an existing data platform, these examples provide the definitive reference for constructing spec-compliant Ossie semantic models.

## Locating Example Ossie Semantic Models

All example Ossie semantic models reside in the **`examples/`** directory at the repository root. The Apache Ossie maintainers provide two primary reference implementations that cover different complexity levels and use cases.

### TPC-DS Retail Model

The **[`examples/tpcds_semantic_model.yaml`](https://github.com/apache/ossie/blob/main/examples/tpcds_semantic_model.yaml)** file presents a comprehensive model based on the industry-standard TPC-DS benchmark. This example covers fact tables, dimension tables, complex relationships, multi-dataset metrics, and custom vendor extensions. It demonstrates advanced concepts including dialect-specific SQL expressions and Salesforce/DBT `custom_extensions`, making it ideal for production data warehouse implementations.

### Flights Model

For quick experimentation and learning, the **[`examples/flights.yaml`](https://github.com/apache/ossie/blob/main/examples/flights.yaml)** file provides a lightweight alternative. This minimal example focuses on a single dataset with straightforward relationships and basic metric definitions. It serves as the optimal starting point for understanding core OSSIE constructs without navigating the complexity of a full-scale retail schema.

## Anatomy of Example Ossie Semantic Models

The example files implement the five architectural components defined in [`core-spec/spec.md`](https://github.com/apache/ossie/blob/main/core-spec/spec.md) and validate against [`core-spec/osi-schema.json`](https://github.com/apache/ossie/blob/main/core-spec/osi-schema.json):

1. **Top-level container** – Each file starts with a `version` field and a top-level `semantic_model` list, matching the schema's root object definition.
2. **Datasets** – Defined under the `datasets` key, each dataset specifies source tables, primary/unique keys, and `fields` containing `expression` objects that support multiple SQL dialects such as `ANSI_SQL`.
3. **Relationships** – The `relationships` section declares foreign-key linkages between datasets, enabling downstream tools to navigate the data graph.
4. **Metrics** – Business KPIs defined at the model or dataset level using SQL expressions that can reference fields across multiple datasets.
5. **Custom extensions** – Vendor-specific metadata embedded via `custom_extensions` while maintaining strict spec compliance, as demonstrated by the Salesforce and DBT extensions in the TPC-DS model.

## Validating Example Ossie Semantic Models

You can verify these examples using the command-line validator or Python utilities. The validation engine resides in [`validation/validate.py`](https://github.com/apache/ossie/blob/main/validation/validate.py), which checks YAML structure against the JSON schema and performs semantic analysis.

To validate the TPC-DS example from the command line:

```bash
python validation/validate.py examples/tpcds_semantic_model.yaml

```

Alternatively, validate programmatically using the Python API:

```python
import yaml
from ossie.validation import validate_semantic_model  # wrapper around validation.validate.py

# Load the TPC-DS example

with open("examples/tpcds_semantic_model.yaml", "r") as f:
    model_yaml = yaml.safe_load(f)

# Validate against the schema

errors = validate_semantic_model(model_yaml)
if errors:
    print("Validation errors:", errors)
else:
    print("Semantic model is valid!")

```

Both approaches invoke the same internal validation logic, ensuring your Ossie semantic models comply with the core specification and versioning rules defined in the Apache Ossie source code.

## Summary

- Example Ossie semantic models are located in the **`examples/`** directory at the repository root of Apache Ossie.
- **[`examples/tpcds_semantic_model.yaml`](https://github.com/apache/ossie/blob/main/examples/tpcds_semantic_model.yaml)** provides a comprehensive TPC-DS benchmark implementation demonstrating advanced features like multi-dataset metrics and vendor extensions.
- **[`examples/flights.yaml`](https://github.com/apache/ossie/blob/main/examples/flights.yaml)** offers a minimal model for quick testing and educational purposes.
- The **[`validation/validate.py`](https://github.com/apache/ossie/blob/main/validation/validate.py)** script and **`validate_semantic_model`** function ensure compliance with **[`core-spec/osi-schema.json`](https://github.com/apache/ossie/blob/main/core-spec/osi-schema.json)**.
- All examples implement the five core OSSIE constructs: containers, datasets, relationships, metrics, and custom extensions.

## Frequently Asked Questions

### What is the difference between the TPC-DS and Flights example models?

The TPC-DS model is a comprehensive production-grade example based on the retail benchmark, demonstrating complex relationships, multi-dataset metrics, and vendor-specific extensions. The Flights model is intentionally minimal, focusing on a single dataset with basic relationships to help developers quickly understand OSSIE fundamentals without overhead.

### How do I validate a custom semantic model against the OSSIE specification?

Use the **[`validation/validate.py`](https://github.com/apache/ossie/blob/main/validation/validate.py)** CLI tool to check your YAML file against the JSON schema, or import **`validate_semantic_model`** from **`ossie.validation`** in Python to validate programmatically. Both methods verify structural compliance and semantic correctness according to the core specification documented in [`core-spec/spec.md`](https://github.com/apache/ossie/blob/main/core-spec/spec.md).

### Can I extend the example models with vendor-specific metadata?

Yes. The TPC-DS example demonstrates this capability through its **`custom_extensions`** field for Salesforce and DBT integrations. You can add vendor-specific extensions while maintaining full compliance with the OSSIE Core Metadata Specification, provided the core required fields remain valid according to the schema.

### Where is the formal definition of the OSSIE semantic model structure?

The authoritative specification lives in **[`core-spec/spec.md`](https://github.com/apache/ossie/blob/main/core-spec/spec.md)**, which defines the YAML structure, field types, and validation rules. The machine-readable JSON Schema in **[`core-spec/osi-schema.json`](https://github.com/apache/ossie/blob/main/core-spec/osi-schema.json)** provides the formal validation rules used by [`validation/validate.py`](https://github.com/apache/ossie/blob/main/validation/validate.py) to verify Ossie semantic models.