辅导program、辅导python,java程序
2022-09-18
3. Transaction ProcessingConsider 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 thealgorithm allows 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 aschedule 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 strictschedules. Write an equivalent strict schedule if they are cascadeless and not a strict schedule. We assume that atransaction will be committed or aborted right after its last operation. [15 marks]4. Deductive DatabaseConsider 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) meansthat 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 thegiven facts. [10 marks]Consider that a database contains the following relations PARENT(X, Y), and a relation BIRTH(X, B), where B is the birthdate of a person X.The following information is used for question (b), (c) and (d).Assume that we have the following family tree:emma williammartin olivia stevetony johnjenny david michael dorothysophia christopherPARENT(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 alldescendants 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 besecond cousins who are the children of the two first cousins or third cousins who are the children of two second cousinsetc.1. Prove that FIRST_COUSIN(jenny, michael) is true. [10 marks]2.Prove that COUSIN(sophia, christopher) is true. [10 marks]