Docs > Ontology and knowledge graph
Ontology
# Ontology An **ontology** is the schema of your workspace's knowledge graph. It defines **what kinds of things exist** (Object types), **what properties and relationships they carry** (typed scalar and link fields), and **how synced Dataset rows resolve into records and timeline activities** (declarative mappings). The ontology owns schema and mapping rules—not live record data or OAuth access. Adding a mapping never grants access to a teammate's account; each source account must be explicitly bound by its owner (or a workspace admin for an organization account). ## Starter ontology and custom Object types When Factory is enabled for a workspace, Dex provisions a starter ontology with two core Object types: - **`person`** — `name`, `email`, `title`, `company` (reference to `company`), `description`, `phone`, `location`, pre-mapped from connected sources such as Attio, Slack, and Gmail. - **`company`** — Organization records linked to people and activity across tools. You can extend starter types with custom fields or add **source-free manual Object types** (such as `commitment`, `candidate`, `deal`, or `incident`) that store records authored by people and agents without needing a source sync mapping. ## Field types and relationships Each Object type in Dex's table-backed store (`zeta_store`) maps to a dedicated Postgres table with strongly typed columns: | Category | Supported types | Notes | | --- | --- | --- | | **Text & lists** | `singleLineText`, `longText`, `textList`, `json` | Supports `email`, `uri`, `date`, `date-time`, and bounded regex formats | | **Numbers & booleans** | `number`, `integer`, `checkbox` | Supports numeric formatting (`plain`, `percent`, `currency`) in Views | | **Dates** | `date`, `dateTime` | Queryable with relative date filters (`pastNumberOfDays`, `today`) and timezone-aware day filters | | **Selects** | `singleSelect`, `multipleSelect` | Defined with `enum` choices and optional `x-choiceColors` | | **Relationships (`link`)** | `manyOne`, `oneMany`, `manyMany` | Declared with `reference: { object, cardinality }` (`"one"` or `"many"`); `manyMany` links materialize as Postgres junction tables | | **System fields** | `createdTime`, `lastModifiedTime`, `createdBy`, `lastModifiedBy`, `autoNumber` | Read-only system columns maintained automatically on every record | Always model pointers between records (such as a person's company or a deal's primary contact) as `reference` link fields rather than plain text so joins, Views, and the Knowledge Graph stay connected. ## Declarative source mappings To populate an Object type from synced Datasets (such as Slack users, Gmail contacts, or Attio companies), author a declarative ontology file in Factory at `workspace/ontology/objects/<uid>.yaml`. Each document contains three sections: 1. **`schemas`** — The Object type's `uid`, `name`, `initialLabel`, `titleFieldUid`, and `fields[]`. 2. **`sourceContracts`** — Pinned Dataset contracts (`bundleResourceId`, `bundleVersion`, `datasetUid`, `schemaHash`, and schema) obtained from `dex zeta datasets get`. Schema drift fails closed so syncs never silently map unexpected columns. 3. **`mappings`** — Rules binding one or more Dataset sources to the Object type: - **`cluster.keys`** — Deterministic identity keys extracted via JSON paths (for example, `profile.email` or `email_addresses[].email_address`), normalized with `trim`, `lowercase`, `email`, or `domain`, and scoped by `scope` (merge across integrations in the same output Data Scope) or `connection` (partition per provider connection). - **`refine.fields`** — Priority-ordered field extraction candidates with merge strategies (`priority` to pick the highest-priority non-empty source, or `unionDistinct` to combine list values across sources) and reference resolution (`targetIdentityUid`). Activity mappings (`activities[]`)—installed automatically by integration bundles or declared explicitly—convert Dataset rows into timeline **observations** (`occurredAt`, `description`, `providerKey`) linked to Object records via the same cluster keys. ## Authoring and editing your ontology Choose the workflow that fits the change: ### 1. Schema edits in the Data Model UI or CLI For adding custom Object types, adding/updating/duplicating fields, adding select choices, or renaming an Object, use `/nexus/settings/data-model` (and `/nexus/settings/data-model/object/[uid]`) or `dex zeta objects`: ```bash # Create a manual Object type with all initial fields in one operation dex zeta objects create --data '{ "name": "commitment", "label": "Commitment", "titleField": "title", "fields": [ {"name": "title", "label": "Title", "schema": {"type": "string"}}, {"name": "status", "label": "Status", "schema": {"type": "string", "enum": ["Open", "Done", "Dropped"]}}, {"name": "due_date", "label": "Due date", "schema": {"type": "string", "format": "date"}}, {"name": "owner", "label": "Owner", "reference": {"object": "person", "cardinality": "one"}} ] }' # Add a field or new select choices to an existing Object dex zeta objects fields add --object commitment --data '{"field":{"name":"source_url","label":"Source URL","schema":{"type":"string","format":"uri"}}}' dex zeta objects fields add-choices --object commitment --field status --choices "Blocked" ``` Create an Object together with its known fields in one operation rather than adding fields one by one. Schema operations return an operation receipt (`dex zeta operations get --id <id>`) and rebuild the workspace's SQL query views atomically on commit. ### 2. Editing source mappings in Factory Source mappings can only be edited through the Object's Factory YAML file (`workspace/ontology/objects/<uid>.yaml`)—not via `dex zeta objects create`: 1. Pull Factory (`dex factory pull`) and inspect the existing YAML file (preserving `schemaVersion` and `resourceId`). 2. Inspect the Dataset contract with `dex zeta datasets get --dataset <id>` and copy its `sourceContract` verbatim—never hand-edit a contract or compute its `schemaHash`. 3. Commit your edit and run `dex factory preview`. Preview runs ontology preflight validation and reports **changed Object types**, **affected saved Views**, and **connected source output bindings** before anything goes live. 4. Push (`dex factory push`) after confirming the preview, then bind an authorized source account with `dex zeta sources outputs bind`. :::caution Deleting an Object type (`dex zeta objects delete --object <name> --yes`) permanently removes its records, sync bindings, and Views. Delete incoming reference fields on other Objects first and update automations that write to it. ::: ## Related pages - [Knowledge graph](/context/knowledge-graph/) - How ontology records, links, merges, and Agent SQL work - [Nexus](/context/nexus/) - Managing Objects, Data Model settings, and saved Views - [Sources and data scopes](/context/sources-and-scopes/) - Binding source accounts and controlling Data Scopes - [Factory definition as code](/factory/workspace-structure/) - Factory layout and preview/push workflow - [CLI and SDK](/integrations/cli-and-sdk/) - Full `dex zeta` command referenceDefine Object types, typed fields, relationships, and declarative source mappings that govern your Dex workspace's knowledge graph.
An ontology is the schema of your workspace’s knowledge graph. It defines what kinds of things exist (Object types), what properties and relationships they carry (typed scalar and link fields), and how synced Dataset rows resolve into records and timeline activities (declarative mappings).
The ontology owns schema and mapping rules—not live record data or OAuth access. Adding a mapping never grants access to a teammate’s account; each source account must be explicitly bound by its owner (or a workspace admin for an organization account).
Starter ontology and custom Object types
Section titled “Starter ontology and custom Object types”When Factory is enabled for a workspace, Dex provisions a starter ontology with two core Object types:
person—name,email,title,company(reference tocompany),description,phone,location, pre-mapped from connected sources such as Attio, Slack, and Gmail.company— Organization records linked to people and activity across tools.
You can extend starter types with custom fields or add source-free manual Object types (such as commitment, candidate, deal, or incident) that store records authored by people and agents without needing a source sync mapping.
Field types and relationships
Section titled “Field types and relationships”Each Object type in Dex’s table-backed store (zeta_store) maps to a dedicated Postgres table with strongly typed columns:
| Category | Supported types | Notes |
|---|---|---|
| Text & lists | singleLineText, longText, textList, json | Supports email, uri, date, date-time, and bounded regex formats |
| Numbers & booleans | number, integer, checkbox | Supports numeric formatting (plain, percent, currency) in Views |
| Dates | date, dateTime | Queryable with relative date filters (pastNumberOfDays, today) and timezone-aware day filters |
| Selects | singleSelect, multipleSelect | Defined with enum choices and optional x-choiceColors |
Relationships (link) | manyOne, oneMany, manyMany | Declared with reference: { object, cardinality } ("one" or "many"); manyMany links materialize as Postgres junction tables |
| System fields | createdTime, lastModifiedTime, createdBy, lastModifiedBy, autoNumber | Read-only system columns maintained automatically on every record |
Always model pointers between records (such as a person’s company or a deal’s primary contact) as reference link fields rather than plain text so joins, Views, and the Knowledge Graph stay connected.
Declarative source mappings
Section titled “Declarative source mappings”To populate an Object type from synced Datasets (such as Slack users, Gmail contacts, or Attio companies), author a declarative ontology file in Factory at workspace/ontology/objects/<uid>.yaml. Each document contains three sections:
schemas— The Object type’suid,name,initialLabel,titleFieldUid, andfields[].sourceContracts— Pinned Dataset contracts (bundleResourceId,bundleVersion,datasetUid,schemaHash, and schema) obtained fromdex zeta datasets get. Schema drift fails closed so syncs never silently map unexpected columns.mappings— Rules binding one or more Dataset sources to the Object type:cluster.keys— Deterministic identity keys extracted via JSON paths (for example,profile.emailoremail_addresses[].email_address), normalized withtrim,lowercase,email, ordomain, and scoped byscope(merge across integrations in the same output Data Scope) orconnection(partition per provider connection).refine.fields— Priority-ordered field extraction candidates with merge strategies (priorityto pick the highest-priority non-empty source, orunionDistinctto combine list values across sources) and reference resolution (targetIdentityUid).
Activity mappings (activities[])—installed automatically by integration bundles or declared explicitly—convert Dataset rows into timeline observations (occurredAt, description, providerKey) linked to Object records via the same cluster keys.
Authoring and editing your ontology
Section titled “Authoring and editing your ontology”Choose the workflow that fits the change:
1. Schema edits in the Data Model UI or CLI
Section titled “1. Schema edits in the Data Model UI or CLI”For adding custom Object types, adding/updating/duplicating fields, adding select choices, or renaming an Object, use /nexus/settings/data-model (and /nexus/settings/data-model/object/[uid]) or dex zeta objects:
# Create a manual Object type with all initial fields in one operationdex zeta objects create --data '{ "name": "commitment", "label": "Commitment", "titleField": "title", "fields": [ {"name": "title", "label": "Title", "schema": {"type": "string"}}, {"name": "status", "label": "Status", "schema": {"type": "string", "enum": ["Open", "Done", "Dropped"]}}, {"name": "due_date", "label": "Due date", "schema": {"type": "string", "format": "date"}}, {"name": "owner", "label": "Owner", "reference": {"object": "person", "cardinality": "one"}} ]}'
# Add a field or new select choices to an existing Objectdex zeta objects fields add --object commitment --data '{"field":{"name":"source_url","label":"Source URL","schema":{"type":"string","format":"uri"}}}'dex zeta objects fields add-choices --object commitment --field status --choices "Blocked"Create an Object together with its known fields in one operation rather than adding fields one by one. Schema operations return an operation receipt (dex zeta operations get --id <id>) and rebuild the workspace’s SQL query views atomically on commit.
2. Editing source mappings in Factory
Section titled “2. Editing source mappings in Factory”Source mappings can only be edited through the Object’s Factory YAML file (workspace/ontology/objects/<uid>.yaml)—not via dex zeta objects create:
- Pull Factory (
dex factory pull) and inspect the existing YAML file (preservingschemaVersionandresourceId). - Inspect the Dataset contract with
dex zeta datasets get --dataset <id>and copy itssourceContractverbatim—never hand-edit a contract or compute itsschemaHash. - Commit your edit and run
dex factory preview. Preview runs ontology preflight validation and reports changed Object types, affected saved Views, and connected source output bindings before anything goes live. - Push (
dex factory push) after confirming the preview, then bind an authorized source account withdex zeta sources outputs bind.
Related pages
Section titled “Related pages”- Knowledge graph - How ontology records, links, merges, and Agent SQL work
- Nexus - Managing Objects, Data Model settings, and saved Views
- Sources and data scopes - Binding source accounts and controlling Data Scopes
- Factory definition as code - Factory layout and preview/push workflow
- CLI and SDK - Full
dex zetacommand reference