Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Assignment  Part 2

Advanced Databases and Applications (CP5520)

Study Period 52, 2022

3. Transaction Processing

Consider schedules S1 and S2  below.

S1 : r2 (X), r2 (Z), r3 (Y), w2 (X), w2 (Z), w3 (Y), r1 (Z), r3 (X), w3 (X), r1 (X), r3 (Z), w1 (X), w3 (Z), w1 (Z)

S2 : r1 (X), r1 (Z), r2 (Y), w2 (Y), w1 (X), r3 (Y), w1 (Z), r2 (X), r3 (X), r2 (Z), w2 (Z), r3 (Z), w3 (Y), w3 (Z)

(a) Apply the basic timestamp ordering (BTO) algorithm to schedules S1  and S2 . Determine whether or not the algorithmallows the execution of the schedules, and discuss cascading rollback (if any).

Hints: each operation takes one-time unit, and timestamp of each transaction is the time associated to its first operation.

For example, timestamps of transactions T1, T2, and T3  in schedule S1 are 7, 1, and 3 (respectively).                     [20 marks]

(b) Testing the serializability of S1 and S2  by serialization graph technique to prove that the successful execution of a

schedule under BTO will ensure the serializability of the schedule.                                                                               [15 marks]

(c) Examine the recoverable characteristic of S1  and S2 and check if the schedules are cascadeless and/or strict                  schedules. Write an equivalent strict schedule if they are cascadeless and not a strict schedule. We assume that a              transaction will be committed or aborted right after its last operation.                                                                        [15 marks]

4. Deductive Database

Consider a deductive database with the following rules:

ANCESTOR(X, Y)  :- PARENT(X, Y)

ANCESTOR(X, Y)  :- PARENT(X, Z), ANCESTOR(Z, Y)

Notice that PARENT(X, Y) means that X, Y are human-beings and Y is the (biological) parent of X; ANCESTOR(X, Y) means that Y is the ancestor of X.

Consider the following fact base:

PARENT(john, steve), PARENT(john, olivia), PARENT(olivia, emma), PARENT(olivia, william).

(a) Construct either a model theoretic interpretation or a proof theoretic interpretation of the above rules using the given facts.

[10 marks]

Consider that a database contains the following relations PARENT(X, Y), and a relation BIRTH(X, B), where B is the birth date of a person X.

The following information is used for question (b), (c) and (d).

Assume that we have the following family tree:

 

emma                 william


martin

jenny

sophia


olivia

john

david     michael    dorothy

christopher

PARENT(olivia, william).

PARENT(olivia, emma).

PARENT (tony, martin).

PARENT (tony,olivia).

PARENT (john, olivia).

PARENT (john, steve).

PARENT (jenny, tony).

PARENT (david, tony).

PARENT (michael, john).

PARENT (dorothy, john).

PARENT (sophia, jenny).

PARENT (christopher, michael).

(b) State a new rule named as SIBLING(X, Y) and construct a proof theoretic interpretation of this rule to find all siblings. [10 marks]

(c) State a new rule named as DESCENDANT(X, Y) and construct a proof theoretic interpretation of this rule to find all      descendants of Martin. Note DESCENDANT(X, Y) means Y is a descendant of X.                                                         [10 marks]

(d)

Given the following rules:

FIRST_COUSIN(X, Y) :- PARENT(X, Z), PARENT(Y, T), SIBLING(Z, T)

COUSIN(X, Y) :- FIRST_COUSINS(X, Y)

COUSIN(X, Y) :- PARENT(X, Z), PARENT(Y, T), COUSIN(Z, T)

Note: Two people are first cousins if their parents are siblings. Cousins means any kind of cousins. Cousins can be            second cousins who are the children of the two first cousins or third cousins who are the children of two second cousins etc.

1.    Prove that FIRST_COUSIN(jenny, michael) is true.            [10 marks]

2.    Prove that COUSIN(sophia, christopher) is true.                [10 marks]