Customer or Invoice. It maps a model’s columns to properties, and names the property that keys it. Handlers, policies, analytics SQL, and agent tools all use the object’s property names.
Define an object type
ontology/sales.ts
Property types
Chain
.optional() for nullable values, .describe(text) for documentation, and .id(name) to keep a stored name when you rename a property.
Who owns a property
Every property has one owner.- Source-owned properties
.map()a SQL expression over the object’s model. Only the source system changes them. - Ontology-owned properties are
.owned(). Only the ontology’s actions change them, and Tilde keeps every edit in an audited log.
source is entirely ontology-owned, and its properties need no .owned(). Actions create and delete it, such as a note or a follow-up task. Its key is always a string.
Links
A link is a relationship between two object types.ontology({ links }).
Entity resolution
The same customer often appears in several systems. A resolution matches members of different object types into one entity, with deterministic rules and optional fuzzy matching.exact, text, email, domain, or phone. List resolutions in ontology({ resolutions }).
History
Sethistory: true on an object to keep every change of its properties from then on, by your actions or in the source system. Add historyAt to date source-side changes with one of the object’s own timestamps.
history(Invoice) to query it. Each row has the key, the property, its value before and after, when it changed, and whether an action or the source changed it.