Skip to content

docs(examples): add the GASP SaaS core example and conformance scripts - #773

Open
403pagelabs wants to merge 19 commits into
apache:mainfrom
403pagelabs:examples-gasp-saas
Open

403pagelabs wants to merge 19 commits into
apache:mainfrom
403pagelabs:examples-gasp-saas

Conversation

@403pagelabs

@403pagelabs 403pagelabs commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Adds the Core department of the GASP Standard (Generally Accepted SaaS Principles, https://gaspwiki.com) as an example set in the layout of the flights files: an ontology, a semantic model and the mapping between them, with 15 conformance cases as ost scripts beside them. GASP is an open standard for SaaS metrics. I offered this on dev@ in the [INTRO] thread (https://lists.apache.org/thread/hyo7xqcyn2339cjtnn31bwsjnxd6rxs3) as a candidate for the roadmap's "Industry / Domain-Specific Semantic Models".

What is in it:

  • gasp_saas.ontology.yaml: 6 entity types (one per dataset), their relationships with multiplicity and 47 value types with enum constraints. All six entity types carry an iri through three declared prefixes: the two event classes point at their headings on the standard's event ledger page, Customer and Subscription at their glossary pages and the survey response and financials datasets at their entries on the datasets page.
  • gasp_saas.semantic_model.yaml: 6 datasets (revenue_event, cost_event, customer, subscription, survey_response, financials), 5 relationships and 39 metrics. The metrics are MRR, ARR, NRR, GRR, logo churn, CAC, LTV, gross margin, Rule of 40 and the MRR movements, with Operating and Market forms where the standard defines both. 23 of them are OSSIE_SQL_2026 expressions, with filtered aggregates in the FILTER (WHERE ...) form. The other 16 need a cohort, a prior period or an opening snapshot, which an expression cannot state, so they read 12 staged datasets whose source is the compiled SQL: 11 with one row per period and one cohort table with a row per customer per period, which NRR, GRR and revenue churn rate sum over. The reason is in the GASP extension on each staged dataset. A metric that reads one dataset is declared under that dataset, 29 of the 39. The 10 that read more than one sit at the model root. The customer and subscription datasets state the snapshot reading rule in their ai_context.
  • gasp_saas.mapping.yaml: the ontology mapped onto the model. It names the other two files by name and relative IRI, so the cross-document checks run.
  • gasp_saas_conformance/: 15 cases from the standard's conformance set, each a semantic model and a script for ost. A script creates the tables its case reads, loads the model and asks for one metric through executeExpand, with the expanded SQL and the result under each command. 12 of the cases read a staged dataset, so they run a query as a dataset source through the expander (fix(expander): expand a dataset whose source is a query #812). The models are slices of the full export, since the cases reach past the Core department (uptime, ticket backlog, DAU over MAU).

The files are generated from the standard's formulas by its exporter (https://github.com/GASP-Standard/standard, Apache 2.0) and I will refresh them from there when the standard changes. The full export, 384 metrics, stays in that repository.

All three pass validate.py with the cross-document checks. The PR adds their validate lines and path filter to validation-ci.yml beside the flights set and one line for the three files to the document map in examples/README.md. The nonportable_extensions entries use the GASP token registered in #765. With main merged in at c298049, validation/tests/ gives 1112 passed and 1 skipped. The Python and scripts suites pass. The 15 scripts pass on ost at the head of this branch in about two seconds and their models pass validate.py. The PR adds a step for them and their path to ost-ci.yml, with a second line in examples/README.md.

A runnable demo sits beside the source: data for the six tables, one query per metric and the expected values, for DuckDB or Postgres (https://github.com/GASP-Standard/standard/tree/main/standard/exports/ossie/example/demo). GASP's own test suite runs it on DuckDB and compares each value with the compiled SQL. The conformance set the scripts come from sits in the same repository, with its data files and the expected rows as SQL (https://github.com/GASP-Standard/standard/tree/main/standard/exports/ossie/conformance).

Two things a reviewer may want to weigh in on, both about size. The staged datasets carry their Snowflake, BigQuery and Databricks sources in the GASP extension, because source is one string. That makes the semantic model about 149 KB, far larger than the flights one. If the size is a problem I can drop the other dialects from this copy and keep them in the full export. The scripts add 2.9 MB, because each carries its tables inline so that it stands alone. The largest is 421 KB. If that is too much for this directory I can cut the set to the small cases or move it to a pull request of its own.

Updated 2026-11-26 with the files regenerated from the standard. Since the pull request opened: NRR, GRR and revenue churn rate read one cohort table (12 staged sources where there were 16), single-dataset metrics moved under their datasets, the ontology gained its prefixes, iri and annotations and the snapshot rule moved from each metric's instructions to the dataset. In this update GRR and revenue churn rate add the contraction that reverses realised usage (the column usage_reversal on the cohort table), customer_status gains the value pay_as_you_go and the survey response dataset gains the field brand_awareness. The conformance scripts were added the same day.

The Core department of the GASP Standard (Generally Accepted SaaS Principles,
https://gaspwiki.com) as three documents in the layout of the flights set: an
ontology (6 entity types, 46 value types with enum constraints), a semantic
model (6 datasets, 5 relationships, 39 metrics; 16 staged per-period datasets
for the formulas the portable language cannot state in one expression) and
the mapping between them, referencing the ontology by name and relative IRI.

Generated from the standard's canonical formulas by its exporter and kept in
sync there; every metric is an OSSIE_SQL_2026 expression where the language
can state it, with filtered aggregates in the FILTER (WHERE ...) form. All
three files pass validate.py, including the cross-document checks, and are
added to the validation workflow. A runnable demo (data, one query per
metric and the expected values, for DuckDB or Postgres) lives beside the
source: https://github.com/GASP-Standard/standard/tree/main/standard/exports/ossie/example
The exporter now writes each field and metric expression as the top-level
sql form alone, as the flights example does since apache#640, instead of a
one-entry dialects list. No expression text changes; all three files still
pass validate.py.
…tensions

Regenerated from the GASP Standard after apache#522 and apache#691: the three documents
declare 0.3.0.dev0 and carry the GASP payloads under nonportable_extensions
with data as an object. They pass validate.py, the cross-document checks
included.
# Conflicts:
#	.github/workflows/validation-ci.yml
# Conflicts:
#	.github/workflows/validation-ci.yml
…ir datasets

A metric that reads one dataset is now declared under that dataset and
names its fields directly (29 of the 39). The 10 that read several
datasets stay at the model root. The ontology picks up three field
descriptions reworded in the standard.
…pshot rule to the dataset

The ontology declares two prefixes and gives four of its six entity
types an iri: the two CEL event classes point at their headings on the
CEL page and Customer and Subscription at their glossary pages.
Annotations carry the ontology version, the level of Customer and
Subscription and the edge class of Customer's two relationships to
other entities.

A snapshot dataset now states its reading rule once in its own
ai_context (one row per key per snapshot date, select one date). The
metrics that read it no longer repeat the rule. A dataset description
is the label alone.

The three files pass validation/validate.py with no warnings.
@403pagelabs 403pagelabs changed the title docs(examples): add the GASP SaaS core example docs(examples): add the GASP SaaS core example and conformance scripts Nov 26, 2026
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