Ontologies and mappings
Add an ontology to a Blueprint, map its concepts to model fields, and control how Balto reads ontology context.
This page explains how to add business meaning to Blueprint models with an ontology. It shows how to connect the ontology's concepts to model fields with a mapping, and explains how Balto reads ontology context in chat.
Semantic models define queryable data. An ontology adds explicit identities and relationships for business concepts. A mapping connects those concepts to model fields. Semantic models work without ontologies, and an ontology can exist before its mappings. For when to use each one, see Blueprints. For definitions, see Core terms.
Before you begin
- Make sure that you have the Maintainer role on the Project, so that you can create and publish a Draft.
- The examples on this page assume an existing model named
bond_priceswith the fields in Choose the counting level.
When you adapt the examples, use your own model name, field names, types, and units. Keep calculations and joins in the semantic model.
Choose the counting level
The bond_prices model has the following fields:
The model has one row for each bond and pricing date. A bond can have many observations, so the bond identifier alone can't identify an observation. The ontology in the next section uses both the instrument and the pricing date as its identity.
Add an ontology
To add an ontology file to a Draft, do the following:
- In the sidebar, click Blueprints, and then select your Project.
- Click New draft, enter a name, and then click Create draft.
- Click New file.
- For the path, enter
products/bond_analytics/ontology.yaml, and then click Create. - In Edit YAML, add the ontology definition from the following example.
You can use any indexed Project folder except system folders and Skill resource folders. A data product folder keeps the ontology next to the models that it describes.
The following ontology defines one bond observation for each instrument and pricing date:
spec_version: "0.2"
type: ontology
name: bond_analytics
ontology:
- concept: InstrumentId
type: ValueType
extends: [String]
description: Internal bond identifier.
- concept: PricingDate
type: ValueType
extends: [Date]
description: Business date of the analytics observation.
- concept: YieldToWorst
type: ValueType
extends: [Decimal]
description: Yield to worst as a percentage.
- concept: BondObservation
type: EntityType
identify_by: [instrument_id, pricing_date]
description: One bond analytics observation per instrument and pricing date.
relationships:
- name: instrument_id
roles: [{concept: InstrumentId}]
multiplicity: ManyToOne
verbalizes: ['{BondObservation} has instrument {InstrumentId}']
- name: pricing_date
roles: [{concept: PricingDate}]
multiplicity: ManyToOne
verbalizes: ['{BondObservation} has pricing date {PricingDate}']
- name: yield_to_worst
roles: [{concept: YieldToWorst}]
multiplicity: ManyToOne
verbalizes: ['{BondObservation} has yield to worst {YieldToWorst}']The definition uses these elements:
EntityType: Defines the observation.ValueType: Defines an identifier, date, or measure that the entity's relationships use.identify_by: Names the relationships that identify one entity. In this example, the pair distinguishes different dates for the same bond.
Map concepts to model fields
To add a mapping file to the same Draft, do the following:
- Click New file.
- For the path, enter
products/bond_analytics/ontology_mapping.yaml, and then click Create. - In Edit YAML, add the mapping from the following example.
The following mapping connects the BondObservation concept and its relationships to fields in bond_prices:
spec_version: "0.2"
type: ontology_mapping
name: bond_analytics_mapping
ontology_ref: {name: bond_analytics}
semantic_model_ref:
name: bond_analytics_data
bindings:
datasets:
prices: bond_prices
concept_mappings:
- concept: BondObservation
object_mappings:
- referent_mappings:
- {relationship: instrument_id, expression: prices.INSTR_ID}
- {relationship: pricing_date, expression: prices.PX_DT}
link_mappings:
- object_mapping:
referent_mappings:
- {relationship: instrument_id, expression: prices.INSTR_ID}
- {relationship: pricing_date, expression: prices.PX_DT}
children:
- relationship: instrument_id
object_mapping: {concept: InstrumentId, expression: prices.INSTR_ID}
- relationship: pricing_date
object_mapping: {concept: PricingDate, expression: prices.PX_DT}
- relationship: yield_to_worst
object_mapping: {concept: YieldToWorst, expression: prices.YLD_W}The mapping uses these elements:
ontology_ref.name: Matches the ontology'sname.bindings.datasets: Connects the local aliaspricesto the existingbond_pricesmodel.semantic_model_ref.name: Names the mapping's semantic scope. It doesn't create a model.object_mappings: Identifies the entity. Itsreferent_mappingssupply both parts of the composite identity.link_mappings: Connects the entity's relationships to model fields.
Map value types through those relationship links. A standalone object_mappings entry requires an entity type.
The mapping doesn't calculate yield or convert its units. A missing yield stays missing. Declaring a concept doesn't supply a value for it.
Validate and publish
Review both files in Changes, click Validate, and then click Save & publish when the Draft is ready to go live. For the full procedure, see Drafts, versions, and deployments.
Validation checks definitions and references. Errors block publication, and warnings stay visible. Declared identities and constraints don't prove that warehouse rows satisfy them. Before you use the example with your data, check the model's row uniqueness and measure units.
If validation reports BLUEPRINT_FILE_TYPE_MISMATCH, the saved file type differs from the file's recognized content. This error can affect files that were created before Bobsled AI recognized their type. To fix it, edit and save each affected file, and then validate again.
Preview ontology concepts
To inspect the concepts in an ontology file, do the following:
- In the Blueprint, open the ontology file.
- Click Preview.
- To inspect the declared concepts and their references, switch between List and Graph.
- Optional: In the graph, select a concept to read its type, meaning, and relationships.
- Optional: To read the authored YAML, click Source.
The preview describes the selected file. It doesn't validate warehouse rows or publish the definitions. When a data product's folder contains the ontology, you can also review the same concepts on the product's Concepts tab. For more information, see Data products.
Read ontology context
Balto receives ontology context automatically in Project chats, and it can also read ontology definitions directly with a tool. Balto uses definitions to interpret a question. Query results provide facts, such as an observation count. Ontology text doesn't grant permissions or execute rules.
Automatic context in chat
For each new Project chat message, Bobsled AI searches the deployed Blueprint for relevant ontology definitions before Balto starts to answer. Short follow-up questions can also use the previous user message to find definitions. Bobsled AI supplies a limited set of matching concepts, related definitions, and mappings, not every ontology. These definitions guide Balto's reasoning, queries, and proposed changes.
The scope of the search depends on your data product selection:
- With data products selected: Bobsled AI finds starting concepts in the products' folders and ontology mappings. A mapping can point to a shared ontology elsewhere in the Project, and related definitions stay available. If you select several products, Bobsled AI searches their combined scope.
- Without a product selection: Bobsled AI uses the question to find concepts across the Project.
If search finds no matching concepts or times out, Bobsled AI tries a direct text lookup within the same product scope. This backup lookup selects up to three highest-scoring concepts and includes their related definitions. If retrieval fails or reaches a limit, Balto receives a notice and can use the ontology tool to read more.
Automatic retrieval uses deployed definitions only. To review unpublished changes, ask Balto to read the Draft.
Read definitions with a tool
Balto uses get_blueprint_ontology to read definitions directly from the selected Blueprint. The external MCP server exposes the same tool. Set source to one of these values:
"deployed": For data questions."authoring": To review a Draft or a committed version.
An MCP request also needs a Project reference. A Draft read can include the Draft's draftSessionId.
The following request reads the BondObservation concept from the deployed bond_analytics ontology:
{
"request": {
"source": "deployed",
"ontology": "bond_analytics",
"concept": "BondObservation",
"limit": 20
}
}The request accepts these optional fields:
view: "list": Returns a small catalog without concept bodies.query: Filters by text.rootPaths: Selects starting concepts by file or folder, including concepts that mappings in those locations reference.rootLimit: Bounds the starting concepts from a text lookup.limit: Bounds the concepts after related definitions are included.
Results include related concepts, mappings, source paths, hashes, validation messages, and omitted references. Mapping status reports whether bindings are absent, available, or unresolved. Available bindings don't prove complete concept coverage. If the result is truncated, read the omitted concepts before you draw a conclusion.
Search indexing
Search indexes ontology concepts, relationships, and mappings with the existing Blueprint search and embedding settings. Exact reads don't wait for indexing. A missing search match, in chat or through the tool, doesn't prove that a concept is absent.
Import and export ontologies
Ontology import and export support only OSI 0.2.0.dev0. The default export version can't represent ontologies and returns an error when an export includes them. To export the complete Blueprint with ontologies, select 0.2.0.dev0.
Use the import_ossie and export_ossie tools. Imported files enter a Draft and follow the normal validation and publication workflow. For more information, see OSI import and export.
What's next
- To group models and ontologies by domain, see Data products.
- To manage the Draft after you publish, including version history, see Drafts, versions, and deployments.
- To exchange ontologies with other tools, see OSI import and export.
