270 likes | 555 Views
SPATIO-TEMPORAL DATABASES. Temporal Databases. Temporal Data. Modeling Temporal Data Temporal Semantics. Temporal density : the time is seen as being: discrete , dense or continuous [BM+98].
E N D
SPATIO-TEMPORAL DATABASES Temporal Databases
Temporal Data. Modeling Temporal DataTemporal Semantics • Temporal density: the time is seen as being: • discrete, • dense or • continuous [BM+98]. • This feature is determined by the isomorphism established between the temporal domain and the set of natural (N), rational (Q), or real (R) numbers. • In modeling time as a discrete domain, each time instance has a successor and a predecessor, and the time intervals are composed of contiguous points, where ti+1 is the successor of ti. From a mathematical point of view, if the temporal axis is represented as Q or R,, between two time instances there is an infinity of other instances.
Time structure: most of the applications consider time as being linear (naturally, as a collection, partially or totally ordered, of temporal primitives), but it can also be modeled as periodic or cyclic (e.g. schedule), or branched (e.g. planning applications). • Time instance: one point on a temporal axis, one moment of time. • Time interval: time between two instances of time, given as the set of contiguous time instances. • Time data types: a time value associated with an item is represented as a point (time instance) or interval. • Period (or duration) of time: a quantitative property of a time interval; the length of a time interval for which the ends are not known.
Valid time: the time (point or interval) associated with an item or the lifespan of an object in modeled reality; it can have any value in the past or future and can be modified anytime and any times in the database. • Transactional time: the time (point or interval) which defines the lifespan of an item within the database (from insertion to logical removal); it may have a value not greater than the current time and its value can not be modified; it is used mainly to track the operations performed on the DB, as a log file. • User-defined time: is a value of time (generally, time instance) whose meaning is determined by the human factor (user of the application or data model designer). Decisional time is a particular case of user-defined time, meaning the time when a particular decision has been taken in some organization. • Example: changing the salary for an employee: E, 100, [1/1/2009, 31/3/2009] = valid time, [20/12/2008, UC] = transactional time, 15/12/2008 = decisional time.
Timestamp: a value of time (point or interval) associated to an object, attribute or relationship; it can be of type valid or transactional. • Absolute time: an independent timestamp, it does not depend on the timestamp of another item or on the present time. • Relative time: the timestamp is depending on another moment of time, like the timestamp of another item or the current time.
Event: something that is happening somewhere, at a moment in time, or having duration. It may cause changing in one’s or more objects’ states. • State: for a specific object, we are interested in some set of properties; one state for that object is given by the set of values, for its properties. • History, evolution: the set of states for an object; the changes of the object’s state. • Remark. The evolution of an object can be seen as an oriented graph, composed of states and events. Figure 1.5. Part of an object’s evolution (three states and two events that cause the changes)
Lifespan: the time interval when an object exists in the modeled reality or in the database. • Time attribute: attribute of which values are of type time instance or time interval (valid time or transactional time). • Static attribute (non time-varying): attribute for which we don’t want to store its evolution in time; we store only the current value. • Time-varying attribute: attribute for which we want to store its evolution in time. • Temporal attribute = time-varying attribute + time attribute • Now: a special variable that represents the current time (“until-changed”, “current”, “∞” or other notations). A DBMS should offer such a variable.
Objects’ evolution • Evolution of object O (function of evolution): • EvO : T → DO, EvO(t) = the state of O at time t, where T = temporal domain and DO = set of all possible states for object O.
Types of evolutions • discrete evolution: • point-based when the states of an object are recorded at certain moments in time and they are timestamped with time instances. • interval-based when one state of an object stays unchanged during a certain time interval; the timestamp is a time. • continuous evolution: changes are usually represented by functions of time, defined on time intervals: • linear: the evolution is represented or approximated by linear functions of time (linear interpolation can be applied). • non-linear: the evolution is represented by non-linear functions of time, usually – polygonal.
Table 1.3. Discrete evolution; timestamps = VT, time instances
Figure 1.6. (a) point-based discrete evolution, (b) interval-based discrete evolution, (c) continuous evolution represented by linear functions of time, (d) continuous evolution represented by non-linear functions of time
Temporal Databases • Usually, the traditional databases are called “snapshot databases”, because they contain only the current state of the modeled reality (and not its history also). • In temporal databases, the data is (usually) not deleted, but the data is “versioned”. The past states are only logically deleted, therefore their evolution in time is preserved. • From here – one of the temporal databases’ disadvantages: the great amount of data that must be managed.
Databases – According to Time Management • snapshot databases: traditional (classical) databases which do not contain temporal attributes; the previous states cannot be known; • historical databases: databases which contain at least one VT temporal attribute, and no TT temporal attributes; the timestamps represent the objects’ existence in time, in reality; for one object, the timestamps cannot overlap; the timestamps can represent any moment of time (past, present, future); • rollback databases: databases which contain at least one TT temporal attribute, and no VT temporal attributes; usually – used in recovery processes, or logging information about the performed operation on the database; usually – the timestamps are automatically managed by the DBMS; they can represent at one moment only the current time; • bi-temporal databases: databases which contain at least one VT temporal attribute and one TT temporal attribute; these databases have the characteristics of historical and rollback databases.
What do we mark with timestamps? • Usually – the timestamped elements are objects. Let’s consider a table with the following structure: • (OID, A1, A2, … Ap, TA1, TA2, …, TAq), where OID represents the object’s id, the attributes A1, …, Ap are non-varying attributes, and TA1, …, TAq are time-varying attributes. • If we add a single time attribute, T, then we obtain (OID, A1, A2, … Ap, TA1, TA2, …, TAq, T), which means that every time something is changing for an object, we have to record this change by adding a new record (in which the attributes for which nothing changed are simply copied – at least all the non-time-varying attributes). • Therefore – we could split this structure: • (OID, A1, A2, … Ap) – static data • (OID, TA1, TA2, …, TAq, T) – time-varying data
What do we mark with timestamps? • If the time-varying attributes are changing their values with the same frequency (or – almost the same), then this is a good structure. Otherwise, we could split again the last structure, depending on the changing frequency of the time-varying attributes. In the “worst” case we will obtain: • (OID, TA1, T) – time-varying data • (OID, TA2, T) – time-varying data • … • (OID, TAq, T) – time-varying data
Timestamps of type time interval • One time interval can be any kind of interval: [t1, t2], [t1, t2), (t1, t2], or (t1, t2). • Usually, these are used: [t1, t2] – for discrete time, [t1, t2) – for dense time (but this is not a rule).
Temporal Representational Schemas • Let’s consider the notations: • AV = VT attribute, instance of time • AT = TT attribute, instance of time • AVs, AVe, ATs, ATe = time attributes representing time intervals (the starting and ending point of such an interval), VT or TT • Ai (i:=1..n) = thematic attributes (not time attributes)
Temporal Models • grouped temporal data model (also called non-1NF data model): timestamping at attribute level; for each attribute – we may have more than one time value; the correlated events are grouped and represented within a single tuple; • non-grouped temporal data model (also called 1NF data model): timestamping at tuple level; each tuple represents one change.
Temporal Models • As an example, we consider a few cinema rooms, and movies. Next – it is showed which movie could be seen in each cinema room, with the corresponding VT and TT data. • Table 1.5. Bi-temporal relation
Non-grouped temporal data models • Ariav representational schema: • R [A1, A2, …, An, AV, AT] • It uses only instances of time, representing VT and TT. It is considered that one state is valid until we record another change for the same object. See Table 1.6. • Table 1.6. Temporal information, according to the Arial schema
Non-grouped temporal data models • Jensenrepresentational schema: • R [A1, A2, …, An, AVs, AVd, AT, Op], • The Op attribute represents the type of the performed operation (insertion or logical deletion), and AT represents the time when that operation was performed. This model uses a mixed timestamping (interval VT and instance TT). See Table 1.7. The operations that are executed in this case are (only) insertions. • Table 1.7. Temporal information, according to the Jensen schema
Non-grouped temporal data models • Ben-Zvirepresentational schema: • Tes – beginning of the VT interval, • Trs – moment of time when Tes was recorded (beginning of the TT interval), • Tee – end of the VT interval, • Tre – moment of time when Tee was recorded • Td – moment of time when the tuple was logically deleted (end of the TT interval). • If Td = “ – “ then the tuple still exists in the current state of database. See Table 1.8. • Table 1.8. Temporal information, according to the Ben-Zvi schema
Non-grouped temporal data models • Ben-Zvirepresentational schema: • Remark. In Table 1.8. – if VT interval for the last tuple is ended with the value 22, at TT time 25, then the tuple will contain:
Grouped temporal data models • McKenzie representational schema: • R [AT, R’], where R’ = [A1AV1, …, AnAVn] • Each value of AT is associated to a VT relation, and AVi, i:=1..n, are sets of VT (finite) instances. See Table 1.9. (for R2, Finding Nemo, VT considered is [16, 22]). Table 1.9. Temporal information, according to the McKenzie schema
Grouped temporal data models • Gadia representational schema: • R [{(A1, V T)}, …, {(An, V T)}], • where V = [AVs, AVe) şi T = [ATs, ATe) • In our example, the Gadia model is applied according to one or both thematic attributes. See Table 1.10. (a) if it is structured according to cinema room values, and Table 1.10. (b) if it is structured according to cinema room and movie values.
Grouped temporal data models Table 1.10. (a) Temporal information, according to the Gadia schema Table 1.10. (b) Temporal information, according to the Gadia schema