Answers To Odd Numbered exercise Questions

67 downloads 2495 Views 2MB Size Report
Answers in this document are supplied for odd numbered exercise questions, as well as a few even ... Exercise 2.1. 1. (a) C (b) A (c) ...... Here is a UML solution.
Answers

to odd numbered exercise questions Terry Halpin and Tony Morgan Neumont University

Answers in this document are supplied for odd numbered exercise questions, as well as a few even numbered questions. Answers to the other exercise questions are available as a separate document to class instructors using the book as a set text. Exercise 2.1 1. (a) C

(b) A

(c) B

Exercise 2.2 1. (a) Ensure database updates are consistent with the conceptual schema. Answer queries about the UoD. (b) Declarations of: fact types; constraints; derivation rules. (c) False. With compound transactions, only the collective effect of all the elementary updates is considered. 3. (a) accepted (b) rejected. C1 violated. Sue must be enrolled in a degree. (c) accepted (d) rejected. C1 violated. Fred may not enroll in two degrees. (e) rejected. Fact type not recognized. (f) single, married, widowed, divorced (g) accepted (h) rejected. C2 violated. (i) accepted. (j) accepted. (k) rejected. C4 violated. Transition single to divorced illegal. (l) No (m) Fred, Bob (n) Sue (o) rejected. Fact type not recognized. -- Such information would typically be derived Final state of database: Student ‘Fred’ is enrolled in Degree ‘BSc’. Student ‘Sue’ is enrolled in Degree ‘MA’. Student ‘Bob’ is enrolled in Degree ‘BSc’. Student ‘Bob’ has MaritalState ‘single’. Student ‘Sue’ has MaritalState ‘married’.

1

Information Modeling and Relational Databases: Answers (odd)–2 5. (a) begin add: Employee ‘Adams’ works for Department ‘Health’ add: Employee ‘Adams’ speaks Language ‘English’ end begin add: Employee ‘Brown’ works for Department ‘Health’ add: Employee ‘Brown’ speaks Language ‘English’ end Brown’s data may be entered first. Within a compound transaction the order is irrelevant. (b) (i) Employee ‘Adams’ works for Department ‘Health’. -- language missing (ii) Employee ‘Adams’ works for Department ‘Health’. Employee ‘Adams’ speaks Language ‘English’. Employee ‘Adams’ works for Department ‘Education’. -- cannot work for 2 depts Exercise 3.3 1. (a), (f), (j) 3−4.

These questions reveal that columns with the same name need not have the same meaning. In the absence of helpful table names, we make an educated guess. For example: 3.

Athlete (.name) ‘Jones EM’ has height of Length (cm:) 166. aliter: Athlete (.name) ‘Jones EM’ has Height 166 (cm: Length).

4.

Athlete (.name) ‘Jones EM’ pole vaults a height of Length (cm:) 400. aliter: Athlete (.name) ‘Jones EM’ pole vaults Height 400 (cm: Length).

5. The uniqueness of person entries suggests that each row contains two elementary facts. For example, the top row may be verbalized as: Person (.name) ‘Jones EM’ has height of Length (cm:) 166. Person (.name) ‘Jones EM’ was born in Year (CE) 1955. However, this is open to interpretation, as the population might not be significant (only a domain expert can know for sure what is intended). So it is still possible that each row contains just a ternary, elementary fact, e.g., Person (.name) ‘Jones EM’ had a height of Length (cm:) 166 in Year (CE) 1995. 7. Person (.surname) ‘Codd’ is an internal member of Panel (.name) ‘Databases’. Person (.surname) ‘Ienshtein’ is an external member of Panel (.name) ‘Databases’. 9. For all relevant answers, we use “firstname” to mean “first given name” (to avoid confusion with languages such as Japanese where the first name listed is normally the family name). Such a definition or description may be noted in an ORM modeling tool. Person (.firstname) ‘Ann’ is a parent of Person (.firstname) ‘Colin’. Person (.firstname) ‘Ann’ is a parent of Person (.firstname) ‘David’. Person (.firstname) ‘Ann’ is a parent of Person (.firstname) ‘Eve’. Person (.firstname) ‘Bill’ is a parent of Person (.firstname) ‘Colin’. Person (.firstname) ‘Bill’ is a parent of Person (.firstname) ‘David’. Person (.firstname) ‘Bill’ is a parent of Person (.firstname) ‘Eve’. 11. The Fruit named ‘Apple’ is harvested in the Country named ‘Australia’ in the Month named ‘June’. etc.

Information Modeling and Relational Databases: Answers (odd)–3 Exercise 3.4 1. (a) Reference schemes: Person (.firstname). Facts: Person ‘Fred’ is male. Person ‘Ann’ is female. (b)

*$2-,3"

!"#$%& '()*#$+&,-".

*$2)"-,3"

(c) Reference schemes: Person (.firstname); Gender (.name) Facts: Person ‘Fred’ has Gender ‘male’. Person ‘Ann’ has Gender ‘female’. (d)

!"#$%& '()*#$+&,-".

0"&1"# '(&,-".

/,$

3. Only the schema diagrams (two of six possible versions based on reading order) are shown here. You should also verbalize and populate. 6+"'(&,-". 4"+,*3"# '(&,-".

78,&+*+9 '(&#.

52$%31252*&2(((

78,&+*+9 '(&#.

4"+,*3"# '(&,-".

52$%31252%)2(((

6+"'(&,-".

If you wish to think of Quantity as a pure number, then you may verbalize and model it as a value type as shown below. Some ORM modelers treat this as an error, since they view even pure numbers (as distinct from numerals) as entities, not values. So whether this is allowed or not depends on the precise definition of what a value is. For mapping purposes, it makes so difference, so we allow this relaxation. 6+"'(&,-". 4"+,*3"# '(&,-".

78,&+*+9 52$%31252*&2(((

4. This schema is equivalent to the previous ones, which may be used again instead. Verbalization and population are omitted here.

4"+,*3"# '(&,-". 6+"'(&,-".

-""+$2%&

5. 4%%'(&#.

-""+$2*&

%1".

78,&+*+9 '(&#.

Information Modeling and Relational Databases: Answers (odd)–4 7.

/,$ !,$$:%#1 C"-;"# '(&#.

,==#%D"1

/,$

C%+*%& '(&#.

C%+*%&%1".

C%&"9L-%8&+ 'IBHM.

52,+2$+,#+2%)252:,$2:%#+/22(((

!"#$%&'(")&*+",

Here is another solution that allows any currency for the first role (USD would then yield an exchange value of 1) and any date for the valuation. It also avoids using USD as the standard monetary unit. As you can see, there can be many correct solutions, so long as the domain experts agree on how the terms used are to be interpreted. H,+" '9-1. G8##"&>9 '(>%1".

52%&252/,122(((

IBHD,38" '(&#.

Information Modeling and Relational Databases: Answers (odd)–5 Exercise 3.5 *$21*$+#*;8+"12;9 N1*$+#*;8+%#O

1. B%)+:,#" '(&,-".

G%-=,&9 '(&,-". *$2$%312;9 N#"+,*3"#O

This solution assumes that distributors and retailers are companies. It also uses “sold” in the sense of retailed (e.g., rather than wholesaled). 3.

"-=3%9$2P2:%#@$2)%# N"-=3%9""O N&#B+,))O

H"=,#+-"&+ '(&,-".

J#B+,)) /,$2!

Q-=3%9"" '(&#.

/,$2,2;81R"+2%)

/,$2,2$,3,#92%) N$,3,#9O

C%&"9L-%8&+ 'IBHM.

/,$2+%+,32$,3,#92%)2! !"#$%"&'()2H"=,#+-"&+S N+%+,3B,3,#9O 222222&#B+,))2T2($*+,'"-=3%9"".( !"#$%"&'()2H"=,#+-"&+S 222222+%+,3B,3,#92T2-*.'$,3,#92$/2"-=3%9"".(

Note: “employee.salary” may be used instead of “salary of employee” At the time of writing, the NORMA tool is being extended to automatically generate implicit role names using object type names (where the object type plays no other role in the relevant fact type) and concatenated names obtained from hyphen binding. For example, using unit-based reference mode support (where the USD unit is based on the Money dimension), the following alternative solution is then allowed without explicitly adding role names. "-=3%9$2P2:%#@$2)%# J#B+,)) /,$2! V81R"+ 'IBHM.

/,$

Q-=3%9"" '(&#. /,$

H"=,#+-"&+ '(&,-".

/,$2+%+,3U2! !"#$%"&'()2H"=,#+-"&+S 222222&#B+,))2T2($*+,'"-=3%9"".( !"#$%"&'()2H"=,#+-"&+S 222222+%+,3B,3,#92T2-*.'$,3,#92$/2"-=3%9"".(

B,3,#9 'IBHM.

5. 0"&1"# '(>%1".

!"#$%&'

*$2%)2P2/,$

!"#$%& '(&,-".

:%#@$2)%#

H"=,#+-"&+ '(&,-".

-"./0'12/1&13"4&*"1"45*06""12'17"5&.84"'89 -"./0'12/1&14&*"1"45*06""12'17"5&.84"'8

Information Modeling and Relational Databases: Answers (odd)–6 7.

/,$ N>,=,>*+9O G%$+!"#CV 'IBHM.

C"1*8'(&,-".

/,$2! N>%$+!"#CVO

G,=,>*+9 'CVM.

:,$2*&+#%18>"12*&

/,$

!"#$%"&'()2C"1*8-S 222222>%$+!"#CV2T21*$@!#*>"P>,=,>*+9(

N1*$@!#*>"O

W",# 'GQ. H*$@!#*>" 'IBHM.

Note: The role names shown above may be assumed once NORMA supports implicit role names. Where relevant, later answers will typically omit implicit role names. Exercise 4.2 1. Uniqueness constraints apply to: (a) B column; (b) AB combination; (c) A column and B column; (d) A column. 3. Uniqueness constraints apply to: (a) each role (implied); (b) left role; (c) 3.3.3 role of Athlete, 3.3.4 role of Athlete, 3.3.5 each role of Person, 3.3.6 combination of Person and Year roles, 3.3.7 both fact types are many:many (population is not significant), 3.3.8 combination of Student and Course roles, 3.3.9 many:many, 3.3.10 both fact types are many:many; (d) each of the three roles of TuteGroup (later we see how to add external uniqueness constraints, e.g. the combination of Room, Day and Hour is probably unique); (e) each role of Project, and the birth and salary roles of Person; (f) each role of Person, and the budget role of Department. Exercise 4.3 1. (a) AB, AC (b) AB, AC, BC (c) ABC (d) AC 3. (a) W",# 'GQ. V#,&>/ '>*+9&,-".

/,12+%+,3U2!

52*&252-,1"2(((

!#%)*+ 'IBHM.

!"#$%"&'()2W",#S 2222222+%+,3!#%)*+2T2-*.'=#%)*+.(

(b)

XV#,&>/W",#Y V#,&>/ '>*+9&,-".

%="#,+"12*&

W",# 'GQ.

/,12+%+,3U2!

-,1"

!#%)*+ 'IBHM.

!"#$%"&'()2W",#S 2222222+%+,3!#%)*+2T2-*.';#,&>/W",#(=#%)*+.(

Note: “profit of branchyear” may be used instead of “branchYear.profit”.

Information Modeling and Relational Databases: Answers (odd)–7 Exercise 4.4 1. (a)

*$2+,8R/+2;9 XB8;E">+Z))"#*&RY G#"1*+ '(=%*&+$.

B8;E">+ '(>%1".

/,$

[">+8#"# '(*&*+*,3$.

B"-"$+"# '(&#.

*$2%))"#"12*&

/,$2"&#%33-"&+2%)

J#B+81"&+$

(b) /,1

X!#%E">+?%#@Y Q-=3%9"" '(&#.

:%#@"12%&

!#%E">+ '(&#.

*&>8##"1

3.

*$2%)

4"+,*3!#*>" 'IBHM.

/,$

G,# '\6J.

H8#,+*%& '/M.

QF="&$"$ 'IBHM.

G,#C%1"3 '(&,-".

*$2%)

G%3%# '(&,-".

:,$2-,1"2*&

W",# 'GQ.

5 %)25 *&25 $%31 *&2((( 78,&+*+9

:%2/1/$%"4&14&;"/1'01&88"4581801."$0.< %2/80.61&=0+81/5"$232$1$&./130.4".*612'1/80$;>

Exercise 4.5 1. (a), (b), (d) 3. Since each executive has only one home phone, this information may be split off without information loss. Hence the proposed ternary is compound, and must be split into two binaries, as shown below. /,$2:%#@U QF">8+*D" '(&,-".

!/%&"J# /,$2/%-"U

Information Modeling and Relational Databases: Answers (odd)–8 5. G%8&+#9 '(>%1". C%D*" '(&,-".

B,3"$["D"3 '(&,-".

52"F=%#+"12)#%-252+%252,>/*"D"12(((

This is unacceptable, since it cannot store the data in the final row. We must be able to store facts about movie origins without knowing their export figures. The quaternary should be split, as shown below: %#*R*&,+"12*& C%D*" '(&,-".

G%8&+#9 '(>%1".

52"F=%#+"12+%252,>/*"D"12(((

B,3"$["D"3 '(&,-".

Exercise 4.6 1. (a) Constraints on AC, BC. (b) Projections: a1 a1 a2 a2

Join:

c1 c2 c1 c2

b1 b1 b2 b2

(c) AB projection:a1 b1 a2 b2

c1 c2 c1 c2

a1 a1 etc.

b1 b2 ..

c1 c1 ..

× so unsplittable

BC projection as in (b)

The join gives the original table. So, assuming significant data, it is splittable in this way. (d)

L

V

Exercise 5.2 1.

/,$2>%,32#"$"#D"$2%) G%8&+#9 '(&,-".

C,$$ '0+M. /,$2%*32#"$"#D"$2%)

G

Information Modeling and Relational Databases: Answers (odd)–9 3.

$>%#"1 J#]$

XG#*>@"+!3,9Y G%8&+#9 '(&,-".

W",# 'GQ.

=3,9"12>#*>@"+2*&

J#^$ $>%#"1 J#V%8&1,#*"$ $>%#"12!

!"#$%"&'()2G#*>@"+!3,9S 222222&#V%8&1,#*"$2T2&#]$2_2&#^$(

Exercise 5.3 1. (a)

*$2*&

B+#""+ '(&,-".

?,#"/%8$"

[%+J# /,$

(b)1 Refine Street:

*$2*& *$2*& B+#""+

?,#"/%8$"

B8;8#; '(&,-". B+#""+J,-"

[%+J#

/,$

/,$ *$2*&

(c)1 Refine Suburb:

*$2*& B8;8#;

*$2*& B+#""+

B8;8#;J,-"

?,#"/%8$"

B+#""+J,-" [%+J#

G*+9 '(&,-".

/,$

/,$

/,$ *$2*&

(d)1 Refine City:

*$2*& G*+9

*$2*& B8;8#;

*$2*&

G*+9J,-"

B+#""+

B8;8#;J,-"

?,#"/%8$"

B+#""+J,-" [%+J#

G%8&+#9 '(&,-".

/,$

/,$

/,$

/,$ *$2%&

(e)1 Refine Country

*$2*& G%8&+#9

*$2*& G*+9

*$2*&

G*+9J,-"

B+#""+

B8;8#;J,-"

?,#"/%8$"

B+#""+J,-" [%+J# /,$

G%8&+#9J,-"

B8;8#;

*$2*&

/,$

/,$

!3,&"+ '(&,-".

/,$

/,$

Information Modeling and Relational Databases: Answers (odd)–10

3. (a)

/,$2FU !%*&+ '(3"++"#.

G%%#1*&,+" /,$29U

(b)

52*$252&%#+/2%)2+/"2>,+/"1#,3

!,#@*&RB+,+*%&

J#V3%>@$

52*$252",$+2%)2+/"2>,+/"1#,3

Note: This schema fragment is just a reference scheme for parking stations. We may now add facts about them (e.g. hours open). South and West coordinates have negative values.

5.

>,&2;"&>/2=#"$$ C"-;"# '(&#. /,$

>,&2;"&>/2=#"$$

C,$$ '@RM.

C"-;"# '(&#.

V%19C,$$ '3;M.!

/,$

!2`23;2T2a(]b]2@R

C,$$ '@RM2C,$$. V%19C,$$ '3;M2C,$$.!

!2`23;2T2a(]b]2@R

Note: This schema uses kg as the standard unit of mass. The bench press fact type assumes earth surface gravity. If you choose lb as the standard unit, the conversion rule is * 1 kg = 2.205 lb. If you choose the term “weight”, either add definitions to indicate that strictly you mean mass, or change the units to lb wt and kg wt. 7.

:,$2+,@"&2;9

:,$2=,$$"12!

%1". :,$2;%#&2%&

0"&1"# '(>%1".

e,>*3*+9J,-"

%1".

N#"+8#&%1".

:%#@$2*&2!

1. /,$2P2*$2%) ?%#@"# '(*&*+*,3$.

8$"$

?%#@"# J,-" !G '(&#.

4%%'(&#.

*$2*&

*$2"F="#+2*& 5 +,3@$2,;%8+ 5 )%# ((( H8#,+*%& '/M.

*$2*&$+,33"12%& [,&R8,R" '(&,-".

*$2%)

N+%+,3H*$>8$$*%&/21"=,#+-"&+2"-=3%9$23">+8#"#$2*&2,332*+$2;8*31*&R$ !2H"=,#+-"&+2*$23%>,+"12*&2V8*31*&R20// H"=,#+-"&+2"-=3%9$2-$.&2[">+8#"#21)$2:%#@$2*&2V8*31*&R(

This solution assumes that for each department, we must record at least one lecturer for each of the department’s buildings. If this is not true, then none of the fact types is fully derivable, and our solution is the same as for Question 2 except for the extra mandatory constraint. Exercise 6.3 1. fg3"=+%&gS 2g-"$%&gS 2g;,#9%&gh

e,-*39 '(&,-".

*&>381"$2P2*$2*&

!,#+*>3" '(&,-".

/,$

/,$

G/,#R"B*R& '($9-;%3. fg_gS2gUgS2gagh C,$$ ',-8M.

fa((iaaah

Information Modeling and Relational Databases: Answers (odd)–13 3.

/,$ G8$+%-"#J,-"

G8$+%-"# '(&#.

:,$2*$$8"12+%

L11#"$$

:,$2*$$8"12%& 6&D%*>" '(&#.

X[*&"6+"-Y

/,$

/,$

H,+" '1-9. :,$2=,*12%& /,$

!/%&"J# /,$

*$23*$+"12%&

I&*+!#*>" 'LIHM.

78,&+*+9 /,$

/,$2$+%>@U 6+"'(>%1". 6+"-@U2!

6&D%*>" '(&#.

/,$

78,&+*+9 52$8==3*"1252*&2(((

!"#$%"&'()26+"-S 2222222$+%>@78,&+*+92T2-*.'l8,&+*+9.2U2-*.'3*&"6+"-(l8,&+*+9.(

(ii) It is not practical to use this rule, since items may be stolen or misplaced. So periodic stocktakes must be taken to determine the exact number in stock, and stocktake numbers should be stored. Such a rule may be used however to provide default stock figures which may be compared with stocktake figures to discover discrepancies. In such a case, a more complex rule is needed to take into account previous discrepancies as well as stock write-offs (e.g. due to damage) and items that are returned from the buyer.

Information Modeling and Relational Databases: Answers (odd)–14 Exercise 6.4 1.

/,$2+#,D"32,33%:,&>"2%)

8$"$

Q-=3%9"" '(&#.

Q-=3%9""J,-" /,$

G,# '(#"RJ#. H#*D"#$[*>"&$" '(&#.

/,$2P2*$2%)

3.

C%&"9L-%8&+ 'IBHM.

=3,9$

Gi e*+&"$$4,+*&R '(&#.

/,$

G`

!"#$%& '()*#$+&,-".

Gn f`((`ah

B=%#+ '(&,-".

Gb G]

*$2"F="#+2,+

Note: If Sport plays no other roles, there is an implied mandatory role constraint on the righthand role of :$;+/#(%-"%#1$

B,3,#9Q,#&"#! :,$2*$$8"12P2:,$2*$$8"12+%

#">%#1$

%1".

G3*"&+ '(&#.

[%,& '(&#. *$2)%#

H8#,+*%& '9M. [%,&L-%8&+ 'IBHM.

*$2%)2P2/,$

fjZkS2jVkS2j4kh J%&B*&R3" G3*"&+!

J#H"="&1,&+$ /,$

6&>%-" 'IBHM.

/,$2$=%8$"2:*+/

A%-"Z:&"# Z#V89"#!

/,$2/%-"2:%#+/

C%&"9L-%8&+ 'IBHM.

C,##*"1 G3*"&+!

C,##*"1 A%-"Z:&"# Z#V89"#!

/,$2$=%8$"2:*+/

A%-"B/,#" 'p.

!2'()2J%&B*&R3"G3*"&+20-"'2G3*"&+21)$2/,$2C,#*+,3B+,+8$2oc2gBg( !2'()2A%-"Z:&"#Z#V89"#20-"'"G3*"&+21)$2/,$24"$*1"&+*,3B+,+8$20+2fgZgS2gVgh( !2'()2C,##*"1G3*"&+20-"'2G3*"&+21)$2/,$2C,#*+,3B+,+8$2gCg( !2'()2C,##*"1A%-"Z:&"#Z#V89"#20-"'2C,##*"1G3*"&+2'+3"'2A%-"Z:&"#Z#V89"#(

Exercise 6.6 1. (a) 0"&1"# fjCkS2jekh '(>%1".

:"*R/$

Q-=3%9""J,-" /,$ L11#"$$

1#*D"$P*$21#*D"&2;9

Q-=3%9"" '(&#.

/,$ ",#&$

!/%&"J#

:"*R/$

C,$$ '@RM.

*$2%)

G,# '(#"RJ#.

B,3,#9 'IBHM.

6+"-G,+"R%#9 '(&,-".

*$2%)2P2*$2*&

6+"'J#.

:"*R/$

C,$$ '@RM.

fjQ-=kS2jG,#kh Q-=3%9""! '(&#.

:,$2-,1"2*&

/,$

/,$

(b)

*$2%)

G,#! '(#"RJ#.

!2'()2Q-=3%9""20-"'+26+"-2,)',2*$2*&26+"-G,+"R%#92jQ-=k( !2'()2G,#20-"'+26+"-2,)',2*$2*&26+"-G,+"R%#92jG,#k(

G,#C%1"3 '(&,-". W",# 'GQ. G%$+ 'IBHM.

Information Modeling and Relational Databases: Answers (odd)–17 1.1 (c) Schema (a) is preferable. Employee and Car are exclusive, with different contextual identification schemes, and it is unlikely we would want to list them both in the same column of an output report. Exercise 7.2 1.

B",$%& '(&,-".

fj4kS2jJ4kh

i

]

H,+,;,$"q*&1 '(>%1".

fB=#*&RkS2jB8--"#kS jL8+8-&kS2j?*&+"#kh 78,&+*+9

1,+,;,$"2$9$+"-$2%)252*&252$%312*&2(((

3. C%&+/J# W",# 'GQ.

`i

5. (a)

`((n 52*&252:,$2,$$*R&"12(((

*$2;9 L==3*>,+*%& '(&#.

!#%18>+ '(>%1".

!"#$%& '(&#.

≤?

*$2)%#

/,$

L:,#1 '(&#. L:,#1B+,+8$ '(>%1".

(b)

/,$ XL==3*>,+*%&Y !"#$%& '(&#.

78,&+*+9

52*&252$%312(((

XL$$*R&-"&+2rY B,3"$="#$%& 'Q-=J#.

f`((`ih

,==3*"12)%#

L:,#1B+,+8$ '(>%1".

L:,#1 '(&#.

IG2*$2:#%&Rr

The spanning uniqueness constraint on the objectified association entails that the same person applied at most once for the same award, but the same person may apply up to 3 times for the same award. Exercise 7.3 1. (a) R, S, T (b) iR (c) iR, S (d) iR, aS, T (e) iR, aS, T (f) R, T (g) iR, S Note that (g) is not intransitive (e.g. locations at vertices of a triangle).

Information Modeling and Relational Databases: Answers (odd)–18 3. Proof is by reductio ad absurdum, using a deduction tree. The justification column abbreviations are: P = Premise, NC = Negated Conclusion, df = definition, QN = Quantifier Negation, EI = Existential Instantiation, UI = Universal Instantiation, PC = Propositional Calculus move, AA = Affirming the Antecedent (i.e. modus ponens), DC = Denying the Consequent (i.e. modus tollens). (a) 1. 2. !3. !4. !5. 6. 7. !8. 9. 10.

∀x ~xRx P (df Irreflex) ∀xyz (xRy & yRz → xRz) P (df Trans) ~∀xy (xRy → ~yRx) NC (negated Asym) ∃xy ~( xRy → ~yRx) 3 QN ~(aRb → ~bRa) 4 EI aRb 5 PC bRa 5 PC aRb & bRa → aRa 2 UI aRa 6,7,8 AA ~aRa 1 UI X 9, 10

(b) 1. ∀xy (xRy → yRx) P (df Sym) 2. ∀xyz (xRy & yRz → xRz) P (df Trans) !3. ~∀xy (xRy ∨ yRx → xRx) NC (negated PopReflex) !4. ∃xy ~( xRy ∨ yRx → xRx) 3 QN !5. ~( aRb ∨ bRa → aRa) 4 EI !6. aRb ∨ bRa 5 PC 7. ~aRa 5 PC 8. aRb → bRa 1 UI 9. bRa → aRb 1 UI !10. aRb & bRa → aRa 2 UI !11. ~(aRb & bRa) 10,7 DC / \ 12. aRb bRa 6 PC 13. bRa aRb 8, 12a AA; 9,12b AA 14. aRa aRa 10,12,13 AA X X 5. The schema is shown with sample data. If storage is not a problem, use a symmetric relation like this (symmetry can be enforced at update to simplify data entry). If storage is a problem, use an asymmetric relation (add asymmetric constraint), say baseBorders (base table for borders), and add the derivation rule: >/-#&;=?( ./;@$;+( >/-#&;=A( !""# >/-#&;=?( .*+$B/;@$;+(>/-#&;=A($%(>/-#&;=A(.*+$B/;@$;+(>/-#&;=?.

G%8&+#9r '(&,-".

;%#1"#$ 2V"3R*82V"3R*82V"3R*82V"3R*82e#,&>" 2(((

2e#,&>" 20"#-,&9 2[8F"-;%8#R 2J"+/"#3,&1$ 2V"3R*82(((

Information Modeling and Relational Databases: Answers (odd)–19 Exercise 7.4 1. (a) /,$ !%$*+*%&J# f`((`bh *$2*& !"#$%&J,-" *$2%)2P2/,$

(b)

48R;9%1". jC,>kh

G,;3"["&R+/ '-M.

*$2%)2P2/,$

J%1" '(3"++"#.

?%#@B+,+*%&!

/,$

J%1"e8&>+*%& '(>%1".

e*3"B"#D"#!

*$2%)2P2/,$

/,$

fjeBkS j?Bkh

G!I)#"l8"&>9 'CAtM.

s2≤2` !2'()2?%#@B+,+*%&20-"'2J%1"2,)',2/,$2J%1"e8&>+*%&2g?Bg( !2'()2e*3"B"#D"#20-"'2J%1"2,)',2/,$2J%1"e8&>+*%&2geBg(

Aliter, simply assert the subtypes in stead of deriving them: fj!GkS G%-=8+"#q*&1 jC,>kh '(>%1".

*$2%)2P2/,$

J%1" '(3"++"#.

s2≤2ia

s2≤2` G,;3"["&R+/ '-M.

?%#@B+,+*%& *$2%)2P2/,$

e*3"B"#D"# /,$

G!I)#"l8"&>9 'CAtM.

Information Modeling and Relational Databases: Answers (odd)–20 7. The schema is as earlier, but with the following derivation rules added: :*;&?(8/#&*"#+(:*;&A((!"((:*;&?(@";$8&0=(8/#&*"#+(:*;&A( :*;&?(8/#&*"#+(:*;&A((!"((:*;&?(@";$8&0=(8/#&*"#+(&$'((:*;&C()*+)!8/#&*"#+(:*;&A( Exercise 7.5 1.1 Regarding the left hand fact types: If A’s role in S is populated with a, say, then a must also play A’s role in R (since the pairsubset constraint implies subset constraints on corresponding roles). But this violates the exclusion constraint. Hence the constraint pattern is population-inconsistent. Regarding the right hand fact types: If S is meant to identify a typed predicate predicate, then replace it by another symbol to avoid conflation with the other S predicate. The combination of the subset constraint and the simple UC implies a simple UC on the left role of T. 3. The supplied predicate was supposed to have the reading “… located in … ordered … of …”. Assuming the population is significant in the sense that each bookshop is located in only one city, the schema should be split into two fact types as shown below:

G*+9 '(&,-".

*$2*&

78,&+*+9 '(&#. V%%@$/%= '(&,-".

52%#1"#"1252%)2(((

V%%@ '6BVJ.

5. The grandparent_of relation is semiderived (partly stored and partly derived). This allows storing of the fact that David is a grandparent of Chris without knowing who David’s children are. However, suppose we now attempt to store the fact that Ann is a grandparent of Chris. If this fact is accepted, we have derived redundancy since this fact can be derived from the stored facts that Ann is a parent of Bob, and Bob is a parent of Chris, given the derivation rule. This kind of derived redundancy is typically harmless, but if such redundancy is not desired, special exclusion and update constraints may be used.

Information Modeling and Relational Databases: Answers (odd)–21 7. This solution was produced with the NORMA tool, using 3 pages named as shown below. Moon Missions:

Astronauts:

Moons&Planets: *$2%)

F'67/$%.*='8

4$3595:& 67+'.&8 /,$ >'.&95:& 67+'.&8

4$35 67+'.&8

/,$ >'.&?%0@0+

52/,$2,+-%$=/"#*>U252*&25

mQ,>/2C%%&2*$2,2V%19 +/,+2*$2%)2V%19/2%1".

*$2%)

X[%,&26+"-2rY

C%&+/ f`((`ih '(&#.

*$2*&

fj0kS2j!0kS2jCkS jCLkS2j4kh

52*&252/,12(((

4,&@ '(&#.

/,$

:,$2>/,#R"12+%

G8$+%-"#J,-" /,$

QF>381"1 \*1"%#*=+*%&

[%,& '(&#.

:,$2#"&+"12%&

L11#"$$

G8$+%-"# '(&#.

/,$ !/%&"J#

/,$

G%--"&+

!2'()2QF>381"1\*1"%/,$"H,+"2i 2222$223",$"QF=*#9H,+"2i

%)

2222QvG[IHQH 2222\6HQZ381" 2222222[ZLJ s22!223%,&J# 2222!22*$$8"H,+" >/,#R"12+%

22!22*$?#*++"&Z))2] 22!22>%--"&+

,$$*R&"1 %)

22222222CZ\6Q %&

222Z8$+%-"#J,-"2d 2222!22,11#"$$2d 2222$22>,33!"#*%12yS2`a 2222$22=/%&"J#2`a

s2"!22-%D*"G%1" 2222!22-%D*""$ G%&$8-"# '(&#.

78,#+"#J# Q&"#R9 '@?/M.

52*&2528$"12(((

:,$2#"=%#+"12;9 /,$

6&$+,&+ 6&$+,&+ '9-1/-. '9-1/-.

!#$%"&'()2[*&"[*&@S 2222=%:"#2T2D%3+,R"2m2>8##"&+2P2`aaa(

/,1

e,83+2r

e,83++/B+,+" >8##"&+ D%3+,R" P=%:"#

`

!

>%1"2f!h 1"$>#*=+*%&2fI`h 3*&@B+,#+

Zq ),83+9

)#%-J%1"

! ! 3*&@Q&1

f=%:"#2T 222D%3+,R"2m2>8##"&+P`aaah

z"&8-"#,+*%&{ 2J,',*-

G0+H95:&

z"&8-"#,+*%&{ 2J10,()J,',&

`

>$3&

`

>%1"2f!h &#e8$"$ +#,&$)%#-"#%&$8-"#2/,$2*+$ +#,&$)%#-"#2+9="2#">%#1"1

! I*'%,&%

`

B$+-*.&% !

9",#J#2f!h l+#J#2f!h2f2D,38"2*&2#,&R"2`((]2h

! f!h &#!/,$"$2f2D,38"2*&2#,&R"2`((n2h

!

#'*=, +9=" +*-" +*-"e*F"12Na((`O >,8$"2Na((`O

B$+-*.&%I*'%,&% "&"#R9I$"1

f`((]h

'>%&$8-"#S2+9="S2+*-".2*$28&*l8"

Information Modeling and Relational Databases: Answers (odd)–24 1. (b) Introduce a simple identifier for fault (e.g. FaultId). This is advisable even if we model Fault directly as shown in the previous solutions rather than as an objectified association. Exercise 10.1 1.1 (a) Employment_A enr pnr e1 p1 e2 p2 e3 p1

startdate d1 d2 d2

enddate d3 ? ?

Employment_B enr e1 e2 e3

pnr p1 p1 p1

(b) outer join semantics for UC on (pnr, enddate), i.e. UC applies to outer join (c) inner join semantics, i.e. UC applies to inner join (d) ,*(,-1(.$)#(/!&)&( 1&(0(,)(8#*+9J# /,$

startdate d1 d2 d3

enddate d4 ? ?

Information Modeling and Relational Databases: Answers (odd)–25 Exercise 10.3 1.1 (a)

/2V3%%1!#"$$8#"S 2222$9$+%3*>V!2c21*,$+%3*>V!(

V!-",$8#"-"&+ '(&#.

NV!+"$+O *$2%)

!#"$$8#" '--ARM.

9*"31"1

NV!O

/,$2$9$+%3*>U

V3%%1!#"$$8#" /,$23,+"$+U2! N3,+"$+V!O

!#"$$8#" '--ARM.

/,$21*,$+%3*>U !"#$%"&'()2!,+*"&+S 222223,+"$+V!2T2V!+"$+(V!21)&%&2V!+"$+(+"$+%&$+#,*&+2+/,+2/,;*+,+*%&2="#*%1$21%&k+2%D"#3,=( L3$%2*R&%#"2D,38"2>%&$+#,*&+M2e%#2",>/2A,;*+,+*%&S2"&1H,+"2cT2$+,#+H,+"(

5. (a) (i) If D is a subtype of B and C, it includes an instance that belongs to both B and C. But B and C are mutually exclusive. So this is impossible. (ii) Student is a role type, so all its instances may join or leave this type during their lifetime. If Person is a subtype of Student, when an instance leaves the Student type it also leaves the Person type. But this is impossible since Person is a rigid type (no instance can ever leave it during its lifetime).

Information Modeling and Relational Databases: Answers (odd)–26

5. (b) Using the decreasing disjunctions pattern:

L==3*>,+*%&e%#'(&#.

:,$2)*3"12;9

!"#$%& '(&#.

!"#$%&J,-" /,$ "&1"12%&

Q-=3%9""2%#2L38-&* :,$2/*#"12%& XA*#"2rY L38-&*

H,+" '-19.

3,$+2E%*&"12,38-&*2,$$%>*,+*%&2%&

Using the role-playing pattern: XQ-=3%9-"&+4%3"!3,9*&RY !"#$%& '(&#.

L==3*>,+*%&e%#'(&#.

!"#$%& L$L==3*>,&+!

:,$2)*3"12;9

Q-=3%9-"&+4%3" '(&,-".

=3,9$

!"#$%&L$ Q-=3%9""!

!"#$%& L$L38-&*!

fjL==3*>,&+kS 2jQ-=3%9""kS 2jL38-&*kh

3,$+2E%*&"12,38-&*2,$$%>*,+*%&2%& H,+" '-19.

XA*#"2rY

:,$2/*#"12%&

"&1"12%&

!2'()2!"#$%&L$L==3*>,&+20-"'+2Q-=3%9-"&+4%3"!3,9*&R"2,)',2*&D%3D"$2Q-=3%9-"&+4%3"2jL==3*>,&+k( !2'()2!"#$%&L$Q-=3%9""20-"'+2Q-=3%9-"&+4%3"!3,9*&R2,)',2*&D%3D"$2Q-=3%9-"&+4%3"2jQ-=3%9""k( !2'()2!"#$%&L$L38-&*20-"'+2Q-=3%9-"&+4%3"!3,9*&R2,)',2*&D%3D"$2Q-=3%9-"&+4%3"2jL38-&*k(

Exercise 10.4 1. (a)

*$2=%:"#"12;9

%-%+*D" '(&#. f`((nh

@MA

52,+252/,$2(((

G,##*,R" '(&#.

G,##*,R"G3,$$ '(&#.

*$2%)

!%$*+*%& f`((h '(&#. #$%"&'()2%-%+*D" '(&#.

!%$*+*%& '(&#.

381"$

f`((h f`((nh G,##*,R" '(&#.

52,+252/,$2(((

*$2%)

G,##*,R"G3,$$ '(&#.

allow other CarriageTrain role to be mandatory aliter: *$2=%:"#"12;9

[%>%-%+*D" '(&#.

!%$*+*%& '(&#.

%-%+*D" '(&#.

*$2%&

f`((nh G,##*,R" '(&#.

!%$*+*%& '(&#.

*$2%)

G,##*,R"G3,$$ '(&#.

/,$

(g) No. Exercise 10.5 1.1 (a) propositional (b) situational (c) propositional 3.

/,12=#"$*1"&>9U L==#%D,34,+*&R '(&#. 0"&1"# '(>%1".

*$2%)

!#"$*1"&+ '(&,-".

fjCkS2jekh

;"R,&2=#"$*1"&>92%&

H,+" '-19.

"&1"12=#"$*1"&>92%&

Exercise 10.6 1.

Negation Approach Negation as Failure Classical Negation Semipositive Negation

Pat is male False UNK False

Pat is a parent False UNK UNK

Exercise 10.7 1.1 (a)

%1".

C,#+*,3L#+ '(&,-".

*$2%)2P2/,$ C"-;"# '(&,-".

!/%&"J#

52*&252/,$2(((

4,&@ '(&,-".

*$2%)2P2/,$

(b) The attribute “Arts and ranks” is multivalued, not atomic-valued. (c) Member ( membername, gender, [phone] ) {M, F}

Ranked

( membername, art, rank )

(d) The nested relation allows all details about members to be retrieved without a table join, so is more efficient for such queries. Moreover the subset constraint is no longer needed. On the negative side, allowing nesting leads to a more complex query language, and queries to determine who has an art or rank are somewhat less efficient than for the relational solution. As an extra exercise, modify answers (a) and (c) to unpack the semantics of ranks into a rank type (dan or kyu) and level (1..). Exercise 11.3 1.

()$*+&#,-1B12/='C1&+8%0.'&4"1D .++/11111B12/='C1828*"C1"
Note: Other facts are derived. The equality constraints above are based on the population provided. In practice, these constraints would usually be at most subset constraints. 7.

.&!,3*

B1=.&'$%H.C1=.&'$%H&4"1D

A!B>!?%&

B18&#J2*"H.C18&6".'&4"C1!G0.;=.&'$%H.,!C1!5%0'"H.,1D

(33+),$C7%&

B1=.&'$%H.C1&$$0+'8H.C18&#J2*"H.1D

A&!,7!3$#+,

@7M-CN7OA B1=.&'$%H.C1&$$0+'8H.C18.&'H.C18.&'7&8"C1&40+'8C18.&':65"C1=&*&'$"""#D

1111111!

1$%&&#'$&(#)*18&#J2*"H.1)$1K$$0+'8L/".>8&#J2*"H.

""1'$#+,-./-1&$$0+'8H.

=&*&'$"1PQ1R9 111'$#%01./-1:.&'/&$820' )*18.&':65"1Q1S7M-S1/2-$#=&*&'$"1PQ1'&11=&*&'$"1T1&40+'89 )*18.&':65"1Q1SN7OS1/2-$#=&*&'$"1PQ1'&11=&*&'$"1U1&40+'8

Information Modeling and Relational Databases: Answers (odd)–31 9. (a)

XQ&#%33-"&+Y

B+81"&+ '(&#.

B8;E">+ '(>%1".

"&#%33"12*&

52%&252R%+2((( B>%#" + '(>%1". 52%&252R%+2((( B>%#" >VWRA11@R>>VXYA111111@R>>VXYA 11111@:)C1H-A ;%&7+,1B130.4H.C1&("C18Z[0+./C15&5".[0+./C1!3&ZF%&''"*,!C1!3&Z-&5".,3C1!5."3H"G/,41D V

1-5)6/6#)**18Z[0+./1\1R 1-5)6/6#)**15&5".[0+./1\1R ? 1-5)6/6#)**18Z[0+./1\1R1.$115&5".[0+./1\1R1.$11&("1\Q1VY ]

(b)

111111111111111111@R>>VWRA11@R>>VXYA1111111@R>>VXYA

;%&7+,@

1B130.4H.C1&("C18Z[0+./C15&5".[0+./1D !

3

D%!E%&@ 1B130.4H.C13&Z-&5".1D 4

F#%G%&

1B130.4H.C13&ZF%&''"*1D 1111@:)C1H-A

*%&%

B1=0%1".

G3*"&+ '(&#.

/,$

=,9$2!!

f2gQLgS2gBQgS2gJQg2h

:,$2#")"##"12;9

633&"$$ '(&,-".

!#"-*8'IBHM.

G%D"# 'IBHM.

/,$

*$2*&2!

fgJBgS2gBgh

=,9$2;9

*$2%)

:,$2$8))"#"122;9

4">%D"#9H"R#"" 'p.

/,1

633&"$$Z>>8##"&>" '(&#.

:,$2+#",+"12,+

L&&8,3e"" 'IBHM.

A%$=*+,3 '(&,-".

!,9C"+/%1 f2gGBAgS2gGA7gS2gG4Hg2h '(>%1". N1,+"!,*1O

=,*12%&2P

H,+" H,+" '-19. '-19.

:,$2;%#&2%& N;*#+/1,+"O !"#$%"&'()2G3*"&+S2,R"2T2',$3'52U2;*#+/1,+".(5&'%-( !2G3*"&+2*$2*&2LR"0#%8=20//2G3*"&+(,R"2cT2,R"0#%8=(-*&LR"2'+32G3*"&+(,R"2oT2,R"0#%8=(-,FLR"( !!2!,9-"&+2l8%+"2*$21"#*D"12)%#2>8##"&+21,+"28$*&R2;*#+/1,+"S2$-%@*&R2$+,+8$2,&12=#%=%$"12>%D"#S 22222+/"&2$+%#"12,$2=,9-"&+2*)2=,*12%&2+/,+21,+"(2e%#2$*-=3*>*+9S2,$$8-"2=,9-"&+2*$2%&21,92%)2l8%+"( 22G3*"&+2=,9$2L&&8,3e""20// G3*"&+2*$2*&2LR"0#%8=2'+32/,$2B-%@*&RB+,+8$2'+32#"l8"$+"12G%D"#2'+3 ,)',"LR"0#%8=2:*+/2,)',2B-%@*&RB+,+8$2,&12,)',2G%D"#2/,$2!#"-*8-2'+3 L&&8,3e""2T2`i2m2,)',2!#"-*8-( O20#%8= &_`(-*&LR"2T20#%8=&(-,FLR"2_2`2UU2:/"#"2;%+/2R#%8=$2"F*$+ P""#$%"&'()2G,#1!,9"#S

1,+"!,*12oT2>#"1*+G,#1("F=*#9H,+"(22UU2+/*$2,==3*"$2,+2+*-"2%)2=,9-"&+

Subtyping: G3*"&+ '(&#. |%; '(&,-".

/,$2"F=*#9U /,$ Q-=3%9"1G3*"&+!

≤2i

G,#1!,9"#!

8$"$

!/%&"J# /,$2:%#@U B"3)Q-=3%9"1G3*"&+!

8$"$

G#"1*+G,#1 '(&#. *$2%)

L>>%8&+*&Re*#'(&,-".

!2'()2G,#1!,9"#20-"'2G3*"&+21)$2=,9$2;92!,9C"+/%12gG4Hg( !2'()2Q-=3%9"1G3*"&+20-"'2G3*"&+21)$2/,$2Q-=B+,+8$2oc2gJQg( !2'()2B"3)Q-=3%9"1G3*"&+20-"'2G3*"&+21)$2/,$2Q-=B+,+8$2gBQg(

H,+" H,+" '-19. '-19. G,#1!A#3 03*%E)"%

B1&("h.0+5H.C142'K("C14&#K("1D

111111111@H_C1_A 11111111111111111] B1&("h.0+5H.C1$0Z".C1/40;2'(_8&8+/C15."42+41D

H"#%,$I"",%77B1$*2"'8H.C12**'"//C1."$0Z".6-".$"'8C1%0/528&*H&4"1D @H_C1_A 111111111111110!7 @F_[C1F[jC1Fi7A @MKC1_MC1HMA H"#%,$ B1$*2"'8H.C1!."3"..".,C1/40;2'(_8&8+/C1$0Z".C15&64"'8C15&6`"8%0%1". /'
( (b)(( &(0(,)(&"&0$("%$'(>/'
(f) &(0(,)(#V0*++(K(L'$*&L66( (i) &(0(,)#8!&)!.,)(/@$( ,*+%1f6( .$)#.200D( ((8/-+&/'$;(6l(

3. (a) ,%(+)(#)+40(#9$8)#"8"*#(1# $'?:##.$)#.200?:#2.!;2(/'381"$

(b)

%1". !"#$%& '(&,-".

52/%31$252%&252OQ"P

*$2,&2%#1*&,#92-"-;"#2%)

!"#$%& '(&,-".

G%--*++"" '(&,-".

>/,*#$ *$2$">#"+,#92%)

O

2#$%"&'()2G%--*++""S 22222',".$-,"$+&2!"#$%&2/%31$2!%$*+*%&2j>/#k2%&2,)',2G%--*++""( P 2#$%"&'()2G%--*++""S 22222',".$-,"$+&2!"#$%&2/%31$2!%$*+*%&2j$">k2%&2,)',"G%--*++""(

Exercise 14.3 1.

(a)

W",# 'GQ. G*+9 '(&,-".

(b)

52*&252/,12(((

!%=83,+*%& '(&#.

/,12>"&$8$2*& G*+9 '(&,-".

W",# 'GQ. XG"&$8$Y R,D"

(c)

!%=83,+*%& '(&#.

*$2%)

G*+9 '(&,-".

G"&$8$ R,D"

W",# 'GQ.

(d) (e)

:,$2*&

I prefer (a). How about you? XG*+9!%=83,+*%&Y G*+9 '(&,-".

!%=83,+*%& '(&#.

/,1 :,$2*&

This is worse.

W",# 'GQ.

!%=83,+*%& '(&#.

G%--*++"" '(&,-".

Information Modeling and Relational Databases: Answers (odd)–53 3.

I prefer the co-referenced version. How about you? Also the software size should more realistically have been measured in megabytes (MB) not megabits (Mb). "#$

4"3",$"J# B*t" 'C;M.

B%)+:,#"%1". fg0gS2gBgS2gVgh

{G, S, B}

Competing ( personName, sportEvent, [medalWon] ) (d)

I prefer the nested conceptual schema. How about you?

Information Modeling and Relational Databases: Answers (odd)–54 7.

(a)

A%8#B3%+ '1/G%1". B8;E">+ '(>%1".

5(2/,$23">+8#"2,+252*&2(((

4%%'(&#.

!"#$%!'()!*+#,,-./0!(.1!23!+#4!%1!#..(5#516!#7!,)181))16 !!!!!!!!!!"6(9%:1;:-.1$!5(!7%1".

(b) B8;E">+ '(>%1".

5(2/,$23">+8#"2,+252*&2(((

4%%'(&#.

*$2)%# *$2*&

4%%'(&#.

[">+8#" A%8#B3%+ '1/G%1".

9.

(a)

*$2,+ :*&$2P2*$2:%&2;9

G38; '(&,-".

≤2]

QD"&+ fj[*R/+:"*R/+kS '(&,-". 2jC*113":"*R/+kS 2jA",D9:"*R/+kh

*$2)*&,3*$+2*&

*$2$">%&12*&

(b)

*$2)*&,3*$+2*& G38; '(&,-".

≤2]

!3,>" '(&#.

52*&252R%+2(((

(c)

fj[*R/+:"*R/+kS 2jC*113":"*R/+kS 2jA",D9:"*R/+kh

QD"&+ '(&,-".

f`S2ih

XQD"&+e*&,3*$+2rY G38; '(&,-".

≤2]

fj[*R/+:"*R/+kS QD"&+ 2jC*113":"*R/+kS '(&,-". 2jA",D9:"*R/+kh

*$2)*&,3*$+2*&

R%+

!3,>" '(&#.

f`S2ih

Information Modeling and Relational Databases: Answers (odd)–55 9.

(d)

This solution assumes that if any results are recorded at all, then all the final results must be recorded (i.e. record all results of the completed competition or record no results). XQD"&+e*&,3*$+Y G38; '(&,-".

]

fj[*R/+:"*R/+kS QD"&+ 2jC*113":"*R/+kS '(&,-". 2jA",D9:"*R/+kh

*$2)*&,3*$+2*&

!3,>" '(&#.

R%+

(e) QD"&+ '(&,-".

fj[*R/+:"*R/+kS 2jC*113":"*R/+kS 2jA",D9:"*R/+kh

]

G38; '(&,-".

fj`kS2jikS2jnLkS2jnVkh

!3,>" '(&#.

fj`kS2jikS2jnLkS2jnVkh

52*&252R%+2(((

(f)

I prefer solution (e) to (d). How about you?

Exercise 14.4 1.

(a)

Q-=3%9"" '(&#.

8$"$

*$2%) !/%&"J#

≤2i

!/%&"+8#"# !"#$%& '(&#.

*$2,2$+81"&+ *$2,21#*D"#

5.

(a)

/,$2FU

Z;E">+ '(&,-".

/,$29U G%%#1*&,+"

/,$2tU

(b)

/,$2FU

Z;E">+ '(&,-".

/,$29U !%$*+*%&

G%%#1*&,+"

*$2,+ /,$2tU

(c)

LF*$+2/,$2,)&"-'.&2G%%#1*&,+"2-&,(

O

Note: The textual constraint is somewhat expensive to enforce.

Information Modeling and Relational Databases: Answers (odd)–57 Exercise 14.5 1.

(a)

["D"3 fjI0kS2j!0kh '(>%1". H"=,#+-"&+ '(>%1".

i

78,&+*+9

52,+252/,$2$+81"&+$2*&2(((

1111111]111111111111@LhC1-hA 0$)E%,$8#7$)$#+,@B1%1". H"=,#+-"&+ J,-"

*$2%)2P2/,$

H"=,#+-"&+ '(>%1".

i

78,&+*+9

52,+252/,$2$+81"&+$2*&2(((

@@@@@@@@@@@@8%>!&$:%,$1B1%&$($

1B1"45H.C1*&'(+&("1D

L+M#3%($

1B1"45H.C1*&'(+&("1D

For the -+$+ and $'+ '(&,-".

&""1$2,2]0[

*$2,+

X!#%E">+L+B*+"Y

2/,$ !#%R#,--*&R !#%E">+!

B*+" '(&,-". 8$"$ Z="#,+*&RB9$+"'(&,-".

|8&*%# !#%R#,--"#!

,3$%28$"$

!#%R#,--"# '"-=J#.

2/,$ B"&*%# !#%R#,--"#!

*$2%)

fj|8&*%#kS G3,$$ jB"&*%#kh '(&,-".

/,$

52@&%:$252,+2(((2O

!2'()2!#%R#,--*&R!#%E">+20-"'2!#%E">+ ,)',2&""1$2,2n0[2$%2&""1$2,2]0[( [,&R8,R" !2'()2|8&*%#!#%R#,--"#"0-"'2!#%R#,--"# '(&,-". 1)$2*$2%)2G3,$$2j|8&*%#k( !2'()2B"&*%#!#%R#,--"#"0-"'"!#%R#,--"# 1)$2*$2%)2G3,$$2jB"&*%#k( O 22'()2!#%R#,--"#2@&%:$2-$.&"[,&R8,R"2,+2["D"32jQF="#+k(

!#%R#,--"# J,-" ["D"3 '(&,-". fjQF="#+kS jJ%D*>"kh

Information Modeling and Relational Databases: Answers (odd)–59 3.

(c)

≠ ;&+2%3$0#$%@111B15.0E"$8C1/28"C1=+$*&//1Q1S_"'20.S 3

(b)1 The "#7/07$+ predicate in the original conceptual schema and its external uniqueness constraint fail to cater for programmers changing their class during a project. An unrealistic resolution would be to demand that the external constraint be enforced anyway (e.g. by changing one or both of the programmers, and only storing the current project team); but this would fail anyway if the external uniqueness is still applied after the project is over and a programmer on the project has his/her class changed. In realistic business practice, we would not change a programmer during a project anyway except in rare cases (e.g. demoted because of incompetence to work on the project). So the original conceptual schema needs to be changed. There are various options (e.g. delete the external uniqueness constraint, apply it only at the initial formation of a project team, or maintain history of project team membership). This change also would also require a change to the optimized schema. Exercise 14.6 1. (a) The Child column is not atomic. So the table is not even in 1NF. (b) The nonkey attribute is functionally dependent on just part of the key (person). hNF = 1. (c) Nonkey attributes depend on just part of the key (e.g. parent ! sexOfParent). hNF = 1. (d) Child attribute depends on only part of the key (tutorName). hNF = 3 (not 1, since child is part of the key). (e)

A)$+&7I,@B15"./0'H&4"C1/+=E"$8F02,&12*&+#,&$+*+*D"

Note: If Subject plays other mandatory, functional roles (as is likely in practice) the fact type :$;+/#( 0$8&-;$+( ,-.Q$8& should be mapped instead to a Subject table that stores functional facts for Subject.

Information Modeling and Relational Databases: Answers (odd)–60 3. (a) This solution uses employee numbers instead of names, and ignores history aspects such as trainees later becoming managers. + '(&,-". %&M#7#+,1B14(.M45H.C18.&2'""M45H.C15.0E"$8H&4"1D

Information Modeling and Relational Databases: Answers (odd)–61 Exercise 14.7 1.

0$)E%,$@B1/8+%1".

52:,$2,:,#1"1252;92((( L>,1"-*> 'Q-=J#.

H"R#"" '(>%1". W",# 'GQ.

≤2i

*$2:%#+/

B8;E">+ '(>%1".

G#"1*+ '(=%*&+$.

*$2,2$"&*%#23">+8#"#2*&

*$2,23">+8#"#2*&

H"=,#+-"&+ '(&,-".

52:,$2,:,#1"1252*&2((( *$2,2=#%)"$$%#2*&

(b) *$2%)2P2/,$

4,&@ fj[kS2jB[kS2j!kh '(>%1".

*$2+",>/"#`2%) :,$2,:,#1"1

H"R#"" '(>%1".

L>,1"-*> 'Q-=J#. XL:,#1Y

:,$2;9

B8;E">+ '(>%1".

*$2+",>/"#i2%)

:,$2*& :%#@$2)%#

I&*D"#$*+9 '(>%1".

1.

(c)

*$2:%#+/

W",# 'GQ.

@@@@@(G!&E1B1"45H.C1*;,*0$?VR$7"$cR$+-0&( ( $.(R$7"$cV8*;Y/@$0%@(K(R$7"$cR$+-0&V8*;Y/@$0%@( # #####+.8(R$7"$cV'*P*w"#$(K(R$7"$cR$+-0&V'*P*w"#$( ( (((((+.8(8;"&$;"/#(K(LE8/#/'=L( oo(%&'()*+(7*(%((8;"&$;"/#(K(LE8/#/'=L($%(8;"&$;"/#(!&#.200(

(d) ## ( ( ( (

&(0(,)(E'*;,*0$?V>*;(9$!.(>*;,*0$?V>/0/;(+&(>/0/;?( # # $.(>*;V8/0/;>/@$(K(>/0/;?V8/0/;>/@$( (((9$!.(>*;,*0$?V>/0/;(+&(>/0/;A( #$.(>/0/;?V8/0/;>/@$(K(>/0/;AV8/0/;>/@$( (((( (+.8(>/0/;?V*;,*0$AD>/0/;( 7*(%(#;$@%#&$#+"&=(!&#.$)#.200#+.8(P;$$#%#&$#+"&=(!&#.$)#.200#+.8#.0-$%#&$#+"&=(!&# .$)#.200# 1%$23#45#;$@%#&$#+"&=D(P;$$#%#&$#+"&=D(.0-$%#&$#+"&=( (*+6!.1(,$2.)=E:#F#?(6# 4(1!.# ( R*"+$;;/;(1LE*8)(R]B("#&$#+"&=(/0/;(!&#.2006( ( (((+.8(1]8/0/;V/0/;(K(LBL($%(B8/0/;V*;,*0$?V>*;( ( !.&(%)#!.)$(>*;,*0$AVR$7"$c( &(0(,)(R$7"$cV8*;Y/@$0%@D(R$7"$cV'*P*w"#$D(,*d$&=R$7"$cV;*&"#P(+&(+*d$&=R*&"#PD( #(E8/#/'=R$7"$cV;*&"#P(+&($8/#/'=R*&"#PD(:$;d/;'*#8$R$7"$cV;*&"#P(+&(*;,*0$?VR$7"$c(0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(,*d$&=R$7"$c( ##### #$.(R$7"$cV8*;Y/@$0%@(K(,*d$&=R$7"$cV8*;Y/@$0%@(+.8(R$7"$cV'*P*w"#$(K(,*d$&=R$7"$cV'*P*w"#$( ( (((((+.8(,*d$&=R$7"$cV8;"&$;"/#(K(L,*d$&=L( 0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(E8/#/'=R$7"$c( #$.(R$7"$cV8*;Y/@$0%@(K(E8/#/'=R$7"$cV8*;Y/@$0%@( ####(+.8(R$7"$cV'*P*w"#$(K(E8/#/'=R$7"$cV'*P*w"#$(+.8(E8/#/'=R$7"$cV8;"&$;"/#(K(LE8/#/'=L( 0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(:$;d/;'*#8$R$7"$c( #$.(R$7"$cV8*;Y/@$0%@(K(:$;d/;'*#8$R$7"$cV8*;Y/@$0%@( ####(+.8(R$7"$cV'*P*w"#$(K(:$;d/;'*#8$R$7"$cV'*P*w"#$(( #####+.8(:$;d/;'*#8$R$7"$cV8;"&$;"/#(K(L:$;d/;'*#8$L( 0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(,&=0$R$7"$c( #$.(R$7"$cV8*;Y/@$0%@(K(,&=0$R$7"$cV8*;Y/@$0%@(+.8(R$7"$cV'*P*w"#$(K(,&=0$R$7"$cV'*P*w"#$( ( ((((((+.8(,&=0$R$7"$cV8;"&$;"/#(K(L,&=0$L( ( !.&(%)#!.)$(>*;,*0$AV>-+&/'$;( &(0(,)(>-+&/'$;?V8-+&/'$;%@D(>-+&/'$;?V8-+&/'$;N*'$D(>-+&/'$;?V-+&/'$;AV*;,*0$?V>-+&/'$;(+&(>-+&/'$;A( (( ($.(>-+&/'$;?V8-+&/'$;%@(K(>-+&/'$;AV8-+&/'$;%@(+.8(>-+&/'$;?V-+&/'$;AV-+&/'$;?V-+&/'$;AV-+&/'$;AV*;,*0$AV>-+&/'$;( &(0(,)(>-+&/'$;?V8-+&/'$;%@D(>-+&/'$;?V8-+&/'$;N*'$D(>-+&/'$;?V-+&/'$;?(9$!.(>*;,*0$?V>-+&/'$;(+&(>-+&/'$;A( #$.(>-+&/'$;?V8-+&/'$;%@(K(>-+&/'$;AV8-+&/'$;%@( 7*(%((>-+&/'$;?V-+&/'$;AV-+&/'$;?V-+&/'$;AV-+&/'$;V8-+&/'$;%@D(>-+&/'$;V8-+&/'$;N*'$D(>-+&/'$;V*;,*0$?V,*0$( ( !.&(%)#!.)$(>*;,*0$AVe/;$"P#!*#P-*P$,I"00!$7$0( &(0(,)(GD(L#/7"8$L(+&(+I"00!$7$0(( "%$'(>*;,*0$?V!*#P-*P$N/7"8$( 2.!$.( &(0(,)(GD(L$J*;(9$!.(>*;,*0$AV>/0/;(( ( ( ( ( $.(>*;V8/0/;>/@$(K(>/0/;V8/0/;>/@$( ( ( ( ( (((+.8(;$@%#&$#+"&=(K(P;$$#%#&$#+"&=( ((((9$!.(>*;,*0$AV>*;Y/@$0( ( ( ( ( $.(>*;V8*;Y/@$0%@(K(>*;Y/@$0V8*;Y/@$0%@(

Information Modeling and Relational Databases: Answers (odd)–68 Exercise 15.7 1. (a) -,@"2 >,;*&"+

,>l8*#"2 -,+"#*,3$

>8+2+%2 3,9%8+

3,92%8+

,$$"-;3"

)*&*$/

$,:

$"3">+2 =3,&

R"+2:%%1

-",$8#"

-,#@

#83"#

#83"#S2="&>*3

)*+2E%*&+$

>/">@2)*+

R38"

$,&1

=,*&+

R38"

$,&1=,="#

=,*&+

,1E8$+2)*+ >/*$"3S2$,&1=,="#

(b)

The resources that appear to be appropriate are marked on the diagram above. Hmmm – we don’t seem to have any use for the screwdriver.

(c)1

Some resources are consumed by activities. Examples in this case would be glue, sandpaper and paint. We would have to monitor the consumption of these and replenish at frequent intervals. Other resources need to be there, but are not consumed by the activities (except in a microscopic way). Examples in this case are saw, ruler, chisel.

(d)1

The process should be suspended after gluing and before finishing to give the glue time to set. Also, note that the process cannot be considered complete until the paint has dried, even though there are no subsequent activities

(e)1

The activities “layout” and “cut to layout” will be required for each part. The activity “assemble“ will be required for each set of joining parts. We can't predict in advance how many instances of these activities there will be (why?). The activities “acquire materials” and “finish” would probably only occur once per process instance. (Given sufficient resources we could also have multiple instances of the whole “make cabinet” process active simultaneously.)

(f)1

This is a trivial example, but it reveals many of the features of real business process design -1 we start from a business description -1 we break the process down into activities that we can define in a straightforward way, usually a hierarchical breakdown -1 we associate resource types with each activity -1 defining the process may make us realize that we need to define or refine other elements of our business model "1 other processes (such as replenish glue, paint and sandpaper) "1 other types of element (such as rules to specify the fit of the joints) "1 more data (e.g., the properties of the wood) that might be required by the process -1 note that the structure is not sufficient to completely define the process (e.g., think about the “cut to layout” and “assemble” activities).

Information Modeling and Relational Databases: Answers (odd)–69 3. (a) Although the state model is consistent with the description given, the state does not seem to be very sensible – we could predict a rapid melt-down of the hair dryer under these conditions! Problems of this kind could be caused by sloppy specification or a genuine design flaw. An information analyst has the responsibility to identify such issues and to facilitate their resolution. (b)

A composite diagram would resemble the following.

A,*#1#9"#

B?`UI=

B?`UI=

%))

$3%:

),$+

B?`UH%:&

e,&

B?`UH%:&

B?iUH%:&

>%%3

(c)1

/%+ B?iUI=

A",+

A composite diagram with the “Swirl” control would resemble the following. A,*#1#9"#

B?`UI=

%))

B?`UI=

$3%: B?`UH%:&

e,&

),$+ B?`UH%:&

B?iUH%:&

>%%3

/%+ B?iUI=

A",+

B?nUI=

%)) B:*#3

(d)1

B?nUI=

-"1*8B?nUH%:&

/*R/ B?nUH%:&

Without composite states we are faced with a potential explosion of replication. In this case, we would need the equivalent of three copies of the original six-state diagram; one copy for each of the “swirl” positions. In realistic scenarios, with many attendant variables, state diagrams quickly become unmanageable if composite states are not used.

5. The two workflows are equivalent. The workflow on the left contains arbitrary cycles, so, for example, it’s possible to jump into the middle of a looping construct. In general, arbitrary loops can be converted to a block structured form, though this may take a little thought. The workflow on the right includes some auxiliary variables (y and z) that are specified in terms of original variables w and x. The main loop (a block) is controlled by z – one of the auxiliary variables. This kind of transformation may be necessary when dealing with languages that are purely block structured.

Information Modeling and Relational Databases: Answers (odd)–70 Exercise 16.8 1.

This allows creation of a table before adding columns.

*$2-,&1,+%#9

!%$*+*%& '(&#.

/,$ G%38-&

G%38-&J,-" /,$ %1". fj`kS2j&kh fjakS2j`kS2j&kh /,$2-,F*-8-U

L++#*;8+"Z#L$$%>*,+*%&Q&1 '(*1.

S

L$$%>*,+*%&4",1*&R

4%3"J,-" *$2%)2P2/,$

/,$

L++#*;8+"J,-"

/,$ /,$2P2*$2%) ≥]

L$$%>*,+*%& '(&#.

L$$%>*,+*%&Q&1 *$2=3,9"12;9

#",1$2)#%V*&,#9L$$%>*,+*%&!

G3,$$ '(&,-".

$=,&$

O

B8;>3,$$G%&$+#,*&+ '(&#.

≥]

/,$2P2*$2%)

fj=8;3*>kS2j=#*D,+"kS 22j=#%+">+"1kS2j=,>@,R"kh

N$8="#>3,$$O *$2,2$8;>3,$$2%)

*$2%) O2#$%"&'()2B8;>3,$$G%&$+#,*&+S

2222&'()2$8;>3,$$G%&&">+*%&2/,$2,)&"-'.&2$8="#>3,$$(

G%&$+#,*&+%-=3"+"kh

5. B+,+" '(&,-".

S2e,>+2+9="2#",1*&R$2'>3,$$2&,-"$2_2,$$%>*,+*%&2#",1*&R.2,#"28&*l8"(

*$2$+,#+*&R2O *$2,>>"=+*&R

L>+*%& '(&,-".

52>/,&R"$252+%2(((

O"

R,".$-,"$+&2B+,+"2*$2$+,#+*&R(

Note: A completed transition graph has additional constraints: (

( (

(

(

(

\*$*;*3*+9 '(&,-".

XB8;>3,$$G%&&">+*%&2rY

!2'()2V*&,#9L$$%>*,+*%&20-"'+2L$$%>*,+*%& 2"",)',2/,$2&K'(,=52i2L$$%>*,+*%&Q&1(

4$*%&@7)1$?$>%7@!&%@!77%&$%EP

/,$ L++#*;8+"

P

G)#0(+&)#$.((,&*&$("+(+&*;&"#PV( G)#0(+&)#$.((,&*&$("+(*88$