Class O3.S10 (Other, Element, Other)


=centercr @ []Query Q 4.10.1: Find the budget history in the period from 1/1/82 to 12/31/84 and from 1/1/87 till now of the department Ed ever worked in
Answer: ``(Toy, $150K, 2/1/82 – 7/31/84),'' ``(Toy, $200K, 8/1/84 – 12/31/84),'' ``(Toy, $100K, 1/1/87 – now),'' ``(Book, — , 1/1/82 – 12/31/84)'' and ``(Book, —, 1/1/87 – now).''
Category: (Projected, Not Empty) / (Containment, Element, Explicit) / (=, Foreign) (=, Constant)

Ed worked in the Toy and in the Book department. The budget history of the Toy department in the required period is: $150K from 2/1/82 to 7/31/84, $200K from 8/1/84 to 12/31/84 and $100K from 1/1/87 till now. The budget history of the Book department in the same period is not available from the stored data (we assume ``nulls'' to be retrieved).

The departments in which Ed ever worked can be found by means of a ``(=, Constant)'' predicate on the employee data. The collected values are then used to select budget histories in the relation dept via a ``(=, Foreign)'' predicate. Eventually, portions of such histories are selected by means of a valid-time predicate categorized as ``(Containment, Element, Explicit)'' since it exctracts data with valid-times contained in the user-supplied temporal element ``1/1/82 – 12/31/84 ∪ 1/1/87 — now.''


=centercr @ []Query Q 4.10.2: Find the name and the budget history in 1984 and 1987 of the department being directed by Di
Answer: ``(Toy, $150K, 1/1/84 – 7/31/84),'' ``(Toy, $200K, 8/1/84 – 12/31/84)'' and ``(Toy, $100K, 1/1/87 – 12/31/87).''
Category: (Projected, Not Empty) / (Containment, Element, Explicit) / (=, Constant)

In the periods from 1/1/84 to 12/31/84 and from 1/1/87 to 12/31/87, Di always directed the Toy department. The Toy budget was $150K from 1/1/84 to 7/31/84, $200K from 8/1/84 to 12/31/84 and $100K from 1/1/87 to 12/31/87.

The query is categorized as ``(Containment, Element, Explicit)'' since it selects data contained in an element-valued time constant supplied by the user (1/1/84 – 12/31/84 ∪ 1/1/87 – 12/31/87). ``(=, Constant)'' indicates the non-temporal selection of the department data where the manager is Di.


=centercr @ []Query Q 4.10.3: Find the names of the department where Ed was working at the beginning of the years 1986 and 1987, and the periods Ed worked there.
Answer: ``(Toy, 2/1/82 – 1/31/87).''
Category: (Projected, Not Empty) / (Containment, Element, Explicit) / (=, Constant)

On 1/1/86 and 1/1/87 Ed was working at the Toy department. He has been working in that department from 2/1/82 to 1/31/87.

The query can be answered in two steps. First, department names are selected if stored as data concerning Ed by means of a ``(=, Constant)'' predicate testing for the employee name. Second, the department names are retrieved together with their valid times if these contain the explicit element ``1/1/86 ∪ 1/1/87'', by using a ``(Containment, Element, Explicit)'' valid-time selection predicate.


=centercr @ []Query Q 4.10.4: Find the name of the manager Ed had on 1984's Christmas and on his 27th birthday, and the dates he/she began to be manager of their department,
Answer: ``(Di, 1/1/82).''
Category: (Projected, Not Empty) / (Containment, Element, User-defined) / (=, Constant) (=, Single) (=, Foreign)

Ed's 27th birthday was 7/1/82. On 7/1/82 and on 12/25/1984, he worked in the Toy department, directed by Di. Di started to direct this department on 1/1/82.

The query contains a ``(Containment, Element, User-defined)'' valid-time predicate selecting data whose valid-times contain an element-value argument computed from a user-defined time attribute. As a matter of fact, the element ``7/1/82 ∪ 12/25/1984'' is computed by means of a date explicitly supplied in the query and from the Ed's date of birth, selected via a ``(=, Constant)'' predicate in relation employee. The first argument used by the valid-time selection predicate is the element-valued period in which Ed worked in a department. This period can be evaluated from Ed's data by means of a non-temporal selection predicate ``(=, Single)'', which tests employee data for a department name, once the department names have been selected. Finally, if a department name qualifies, it is used — via a ``(=, Foreign)'' predicate and together with the valid-time selection predicate — to select the manager data (name and valid-time) in relation dept.


=centercr @ []Query Q 4.10.5: Find the department name, the then manager, the modification dates and the new values of the budget for every budget change occurred in 1984, 1986 and 1988.
Answer: ``(Toy, Di, $200K, 8/1/84).''
Category: (Complete, Not Empty) / (Containment, Element, Explicit) (Ordering, Interval, Computed) / (=, Single) (< >, Single)

No data are available about the Book department budget. The Toy department budget changed on 8/1/84 and 1/1/87. Only the first date qualifies for the query. The manager at this time was Di and the new budget value was $200K.

The query is classified as ``(Containment, Element, Explicit)'' because it uses a valid-time predicate to select data whose valid-times are contained in an element-valued argument supplied in the query (i.e. ``1/1/84 – 12/31/84 ∪ 1/1/86 – 12/31/86 ∪ 1/1/88 – 12/31/88''). Candidate data are snaphots of the department data taken on budget changes. Budget changes are detected by means of the comparison of two consecutive department data versions. The first one can be freely selected, whereas the second one is the version of the same department (equality of the key ensured by means of a ``(=, Single)'' predicate) that follows the first one (as ensured by a temporal ``(Ordering, Interval, Computed)'' predicate). The two versions qualify — and the validity beginning of the second one is selected as a candidate date — if their budget values differ, according to a ``(< >, Single)'' predicate.