Apache Ossie (Open Semantic Interchange)
Convert an Apache Ossie semantic model into anfra AML models and a dataset.
Apache Ossie (formerly Open Semantic Interchange, OSI) is a vendor-neutral format for exchanging semantic models. An Ossie model is one YAML file that describes datasets, fields, metrics and the relationships between them.
If another tool already exports your semantic layer to Ossie, you don't need to rewrite it by hand. The ossie-holistics converter, maintained by Holistics (the company behind anfra), turns the Ossie file into data models and a dataset that anfra can query.
The converter is a command-line tool that runs locally. It only converts Ossie to AML. Exporting AML to Ossie is not supported.
How it works
- Other tools — Omni, Cube, Hex and any tool with an Ossie exporter
- Ossie YAML — One open, vendor-neutral file: datasets, fields, metrics and relationships
- anfra
- Models & dataset — One .model.aml per Ossie dataset, plus one .dataset.aml
- tools → ossie (export)
- ossie → aml (ossie-holistics to-aml)
Say another tool exported this Ossie model:
version: 0.3.0.dev0
name: sales
datasets:
- name: orders
source: analytics.public.orders
primary_key: [order_id]
fields:
- name: order_id
expression: { sql: order_id }
datatype: Integer
- name: customer_id
expression: { sql: customer_id }
datatype: Integer
- name: amount
expression: { sql: amount }
datatype: Decimal
metrics:
- name: total_revenue
expression: { sql: SUM(amount) }
description: Gross revenue before discounts
- name: customers
source: analytics.public.customers
primary_key: [customer_id]
fields:
- name: customer_id
expression: { sql: customer_id }
datatype: Integer
relationships:
- name: orders_to_customers
from: orders
to: customers
from_columns: [customer_id]
to_columns: [customer_id]
metrics:
- name: revenue_per_customer
expression: { sql: SUM(orders.amount) / COUNT(DISTINCT customers.customer_id) }Step 1: Install the converter
Install ossie-holistics with uv. uv provides a compatible Python version, so you don't need to install Python yourself.
uv tool install "git+https://github.com/apache/ossie-converters#subdirectory=holistics"To upgrade the converter later, run uv tool upgrade apache-ossie-holistics.
Step 2: Convert the Ossie model
ossie-holistics to-aml sales.ossie.yaml -o models/ \
--sql-dialect SNOWFLAKE \
--data-source-name <your-datasource-name>| Option | Description |
|---|---|
-o | Output directory for the AML files. Required. |
--sql-dialect | Your warehouse's SQL dialect: ANSI_SQL, OSSIE_SQL_2026, BIGQUERY, DATABRICKS or SNOWFLAKE. Required. |
--data-source-name | The connection in .anfra/data_sources.yml the models read from. Required. |
--issues FILE | Write the issue log to a file instead of the terminal. |
--force | Overwrite existing output files. |
Step 3: Review the generated AML
The converter writes one .model.aml per Ossie dataset and one .dataset.aml for the whole model:
Model orders {
type: 'table'
data_source_name: 'snowflake'
table_name: 'analytics.public.orders'
dimension order_id {
label: 'Order Id'
type: 'number'
primary_key: true
definition: @sql {{ #SOURCE.order_id }};;
}
// customer_id and amount dimensions
measure total_revenue {
label: 'Total Revenue'
type: 'number'
description: 'Gross revenue before discounts'
definition: @sql SUM({{ #SOURCE.amount }});;
}
}Dataset sales {
label: 'Sales'
data_source_name: 'snowflake'
models: [orders, customers]
relationships: [
relationship(orders.customer_id > customers.customer_id, true)
]
metric revenue_per_customer {
label: 'Revenue Per Customer'
type: 'number'
definition: @aql sum(orders.amount) / count_distinct(customers.customer_id);;
}
}Then check that the files are valid AML:
anfra validate "models/*.aml"Here's what each part of the Ossie model maps to:
| Ossie | anfra |
|---|---|
| The model | One .dataset.aml |
| Dataset | One .model.aml |
| Field | dimension |
| Dataset metric | measure on the model |
| Model metric | metric on the dataset, written in AQL |
| Relationship | relationship() in the dataset, from the many side to the one side |
description | description |
datatype | type |
When an expression has several dialects, the converter uses the one set by --sql-dialect.
Issues
Every conversion reports what it dropped or changed, at three levels:
- INFO: kept in another form.
- WARNING: dropped or changed, such as a vendor extension anfra doesn't read.
- ERROR: could not be converted, such as a metric with a window function.
The command exits with code 1 if there is any ERROR, so you can run it in CI.
Re-converting
Run ossie-holistics to-aml with --force after the Ossie model changes. This overwrites the generated files, so re-apply any edits you made to them and review the diff before you commit.
Capabilities
| Capability | Support | Details |
|---|---|---|
| Import Ossie to AML | Supported | Datasets, fields, metrics and relationships, with ossie-holistics to-aml. |
| Export AML to Ossie | Not supported | anfra can't write an Ossie model. |
| Cross-dataset metrics | Supported | Written as AQL metrics on the dataset. |
| Window functions in metrics | Not supported | The metric is dropped and reported as an ERROR. |
| Vendor extensions | Not supported | Other tools' nonportable_extensions are ignored. |