Data model
Datomic stores data as facts with each fact being a five-tuple (https://en.wikipedia.org/wiki/Tuple). These facts are called Datoms. Each datom consists of an Entity ID, Attribute, and Value that form the first three parts of the five-tuple. The fourth part defines the timestamp at which the fact was created and holds true. The fifth part consists of a boolean value that determines whether the defined datom is an addition or retraction of a fact. Multiple datoms of the same entity can be represented as an entity map with an attribute and value as key-value pairs. The Entity ID for the entity map is defined using the key :db/id:
In the preceding example, there are four attributes—order/name, :order/status, :order/rating, and
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access