Docsity

Temporal Data Models-Temporal and Spatial Databases-Lecture 03 Slides-Computer Science, Appunti di Basi di Dati

Toggle sidebar
bg1
Temporal and Spatial Databases
Chapter 3: Temporal Data Models I
J. Gamper
◮Dimensions of time
◮Timestamp types
◮Point-based data models
◮Interval-based data models
◮Data models with temporal elements
◮Attribute value timestamping
◮The bitemporal conceptual data model
Literature
◮C.S. Jensen, M.D. Soo, and R.T. Snodgrass: Unifying temporal data models via
a conceptual model. Information Systems, vol. 19, no. 7, pp. 513-547, 1994.
TSDB 2008/09 J. Gamper 1/25
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Anteprima parziale del testo

Scarica Temporal Data Models-Temporal and Spatial Databases-Lecture 03 Slides-Computer Science e più Appunti in PDF di Basi di Dati solo su Docsity!

Temporal and Spatial Databases

Chapter 3: Temporal Data Models I

J. Gamper

◮ Dimensions of time

◮ Timestamp types

◮ Point-based data models

◮ Interval-based data models

◮ Data models with temporal elements

◮ Attribute value timestamping

◮ The bitemporal conceptual data model

Literature

◮ (^) C.S. Jensen, M.D. Soo, and R.T. Snodgrass: Unifying temporal data models via a conceptual model. Information Systems, vol. 19, no. 7, pp. 513-547, 1994.

Temporal Data Models

◮ Data model: M = (DS, QL)

◮ (^) DS is a set of data structures ◮ (^) QL is a language for querying the data structures

◮ e.g., the relational data model is composed of relations and SQL

◮ Many extensions of the relational data model to support time have been

proposed

◮ Several aspects have to be considered

◮ (^) Different time dimensions ◮ (^) Different timestamp types ◮ (^) Attribute versus tuple timestamping

Dimensions of Time...

◮ Valid time: The time a fact was/is/will be true in the modeled

reality/mini-world

◮ (^) e.g., John has been hired on October 1, 2004 ◮ (^) Valid time captures the time-varying states of the mini-world ◮ (^) All facts have a valid time by definition, however, it might not be recoreded in the database ◮ (^) Valid time is independent of the recording of the fact in a database ◮ (^) Bounded or unbounded

Dimensions of Time...

◮ Transaction time: The time when a fact is current/present in the

database as stored data

◮ (^) e.g., the fact “John was hired on October 1, 2004” was stored in the DB on October 5, 2004, and has been deleted on March 31, 2005 ◮ (^) Transaction time has a duration: from insertion to deletion, with multiple insertions and deletions being possible for the same fact ◮ (^) As a consequence of this semantics, deletions of facts are purely logical ◮ (^) the fact remains in the database, but ceases to be part of the database’s current state. ◮ (^) Transaction time captures the time-varying states of the database ◮ (^) Always bounded on both ends ◮ (^) Starts when the database is created (nothing was stored before) ◮ (^) Does not extend past now (no facts are known to have been stored in the future) ◮ (^) Basis for supporting accountability and “traceability” requirements, e.g., in financial, medical, legal applications. ◮ (^) May be supplied automatically by the DBMS

Timestamp Types

◮ Timestamp: A time value that is associated with an attribute value or a

tuple in a database

◮ (^) Captures some temporal aspect, e.g., valid time, transaction time ◮ (^) Represented as one or more attributes/columns of a relation

◮ Three different types of timestamps are widley used

◮ (^) Time points ◮ (^) Time intervals ◮ (^) Temporal elements

◮ Two different ways of timestamping

◮ (^) Tuple timestamping ◮ (^) Attribute timestamping

Timestamp Types...

◮ Example: Video store where customers, identified by a CustID, rent video

tapes, identified by a TapeNum. Consider the following rentals during May

◮ (^) On 3rd of May, customer C101 rents tape T1234 for three days ◮ (^) On 5th of May, customer C102 rents tape T1245 for 3 days ◮ (^) From 9th to 12th of May, customer C102 rents tape T ◮ (^) From 19th to 20th of May, and again from 21st to 22nd of May, customer C102 rents tape T

◮ These rentals are stored in a relation Checkout which is graphically

illustrated below

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

(1,C101,T1234) (2,C102,T1245) (3,C102,T1234) (4,C102,T1245)

(5,C102,T1245)

Interval-Based Data Models

◮ Interval-based data model: each tuple is timestamped with a time

interval (time period)

CheckOut SeqNo CustID TapeNum T 1 C101 T1234 [3,5] 2 C102 T1245 [5,7] 3 C102 T1234 [9,12] 4 C102 T1245 [19,20] 5 C102 T1245 [21,22]

◮ (^) Timestamps are atomic values that can be compared using Allen’s 13 basic relationships between intervals (before, meets, during, etc.) ◮ (^) more convenient than comparing the endpoints of the intervals ◮ (^) Multiple tuples are used if a fact is valid over disjoint time intervals ◮ (^) The SeqNo attribute is not needed to distinguish between different tuples. ◮ (^) The most popular model from an implementation perspective ◮ (^) Time intervals are not closed under all set operations ◮ (^) e.g., subtracting [5, 7] from [1, 9] returns a set of intervals {[1, 4], [8, 9]}

Interval-Based Data Models...

◮ Weak interval-based data model

◮ (^) The following two relations are considered equivalent, i.e., contain exact the same information CheckOut CustID TapeNum T C101 T1234 [3,5] C102 T1245 [5,7] C102 T1234 [9,12] C102 T1245 [19,20] C102 T1245 [21,22]

CheckOut CustID TapeNum T C101 T1234 [3,5] C102 T1245 [5,7] C102 T1234 [9,12] C102 T1245 [19,22]

◮ (^) The relations are (syntactically) different, but snapshot equivalent, i.e., they contain the same snapshots ◮ (^) Semantically, a point-based view is adopted ◮ (^) Intervals are only used as a convenient representation of (contiguous) sets of time points ◮ (^) Coalescing of relations makes sense ◮ (^) Syntactically different relations are also semantically different ◮ (^) Impossible to distinguish two consecutive 2-day checkouts without an additional attribute

Data Models with Temporal Elements

◮ Data models with temporal elements: each tuple is timestamped with a

temporal element, i.e., a finite union of intervals

CheckOut CustID TapeNum T C101 T1234 [3,5] C102 T1245 [5,7] ∪ [19,20] ∪ [21,22] C102 T1234 [9,12]

CheckOut CustID TapeNum T C101 T1234 [3,5] C102 T1245 [5,7] ∪ [19,22] C102 T1234 [9,12]

◮ (^) The full history of a fact is stored in one tuple ◮ (^) Point-based and interval-based semantics are possible (as for the interval-based data model) ◮ (^) Under the point-based view, both relations are equivalent

Attribute Value Timestamping

◮ Attribute value timestamping: each attribute value is timestamped

with a set of time points/intervals

◮ (^) Captures all information about a real-world object in a single tuple ◮ (^) e.g., all information about a customer in the relation below

CheckOut SeqNo CustID TapeNum [3,5] 1 [3,5] C101 [3,5] T [5,7] 2 [5,7] ∪ [9,12] ∪ [19,22] C102 [5,7] ∪ [19,22] T [9,12] 3 [9,12] T [19,20] 4 [21,22] 5 ◮ (^) Information about other objects is spread across several tuples, e.g., information about tapes. ◮ (^) A single tuple may record multiple facts ◮ (^) e.g., the second tuple records the following facts: rental information for customer C102 for the tapes T1245 and T1234, and four different checkouts ◮ (^) Non-first-normal-form data model

The Bitemporal Conceptual Data Model

◮ Bitemporal Conceptual Data Model^1 (BCDM)

◮ (^) Supports valid time and transaction time ◮ (^) Both time domains are linear and discrete ◮ (^) Valid-time domain: DVT = {t 1 , t 2 ,... , tk } ◮ (^) Transaction-time domain: DTT = {t′ 1 , t 2 ′,... , tj } ∪ {UC } ◮ (^) A bitemporal chronon is a pair of a transaction-time chronon and a valid-time chronon ◮ (^) (ti , t′ j ) ∈ DTT × DVT ◮ (^) ”tiny rectangle” in the two-dimensional space ◮ (^) A bitemporal element is a set of bitemporal chronons ◮ (^) Timestamp attribute T with domain of bitemporal elements ◮ (^) Explicit (non-timestamp) attributes ◮ (^) Names: DA = {A 1 ,... , AnA } ◮ (^) BCDM schema: (A 1 , A 2 ,... , An, T ) ◮ (^) BCDM tuple: x = (a 1 , a 2 ,... , an, tb ) ◮ (^) Value-equivalent tuples (tuples with identical explicit attributes) are not allowed ◮ (^) the full history of a fact is contained in a single tuple

(^1) C.S. Jensen, M.D. Soo, and R.T. Snodgrass: Unifying temporal data models via a conceptual model. Information Systems, vol. 19, no. 7, pp. 513-547, 1994.

The Bitemporal Conceptual Data Model...

◮ Example: Consider a relation recording empolyee/department information.

◮ (^) Employee Jake was hired in the shipping department for the interval from time 10 to time 15. ◮ (^) This fact become current in the database at time 5.

◮ (^) Arrows indicate that the tuple has not yet been deleted

The Bitemporal Conceptual Data Model...

◮ Example (contd.) At time point 20 the following updates become current:

◮ (^) Jake was not in the shipping department, but in the loading department ◮ (^) A new employee Kate is hired for the shipping department for the time from 25 to 30

◮ (^) The fact (Jake,Ship) is removed from the current state, and the fact (Jake,Load) is inserted

The Bitemporal Conceptual Data Model...

◮ Example (contd.) The bitemporal relation contains now 3 facts and is

given below

dept Emp Dept T Jake Ship {(5,10),... ,(5,15),... ,(9,10),... ,(9,15), (10,5),... ,(10,20),... ,(14,5),... ,(14,20), (15,10),... ,(15,15),... ,(19,10),... ,(19,15) } Jake Load {(UC,10),... ,(UC,15)} Kate Ship {(UC,25),... ,(UC,30)}