Class O2.S7 (Other, Interval, Computed)


=centercr @ []Query Q 3.7.1: Find when the Toy budget decreased
Answer: ``1/1/87.''
Category: (None, Not Empty) / (Ordering, Interval, Computed) / (=, Constant) (< >, Single)

The budget of the Toy department decreased on 1/1/87.

The required date is extracted when two consecutive periods are found (i.e. selected via the predicate ``(Ordering, Interval, Computed)'') in the first of which the budget of the Toy department was higher than in the second one (as tested by ``(< >, Single)''). The category ``(=, Constant)'' indicates that Toy data are selected in relation dept via a non-temporal predicate testing the equality of the key with a constant. The required date is extracted as the beginning of the valid-time of the second period.


=centercr @ []Query Q 3.7.2: Find when the name of an employee was presumably changed
Answer: ``1/1/88.''
Category: (None, Not Empty) / (Ordering, Interval, Computed) / (=, Single) (< >, Single)

Only ED's name changed from Ed to Edward on 1/1/88.

We can guess that employees with different names but with the same gender and date of birth are the same person (also the salary and the department before and after the name change can be tested for equality, but their values could have been changed together with the name). The retrieved event is the validity beginning of the second of two consecutive employee versions. Such versions are detected by means of the following conditions: their valid-time intervals meet (cf. ``(Ordering, Interval, Computed)''), their time-invariant attributes but the name are equal (cf. ``(=, Single)'' used twice), their names are different (cf. ``(< >, Single)'').


=centercr @ []Query Q 3.7.3: Find when the salary of a manager increased
Answer: ``8/1/84'' and ``9/1/86.''
Category: (None, Not Empty) / (Ordering, Interval, Computed) (Containment, Element, Computed) / (=, Foreign) (=, Const) (< >, Single)

The only manager in our data is Di. Di's salary was increased on 8/1/84 and on 9/1/86.

First, all the manager names (together with the valid-times they were manager) are retrieved from the relation dept by means of a simple projection. Then, the data of each manager are selected in the relation emp by means of a non-temporal predicate in the class ``(=, Foreign)'' and a valid-time predicate in the class ``(Containment, Element, Computed)''. In order to find the desired events, two consecutive versions of the data of a manager with increasing salary must be detected. The desired dates are extracted as the begin of the valid-time interval of the second version. A version of the manager data is selected via the ``(=, Foreign)'' predicate as a candidate to be the first desired version. The second version is selected in relation emp if its valid-time interval is met by the valid-time interval of the first version (temporal selection in category ``(Ordering, Interval, Computed)''), has the same Name and has a greater Salary than the first version (non-temporal selection with categories ``(=, Constant)'' and ``(< >, Single)''). Notice that, if the name equality for the second version is tested with the names retrieved from dept rather than with the name in the first selected version, two predicates of the class ``(=, Foreign)'' are used and ``(=, Constant)'' is no longer present in the categorization.


=centercr @ []Query Q 3.7.4: Find the periods in which Di earned $40K while she was manager of the Toy department
Answer: ``8/1/84 – 8/31/86.''
Category: (None, Not Empty) / (Containment, Interval, Computed) / (=, Constant)

DI has been manager of the Toy department since 1982. In this period, she earned $40K from 8/1/84 to 8/31/86.

The query selects the valid-time intervals — of the employee data with name ``Di'' and salary $40K, according to ``(=, Constant)'' non-temporal selection — completely contained in another interval computed from other data, according to a ``(Containment, Interval, Computed)'' predicate. Such an interval is the valid time she was manager of the Toy department and is selected from the relation dept via a non-temporal predicate in the category ``(=, Const)'' concerning the Manager attribute value.


=centercr @ []Query Q 3.7.5: Find the acquisition dates of the skills Ed had during the year he joined the Toy department
Answer: ``1/1/82'' and ``4/1/82.''
Category: (None, Not Empty) / (Containment, Interval, Computed) / (=, Constant)

Ed joined the Toy department on 2/1/82. During 1982, he acquired a driving skill on the 1st of January, and a typing skill on the 1st of April.

The year 1982 is computed from the beginning of the temporal element Ed worked in the Toy department, which is selected by means of non-temporal predicates in the category ``(=, Constant).'' Hence, the Ed's skills (selected by another ``(=, Constant)'' predicate) whose valid-times overlap the computed year are retrieved according to a ``(Containment, Interval, Computed)'' temporal selection predicate.