Where to Find Example Ossie Semantic Models in Apache Ossie
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 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 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 and validate against core-spec/osi-schema.json:
- Top-level container – Each file starts with a
versionfield and a top-levelsemantic_modellist, matching the schema's root object definition. - Datasets – Defined under the
datasetskey, each dataset specifies source tables, primary/unique keys, andfieldscontainingexpressionobjects that support multiple SQL dialects such asANSI_SQL. - Relationships – The
relationshipssection declares foreign-key linkages between datasets, enabling downstream tools to navigate the data graph. - Metrics – Business KPIs defined at the model or dataset level using SQL expressions that can reference fields across multiple datasets.
- Custom extensions – Vendor-specific metadata embedded via
custom_extensionswhile 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, which checks YAML structure against the JSON schema and performs semantic analysis.
To validate the TPC-DS example from the command line:
python validation/validate.py examples/tpcds_semantic_model.yaml
Alternatively, validate programmatically using the Python API:
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.yamlprovides a comprehensive TPC-DS benchmark implementation demonstrating advanced features like multi-dataset metrics and vendor extensions.examples/flights.yamloffers a minimal model for quick testing and educational purposes.- The
validation/validate.pyscript andvalidate_semantic_modelfunction ensure compliance withcore-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 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.
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, which defines the YAML structure, field types, and validation rules. The machine-readable JSON Schema in core-spec/osi-schema.json provides the formal validation rules used by validation/validate.py to verify Ossie semantic models.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →