CS240A: Databases and Knowledge Bases Time Ontology and Representations Carlo Zaniolo Department of Computer Science University of California, Los Angeles.

Slides:



Advertisements
Similar presentations
TSQL 2 : QUERY LANGUAGE FOR TEMPORAL DATA CS 224 : Advanced Topics in Data Management.
Advertisements

CIT 613: Relational Database Development using SQL Revision of Tables and Data Types.
From Handbook of Temporal Reasoning in Artificial Intelligence By Jan Chomicki & David Toman Temporal Databases Presented by Leila Jalali CS224 presentation.
Temporal Constraints Time and Time Again: The Many Ways to Represent Time James F Allen.
PostgreSQL & Temporal Data Christopher Browne Afilias Canada PGCon 2009.
1 Efficient Temporal Coalescing Query Support in Relational Database Systems Xin Zhou 1, Carlo Zaniolo 1, Fusheng Wang 2 1 UCLA, 2 Simens Corporate Research.
CS240A: Databases and Knowledge Bases Temporal Applications and SQL:1999 Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Dr. Kalpakis CMSC 661, Principles of Database Systems Representing Data Elements [12]
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.
Advanced Databases Temporal Databases Dr Theodoros Manavis
Temporal and Real-Time Databases: A Survey by Gultekin Ozsoyoglu and Richard T. Snodgrass Presentation by Didi Yao.
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Chapter 3 Probability Distribution. Chapter 3, Part A Probability Distributions n Random Variables n Discrete Probability Distributions n Binomial Probability.
Structured Query Language - SQL Carol Wolf Computer Science.
Representing Data Elements Gayatri Gopalakrishnan.
CS240A: Databases and Knowledge Bases Time Ontology and Representations Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Spatio-Temporal Databases
Temporal Databases. Outline Spatial Databases Indexing, Query processing Temporal Databases Spatio-temporal ….
Spatio-Temporal Databases. Outline Spatial Databases Temporal Databases Spatio-temporal Databases Multimedia Databases …..
CS 240A: Databases and Knowledge Bases Analysis of Active Databases Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Spatiotemporal GIS: Incorporating Time Group 7 Nathan Hunstad, Kyle Martin Csci 5980.
CS240A: Databases and Knowledge Bases A Taxonomy of Temporal DBs Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Winter 2002Judy Cushing8–1 Schedule Jan. 30 (Wed) u Modifications, Schemas, Views. Read Sections This Week (Feb 4ff) u Constraints Read Sections.
Temporal Databases. Outline Spatial Databases Indexing, Query processing Temporal Databases Spatio-temporal ….
Time Chapter 10 © Worboys and Duckham (2004)
©Silberschatz, Korth and Sudarshan4.1Database System Concepts Modification of the Database – Deletion Delete all account records at the Perryridge branch.
CS240A: Databases and Knowledge Bases Applications of Active Database Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
MM3FC Mathematical Modeling 3 LECTURE 2 Times Weeks 7,8 & 9. Lectures : Mon,Tues,Wed 10-11am, Rm.1439 Tutorials : Thurs, 10am, Rm. ULT. Clinics : Fri,
Concepts of Database Management, 4th Edition, Pratt & Adamski
CVSQL 2 The Design. System Overview System Components CVSQL Server –Three network interfaces –Modular data source provider framework –Decoupled SQL parsing.
Structured Query Language (SQL) A2 Teacher Up skilling LECTURE 2.
Basis Data Terapan Yoannita. SQL Server Data Types Character strings: Data typeDescriptionStorage char(n)Fixed-length character string. Maximum 8,000.
Chapter 3: The Fundamentals: Algorithms, the Integers, and Matrices
Said Salomon Unitrin Direct Insurance T-SQL Date and Time Functions Said Salomon.
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
Recent research : Temporal databases N. L. Sarda
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
USE OF TEMPORAL CONCEPTS IN TRANSACTIONAL DATABASES.
SCUHolliday - coen 1788–1 Schedule Today u Modifications, Schemas, Views. u Read Sections (except and 6.6.6) Next u Constraints. u Read.
CS240A: Databases and Knowledge Bases Recursive Queries in SQL 1999 Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size.
CS 338The Relational Model2-1 The Relational Model Lecture Topics Overview of SQL Underlying relational model Relational database structure SQL DDL and.
CS240A: Databases and Knowledge Bases Time Ontology and Representations Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
P-1 The Real Number System. Real Numbers— Irrational Numbers— the real number that can not be written as the ratio of two integers. Rational Numbers—
SPATIO-TEMPORAL DATABASES Temporal Databases. Temporal Data. Modeling Temporal Data Temporal Semantics Temporal density: the time is seen as being: 
CS240A: Databases and Knowledge Bases Temporal Databases Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
CS 240A: Databases and Knowledge Bases Analysis of Active Databases Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Temporal Data Modeling
Where does time go ?. Applications abound Temporal database systems provide built-in support for recording and querying time-varying information Application.
Spatiotemporal GIS Standard GIS: Spatial Characteristics only Implicit time is usually “now” Spatiotemporal GIS: Adds concept of time What happened when.
CS240A: Databases and Knowledge Bases Recursive Queries in SQL 2003 Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
CS240A: Databases and Knowledge Bases TSQL2 Carlo Zaniolo Department of Computer Science University of California, Los Angeles Notes From Chapter 6 of.
1 The T4SQL Temporal Query Language Presented by 黃泰豐 2007/12/26.
IBM Research: Software Technology © 2005 IBM Corporation Programming Technologies 1 Temporal Rules Vijay Saraswat IBM TJ Watson July 27, 2012.
CPT-S Advanced Databases 11 Yinghui Wu EME 49.
Data Types COMP3211 Advanced Databases Dr Nicholas Gibbins
SPECIAL PURPOSE DATABASES 13/09/ Temporal Database Concepts  Time is considered ordered sequence of points in some granularity Use the term choronon.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Data Types COMP3017 Advanced Databases Dr Nicholas Gibbins
COMP3211 Advanced Databases
Temporal Databases.
Defining a Database Schema
Temporal Databases.
CS240A: Databases and Knowledge Bases TSQL2
CS240A: Databases and Knowledge Bases A Taxonomy of Temporal DBs
Presentation transcript:

CS240A: Databases and Knowledge Bases Time Ontology and Representations Carlo Zaniolo Department of Computer Science University of California, Los Angeles Notes From Chapter 5 of Advanced Database Systems by Zaniolo, Ceri, Faloutsos, Snodgrass, Subrahmanian and Zicari. Morgan Kaufmann, 1997

Time Properties  Structure  Boundedness  Density  Time Data Types  Time and Facts

Time Structure  Linear Time  Branching Time  Directed Acyclic Graph  Periodic/Cyclic Time Sunday. E.g., days of the week.  Boundedness of Time From now on, we will assume a linear time structure.  Boundedness  Unbounded  Time origin exists (bounded from the left)  Bounded time (bounds on both ends)

Time Density  Discrete:  Time line is isomorphic to the integers  Timeline composed of a sequence of non­decomposable time periods of some fixed, minimal duration, termed chronons.  Between each pair of chronons is a finite number of other chronons.  Dense: (difficult to implement)  Time line is isomorphic to the rational numbers.  Between any two chronons is an infinite number of other instants.  Continuous: (very difficult to implement)  Time line is isomorphic to the real numbers.  Between each pair of instants is a infinite number of other instants.  A bounded discrete representation of time is the simplest option used in SQL-2 and most temporal DBs.

Time Datatype in SQL-2  DATE : four digits for the year and two for month and day. Multiple formats allowed:  E.g., or 12/08/2001 or  ISO, USA, EUR, JIS representations supported---DBA selects which one is used in specific system.  Internal representation is the same, independent of external ones. Basically an 8-byte string  TIME : 2 digits for hour, 2 for minutes, and 2 for seconds, plus optional fractional digits (system dependent). E.g., 13:50:00, 13:50, 1:50 PM denote the same time.

Internal Representation (DB2)  A date is a three-part value (year, month, and day). The range of the year part is 0001 to The range of the month part is 1 to 12. The range of the day part is 1 to x, where x depends on the month.  The internal representation of a date is a string of 4 bytes. Each byte consists of 2 packed decimal digits. The first 2 bytes represent the year, the third byte the month, and the last byte the day.  The length of a DATE column, as described in the SQLDA, is 10 bytes, which is the appropriate length for a character string representation of the value.  A time is a three-part value (hour, minute, and second) designating a time of day under a 24-hour clock. The range of the hour part is 0 to 24; while the range of the other parts is 0 to 59 (?) If the hour is 24, the minute and second specifications will be zero.  The internal representation of a time is a string of 3 bytes. Each byte is 2 packed decimal digits. The first byte represents the hour, the second byte the minute, and the last byte the second.  The length of a TIME column, as described in the SQLDA, is 8 bytes, which is the appropriate length for a character string representation of the value.

Internal Representation (cont.) Timestamp*  A timestamp is a seven-part value (year, month, day, hour, minute, second, and microsecond) that designates a date and time as defined above, except that the time includes a fractional specification of microseconds.  The internal representation of a timestamp is a string of 10 bytes, each of which consists of 2 packed decimal digits. The first 4 bytes represent the date, the next 3 bytes the time, and the last 3 bytes the microseconds.  The length of a TIMESTAMP column, as described in the SQLDA, is 26 bytes, which is the appropriate length for the character string representation of the value. ____________________________________ * See time representation peculiarities for commercial RDBMS in :

Time Datatype in SQL-2  TIMESTAMP : date+time with six fractional digits for the second field. E.g.,  TIME(STAMP) WITH ZONE: offset according to UTC (universel temps coordonné)  INTERVAL: I.e. a time span. In DB2 is called a labeled duration. E.g., 10 DAYS  Time expressions. Using the labeled duration in arithmetic : orderdate + 10 DAYS < CURRENT DATE --- this is valid, but CURRENT DATE - orderdate > 10 DAYS --- this is not valid.  CAST expressions: E.g. CAST(2 DAYS AS HOURS) returns 48 HOURS

Various Temporal Types used in temporal DBs  A time instant is a time point on the time line.  An event is an instantaneous fact, i.e, something occurring at an instant. The event occurrence time of an event is the instant at which the event occurs in the real world.  An instant set is a set of instants.  A time period is the set of time instants between two instants (start time and end time).  In TSQL2, the basic temporal element is a finite union of periods.

Periods versus Time Intervals  Periods are frequently called (time) intervals.  but this conflicts with the SQL3 data type INTERVAL and we will try to avoid it.  In SQL:1999, a time interval is a directed duration of time. A duration is an amount of time with a known length, but no specific starting or ending instants.Also called a span.  A positive interval denotes forward motion of time; a negative interval denotes backwards motion of time.

Valid Time and Transaction Time  Valid Time of a fact: when the fact is true in the modeled reality  Transaction Time of a fact: when it was recorded in the database.  Thus we have four different kinds of tables: 1. Snapshot 2. Valid-time 3. Transaction-time 4. Bitemporal

Example: Tom's Employment History  On January 1, 1984, Tom joined the faculty as an Instructor.  On December 1, 1984, Tom completed his doctorate, and so was promoted to Assistant Professor effective retroactively on July 1,  On March 1, 1989, Tom was promoted to Associate Professor, effective July 1, 1989 (proactive update).

Queries and Updates  A transaction time table is append only it keeps the history of the updates made on the database.  Transaction time tables supports rollback queries, such as:  On October 1, what rank was our database showing for Tom?  A valid time table can be updated: e.g., Tom’s past record is changed once his rank is changed retroactively.  Valid time tables support historical queries, such as:  What was Tom’s rank on October 1 (according to our current database)?

Bitemporal Tables  Bitemporal Tables are append­only and supports queries of both kinds (rollback&historical) such as:  On October 1, 1984, what did we think Tom's rank was at that date?  TSQL3: SELECT Rank FROM Faculty AS F WHERE Name = 'Tom‘ AND VALID(F) OVERLAPS DATE '1984­10­01‘ AND TRANSACTION(F) OVERLAPS DATE '1984­10­01'