Class O3.S9 (Other, Element, Computed)


=centercr @ []Query Q 4.9.1: Find Ed's salary history when he had a driving skill
Answer: ``($20K, 2/1/82 – 5/1/82),'' ``($30K, 6/1/84 – 1/31/85)'' and ``($40K, 2/1/85 – 1/31/87 ∪ 4/1/87 – 12/31/87)''
Category: (Projected, Not Empty) / (Containment, Element, Computed) / (=, Constant)

Ed has been qualified for driving from 2/1/82 to 5/1/82 and from 6/1/84 to 12/31/87 (after that, Edward nor Ed had). In those periods, he earned $20K from 2/1/82 to 5/1/82, $30K from 6/1/84 to 1/31/85 and $40K from 2/1/85 to 1/31/87 and from 4/1/87 to 12/31/87.

A non-temporal ``(=, Constant)'' is used to select Ed's data in relation emp. Ed's salary data are retrieved if their valid-times are contained in an element-valued period computed from stored facts, according to ``(Containment, Element, Computed)''. Such period is computed by means of other ``(=, Constant)'' predicates which select data with Name="Ed" and Skill="driving" in relation skills.


=centercr @ []Query Q 4.9.2: Find the salary history, during the periods in which ED had a driving skill, of the employees who earned less than $50K in 1989
Answer: ``(—, 1/1/82 – 1/31/82),'' ``($20K, 2/1/82 – 5/1/82),'' ``($30K, 6/1/84 – 1/31/85),'' ``($40K, 2/1/85 – 1/31/87),'' ``(—, 1/31/87 – 3/30/87)'' and ``($40K, 4/1/87 – 5/31/88).''
Category: (Projected, Not Empty) / (Containment, Element, Computed) (Containment, Interval, Explicit) / (=, Constant) (< >, Constant)

ED was qualified for driving from 1/1/82 to 5/1/82 and from 6/1/84 to 5/31/88. The only employee who earned less than $50K in 1989 is ED again. While he had the driving skill, his salary was $20K from 2/1/82 to 5/1/82, $30K from 6/1/84 to 1/31/85, $40K from 2/1/85 to 1/31/87 and from 4/1/87 to 5/31/88 (unknown from 1/1/82 to 1/31/82 and from 1/31/87 to 3/30/87).

Two valid-time selection predicates are present in the query. One — ``(Containment, Interval, Explicit)'' — is used to select the objects of interest, whereas the other — ``(Containment, Element, Computed)'' — is used to select a portion of their data history. Objects qualify if the salary is less that $50K (cf. ``(< >, Constant)'') in their employee data selected by the temporal predicate ``(Containment, Element, Computed),'' extracting the versions with valid-times overlapped by the user-supplied interval ``1/1/89 – 12/31/89''. The other non-temporal predicate is used to evaluate the element-valued period in which ED had the driving skill (cf. ``(=, Constant)'' testing for skills.Name equal to ``Ed'' or ``Edward''). Such period is used as argument by the temporal predicate used for categorization.


=centercr @ []Query Q 4.9.3: Find the name and salary history of the male employees in the periods they were directed by a woman
Answer: ``($20K, 2/1/82 – 5/31/82),'' and ``($30K, 6/1/82 – 1/31/85).''
Category: (Projected, Not Empty) / (Containment, Element, Computed) / (=, Constant) (=, Foreign)

The only employee qualifying for the query is Ed, since he had been directed by Di when he worked in the Toy department from 2/1/82 to 1/31/87. His salary history in that period is: $20K from 2/1/82 to 5/31/82, $30K from 6/1/82 to 1/31/85 and $40K from 2/1/85 to 1/31/87.

The objects of interest for this query are the male employee which can be identified by a ``(=, Constant)'' predicate in the relation emp. The query is categorized as ``(Containment, Element, Computed),'' since it selects the data of the selectd objects having their valid-times contained in an element-valued argument computed from other stored facts. In order to find out such an element, two temporal joins must be effected: one between the relations emp and dept, to find out the department data of the selected employee, and the other between the relations dept and emp again, to find out the department manager data. The two joins can be categorized as ``(=, Foreign)'' and ``(Containment, Element, Computed)'', because the join attribute equality and the overlap of the valid-times must be ensured. The intersection of the valid-times of the histories joined, with the final local restriction emp.Gender=F on the manager data, gives the desired temporal element.


=centercr @ []Query Q 4.9.4: Find the department name, the manager name and the periods, for which a department manager earned more than one third of the department budget
Answer: ``(Toy, Di, 1/1/87 – now).''
Category: (Projected, Not Empty) / (Containment, Element, Computed) / (< >, Arbitrary)

The only stored information about department managers is that Di has directed the Toy department from 1/1/82. She earned more than one third of the department budget from 1/1/87 to the present (cf. $50K > $100K/3).

For each department, the requested data are retrieved by means of a temporal join between relations dept and emp. The categorizations of the temporal join conditions are the following: ``(=, Foreign)'' for the equality emp.Name=dept.Manager, ``(Containment, Element, Computed)'' for the overlap of the salary valid-times with the valid-times he/she was manager, ``(< >, Arbitrary)'' for the further comparison between department budget and manager salary.


=centercr @ []Query Q 4.9.5: Find the name and the salary history of the employees in the periods they earned as much as their managers
Answer: ``(Ed, $30K, 6/1/83 – 7/31/84)'' and ``(Ed, $40K, 2/1/86 – 8/31/86).''
Category: (Projected, Not Empty) / (Containment, Element, Computed) (Containment, Interval, Computed) / (=, Foreign) (=, Single) (< >, Single)

The only relationship directed-director between employees which can be retrieved from the data is Ed-Di, which held from 2/1/82 to 1/31/87 at the Toy department. Ed earned as much as Di from 6/1/83 to 7/31/84 ($30K) and from 2/1/86 to 8/31/86 ($40K).

The query retrieves salary histories of the employees who earned as much as the employee who was the manager of the department they worked in. Such employees, and the periods of interest, can be selected via a cyclic temporal join between emp and dept. As a matter of fact, ``(=, Foreign)'' non-temporal predicates allow us to express the join conditions dept.Department=emp.Dept and emp.Name=dept.Manager as in Query Q 4.9.3, a ``(=, Single)'' non-temporal predicate allows us to express the furter join condition on salary equality between employee and manager, whereas ``(Containment, Element, Computed)'' temporal selection predicates allow us to join data versions synchronized along valid-time. An additional ``(< >, Single)'' condition is assumed in the last join to ensure selected employees do not have the same name as their managers.


=centercr @ []Query Q 4.9.6: When did one person earn a lower salary than another younger person, and who were those persons?
Answer: ``Ed and Di, 02/01/82–05/31/82, 08/01/84–01/31/85, 09/01/86–01/31/87, 04/01/87–12/31/ 87'', ``Edward and Di, 01/01/88–01/01/90''
Category: (Projected, Element, Derived) / (Containment, Element, Computed) /


=centercr @ []Query Q 4.9.7: When and who had the same salary for the longest time?
Answer: ``09/01/86–01/01/90, Di''
Category: (Projected, Element, Derived) / (Containment, Element, Computed) /


=centercr @ []Query Q 4.9.8: List Di's skills and salary histories during the time she was a manager.
Answer: ``(Directing, 01/01/82–01/01/90)'' and ``(30K, 01/01/82–07/31/84), (40K, 08/01/84–08/31/86), (50K, 09/01/86–01/01/90)''
Category: (Projected, Element, Derived) / (Containment, Element, Computed) / (=, Constant)


=centercr @ []Query Q 4.9.9: List the names and salary histories of all managers when they earned at least 36K.
Answer: ``Di, ((08/01/84–08/31/86, 40K), (09/01/ 86–01/01/90, 50K))''
Category: (Projected, Element, Derived) / (Containment, Element, Computed) / (< >, Constant)