Presentation is loading. Please wait.

Presentation is loading. Please wait.

BCDM Temporal Domains - Time is linear and totally ordered - Chronons are the basic time unit - Time domains are isomorphic to subsets of the domain of.

Similar presentations


Presentation on theme: "BCDM Temporal Domains - Time is linear and totally ordered - Chronons are the basic time unit - Time domains are isomorphic to subsets of the domain of."— Presentation transcript:

1 BCDM Temporal Domains - Time is linear and totally ordered - Chronons are the basic time unit - Time domains are isomorphic to subsets of the domain of Natural numbers D VT = {t 1,t 2, …, t k }(valid time) D TT = {t’ 1,t’ 2, …, t’ h }  {UC} (transaction time) D TT  D VT (bitemporal chronons)

2 BCDM Data Attribute names: D A ={A 1, A 2, …, A n } Attribute domains D D ={D 1, D 2, …, D n } Schema of a bitemporal relation: R = A i1, A i2, …, A ij T Domain of a bitemporal relation: D i1  D i2  …  D ij  D TT  D VT Tuple of a relation r(R): x = (a 1, a 2, …, a j | t B )

3 BCDM Example. Relation Employee with Schema: (name,salary,T) “Andrea was earning 60K at valid times 10, 11, 12 Such a tuple has been inserted into Employee at time 12, and is current now (say now=13)” (Andrea, 60k | {(12,10), (12,11), (12,12),(13,10), (13,11), (13,12), ……}) VT TT

4 BCDM Example. Relation Employee with Schema: (name,salary,T) “Andrea was earning 60K at valid times 10, 11, 12 Such a tuple has been inserted into Employee at time 12, and is current now (say now=13)” (Andrea, 60k | {(12,10), (12,11), (12,12),(13,10), (13,11), (13,12), (UC,10), (UC,11), (UC,12)}) VT TT UC

5 BCDM Bitemporal relation: set of bitemporal tuples. Constraint: Value equivalent tuples are not allowed. (Bitemporal) DB: set of (bitemporal) relations

6 BCDM Semantics (another viewpoint) NameSalaryT Andrea60K{(12,10), (12,11), (12,12),(13,10), (13,11), (13,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)} (12,10)  {Employee(Andrea,60K)} (12,11)  {Employee(Andrea, 60K)} (12,12)  {Employee(Andrea, 60K), Employee(John,50K)} (12,13)  {Employee(John,50K)} (13,10)  {Employee(Andrea,60K)} (13,11)  {Employee(Andrea, 60K)} …….. (UC,12)  {Employee(Andrea, 60K)}

7 BCDM PROPERTIES Consistent extension (of “classical” SQL DB) A temporal DB is a set of “classical” DBs, one for each bitemporal chronon Uniqueness of representation (from the constraint about value equivalent tuples)

8 BCDM Semantics of UC e.g., the DB’s clock thicks time 14 NameSalaryT Andrea60K{(12,10), (12,11), (12,12), (13,10), (13,11),(13,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)} NameSalaryT Andrea60K{(12,10), (12,11), (12,12), (13,10), (13,11), (13,12), (14,10), (14,11), (14,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)}

9 UC semantics

10 Deletion

11 BCDM deletion (e.g., at time 15) delete(Employee, (Andrea,60K)) NameSalaryT Andrea60K{(12,10), (12,11), (12,12), (13,10), (13,11), (13,12), (14,10), (14,11), (14,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)} NameSalaryT Andrea60K{(12,10), (12,11), (12,12), (13,10), (13,11), (13,12), (14,10), (14,11), (14,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)}

12 Insertion

13 BCDM insertion (e.g., at time 16) insert(Employee, (Andrea,60K|{12,13})) insert(Employee, (Mary,70K|{16})) NameSalaryT Andrea60K{(12,10), (12,11), (12,12),(13,10), (13,11), (13,12), (14,10), (14,11), (14,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)} NameSalaryT Andrea60K{(12,10), (12,11), (12,12),(13,10), (13,11), (13,12), (14,10), (14,11), (14,12), (16,12),(16,13),(UC,12),(UC,13) } John50K{(12,12),(12, 13)} Mary70K{(16,16),(UC,16)}

14 BCDM π D (r)={z | ∃x  r (z[D]=x[D]) ∧ ∀ y  r (y[D]=z[D] ⇒ y[T]  z[T]) ∧ ∀ t  z[T] ∃y  r (y[D]=z[D] ∧ t  y[T])} Algebraic Operators (Ex. Projection) - No value-equivalent tuple generated (uniqueness of representation!) - Coalescing!

15 Example

16

17 BCDM BCDM algebraic operators are a consistent extension of SQL’s ones (reducibility and equivalence) Algebraic Operators Properties

18 BCDM Reducibility rTrT ρ t T (r T ) ρtTρtT op T (r T ) op T op op(ρ t T (r T )) ρtTρtT ρ t T (op T (r T )) =

19 BCDM Equivalence r τtτt τ t (r) op T op op(r) τtτt τ t (op(r))=op T (τ t (r))

20 BCDM PROBLEM Semantically clear but ….. inefficient (not suitable for a “direct” implementation) (1) Not 1-NF (2) UC (at each thick of the clock, all current tuples should be updated!)

21 Task An efficient implementation must be devised The implementation must be proven to respect the semantics. Core issue here: efficient (1-NF) implementations hardly grant uniqueness of representation.

22 An example of implementation: TSQL2 (Snodgrass et al., 1995) Temporal attribute T  four temporal attributes (TT S, TT E, VT S, VT E ) Attribute value: a timestamp or UC Bitemporal tuple: A 1,….A n | TT S, TT E, VT S, VT E Bitemporal relation: set of bitemporal tuples Notice: value-equivalent tuples are allowed!

23 An example of implementation: TSQL2 (Snodgrass et al., 1995) NameSalaryT Andrea60K{(12,10), (12,11), (12,12),(13,10), (13,11), (13,12), (UC,10), (UC,11), (UC,12)} John50K{(12,12),(12, 13)} NameSalaryTT S TT E VT S VT E Andrea60K12UC1012 John50K12 13 SEMANTICS BCDM TSQL2

24 Semantics of TSQL2 representation

25 From BCDM to TSQL2

26 Property

27 Insertion and Deletion in TSQL2

28 An example of implementation: TSQL2 (Snodgrass et al., 1995) Efficient implementation (data model): - 1-NF - UC managed efficiently - clear semantics (mapping onto BCDM) BUT to get efficiency, we loose the uniqueness of representation property

29 Problem: no uniqueness of representation NameSalaryT Andrea60K{(10,2), (10,3), (11, 2),(11,3), (12,1), (12,2),(12,3),(12,4),(13,1),(13,2),(13,3),(13,4)} NameSalaryTT S TT E VT S VT E Andrea60K Andrea60K12UC14 NameSalaryTT S TT E VT S VT E Andrea60K12UC11 Andrea60K10UC23 Andrea60K12UC44 BCDM SEMANTICS TSQL2 (a) TSQL2 (b) Example. At time 10, the fact that Andrea earned 60K from 2 to 3 inserted in Employee. At time 12, such a tuple is updated: Andrea earned 60K from 1 to 4. At time 13, the tuple is (logically) deleted.

30 Problem: no uniqueness of representation VT TT TSQL2 implementation: “covering” rectangles

31 Problem: no uniqueness of representation VT TT TSQL2 Representation (a) NameSalaryTT S TT E VT S VT E Andrea60K Andrea60K12UC14

32 Problem: no uniqueness of representation VT TT TSQL2 Representation (b) NameSalaryTT S TT E VT S VT E Andrea60K12UC11 Andrea60K10UC23 Andrea60K12UC44

33 Problem: no uniqueness of representation VT TT Other TSQL2 Representations!!

34 Problem: no uniqueness of representation NameSalaryTT S TT E VT S VT E Andrea60K Andrea60K12UC14 NameSalaryTT S TT E VT S VT E Andrea60K12UC11 Andrea60K10UC23 Andrea60K12UC44 Potentially, an enormous problem! e.g., Return all employees earning more than 50K for at most 3 consecutive time chronons NameTT S TT E VT S VT E Andrea12UC14 ?

35 Problem: no uniqueness of representation One must grant that the temporal DB implementation respects its underlying semantics, independently of the representation DB1 DB2 op 1, …, op k DB1’ DB2’ op 1, …, op k Given two “semantically equivalent” temporal DBs, and given any sequence of operations, the results are always “semantic equivalent” Otherwise …..We cannot trust DB’s results!

36 Problem: no uniqueness of representation Solution. Step 1. Formal definition of “semantic equivalence” Snapshot equivalence: Informally: two relations (Databases) are snapshot equivalent if they are identical at each bitemporal chronon

37 Problem: no uniqueness of representation Solution. Step 2. Definition of manipulation and algebraic operators that preserve snapshot equivalence e.g., proofs given about TSQL2 (bitemporal) operators rB1rB1 rB2rB2 op B i op B i (r B 1 ) op B i (r B 2 ) snapshot equivalent snapshot equivalent

38 Snapshot Equivalence Valid-timeslice operator σ B t1 (r) = {z (n+1) |  x  r (z[A]=x[A]  z[T v ] = {t2 | (t1, t2)  x[T]}  z[T v ]  } Transaction-timeslice operator

39 Snapshot Equivalence

40 Uniqueness of representation (BCDM)

41 Timeslice operators in TSQL2

42 TSQL2 property


Download ppt "BCDM Temporal Domains - Time is linear and totally ordered - Chronons are the basic time unit - Time domains are isomorphic to subsets of the domain of."

Similar presentations


Ads by Google