Skip to content
ThirdLayer

Docs > Ontology and knowledge graph

Ontology

Define 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).

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.

Each Object type in Dex’s table-backed store (zeta_store) maps to a dedicated Postgres table with strongly typed columns:

CategorySupported typesNotes
Text & listssingleLineText, longText, textList, jsonSupports email, uri, date, date-time, and bounded regex formats
Numbers & booleansnumber, integer, checkboxSupports numeric formatting (plain, percent, currency) in Views
Datesdate, dateTimeQueryable with relative date filters (pastNumberOfDays, today) and timezone-aware day filters
SelectssingleSelect, multipleSelectDefined with enum choices and optional x-choiceColors
Relationships (link)manyOne, oneMany, manyManyDeclared with reference: { object, cardinality } ("one" or "many"); manyMany links materialize as Postgres junction tables
System fieldscreatedTime, lastModifiedTime, createdBy, lastModifiedBy, autoNumberRead-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.

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.

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:

Terminal window
# 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.

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.