CP5520 - Advanced Databases and Applications Assignment, James Cook University, Australia
GET READYMADE CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT SOLUTIONS - 100% PLAGIARISM FREE WORK DOCUMENT AT NOMINAL CHARGES!
1. 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 algorithm allows the execution of the schedules, and discuss cascading rollback (if any).
Answer -
Schedule 1 -
T1
|
T2
|
T3
|
|
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)
|
|
|
1) First of all, we will calculate the read and write time stamp of the data items X, Y, Z.
The time stamp of transactions T1, T2, T3 is 7, 1, 3 as the first operation of these transactions is issued on these timestamps.
To find Read time stamp of X, Y, Z
Read timestamp is the largest time stamp when a transaction successfully completes read operation.
R_TS(X)=7 as transaction T1 successfully completed read operation on it.
R_TS(Y)=3 as transaction T3 successfully completed read operation on it.
R_TS(Z)=7 as transaction T1 successfully completed read operation on it.
Write timestamp is the largest time stamp when a transaction successfully completes read operation.
W_TS(X)=7 as transaction T1 successfully completed write operation on it.
W_TS(Y)=3 as transaction T3 successfully completed write operation on it.
W_TS(Z)=7 as transaction T1 successfully completed write operation on it.
MOST RELIABLE AND TRUSTWORTHY CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT HELP & HOMEWORK WRITING SERVICES AT YOUR DOORSTEPS!
2) Now, we will apply basic time stamp ordering protocol which says
if TS_(T) issues W_TS(A) then, it checks 2 conditions
i) If R_TS(A)>TS(T) or W_TS(A)>TS(T) then, abort and rollback T and reject write operation
ii) Otherwise, execute Write operation and update W_TS(A)=TS(T)
if TS_(T) issues R_TS(A) then, it checks 2 conditions
iii) If W_TS(A)>TS(T) then, abort and rollback T and reject write operation
iv) Otherwise, execute read operation and update R_TS(A)=Max(TS(T),current R_TS(A)).
a) Now, in this schedule transaction T2 issues read operation on data item X
W_TS(X)=7, TS(T2)=1 . Since, W_TS(X)> TS(T2) so, this read operation is aborted.
b) Now, transaction T2 issues read operation on data item Z
W_TS(Z)=7, TS(T2)=1 . Since, W_TS(X)> TS(T2) so, this read operation is aborted.
c) Now, transaction T3 issues read operation on data item Y
W_TS(Y)=3, TS(T3)=3 . Since, W_TS(X)=TS(T3) so, this read operation is executed.
R_TS(Y)=3
d) Now, transaction T2 issues write operation on data item X
W_TS(X)=7, TS(T2)=1 and. R_TS(X)=7, TS(T2)=1 Since, W_TS(X)>TS(T2) and also R_TS(X)>TS(T2) so, this write operation is aborted
e) Now, transaction T2 issues write operation on data item Z
W_TS(Z)=7, TS(T2)=1 and. R_TS(Z)=7, TS(T2)=1 Since, W_TS(Z)>TS(T2) and also R_TS(Z)>TS(T2) so, this write operation is aborted
f) Now, transaction T3 issues write operation on data item Y
W_TS(Y)=3, TS(T3)=1 and. R_TS(X)=3, TS(T3)=1 Since, W_TS(Y)>TS(T3) and also R_TS(Y)>TS(T3) so, this write operation is aborted
g) T1 issues read operation on data item Z
W_TS(Z)=7, TS(T1)=7.. Since, W_TS(Z)=TS(T1) so, this read operation is executed and R_TS(Z)=7.
h) Now, transaction T3 issues read operation on data item X
W_TS(X)=7, TS(T3)=3 . Since, W_TS(X)>TS(T3) so, this read operation is aborted.
i) Now, transaction T3 issues write operation on data item X
W_TS(X)=7, TS(T3)=3 and. R_TS(X)=7, TS(T3)=3 Since, W_TS(X)>TS(T3) and also R_TS(X)>TS(T3) so, this write operation is aborted
j) T1 issues read operation on data item X
W_TS(X)=7, TS(T1)=7.. Since, W_TS(X)=TS(T1) so, this read operation is executed and R_TS(X)=7.
k) T3 issues read operation on data item Z
W_TS(Z)=7, TS(T3)=3.. Since, W_TS(Z)>TS(T3) so, this read operation is aborted.
l) Now, transaction T1 issues write operation on data item X
W_TS(X)=7, TS(T1)=7 and. R_TS(X)=7, TS(T3)=7 Since, W_TS(X)=TS(T3) and also R_TS(X)=TS(T3) so, this write operation is executed and W_TS(X)=7
m) Now, transaction T3 issues write operation on data item Z
W_TS(Z)=7, TS(T3)=3 and. R_TS(Z)=7, TS(T3)=3 Since, W_TS(Z)>TS(T3) and also R_TS(Z)>TS(T3) so, this write operation is aborted
n) Now, transaction T1 issues write operation on data item Z
W_TS(Z)=7, TS(T1)=7 and. R_TS(Z)=7, TS(T3)=7 Since, W_TS(Z)=TS(T3) and also R_TS(Z)=TS(T3) so, this write operation is executed and W_TS(Z)=7
SAVE DISTINCTION MARKS IN EACH CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT WHICH IS WRITTEN BY OUR PROFESSIONAL WRITER!
Schedule 2 -
T1
|
T2
|
T3
|
r1(X)
|
|
|
r1(Z)
|
|
|
|
r2(Y)
|
|
|
w2(Y)
|
|
w1(X)
|
|
|
|
|
r3(Y)
|
w1(Z)
|
|
|
Commit
|
r2(X)
|
|
|
|
r3(X)
|
|
r2(Z)
|
|
|
w2(Z)
|
|
|
|
r3(Z)
|
|
|
w3(Y)
|
|
|
w3(Z)
|
1) First of all, we will calculate the read and write time stamp of the data items X, Y, Z.
The time stamp of transactions T1, T2, T3 is 1, 3, 7 as the first operation of these transactions is issued on these timestamps.
To find Read time stamp of X, Y, Z
Read timestamp is the largest time stamp when a transaction successfully completes read operation.
R_TS(X)=7 as transaction T3 successfully completed read operation on it.
R_TS(Y)=7 as transaction T3 successfully completed read operation on it.
R_TS(Z)=7 as transaction T3 successfully completed read operation on it.
Write timestamp is the largest time stamp when a transaction successfully completes read operation.
W_TS(X)=1 as transaction T1 successfully completed write operation on it.
W_TS(Y)=3 as transaction T2 successfully completed write operation on it.
W_TS(Z)=7 as transaction T3 successfully completed write operation on it.
2) Now, we will apply basic time stamp ordering protocol which says
if TS_(T) issues W_TS(A) then, it checks 2 conditions
i) If R_TS(A)>TS(T) or W_TS(A)>TS(T) then, abort and rollback T and reject write operation
ii) Otherwise, execute Write operation and update W_TS(A)=TS(T)
if TS_(T) issues R_TS(A) then, it checks 2 conditions
i) If W_TS(A)>TS(T) then, abort and rollback T and reject write operation
ii) Otherwise, execute read operation and update R_TS(A)=Max(TS(T),current R_TS(A)).
a) Now, in this schedule transaction T1 issues read operation on data item X
W_TS(X)=1, TS(T1)=1 . Since, W_TS(X)= TS(T1) so, this read operation is executed and R_TS(X)=7.
b) Now, transaction T1 issues read operation on data item Z
W_TS(Z)=7, TS(T1)=1 . Since, W_TS(X)> TS(T1) so, this read operation is aborted.
c) Now, transaction T2 issues read operation on data item Y
W_TS(Y)=3, TS(T3)=3 . Since, W_TS(X)=TS(T3) so, this read operation is executed.
R_TS(Y)=3
d) Now, transaction T2 issues write operation on data item Y
R_TS(Y)=7, TS(T2)=3 Since, R_TS(X)>TS(T2) so, this write operation is aborted.
e) Now, transaction T1 issues write operation on data item X
R_TS(X)=7, TS(T1)=1 Since, R_TS(X)>TS(T1) so, this write operation is aborted.
f) Now, transaction T3 issues read operation on data item Y
W_TS(Y)=3, TS(T3)=3 . Since, W_TS(X)=TS(T3) so, this read operation is executed.
R_TS(Y)=3
g) T1 issues write operation on data item Z
W_TS(Z)=7, TS(T1)=1 Since, W_TS(Z)>TS(T1) so, this write operation is aborted.
h) Now, transaction T2 issues read operation on data item X
W_TS(X)=1, TS(T2)=3 . Since, W_TS(X)<TS(T3) so, this read operation is executed and R_TS(X)=7.
i) Now, transaction T3 issues read operation on data item X
W_TS(X)=1, TS(T3)=7 Since, W_TS(X)<TS(T3) and so, this read operation is executed and R_TS(X)=7.
j) T2 issues read operation on data item Z
W_TS(Z)=7, TS(T2)=3.. Since, W_TS(Z)>TS(T3) so, this read operation is aborted.
k) Now, transaction T2 issues write operation on data item Z
W_TS(Z)=7, TS(T2)=7 and. R_TS(Z)=7, TS(T2)=7 Since, W_TS(X)=TS(T2) and also R_TS(X)=TS(T2) so, this write operation is executed and W_TS(Z)=7
l) Now, transaction T3 issues read operation on data item Z
W_TS(Z)=7, TS(T3)=7 Since, W_TS(Z)=TS(T3) so, this read operation is executed and R_TS(Z)=7
m) Now, transaction T3 issues write operation on data item Y
R_TS(Y)=&, TS(T3)=3 Since, R_TS(Y)>TS(T3) so, this write operation is aborted.
n) Now, transaction T3 issues write operation on data item Z
R_TS(Z)=7, TS(T3)=3 Since, R_TS(Z)>TS(T3) so, this write operation is aborted.
HIRE PROFESSIONAL WRITER FROM EXPERTSMINDS.COM AND GET BEST QUALITY CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT HELP AND HOMEWORK WRITING SERVICES!
(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.
Answer - Serialization Graph
There is no cycle in the graph. Hence, it is serializable.
(c) Examine the recoverable characteristic of S1 and S2. What schedule (S1 or S2) can be executed under the strict timestamp ordering (STO) algorithm and write an equivalent strict schedule for it? We assume that a transaction will be be committed or aborted right after its last operation.
Answer - Recoverable schedules
Schedule 1
T1
|
T2
|
T3
|
|
r2(X)
|
|
|
r2(Z)
|
|
|
|
r3(Y)
|
|
w2(X)
|
|
|
w2(Z)
|
|
|
Rollback
|
w3(Y)
|
r1(Z)
|
|
|
|
|
r3(X)
|
|
|
w3(X)
|
r1(X)
|
|
|
|
|
r3(Z)
|
w1(X)
|
|
|
|
|
w3(Z)
|
w1(Z)
|
|
Rollback
|
Rollback
|
|
|
Schedule 1 is recoverable with cascading rollback of all the transactions.
Schedule 2
T1
|
T2
|
T3
|
r1(X)
|
|
|
r1(Z)
|
|
|
|
r2(Y)
|
|
|
w2(Y)
|
|
w1(X)
|
|
|
|
|
r3(Y)
|
w1(Z)
|
|
|
Rollback
|
r2(X)
|
|
|
|
r3(X)
|
|
r2(Z)
|
|
|
w2(Z)
|
|
|
Rollback
|
r3(Z)
|
|
|
w3(Y)
|
|
|
w3(Z)
|
|
|
Rollback
|
The schedule is recoverable after rollback of all the transactions.
Both the schedules can not be executed under strict time stamp ordering protocol because many operations of the transactions need to be aborted.
Schedule 1
So, this schedule can not be executed under strict two phase locking protocol as transactions t1 and t3 will keep waiting. Even, if the T2 release the lock after commit then, shrinking phase the schedule will start and no new lock can be taken.
WE HELP STUDENTS TO IMPROVE THEIR GRADES! AVAIL TOP QUALITY CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT HELP AND HOMEWORK WRITING SERVICES AT CHEAPER RATE!
(d) Examine the two-phase locking (2PL) technique on S1 and S2 with an assumption of unlock operations being done as late as possible. Are BTO schedules also 2PL schedules?
Answer - Strict 2PL for Schedule 1
T1
|
T2
|
T3
|
|
Lock s(x)
|
|
|
r2(X)
|
|
|
Lock s(y)
|
|
|
r2(Z)
|
Lock s(Y)
|
|
Lock x(X)
|
r3(Y)
|
|
w2(X)
|
|
|
Lock x(Z)
|
|
|
w2(Z)
|
|
|
Unlock(x)
|
|
|
Unlock(Z)
|
|
|
Unlock(Y)
|
|
|
|
Lock x(Y)
|
|
|
w3(Y)
|
Lock S(Z)
|
|
|
r1(Z)
|
|
|
|
|
Lock S(X)
|
|
|
r3(X)
|
|
|
Lock x(X)
|
|
|
w3(X)
|
Wait
|
|
|
|
|
Lock s(Z)
|
|
|
r3(Z)
|
|
|
Lock x(Z)
|
|
|
w3(Z)
|
|
|
Unlock (X)
|
|
|
Unlock(Y)
|
Wait
|
|
Unlock(Z)
|
Lock s(X)
|
|
|
r1(X)
|
|
|
Lock x(X)
|
|
|
w1(X)
|
|
|
Lock x(Z)
|
|
|
w1(Z)
|
|
|
Unlock(X)
|
|
|
Unlock(Y)
|
|
|
Unlock(Z)
|
|
|
Strict 2PL for Schedule 2
T1
|
T2
|
T3
|
Lock s(X)
|
|
|
r1(X)
|
|
|
Lock s(Z)
|
|
|
r1(Z)
|
|
|
|
Lock s(Y)
|
|
|
r2(Y)
|
|
|
Lock x(Y)
|
|
|
w2(Y)
|
|
Lock x(X)
|
|
|
w1(X)
|
|
Wait
|
Lock x(Z)
|
|
wait
|
w1(Z)
|
Wait
|
Wait
|
Unlock (X)
|
Wait
|
Wait
|
Unlock (Y)
|
Wait
|
Wait
|
Unlock (Z)
|
Wait
|
Wait
|
|
Wait
|
wait
|
|
Lock s(X)
|
wait
|
|
r2(X)
|
Wait
|
|
Lock s(Z)
|
wait
|
|
r2(Z)
|
Wait
|
|
Lock x(Z)
|
wait
|
|
w2(Z)
|
Wait
|
|
Unlock (X)
|
wait
|
|
Unlock (Y)
|
wait
|
|
Unlock (Z)
|
wait
|
|
|
Lock s(Y)
|
|
|
r3(Y)
|
|
|
Lock s(X)
|
|
|
r3(X)
|
|
|
Lock s(Z)
|
|
|
r3(Z)
|
|
|
Lock x(Y)
|
|
|
w3(Y)
|
|
|
Lock x(Z)
|
|
|
w3(Z)
|
|
|
Unlock (X)
|
|
|
Unlock (Y)
|
|
|
Unlock (Z)
|
No, BTO are not 2PL
NEVER MISS YOUR CHANCE TO EXCEL IN CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT! AVAIL AFFORDABLE AND RELIABLE XXXX ASSIGNMENTS HELP SERVICES OF EXPERTSMINDS.COM!
2. Deductive Database
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 a model theoretic interpretation of the above rules using the given facts.
Answer -
Rules
ANCESTOR(X, Y) :- PARENT(X, Y)
ANCESTOR(X, Y) :- PARENT(X, Z), ANCESTOR(Z, Y)
Known Facts
PARENT(john, steve) is true.
PARENT(john, olivia) is true.
PARENT(olivia, emma) is true.
PARENT(olivia, william) is true.
Parent (X,Y) is false for all other combinations of X,Y
Deduced facts
Ancestor(john, steve) is true.
Ancestor(john, olivia) is true.
Ancestor(olivia, emma) is true.
Ancestor(olivia, william) is true.
Ancestor(john, emma) is true.
Ancestor(john, william) is true.
Ancestor (X,Y) is false for all other combinations of X,Y
(b) State a new rule named as SIBLING(X, Y) and construct a proof theoretic interpretation of this rule to find all siblings.
Answer -
Rule:-
SIBLING(X, Y):-Parent (X,Z),Parent (Y,Z)
if Z is parent of X and also Z is parent Y then, X,Y will be sibling.
Known facts
PARENT(olivia, william) is true.
PARENT(olivia, emma) is true.
PARENT (tony, martin) is true.
PARENT (tony,olivia) is true.
PARENT (john, olivia) is true.
PARENT (john, steve) is true.
PARENT (jenny, tony) is true.
PARENT (david, tony) is true.
PARENT (michael, john) is true.
PARENT (dorothy, john) is true.
PARENT (sophia, jenny) is true.
PARENT (christopher, michael) is true.
Parent (X,Y) is not true for any other combination of X,Y.
Deduced Facts
Sibling (tony, john) is true.
Sibling((jenny, david) is true.
Sibling(Michael,Dorothy) is true.
Sibling(X,Y) is not true for any other combination of X,Y.
NO PLAGIARISM POLICY - ORDER NEW CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT & GET WELL WRITTEN SOLUTIONS DOCUMENTS WITH FREE TURNTIN REPORT!
(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.
Answer -
DECENDENT(Z,X) :- PARENT(Z, Y)
DECENDANT(Z,X) :- PARENT(Z,Y), PARENT(Y,X)
DECENDANT(Z,X) states Z is decendant of X
Known facts
PARENT(olivia, william) is true.
PARENT(olivia, emma) is true.
PARENT (tony, martin) is true.
PARENT (tony,olivia) is true.
PARENT (john, olivia) is true.
PARENT (john, steve) is true.
PARENT (jenny, tony) is true.
PARENT (david, tony) is true.
PARENT (michael, john) is true.
PARENT (dorothy, john) is true.
PARENT (sophia, jenny) is true.
PARENT (christopher, michael) is true.
Deduced Facts
DECENADANT(William,Olivia) is true.
DECENADANT(emma,Olivia) is true.
DECENADANT(martin,tony) is true.
DECENADANT(Olivia,tony) is true.
DECENADANT(Olivia,john) is true.
DECENADANT(Steve,john) is true.
DECENADANT(tony,jenny) is true.
DECENADANT(tony,david) is true.
DECENADANT(john,michael) is true.
DECENADANT(john,dorothy) is true.
DECENADANT(jenny,sophia) is true.
DECENADANT(Michael,christopher) is true.
DECENADANT(emma,tony) is true.
DECENADANT(emma,john) is true.
DECENADANT(martin,jenny) is true.
DECENADANT(martin,david) is true.
DECENADANT(john,christopher) is true.
DECENDANT(X,Y) is not true for any other combination X,Y.
HELPING STUDENTS TO WRITE QUALITY CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT AT LOW COST!
(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.
2. Prove that COUSIN(sophia, christopher) is true.
Answer - 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)
Known facts
PARENT(olivia, william) is true.
PARENT(olivia, emma) is true.
PARENT (tony, martin) is true.
PARENT (tony,olivia) is true.
PARENT (john, olivia) is true.
PARENT (john, steve) is true.
PARENT (jenny, tony) is true.
PARENT (david, tony) is true.
PARENT (michael, john) is true.
PARENT (dorothy, john) is true.
PARENT (sophia, jenny) is true.
PARENT (christopher, michael) is true.
Sibling (tony, john) is true.
Sibling((jenny, david) is true.
Sibling(Michael,Dorothy) is true.
Sibling(X,Y) is not true for any other combination of X,Y.
1) Known Fact
PARENT (jenny, tony) is true.
PARENT (michael, john) is true.
Deduced Fact
From rule 1, FIRST_COUSIN(jenny, michael)is true.
2) Known fact
PARENT (christopher, michael) is true.
PARENT (sophia, jenny) is true.
Deduced Fact
From rule 1, FIRST_COUSIN(christopher, michael)is true.
Hence, From rule2 FIRST_COUSIN(christopher, michael) implies COUSIN(sophia, christopher)
Therefore, COUSIN(sophia, christopher) is true.
ENDLESS SUPPORT IN CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENTS WRITING SERVICES - YOU GET REVISED OR MODIFIED WORK TILL YOU ARE SATISFIED WITH OUR CP5520 - ADVANCED DATABASES AND APPLICATIONS ASSIGNMENT HELP SERVICES!
Avail the best an affordable our James Cook University, Australia Assignment Help service offered for different courses and units, such as:-
- CP1402 - Internet Fundamentals Assignment Help
- CP1403 - Design Thinking Assignment Help
- CP1406 - Web Design and Development Assignment Help
- CP1407 - Introductory Machine Learning and Data Science Assignment Help
- CP1801 - Fundamentals of Problem Solving and Programming Assignment Help
- CP1802 - Internet Fundamentals Assignment Help
- CP2412 - Game Design and Technologies Assignment Help
- CP3000 - Research Topics in Technology Assignment Help
- CP3102 - Multidisciplinary Project Assignment Help
- CP3103 - Independent Project Assignment Help
- CP3402 - Content Management Systems Assignment Help
- CP3405 - Design Thinking and Project Management Assignment Help
- CP3407 - Advanced Software Engineering Assignment Help
- CP3408 - Game Engine and Simulation Assignment Help
- CP3413 - Information Processing and Visualisation Assignment Help