You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/compatibility/osi.md
+35-17Lines changed: 35 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# OSI Compatibility
2
2
3
-
Sidemantic's OSI adapter parses [Open Semantic Interface](https://github.com/open-semantic-interchange/OSI) YAML files and maps OSI concepts to Sidemantic's semantic model (Model, Dimension, Metric, Relationship). It also supports exporting back to OSI YAML, including multi-dialect SQL transpilation via sqlglot.
3
+
Sidemantic's OSI adapter parses [Open Semantic Interchange](https://github.com/open-semantic-interchange/OSI) YAML files and maps OSI concepts to Sidemantic's semantic model (Model, Dimension, Metric, Relationship). It also supports exporting back to OSI YAML, including multi-dialect SQL transpilation via sqlglot.
4
4
5
5
Features are marked **supported**, **partial support**, or **unsupported**. Partial support entries include notes explaining the limitation. Properties that parse without error but have no Sidemantic equivalent are grouped together per section rather than listed individually.
6
6
@@ -12,10 +12,11 @@ Features are marked **supported**, **partial support**, or **unsupported**. Part
12
12
|---------|--------|
13
13
|`semantic_model` (list of models) | Supported |
14
14
| Multiple semantic models in one file | Supported (each iterated independently) |
15
-
|`name` (semantic model name) | Partial support: parsed but not stored. The graph has no concept of a top-level model name. Individual datasets become named Models. |
16
-
|`description` (semantic model description) | Partial support: parsed but not stored on the graph. |
17
-
18
-
Not mapped: `version`.
15
+
|`version`| Supported. Current exports emit `0.2.0.dev0`; imports preserve the source version in `SemanticGraph.metadata["osi"]["version"]`. |
16
+
|`name` (semantic model name) | Supported as metadata. Stored in `SemanticGraph.metadata["osi"]["semantic_models"]` and reused on export. Individual datasets still become named Models. |
17
+
|`description` (semantic model description) | Supported as graph metadata and reused on export. |
18
+
|`ai_context` (semantic model level) | Supported as graph metadata and reused on export. |
19
+
|`custom_extensions` (semantic model level) | Supported as graph metadata and reused on export. |
19
20
20
21
---
21
22
@@ -32,7 +33,6 @@ Not mapped: `version`.
32
33
|`fields`| Supported (mapped to Dimensions) |
33
34
|`ai_context`| Supported (stored in `Model.meta["ai_context"]`) |
34
35
|`custom_extensions` (dataset level) | Supported (stored in `Model.meta["custom_extensions"]`) |
| Relationship type | Partial support: all relationships are imported as `many_to_one`. The OSI spec does not define cardinality on the `from`/`to` relationship format, and the adapter always assumes many-to-one. |
94
+
| Relationship `name`| Supported (stored in `Relationship.metadata["osi_name"]` and reused on export) |
95
+
| Relationship `ai_context`| Supported (stored in `Relationship.metadata["ai_context"]`) |
96
+
| Relationship `custom_extensions`| Supported (stored in `Relationship.metadata["custom_extensions"]`) |
94
97
| Missing `from_columns`| Supported (defaults foreign key to `{to_model}_id`) |
95
98
| Missing `to_columns`| Supported (defaults primary key to `id`) |
96
99
| Relationship with missing `from` or `to`| Supported (gracefully skipped) |
@@ -99,8 +102,6 @@ Not mapped: `type` (the OSI `type` hint on metrics, e.g. `type: count`, is ignor
99
102
100
103
The `left_dataset`/`right_dataset`/`cardinality` relationship format (used by some community OSI files, e.g. mdb-engine models) is not parsed. Only the `from`/`to`/`from_columns`/`to_columns` format is recognized. Files using the alternative format will parse without error, but relationships will be silently skipped.
101
104
102
-
Not mapped: relationship `name`, `ai_context` on relationships.
103
-
104
105
---
105
106
106
107
## Expression Dialects
@@ -112,8 +113,8 @@ Not mapped: relationship `name`, `ai_context` on relationships.
|`BIGQUERY` dialect | Supported (used as fallback if preferred dialects absent)|
116
-
| Other/custom dialects | Supported (used as fallback if preferred dialects absent)|
116
+
|`MAQL`, `TABLEAU`, `MDX` dialects | Supported as fallback expressions if no preferred SQL dialect is present. The expression is preserved as text; it is not translated.|
117
+
| Other/custom dialects | Supported on import as fallback if preferred dialects absent |
117
118
| Multiple dialects per expression | Supported (single dialect selected by preference order) |
@@ -124,9 +125,10 @@ Not mapped: relationship `name`, `ai_context` on relationships.
124
125
| Export to `ANSI_SQL`| Supported (default, expression passed through as-is) |
125
126
| Export to `SNOWFLAKE`| Supported (transpiled from DuckDB/ANSI via sqlglot) |
126
127
| Export to `DATABRICKS`| Supported (transpiled via sqlglot) |
127
-
| Export to `BIGQUERY`| Supported (transpiled via sqlglot) |
128
+
| Export to `BIGQUERY`| Unsupported (not in the current OSI dialect enum) |
129
+
| Export to `MAQL`, `TABLEAU`, `MDX`| Unsupported (not safely generated from Sidemantic SQL) |
128
130
| Multiple dialects in single export | Supported (pass `dialects=["ANSI_SQL", "SNOWFLAKE", ...]`) |
129
-
| Unknown dialect on export |Supported (falls back to original expression) |
131
+
| Unknown dialect on export |Unsupported (raises `ValueError`) |
130
132
| Transpilation failure | Supported (falls back to original expression) |
131
133
132
134
---
@@ -140,8 +142,8 @@ Not mapped: relationship `name`, `ai_context` on relationships.
140
142
| Dataset `ai_context`| Supported (stored in `Model.meta["ai_context"]`) |
141
143
| Field `ai_context`| Supported (stored in `Dimension.meta["ai_context"]`) |
142
144
| Metric `ai_context`| Supported (stored in `Metric.meta["ai_context"]`) |
143
-
| Semantic model level `ai_context`|Partial support: parsed by YAML but not stored on the graph.|
144
-
| Relationship `ai_context`|Unsupported|
145
+
| Semantic model level `ai_context`|Supported (stored in `SemanticGraph.metadata["osi"]["semantic_models"]`)|
146
+
| Relationship `ai_context`|Supported (stored in `Relationship.metadata["ai_context"]`)|
145
147
146
148
Common sub-keys (`synonyms`, `instructions`, `examples`, `description_for_ai`) are all preserved as-is in the meta dictionary. No sub-key receives special handling.
147
149
@@ -154,9 +156,10 @@ Common sub-keys (`synonyms`, `instructions`, `examples`, `description_for_ai`) a
154
156
| Dataset `custom_extensions`| Supported (stored in `Model.meta["custom_extensions"]`) |
155
157
| Field `custom_extensions`| Supported (stored in `Dimension.meta["custom_extensions"]`) |
156
158
| Metric `custom_extensions`| Supported (stored in `Metric.meta["custom_extensions"]`) |
157
-
| Semantic model level `custom_extensions`| Unsupported |
159
+
| Relationship `custom_extensions`| Supported (stored in `Relationship.metadata["custom_extensions"]`) |
160
+
| Semantic model level `custom_extensions`| Supported (stored in `SemanticGraph.metadata["osi"]["semantic_models"]`) |
158
161
159
-
Nested structures within `custom_extensions`(vendor configs, tag lists, etc.) are preserved verbatim as Python dicts/lists.
162
+
Current OSI schema represents `custom_extensions`as a list of `{vendor_name, data}` objects where `data` is a JSON string. Sidemantic still imports legacy dict/list extension shapes. On export, non-standard extension payloads are wrapped as a `SIDEMANTIC` extension with stringified JSON so emitted OSI stays schema-shaped.
160
163
161
164
---
162
165
@@ -166,6 +169,8 @@ Sidemantic can export its semantic model back to OSI YAML format.
166
169
167
170
| Feature | Status |
168
171
|---------|--------|
172
+
| Current OSI version | Supported (`version: "0.2.0.dev0"` emitted at file root) |
| Non-`many_to_one` relationships | Unsupported (silently omitted from export) |
186
192
| Multi-column relationship keys | Supported |
187
193
| Related model PK lookup on export | Supported (when `rel.primary_key` is None, the related model's actual PK columns are used for `to_columns`) |
@@ -195,7 +201,19 @@ Sidemantic can export its semantic model back to OSI YAML format.
195
201
196
202
## Version Field
197
203
198
-
Unsupported. The `version: "1.0"` key at the file root is ignored on import and not emitted on export.
204
+
Supported. Imports preserve the source value in graph metadata. Exports always emit the current supported OSI draft version, `0.2.0.dev0`.
205
+
206
+
---
207
+
208
+
## Ontology Files
209
+
210
+
OSI's ontology spec defines conceptual `ontology` entries plus `ontology_mappings` that embed logical semantic models. Sidemantic does not implement ontology reasoning, but it does:
211
+
212
+
| Feature | Status |
213
+
|---------|--------|
214
+
| Top-level `ontology`| Partial support: preserved in `SemanticGraph.metadata["osi"]["ontology"]`; not converted to Models. |
215
+
|`ontology_mappings[].semantic_model`| Supported: parsed into Sidemantic Models, Relationships, and Metrics. |
216
+
|`ontology_mappings[].concept_mappings`| Partial support: preserved in graph metadata; not used for query planning. |
0 commit comments