Extending POSTGRES with ADT's
Description
Consider a database application wherein we want to maintain a
historical events database (e.g. the database may contain facts such
as, ``J.F. Kennedy was president from 1961 to 1963,'' ``WWI took place
from 1914 to 1918," etc). In addition, we want to maintain a person
database. For each person we want to keep track of the life-span of
that person, along with the person's name, place of birth and place of
death (e.g. the database may contain the following fact "J.F. Kennedy
lived from 1917 to 1963, his was born in Brookline, Mass, and he died
in Dallas, Texas.").
We subsequently like to solve problems such as:
- Which persons where alive during J.F.K's presidency?
- Which persons died during J.F.K's presidency?
- What historical events took place during the time-span 1990-1970?
- What historical events where ongoing when J.F.K. was alive?
To solve these problems it is useful to have an ADT time-interval.
Formally, we assume that we have the ordered domain of the reals. A
time interval T is represented by a pair of reals (m,n) such that m <=
n. We will use the following notation: T- denotes the lesser interval
point of T (i.e, the point m), and T+ denotes the higher interval
point of T (i.e., the point n). The semantics of a time interval T
can be thought of as all the real points between T- and T+.
We also have the following methods associated with the ADT Time-Interval (TI
for short).
- Before: TI X TI -> Boolean
Semantics: Before(T,S) iff T+ < S-
After: TI X TI -> Boolean
Semantics: Inverse of Before
-
Equal: TI X TI -> Boolean
Semantics: Equal(T,S) iff (T- = S-) and (T+ = S+)
-
Meets: TI X TI -> Boolean
Semantics: Meets(T,S) iff T+ = S-
-
During: TI X TI -> Boolean
Semantics: During(T,S) iff ((T- > S-) and (T+ <= S+)) or
((T- >= S-) and (T+ < S+))
-
Overlaps: TI X TI -> Boolean
Semantics: Overlap(T,S) iff (T- < S-) and (T+ > S-) and (T+ < S+)
-
Starts: TI X TI -> Boolean
Semantics: Starts(T,S) iff (T- = S-) and (T+ <= S+)
-
Finishes: TI X TI -> Boolean
Semantics: Finishes(T,S) iff (T- <= S-) and (T+ = S+)
(For further information about TI consult the article ``Maintaining
Knowledge about Temporal Intervals'' by James F. Allen,
_Communications of the ACM_, November 1983.
Tasks
- Extend POSTGRES with the ADT Time Interval.
- Create and populate a relation containing historical events
and a relation containing person data.
- Formulate ten queries like the ones suggested at the beginning
of the assignment that make use of all the methods associated with the
ADT Time Interval. Write POSTGRES expressions that solves your queries.