anfra docsAlpha
Semantic layerExisting semantic layers

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

Converting Apache Ossie to AML
  • 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:

sales.ossie.yaml
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>
OptionDescription
-oOutput directory for the AML files. Required.
--sql-dialectYour warehouse's SQL dialect: ANSI_SQL, OSSIE_SQL_2026, BIGQUERY, DATABRICKS or SNOWFLAKE. Required.
--data-source-nameThe connection in .anfra/data_sources.yml the models read from. Required.
--issues FILEWrite the issue log to a file instead of the terminal.
--forceOverwrite 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:

orders.model.aml
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 }});;
  }
}
sales.dataset.aml
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:

Ossieanfra
The modelOne .dataset.aml
DatasetOne .model.aml
Fielddimension
Dataset metricmeasure on the model
Model metricmetric on the dataset, written in AQL
Relationshiprelationship() in the dataset, from the many side to the one side
descriptiondescription
datatypetype

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

CapabilitySupportDetails
Import Ossie to AMLSupportedDatasets, fields, metrics and relationships, with ossie-holistics to-aml.
Export AML to OssieNot supportedanfra can't write an Ossie model.
Cross-dataset metricsSupportedWritten as AQL metrics on the dataset.
Window functions in metricsNot supportedThe metric is dropped and reported as an ERROR.
Vendor extensionsNot supportedOther tools' nonportable_extensions are ignored.

On this page