Schemas
Generate a schema from an ontology
Most of Kenseme goes from schema to ontology. This feature goes the other way. From an ontology, Kenseme builds a relational schema whose tables, columns and relationships mirror the ontology, and remembers what it created so later updates never overwrite work you did by hand.
In the app: Data Context › Ontologies › your ontology › More › Generate Schema
Before you start¶
- You need Read/Write access. The menu items are disabled while your organization is in read-only mode.
- The ontology should have its classes, attributes and relationships in reasonable shape. You can update the schema later, but a cleaner ontology gives a cleaner first schema.
Generate the schema¶
- Open the ontology and click
More. - Choose
Generate Schema. TheGenerate Schemadialog opens. - Fill in:
Schema Name(required, up to 256 characters). It starts filled in from the ontology.Database System: the SQL dialect.Description(optional).Database schema name(required): the one database schema, such asdbo, that every generated table goes into.
- Click
Generate.
Kenseme creates the schema straight away and confirms it. If some parts of the ontology couldn’t be generated, the dialog stays open, shows what was built (for example Schema 'Sales' created — 12 tables, 9 relationships.), and lists the parts it skipped. Click Done to close it.
What it builds¶
- Each class becomes a table with an identity primary key.
- Each attribute (data property) becomes a column. Columns are nullable, and their types come from a fixed mapping of XSD types to SQL types.
- Each relationship (object property) becomes a foreign key or a bridge table, depending on its cardinality.
The result is an ordinary schema. It appears on the Schemas page, and you can browse it, edit it and generate SQL from it.
Update the schema when the ontology changes¶
When a schema is linked, the More menu shows Update Schema instead of Generate Schema.
- Choose
Update Schema. Kenseme compares the ontology with the schema it generated. - If nothing differs, the dialog says
Schema is up to date with the ontology. - Otherwise it lists the differences in groups:
- Add: new objects the ontology now implies. Selected by default.
- Modify: changes to objects the generator owns. Selected by default.
- Remove: generated objects the ontology no longer implies. Not selected by default, because removal is destructive. Removed items are soft-deleted. A renamed ontology item shows as a remove plus an add.
- A warning,
Not applied — these names are already taken by objects this ontology did not generate, lists additions Kenseme won’t make.
- Tick what you want and click
Apply Selected.
Why your own edits are safe¶
Kenseme tracks exactly which objects it created for this ontology. An update only modifies or removes those objects, and only adds a new object when nothing else has that name. A table, column or relationship you added yourself is never listed and never changed. If one of your objects has a name the ontology wants, that addition is skipped and listed in the warning instead.
Unlink, delete or bind¶
Once a schema is linked, the More menu also offers:
Unlink Schema: keep the schema but forget it came from this ontology.Generate Schemabecomes available again.Delete Generated Schema: delete the schema and the link together. If Pipelines depend on the schema, Kenseme asks you to confirm again.Bind Generated Schema: bind the ontology to a real database that runs the generated schema, so the Data Agent can query it. Run the generated DDL against your database first, then pick the database connection that points at it. Kenseme matches classes to tables and attributes to columns and builds the relationships. This item appears only when your organization has database binding turned on.
Note: If the generated schema is deleted some other way, the link goes stale.
Update SchemaandDelete Generated Schemaare then disabled with “The generated schema no longer exists. Unlink to start fresh.” UseUnlink Schema.