You can configure MarkLogic Server to manage and query bi-temporal data. Bi-temporal documents are associated with both a valid time that marks when a thing is known in the real world and a system time that marks when the thing is available for discovery in MarkLogic Server.
Bi-temporal data is necessary whenever there is a requirement to maintain snapshots of a transaction across various time dimensions. For example, financial and insurance industries use bitemporal data to track changes to contracts, policies, and events in a manner that adheres to strict regulation and compliance requirements.
In this guide, the term temporal refers to both bi-temporal and uni-temporal documents and collections.
This chapter describes the basic components used to manage temporal documents, and includes the following sections:
To understand the temporal functions, you need to understand the meaning of the following terms:
Document quality and permissions travel with the split. Document properties do not travel with the split.
Bi-temporal data tracks information along two different time lines:
MarkLogic also supports uni-temporal documents that have only a system time. Uni-temporal documents are managed in MarkLogic in the same manner as bi-temporal documents.
In MarkLogic, a temporal document is managed as a series of versioned documents in a protected collection. The 'original' document inserted into the database is kept and never changes. Updates to the document are inserted as new documents with different valid and system times. A delete of the document is also inserted as a new document. In this way, a temporal document can be rolled back to review, at any point in time, when the information was known in the real world and when it was recorded in the database.
The temporal-admin
or admin
role is required to create axes, temporal collections, and otherwise configure the temporal environment.
Changing permissions on a temporal document only affects the latest version of the document that is created as a result of the change. All previous versions of the document maintain their original permissions.
Bi-temporality and uni-temporality is defined on a protected collection, known as a temporal collection. A temporal collection is a logical grouping of temporal documents that share the same axes with timestamps defined by the same range indices. You can create additional temporal collections if you have documents that require a different schema for the timestamps. A temporal collection can be created for either bi-temporal documents (documents with both system and valid times) or uni-temporal documents (documents with only system times).
When a document is inserted into a temporal collection, a URI collection is created for that document. When the document is updated, a new document representing the update is inserted into the document's URI collection. Any new document inserted into the temporal collection will have its own unique URI collection that will hold all of the versions of that document.
Additionally, the latest version of each document will reside in a latest collection.
The following illustrates how three temporal documents would be organized into the temporal, URI, and latest collections:
When a temporal document is deleted, it is removed from the latest
collection.
You can set an archive date on temporal documents at which time they can be moved to a WORM (Write Once Read Many) device. Once a temporal document is written to a WORM device, it cannot be modified or deleted. This write protection ensures that the data cannot be tampered with once it is written to the device until a pre-determined expiration date.
For details on archiving temporal documents, see Protecting and Archiving Temporal Documents.