Time In Databases While most databases tend to model reality at a point in time (at the 'current"time),temporal databases model the states of the real world across time. Facts in temporal relations have associated times when they are valid, which can be represented as a union of intervals. The transaction time for a fact is the time interval during which the fact is current within the database system. In a temporal relation,each tuple has an associated time when it is true;the time may be either valid time or transaction time. A bi-temporal relation stores both valid and transaction time. 2 Database System Concepts,5th Ed. 24.2 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 24.2 ©Silberschatz, Korth and Sudarshan th Ed. 2 Time In Databases While most databases tend to model reality at a point in time (at the ``current'' time), temporal databases model the states of the real world across time. Facts in temporal relations have associated times when they are valid, which can be represented as a union of intervals. The transaction time for a fact is the time interval during which the fact is current within the database system. In a temporal relation, each tuple has an associated time when it is true; the time may be either valid time or transaction time. A bi-temporal relation stores both valid and transaction time
Time In Databases(Cont.) Example of a temporal relation: account- number branch-name balance from to A-101 Downtown 500 1999/1/1 9:00 1999/1/2411:30 A-101 Downtown 100 1999/1/2411:30 A-215 Mianus 700 2000/6/2 15:30 2000/8/8 10:00 A-215 Mianus 900 2000/8/8 10:00 2000/9/5 8:00 A-215 Mianus 700 2000/9/5 8:00 米 A-217 Brighton 750 1999/7/5 11:00 2000/5/116:00 lemporal query languages have been proposed to simplity modeling of time as well as time related queries. 3 Database System Concepts,5th Ed. 24.3 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 24.3 ©Silberschatz, Korth and Sudarshan th Ed. 3 Time In Databases (Cont.) Example of a temporal relation: Temporal query languages have been proposed to simplify modeling of time as well as time related queries
Time Specification in SQL-92 date:four digits for the year(1--9999),two digits for the month(1--12). and two digits for the date(1--31). time:two digits for the hour,two digits for the minute,and two digits for the second,plus optional fractional digits. timestamp:the fields of date and time,with six fractional digits for the seconds field. Times are specified in the Universal Coordinated Time,abbreviated UTC(from the French);supports time with time zone. interval:refers to a period of time (e.g.,2 days and 5 hours),without specifying a particular time when this period starts;could more accurately be termed a span. 4 Database System Concepts,5th Ed. 24.4 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 24.4 ©Silberschatz, Korth and Sudarshan th Ed. 4 Time Specification in SQL-92 date: four digits for the year (1--9999), two digits for the month (1--12), and two digits for the date (1--31). time: two digits for the hour, two digits for the minute, and two digits for the second, plus optional fractional digits. timestamp: the fields of date and time, with six fractional digits for the seconds field. Times are specified in the Universal Coordinated Time, abbreviated UTC (from the French); supports time with time zone. interval: refers to a period of time (e.g., 2 days and 5 hours), without specifying a particular time when this period starts; could more accurately be termed a span
Temporal Query Languages Predicates precedes,overlaps,and contains on time intervals. Intersect can be applied on two intervals,to give a single(possibly empty)interval;the union of two intervals may or may not be a single interval. A snapshot of a temporal relation at time t consists of the tuples that are valid at time t,with the time-interval attributes projected out. Temporal selection:involves time attributes Temporal projection:the tuples in the projection inherit their time- intervals from the tuples in the original relation. Temporal join:the time-interval of a tuple in the result is the intersection of the time-intervals of the tuples from which it is derived. It intersection is empty,tuple is discarded from join. Database System Concepts,5th Ed. 24.5 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 24.5 ©Silberschatz, Korth and Sudarshan th Ed. 5 Temporal Query Languages Predicates precedes, overlaps, and contains on time intervals. Intersect can be applied on two intervals, to give a single (possibly empty) interval; the union of two intervals may or may not be a single interval. A snapshot of a temporal relation at time t consists of the tuples that are valid at time t, with the time-interval attributes projected out. Temporal selection: involves time attributes Temporal projection: the tuples in the projection inherit their timeintervals from the tuples in the original relation. Temporal join: the time-interval of a tuple in the result is the intersection of the time-intervals of the tuples from which it is derived. It intersection is empty, tuple is discarded from join
Temporal Query Languages (Cont.) Functional dependencies must be used with care:adding a time field may invalidate functional dependency A temporal functional dependency x->holds on a relation schema R if,for all legal instances r of R,all snapshots of r satisfy the functional dependency X->Y. SQL:1999 Part 7(SQL/Temporal)is a proposed extension to SQL:1999 to improve support of temporal data. 6 Database System Concepts,5th Ed. 24.6 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 24.6 ©Silberschatz, Korth and Sudarshan th Ed. 6 Temporal Query Languages (Cont.) Functional dependencies must be used with care: adding a time field may invalidate functional dependency A temporal functional dependency x → Y holds on a relation schema R if, for all legal instances r of R, all snapshots of r satisfy the functional dependency X →Y. SQL:1999 Part 7 (SQL/Temporal) is a proposed extension to SQL:1999 to improve support of temporal data.
Spatial and Geographic Databases Spatial databases store information related to spatial locations,and support efficient storage,indexing and querying of spatial data. Special purpose index structures are important for accessing spatial data,and for processing spatial join queries. Computer Aided Design(CAD)databases store design information about how objects are constructed E.g.:designs of buildings,aircraft, layouts of integrated-circuits Geographic databases store geographic information(e.g.,maps): often called geographic information systems or GIS 8 Database System Concepts,5th Ed. 24.8 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 24.8 ©Silberschatz, Korth and Sudarshan th Ed. 8 Spatial and Geographic Databases Spatial databases store information related to spatial locations, and support efficient storage, indexing and querying of spatial data. Special purpose index structures are important for accessing spatial data, and for processing spatial join queries. Computer Aided Design (CAD) databases store design information about how objects are constructed E.g.: designs of buildings, aircraft, layouts of integrated-circuits Geographic databases store geographic information (e.g., maps): often called geographic information systems or GIS
Represented of Geometric Information Various geometric constructs can be represented in a database in a normalized fashion. Represent a line segment by the coordinates of its endpoints. Approximate a curve by partitioning it into a sequence of segments Create a list of vertices in order,or Represent each segment as a separate tuple that also carries with it the identifier of the curve(2D features such as roads) Closed polygons List of vertices in order,starting vertex is the same as the ending vertex,or Represent boundary edges as separate tuples,with each containing identifier of the polygon,or Use triangulation-divide polygon into triangles Note the polygon identifier with each of its triangles. Database System Concepts,5th Ed. 24.9 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 24.9 ©Silberschatz, Korth and Sudarshan th Ed. 9 Represented of Geometric Information Various geometric constructs can be represented in a database in a normalized fashion. Represent a line segment by the coordinates of its endpoints. Approximate a curve by partitioning it into a sequence of segments Create a list of vertices in order, or Represent each segment as a separate tuple that also carries with it the identifier of the curve (2D features such as roads). Closed polygons List of vertices in order, starting vertex is the same as the ending vertex, or Represent boundary edges as separate tuples, with each containing identifier of the polygon, or Use triangulation — divide polygon into triangles Note the polygon identifier with each of its triangles
Representation of Geometric Constructs line segment {(x1,y1),(x2,y2)》 3 triangle {(x1,y1),(x2y2),(x3,y3)} 2 2 3 polygon {(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)} 4 5 2 3 {(x1y1),(x2,y2),(x3,y3),ID1 polygon {(x1,y1),(x3,y3),(x4,y4),ID1 {(x1,y1),(x4y4),(x5,y5),ID1} 4 5 object representation 10 Database System Concepts,5th Ed. 24.10 ©Silberschat乜,Korth and Sudarshan
Database System Concepts, 5 24.10 ©Silberschatz, Korth and Sudarshan th Ed. 10 Representation of Geometric Constructs
Representation of Geometric Information (Cont.) Representation of points and line segment in 3-D similar to 2-D,except that points have an extra z component Represent arbitrary polyhedra by dividing them into tetrahedrons,like triangulating polygons. Alternative:List their faces,each of which is a polygon,along with an indication of which side of the face is inside the polyhedron. 11 Database System Concepts,5th Ed. 24.11 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 24.11 ©Silberschatz, Korth and Sudarshan th Ed. 11 Representation of Geometric Information (Cont.) Representation of points and line segment in 3-D similar to 2-D, except that points have an extra z component Represent arbitrary polyhedra by dividing them into tetrahedrons, like triangulating polygons. Alternative: List their faces, each of which is a polygon, along with an indication of which side of the face is inside the polyhedron
Design Databases Represent design components as objects(generally geometric objects);the connections between the objects indicate how the design is structured. Simple two-dimensional objects:points,lines,triangles, rectangles,polygons. Complex two-dimensional objects:formed from simple objects via union,intersection,and difference operations. Complex three-dimensional objects:formed from simpler objects such as spheres,cylinders,and cuboids,by union,intersection, and difference operations. Wireframe models represent three-dimensional surfaces as a set of simpler objects. 12 Database System Concepts,5th Ed. 24.12 @Silberschatz,Korth and Sudarshan
Database System Concepts, 5 24.12 ©Silberschatz, Korth and Sudarshan th Ed. 12 Design Databases Represent design components as objects (generally geometric objects); the connections between the objects indicate how the design is structured. Simple two-dimensional objects: points, lines, triangles, rectangles, polygons. Complex two-dimensional objects: formed from simple objects via union, intersection, and difference operations. Complex three-dimensional objects: formed from simpler objects such as spheres, cylinders, and cuboids, by union, intersection, and difference operations. Wireframe models represent three-dimensional surfaces as a set of simpler objects