BitemporalPostgres.jl

BitemporalPostgres.Component — Type

Component

an abstract component of a bitemporal entity i.e. a contract, a reference to a partner a component's history of states is represented by its revisions

source
BitemporalPostgres.ValidityInterval — Type

ValidityInterval

a 2-dimensional interval of validity of a version with respect to the state

  • of the data base storage and
  • of the world

See the theory page for background

source
BitemporalPostgres.Workflow — Type

Workflow Holds application based transaction data.

  • current version
  • world validFrom date
  • db validfrom date
  • is_committed means: bitemporal transaction is
    • pending: 0
    • committed: 1
    • rolled back: 2
source
BitemporalPostgres.commit_workflow! — Method

commitworkflow!(w::Workflow) commits the bitemporal transaction identified by refversion begun with the creation of w

  • sets w's version's validityInterval to is_committed
  • ends all overlapping intervals to tsdbinvalidfrom w.tsdbvalidfrom
  • creates a new interval for the non_overlapping part of a partially interval if any
source
BitemporalPostgres.create_entity! — Method

create_entity!(w::Workflow)

  • opens a bitemporal transaction identified by ref_version
  • persists a history, version, validityInterval and a Workflow
  • requires: w.tsw_validfrom is a valid date
source
BitemporalPostgres.delete_component! — Method

delete_component!(c::T, w::Workflow) where {T<:Component}

  • deletes a component if it was created for the current version or
  • mark its latest component revision as invalid
source
BitemporalPostgres.delete_component! — Method

delete_component!(r::T, w::Workflow) where {T<:ComponentRevision}

  • deletes a component if it was created for the current version or
  • mark its latest component revision as invalid
source
BitemporalPostgres.findcomponentrevision — Method

findcomponentrevision(t::Type{T},refcomponent::DbId,refversion::DbId,)::Vector{T} where {T<:ComponentRevision} retrieves the version_id of a bitemporal history asof tsdb as per tsw

source
BitemporalPostgres.findversion — Function

findversion(refhistory::DbId, tsdb::ZonedDateTime, tsw::ZonedDateTime, committed::Integer=1)::DbId retrieves the versionid of a bitemporal history asof tsdb as per tsw

source
BitemporalPostgres.get_revision — Method

get_revision(ctype::Type{CT}, rtype::Type{RT}, hid::DbId, vid::DbId) where {CT<:Component,RT<:ComponentRevision}

retrieves the revision of the unique component of type CT in history hid as of version vid 
the revision must exist
source
BitemporalPostgres.get_revision — Method

get_revision(rtype::Type{RT}, cid::DbId, vid::DbId) where {RT<:ComponentRevision}

retrieves the revision of component cid as of version vid 
the revision must exist
source
BitemporalPostgres.get_revisionIfAny — Method

function get_revisionIfAny( ctype::Type{CT}, rtype::Type{RT}, hid::DbId, vid::DbId, )::Vector{RT} where {CT<:Component,RT<:ComponentRevision} retrieves the revision of the unique component of type CT in history hid if one exists as of version vid

An optional (unique) component may have a revision for a version later as vid. In such cases a component w/o valid revision is itself valid, just to be ignored for the current version.
source
BitemporalPostgres.get_revisionIfAny — Method

function get_revisionIfAny(rtype::Type{RT}, hid::DbId, vid::DbId, )::Vector{RT} where {RT<:ComponentRevision} retrieves the revision of component cid if one exists as of version vid

An optional component may have a revision for a version later as vid. In such cases a component w/o valid revision is itself valid, just to be ignored for the current version.
source
BitemporalPostgres.get_typeof_component — Method

gettypeofcomponent(component::T)::Type{R} where {T<:ComponentRevision,R<:Component} returns the actual subtype of Component that fits the actual type of ComponentRevision

source
BitemporalPostgres.get_typeof_revision — Method

gettypeofrevision(component::T)::Type{R} where {T<:Component,R<:ComponentRevision} returns the actual subtype of ComponentRevision that fits the actual type of Component

source
BitemporalPostgres.mkforest — Method

mkforest(hid::DbId)::Vector{Node}

builds a forest of version nodes where
* eventual child node vectors denote mutations which have been retrospectively corrected by their predecessor


see: Theory: Textual representation of mutation histories
source
BitemporalPostgres.mktree — Method

function mktree(version::Integer, vidsDict::Dict{Integer,Integer}, treeDict::Dict{Integer,Vector{Integer}})::BitemporalPostgres.Node

builds a tree of versipon nodes with child node vectors denoting
mutations which have been retrospectively corrected by their parent = predecessor

see: Theory: Textual representation of mutation histories
source
BitemporalPostgres.update_entity! — Method

update_entity!(w::Workflow)

  • opens a bitemporal transaction identified by ref_version
  • persists a version, a validityInterval and a Workflow
  • For retrospective transactions
    • preliminarily invalidates all insertions and mutations from shadowed versions
    • preliminarily revives all revisions invalidated by shadowed versions
  • requires:
    • w.tsw_validfrom is a valid date
    • w.ref_history is a valid history id
    • w.refversion is a valid version of w.refhistory
source