xDBML Examples
Reference xDBML documents covering a range of realistic business domains and storage paradigms. Each example is self-contained, parses standalone against the v0.1 grammar, and demonstrates a specific subset of the language's features.
These files serve three audiences:
- Learners picking up xDBML, who want to see realistic syntax in context.
- Parser implementers, who use these files as test fixtures and round-trip targets.
- Evaluators, who want to judge xDBML's expressiveness against alternatives.
The examples
| Example | Domain | Paradigm | View / Download |
|---|---|---|---|
| Blog (relational) | Blogging platform | PostgreSQL relational | View · Download |
| E-commerce (polyglot) | E-commerce | Oracle + MongoDB hybrid | View · Download |
| IoT telemetry | IoT sensor data | TimescaleDB time-series | View · Download |
| Social graph (LPG) | Social network | Neo4j labeled property graph | View · Download |
| Healthcare (FHIR-style) | Clinical records | PostgreSQL | View · Download |
| Financial services | Retail banking | Snowflake | View · Download |
| Project management (self-refs) | Project tracking | PostgreSQL relational | View · Download |
| University registrar (composite keys) | Course enrollment | PostgreSQL relational | View · Download |
| Module system: conformed dimensions library (v0.2) | Enterprise conformed dimensions | Library file (Snowflake-targeted) | View · Download |
| Module system: sales data product (v0.2) | Sales data product | Consumer file with module imports | View · Download |
| Module system: remote sources (v0.3) | Sales data product | Consumer file with remote (URL) imports | View · Download |
The View link opens the rendered example with syntax highlighting and the VitePress theme. The Download link serves the raw .xdbml file for use with parsers, generators, or your own tooling.
A note on the note: capability
Every example uses xDBML's note: setting extensively -- at the project level, container level, entity level, field level, and inside nested types and polymorphic alternatives. This is deliberate. The examples demonstrate the full range of what note: can carry: short field-level descriptions, multi-paragraph design rationale, regulatory references, and cross-references to companion documentation.
Production schemas should be more selective. Over-noting is as bad as no noting -- the noise drowns out the signal. As a general guideline:
- Project and container notes should explain why the schema is structured the way it is. Decisions worth preserving for the next maintainer.
- Entity notes should describe the entity's role in the broader system and any non-obvious lifecycle rules.
- Field notes should be reserved for fields whose meaning, format, or constraints are not obvious from name and type alone.
A field called email of type varchar [unique, not null] doesn't need a note. A field called kyc_status of type varchar with an enum constraint absolutely does.
Running the examples through a parser
Once the reference parser is available, you can validate each example with:
xdbml parse 01-blog.xdbml
xdbml parse --allGenerators target specific output formats:
xdbml generate --target oracle 02-ecommerce.xdbml
xdbml generate --target mongodb 02-ecommerce.xdbml
xdbml generate --target avro 03-iot-telemetry.xdbml
xdbml generate --target cypher 04-social-graph.xdbml
xdbml generate --target json-schema 05-healthcare-fhir.xdbml
xdbml generate --target odcs 06-financial-services.xdbml
xdbml generate --target postgres 07-project-management.xdbml
xdbml generate --target sql-ddl 08-university-registrar.xdbmlContributing examples
We welcome additional examples that demonstrate xDBML features not yet covered or cover domains the current set omits. Particularly desired:
- A streaming platform example showing Avro event records with full union semantics
- A content management system example showing deeply nested polymorphism (article body composed of mixed content blocks)
- A multi-tenant SaaS example showing how tenant isolation patterns translate to xDBML
To contribute, open a pull request adding a new file numbered consecutively. Follow the conventions of the existing examples: realistic domain, generous noting, demonstrated feature subset clearly identified in the project-level Note.
License
The examples are dedicated to the public domain under CC0 1.0. Copy, adapt, derive -- no attribution required. The xDBML specification itself is Apache License 2.0.