












Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!













J. Gamper
◮ (^) Algebra for BCDM ◮ (^) Algebra for Snodgrass’ tuple timestamped data model ◮ (^) Semantic equivalence and snapshot equivalence ◮ (^) Reducibility of operators
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.
◮ (^) An algebra provides a procedural/operational language for a data structure that is suitable for implementation ◮ (^) Algebra for the standard relational algebra operators in BCDM ◮ (^) Schema: R = (A 1 ,... , An, T ) ◮ (^) Domains: Ai has domain Di and T has domain P(DTT × DVT ) ◮ (^) DTT is the transaction-time domain and DVT is the valid-time domain ◮ (^) r is an instance relations of schema R ◮ (^) The operators then have the following signature
πBD : r → r σBP : r → r ∪B^ : r × r → r 1 B^ : r × r → r −B^ : r × r → r ρBt : r → rvt τ (^) tB : r → rtt
◮ (^) Temporal selection: Select from relation r with non-timestamp attributes A 1 ,... , An all tuples that satisfy a predicate P defined on the non-timestamp attributes
σBP (r ) = {z|z ∈ r ∧ P(z[A])}
◮ (^) Example: Select all tuples of employee Kate: σBEmp=′Kate′ (dept) 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)} result Emp Dept T Kate Ship {(UC,25),... ,(UC,30)}
◮ (^) Temporal union: Compute the union of tuples from two relations r 1 and r 2 that are instances of the same schema (or union-compatible schemas)
r 1 ∪B^ r 2 = {z(n+1)|(∃x ∈ r 1 ∃y ∈ r 2 (z[A] = x[A] = y [A] ∧ z[T ] = x[T ] ∪ y [T ])) ∨ (∃x ∈ r 1 (z[A] = x[A] ∧ (¬∃y ∈ r 2 (y [A] = x[A])) ∧ z[T ] = x[T ])) ∨ (∃y ∈ r 2 (z[A] = y [A] ∧ (¬∃x ∈ r 1 (x[A] = y [A])) ∧ z[T ] = y [T ]))} ◮ (^) The first clause handles value-equivalent tuples found in r 1 and r 2 ◮ (^) The second (third) clause handles those tuples that are found only in r 1 (r 2 )
◮ (^) Temporal difference: Computes those tuples that are in r 1 and not in r 2 , where the two relations are instances of the same schema (or union-compatible schemas)
r 1 −B^ r 2 = {z(n+1)|∃x ∈ r 1 ((z[A] = x[A]) ∧ ((∃y ∈ r 2 (z[A] = y [A]) ∧ z[T ] = x[T ] − y [T ]) ∨ (¬∃y ∈ r 2 (z[A] = y [A]) ∧ z[T ] = x[T ])))}
◮ (^) The last two lines compute the bitemporal element, depending on whether a value-equivalent tuple may be found in r 2 or not.
◮ (^) Example: Compute the temporal difference between dept and emp: dept −B^ emp
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)} emp Name Inst T Jake Ship {(10,5),... ,(10,20),... ,(14,5),... ,(14,20) } Jake Load {(15,10),... ,(15,15),... ,(UC,10),... ,(UC,15) } result Emp Dept T Jake Ship {(5,10),... ,(5,15),... ,(9,10),... ,(9,15), (15,10),... ,(15,15),... ,(19,10),... ,(19,15) } Kate Ship {(UC,25),... ,(UC,30)}
◮ (^) Example: Bitemporal join of two relations to compute “Who managed whom”? ◮ (^) Compute dept 1 B^ mgr
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)} mgr Dept Mgr T Ship Jean {(10,15),... ,(10,30),... ,(UC,15),... ,(UC,30), Load Jean {(15,5),... ,(15,15),... ,(UC,5),... ,(UC,15)} result Emp Dept Mgr T Jake Ship Jean {(10,15),... ,(10,20),... ,(15,15),... ,(15,20), Jake Load Jean {(UC,10),... ,(UC,15)} Kate Ship Jean {(UC,25),... ,(UC,30)}
◮ (^) Timestamp is the overlap of timestamp regions of tuples with matching join attributes
◮ (^) Transaction-timeslice operator: selects the relation at transaction-time t 1 (which is not exceeding the current time) ◮ (^) Gets a bitemporal relation r as input and returns a valid-time relation
ρBt 1 (r ) = {z(n+1)^ | ∃x ∈ r (z[A] = x[A] ∧ z[Tv ] = {t 2 |(t 1 , t 2 ) ∈ x[T ]} ∧ z[Tv ] 6 = ∅)}
◮ (^) Valid-timeslice operator: selects the relation at valid-time t 2 ◮ (^) Gets a bitemporal relation r as input and returns a transaction-time relation
τ (^) tB 2 (r ) = {z(n+1)^ | ∃x ∈ r (z[A] = x[A] ∧ z[Tt ] = {t 1 |(t 1 , t 2 ) ∈ x[T ]} ∧ z[Tt ] 6 = ∅)}
◮ (^) Timeslice operators can be extended for transaction-time and valid-time relations ◮ (^) ρT^ gets as input a transaction-time relation and returns a snapshot relation ◮ (^) τ V^ gets as input a valid-time relation and returns a snapshot relation
◮ (^) Relation schema: R = (A 1 ,... , An, Ts , Te , Vs , Ve ) ◮ (^) V is a shorthand for (Vs , Ve ), T is a shorthand for (Ts , Te )
◮ (^) Temporal projection: Project a relation r with non-timestamp attributes A 1 ,... , An to a subset D of attributes (columns)
πBD (r ) = {z(|D|+4)|∃x ∈ r (z[D] = x[D] ∧ z[T ] = x[T ] ∧ z[V ] = x[V ])}
◮ (^) Temporal selection: Select from relation r with non-timestamp attributes A 1 ,... , An all tuples that satisfy a predicate P defined on the non-timestamp attributes
πBP (r ) = {z(n+4)|z ∈ r ∧ P(z[A])}
◮ (^) Temporal union: Compute the union of tuples from two relations r 1 and r 2 that are instances of the same schema (or union-compatible schemas)
r 1 ∪B^ r 2 = {z(n+4)|∃x ∈ r 1 ∃y ∈ r 2 (z = x ∨ z = y )}
◮ (^) Temporal difference: Computes those tuples that are in r 1 and not in r 2 , where the two relations are instances of the same schema (or union-compatible schemas) r 1 −B^ r 2 = {z(n+4)|∃x ∈ r 1 (z[A] = x[A]) ∧ ∃t ∈ cover (bi chr (x[T ], x[V ]) − {bi chr (y [T ], y [V ])|y ∈ r 2 ∧ y [A] = x[A]}) ∧ z[Ts ] = min 1(t) ∧ z[Te ] = max 1(t) ∧ z[Vs ] = min 2(t) ∧ z[Ve ] = max 2(t))}
◮ (^) The new timestamp is conveniently determined by set difference on bitemporal elements ◮ (^) bi chr (T , V ) computes the bitemporal chronons covered by the argument rectangular region
◮ (^) Timesclide operators
ρBt 1 (r ) = {z(n+2)^ | ∃x ∈ r (z[A] = x[A] ∧ z[V ] = x[V ] ∧ t 1 ∈ x[T ])} τ (^) tB 2 (r ) = {z(n+2)^ | ∃x ∈ r (z[A] = x[A] ∧ z[T ] = x[T ] ∧ t 2 ∈ x[V ])}
◮ (^) Snapshot equivalence: Two bitemporal relations, r and s, are snapshot equivalent, r
s ≡ s, if for all times t 1 (not exceeding the current time) and for all times t 2 the following holds:
τ (^) tV 2 (ρBt 1 (r )) = τ (^) tV 2 (ρBt 1 (s))
◮ (^) Theorem: Let r and s be BCDM relations over the same schema. Then r s ≡ s iff r = s.
◮ (^) Theorem: Let r be a temporal relation. Then for all times t 1 not exceeding the current time and for all times t 2 we can swap the timeslice operators, i.e.,
τ (^) tV 2 (ρBt 1 (r )) s ≡ ρTt 1 (τ (^) tB 2 (r ))
◮ (^) In point-based and weakly interval-based data models: ◮ (^) Snapshot equivalent relations have the same information content (i.e., are semantically equivalent). ◮ (^) Snapshot equivalence is not applicable in strong interval-based models!
◮ (^) Operators in the various data models (snapshot, transaction-time, valid-time, and bitemporal) are related. ◮ (^) The semantics of an operator in a more complex data model can be reduced to the semantics of the operator in a simpler data model. ◮ (^) Reducibility guarantees that the semantics of simpler operators are preserved in their more complex counterparts. ◮ (^) Theorem: Let t denote an arbitrary time and let r and s be relation instances of the proper types for the operators they are applied to. Then the following holds for all t.
ρTt (r 1 T^ s)
s ≡ ρTt (r ) 1 S^ ρTt (s) τ (^) tV (r 1 V^ s) s ≡ τ (^) tV (r ) 1 S^ τ (^) tV (s) τ (^) tB (r 1 B^ s)
s ≡ τ (^) tB (r ) 1 T^ τ (^) tB (s) ρBt (r 1 B^ s)
s ≡ ρBt (r ) 1 T^ ρBt (s) ◮ (^) Similar theorems for the other operators.
◮ (^) Example: Reducibility of transaction-time natural join to snapshot natural join ◮ (^) The result of first joining two transaction-time relations and then transforming the result to a snapshot relation yields a result that is the same as that obtained by first transforming the arguments to snapshot relations and then joing the snapshot relations.