File notes/fig/er/accident.tex added (mode: 100644) (index 0000000..ea306b2) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=7em] |
|
5 |
|
\node[entity] (person) {Person}; |
|
6 |
|
\node[attribute] (pid) [left of=person] {\key{id}} edge (person); |
|
7 |
|
\node[attribute] (name) [above left of=person] {Name} edge (person); |
|
8 |
|
\node[attribute] (address) [below left of=person] {address} edge (person); |
|
9 |
|
|
|
10 |
|
\node[relationship] (owns) [above right of=person] {Owns} edge node[above, sloped]{$M$} (person); |
|
11 |
|
\node[entity] (car) [above right of=owns] {Car} edge node[above, sloped]{$N$} (owns); |
|
12 |
|
\node[attribute] (licence) [above left of=car] {\key{licence}} edge (car); |
|
13 |
|
\node[attribute] (model) [above of =car] {model} edge (car); |
|
14 |
|
\node[attribute] (year) [above right of =car] {year} edge (car); |
|
15 |
|
|
|
16 |
|
\node[relationship] (accident) [right = 5cm of person] {Accident} edge[total] node[above, sloped]{$M$} (person); |
|
17 |
|
\node[attribute] (report_number) [below of = accident] {\key{Report Number}} edge (accident); |
|
18 |
|
\node[attribute] (time) [right of = accident] {Time} edge (accident); |
|
19 |
|
\node[attribute] (place) [below right of = accident] {Place} edge (accident); |
|
20 |
|
\node[attribute] (damage_amount) [above right of = accident] {Damage\_Amount} edge (accident); |
|
21 |
|
|
|
22 |
|
\draw (car) edge[total] node[above, sloped]{$N$} (accident); |
|
23 |
|
\end{tikzpicture} |
|
24 |
|
|
|
25 |
|
\end{document} |
File notes/fig/er/alt_Not_03.tex added (mode: 100644) (index 0000000..0cddaad) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=5em] |
|
5 |
|
% Above |
|
6 |
|
\node (A) {}; |
|
7 |
|
\node [relationship] (R) [right=of A] {} edge node[above]{$1$} (A); |
|
8 |
|
\node (B) [right = of R] {} edge node[above]{$\cN$} (R); |
|
9 |
|
|
|
10 |
|
\node (ar) [right of = B] {\(\Rightarrow\)}; |
|
11 |
|
|
|
12 |
|
\node (A1) [right of = ar] {}; |
|
13 |
|
\node [relationship] (R1) [right=of A1] {} edge node[above]{$(0, \cN)$} (A1); |
|
14 |
|
\node (B1) [right = of R1] {} edge node[above]{$(0,1)$} (R1); |
|
15 |
|
|
|
16 |
|
% Middle |
|
17 |
|
\node (A2) [below of = A] {}; |
|
18 |
|
\node [relationship] (R2) [right=of A2] {} edge[total] node[above]{$1$} (A2); |
|
19 |
|
\node (B2) [right = of R2] {} edge node[above]{$\cN$} (R2); |
|
20 |
|
|
|
21 |
|
\node (ar1) [right of = B2] {\(\Rightarrow\)}; |
|
22 |
|
|
|
23 |
|
\node (A21) [right of = ar1] {}; |
|
24 |
|
\node [relationship] (R21) [right=of A21] {} edge node[above]{$(1, \cN)$} (A21); |
|
25 |
|
\node (B21) [right = of R21] {} edge node[above]{$(0,1)$} (R21); |
|
26 |
|
|
|
27 |
|
% Below |
|
28 |
|
\node (A3) [below of = A2] {}; |
|
29 |
|
\node [relationship] (R3) [right=of A3] {} edge[total] node[above]{$\cM$} (A3); |
|
30 |
|
\node (B3) [right = of R3] {} edge[total] node[above]{$\cN$} (R3); |
|
31 |
|
|
|
32 |
|
\node (ar2) [right of = B3] {\(\Rightarrow\)}; |
|
33 |
|
|
|
34 |
|
\node (A5) [right of = ar2] {}; |
|
35 |
|
\node [relationship] (R5) [right=of A5] {} edge node[above]{$(1, \cN)$} (A5); |
|
36 |
|
\node (B5) [right = of R5] {} edge node[above]{$(1, \cM)$} (R5); |
|
37 |
|
\end{tikzpicture} |
|
38 |
|
|
|
39 |
|
\end{document} |
File notes/fig/er/award.tex added (mode: 100644) (index 0000000..fc876ea) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=1.5cm] |
|
5 |
|
\node[entity] (INSTITUTION) {INSTITUTION}; |
|
6 |
|
\node[attribute] [above of=INSTITUTION] {\key{Name}} edge (INSTITUTION); |
|
7 |
|
\node[attribute] [right = .5cm of INSTITUTION] {Phone} edge (INSTITUTION); |
|
8 |
|
\node[attribute] (Address) [below = .5cm of INSTITUTION] {Address} edge (INSTITUTION); |
|
9 |
|
\node[attribute] [left = .5cm of Address] {Street} edge (Address); |
|
10 |
|
\node[attribute] [below = .5cm of Address] {Zip} edge (Address); |
|
11 |
|
\node[attribute] [below left = .5cm of Address] {City} edge (Address); |
|
12 |
|
\node[attribute] (Location) [below right = .5cm of Address] {Location} edge (Address); |
|
13 |
|
\node[attribute] [below = .5cm of Location] {Country} edge (Location); |
|
14 |
|
\node[attribute] [below right = .5cm of Location] {State} edge (Location); |
|
15 |
|
\node[derived attribute] [right = .5cm of Location] {Code} edge (Location); |
|
16 |
|
% |
|
17 |
|
\node[relationship] (AWARDEDTO) [left = 1.5cm of INSTITUTION] {AWARDED\_TO} edge node[above, pos=0.4] {$\cN$} (INSTITUTION); |
|
18 |
|
% |
|
19 |
|
\node[entity] (AWARD) [left = 1.5cm of AWARDEDTO] {AWARD} edge[total] node[above, pos=0.6]{$\cM$} (AWARDEDTO); |
|
20 |
|
\node[attribute] [below right = .5cm and .5cm of AWARD] {Title} edge (AWARD); |
|
21 |
|
\node[attribute] [left = .5cm of AWARD] {Amount} edge (AWARD); |
|
22 |
|
\node[attribute] (Period) [below left = .5cm of AWARD] {Period} edge (AWARD); |
|
23 |
|
\node[attribute] [below left = .5cm of Period] {Start} edge (Period); |
|
24 |
|
\node[attribute] [below = .5cm of Period] {End} edge (Period); |
|
25 |
|
\node[attribute] [above right of = AWARD] {\key{id}} edge (AWARD); |
|
26 |
|
\node[attribute] [above = 1cm of AWARD] {Program Officier} edge (AWARD); |
|
27 |
|
% |
|
28 |
|
% \node[relationship] (EMPLOYS) [below =0.8cm of INSTITUTION] {EMPLOYS} edge node[right, pos=0.4] {$\cN$} (INSTITUTION); |
|
29 |
|
% |
|
30 |
|
\node[entity] (RESEARCHER) [below = 5cm of AWARD] {RESEARCHER}; |
|
31 |
|
|
|
32 |
|
\node[attribute] (Name) [left = 0.5cm of RESEARCHER] {Name} edge (RESEARCHER); |
|
33 |
|
\node[attribute] [above left = 0.5cm and 0.5cm of Name] {First Name} edge (Name); |
|
34 |
|
\node[attribute] [below left = 0.5cm of Name] {Last Name} edge (Name); |
|
35 |
|
\node[attribute] [below = 0.5cm of RESEARCHER] {\key{email}} edge (RESEARCHER); |
|
36 |
|
|
|
37 |
|
\node[relationship] (CONDUCTEDBY) [below = 1 cm of AWARD] {CONDUCTED\_BY} edge[total] node[right, pos=0.4] {$\cM$} (AWARD) edge node[left]{$\cN$} (RESEARCHER); |
|
38 |
|
\node[attribute] [right = .5cm of CONDUCTEDBY] {Role} edge (CONDUCTEDBY); |
|
39 |
|
|
|
40 |
|
\node[attribute] (RePeriod) [right = .5cm of RESEARCHER] {Period} edge (RESEARCHER); |
|
41 |
|
\node[attribute] [above right = .5cm of RePeriod] {Start} edge (RePeriod); |
|
42 |
|
\node[attribute] [below right = .5cm of RePeriod] {End} edge (RePeriod); |
|
43 |
|
|
|
44 |
|
\node[entity] (ORGANIZATION) [left = 3cm of AWARD] {ORGANIZATION}; |
|
45 |
|
\node[attribute] [below = .5cm of ORGANIZATION] {Code} edge (ORGANIZATION); |
|
46 |
|
|
|
47 |
|
\node[relationship] (GRANTS) [above left = 1cm and 1.5cm of AWARD] {GRANTS} edge node[above]{$1$} (ORGANIZATION) edge[total] node[above right]{$\cM$}(AWARD); |
|
48 |
|
|
|
49 |
|
\node[entity] (DIRECTORATE) [left = 1.5cm of ORGANIZATION] {DIRECTORATE}; |
|
50 |
|
|
|
51 |
|
\node[attribute] [below right = .5cm and 0 of DIRECTORATE] {Name} edge (DIRECTORATE); |
|
52 |
|
\node[attribute] [below left = .5cm and 0cm of DIRECTORATE] {Abbreviation} edge (DIRECTORATE); |
|
53 |
|
\node[attribute] [below = 1.3cm of DIRECTORATE] {Assistant Director} edge (DIRECTORATE); |
|
54 |
|
|
|
55 |
|
|
|
56 |
|
\node[relationship] (BELONG1) [above left = 1cm and 0cm of ORGANIZATION] {BELONGS\_TO} edge node[above]{$\cN$} (ORGANIZATION) edge node[above =0.2cm]{$\cM$}(DIRECTORATE); |
|
57 |
|
|
|
58 |
|
\node[entity] (DIVISION) [left = 1.5cm of DIRECTORATE] {DIVISION}; |
|
59 |
|
|
|
60 |
|
\node[attribute] [left = .5cm of DIVISION] {Name} edge (DIVISION); |
|
61 |
|
\node[attribute] [below left = 1cm of DIVISION] {Abbreviation} edge (DIVISION); |
|
62 |
|
|
|
63 |
|
\node[relationship] (BELONG2) [above left = 1cm and 0cm of DIRECTORATE] {BELONGS\_TO} edge node[above]{$1$} (DIRECTORATE) edge[total] node[above=0.2cm ]{$\cM$}(DIVISION); |
|
64 |
|
\end{tikzpicture} |
|
65 |
|
|
|
66 |
|
\end{document} |
File notes/fig/er/bad_design.tex added (mode: 100644) (index 0000000..93f742d) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=2em] |
|
5 |
|
\node[entity] (people) {PEOPLE}; |
|
6 |
|
\node[relationship] (has) [right=of people] {HAS} edge (people); |
|
7 |
|
\node[entity] (job) [right = of has] {JOB} edge (has); |
|
8 |
|
\node[relationship] (in) [above=of job] {IN} edge (job); |
|
9 |
|
\node[entity] (employer) [above=of in] {EMPLOYER} edge (in); |
|
10 |
|
|
|
11 |
|
\draw [->, >=latex] (has)+(0, -1) -- ++(0, -2); |
|
12 |
|
|
|
13 |
|
\node[entity] (person) [below right = 6.5 and -2.5 of people] {PERSON}; |
|
14 |
|
\node[relationship] (occupies) [right=of person] {OCCUPIES} edge (person); |
|
15 |
|
\node[entity] (position) [right = of occupies] {POSITION} edge (occupies); |
|
16 |
|
\node[relationship] (offers) [above=of position] {OFFERS} edge (position); |
|
17 |
|
\node[entity] (company) [above=of offers] {COMPANY} edge (offers); |
|
18 |
|
\end{tikzpicture} |
|
19 |
|
|
|
20 |
|
\end{document} |
File notes/fig/er/bike.tex added (mode: 100644) (index 0000000..5df1fda) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=1.5cm] |
|
5 |
|
\node[entity] (CUSTOMER) {CUSTOMER}; |
|
6 |
|
\node[attribute] [above of=CUSTOMER] {\key{Name}} edge (CUSTOMER); |
|
7 |
|
\node[attribute] [right = .5cm of CUSTOMER] {Phone} edge (CUSTOMER); |
|
8 |
|
% |
|
9 |
|
\node[ident relationship] (DROPPEDBY) [left = 1.5cm of CUSTOMER] {DROPPED\_BY} edge node[above, pos=0.4] {$1$} (CUSTOMER); |
|
10 |
|
% |
|
11 |
|
\node[weak entity] (BIKE) [left = 1.5cm of DROPPEDBY] {BIKE} edge[total] node[above, pos=0.6]{$\cM$} (DROPPEDBY); |
|
12 |
|
\node[attribute] [above of = BIKE] {\pkey{Dropped\_Time\_Date}} edge (BIKE); |
|
13 |
|
\node[attribute] (Description) [left = 0.5cm of BIKE] {Description} edge (BIKE); |
|
14 |
|
\node[attribute] [above left of = Description] {Color} edge (Description); |
|
15 |
|
\node[attribute] [below left of = Description] {Brand} edge (Description); |
|
16 |
|
% |
|
17 |
|
\node[relationship] (ASSIGNEDTO) [below =1cm of CUSTOMER] {ASSIGNED\_TO} edge [total] node[right, pos=0.4] {$\cM$} (CUSTOMER); |
|
18 |
|
\node[attribute] [right = .5cm of ASSIGNEDTO] {Level\_Of\_Satisfaction} edge (ASSIGNEDTO); |
|
19 |
|
% |
|
20 |
|
\node[entity] (EMPLOYEE) [below = 5cm of CUSTOMER] {EMPLOYEE} edge node[right, pos=0.4] {$1$} (ASSIGNEDTO); |
|
21 |
|
\node[attribute] [right = .5cm of EMPLOYEE] {\key{Name}} edge (EMPLOYEE); |
|
22 |
|
\node[multi attribute] [below = .5cm of EMPLOYEE] {Specialty} edge (EMPLOYEE); |
|
23 |
|
% |
|
24 |
|
\node[relationship] (REPAIREDBY) [below right =3cm of BIKE] {REPAIRED\_BY} edge node[below, pos=0.6] {$\cM$} (BIKE) edge node[below, pos=0.6] {$1$} (EMPLOYEE); |
|
25 |
|
|
|
26 |
|
|
|
27 |
|
%\node[entity] (CUSTOMER) {CUSTOMER}; |
|
28 |
|
% |
|
29 |
|
% |
|
30 |
|
% |
|
31 |
|
%\node[relationship] (SPEAKS) [below right of=CUSTOMER] {SPEAKS} edge node[right, pos=0.4] {$M$} (CUSTOMER); |
|
32 |
|
%\node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); |
|
33 |
|
%\node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); |
|
34 |
|
%\node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); |
|
35 |
|
% |
|
36 |
|
%\node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; |
|
37 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); |
|
38 |
|
%\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); |
|
39 |
|
% |
|
40 |
|
% |
|
41 |
|
%\node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); |
|
42 |
|
|
|
43 |
|
% |
|
44 |
|
%\node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; |
|
45 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); |
|
46 |
|
%\draw (anthem) to node[right, pos=0.6] {$M$} (WIN); |
|
47 |
|
|
|
48 |
|
\end{tikzpicture} |
|
49 |
|
|
|
50 |
|
\end{document} |
File notes/fig/er/car_info.tex added (mode: 100644) (index 0000000..84ac4fb) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=8em] |
|
5 |
|
\node[entity] (person) {PERSON}; |
|
6 |
|
\node[attribute] (pid) [left of=person] {\key{ID}} edge (person); |
|
7 |
|
\node[attribute] (name) [above left of=person] {Name} edge (person); |
|
8 |
|
\node[multi attribute] (phone) [above of=person] {Phone} edge (person); |
|
9 |
|
\node[attribute] (address) [above right of=person] {Address} edge (person); |
|
10 |
|
\node[attribute] (street) [above right of=address] {Street} edge (address); |
|
11 |
|
\node[attribute] (city) [right of=address] {City} edge (address); |
|
12 |
|
%\node[derived attribute] (age) [right of=person] {Age} edge (person); |
|
13 |
|
|
|
14 |
|
\node[relationship] (drives) [below right of=person] {DRIVES} edge node[above, pos=0.1] {$1$} (person); |
|
15 |
|
\node[entity] (car) [below left of=drives] {CAR} edge node[above, pos=0.7] {$1$} (drives); |
|
16 |
|
\node[attribute] (make) [left of=car] {Make} edge (car); |
|
17 |
|
\node[attribute] (year) [below left of =car] {Year} edge (car); |
|
18 |
|
\node[attribute] (brand) [below of =car] {Brand} edge (car); |
|
19 |
|
|
|
20 |
|
\node[relationship] (seats) [below left of=person] {SEATS\_IN} edge node[above, pos=0.1] {$N$} (person); |
|
21 |
|
\draw (seats) edge node[above, pos=0.3] {$1$} (car); |
|
22 |
|
\node[attribute] (position) [left of=seats] {Position} edge (seats); |
|
23 |
|
|
|
24 |
|
\node[ident relationship] (insured) [right of=car] {INSURED} edge node[above, pos=0.3] {$1$} (car); |
|
25 |
|
\node[weak entity] (insurance) [right = 1cm of insured] {CAR\_INSURANCE} edge[total] node[above, pos=0.7] {$N$} (insured); |
|
26 |
|
\node[attribute] (amount) [above of =insurance] {Covered Amount} edge (insurance); |
|
27 |
|
\node[attribute] (policy) [above right of =insurance] {Policy Number} edge (insurance); |
|
28 |
|
\node[attribute] (company) [below right of =insurance] {Company Name} edge (insurance); |
|
29 |
|
\end{tikzpicture} |
|
30 |
|
|
|
31 |
|
\end{document} |
File notes/fig/er/country.tex added (mode: 100644) (index 0000000..8e99496) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=8em] |
|
5 |
|
\node[entity] (COUNTRY) {COUNTRY}; |
|
6 |
|
\node[attribute] (name) [left of=COUNTRY] {\key{Name}} edge (COUNTRY); |
|
7 |
|
\node[attribute] (population) [below left of=COUNTRY] {Population} edge (COUNTRY); |
|
8 |
|
|
|
9 |
|
\node[relationship] (SPEAKS) [below right of=COUNTRY] {SPEAKS} edge node[right, pos=0.4] {$M$} (COUNTRY); |
|
10 |
|
\node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); |
|
11 |
|
\node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); |
|
12 |
|
\node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); |
|
13 |
|
|
|
14 |
|
\node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; |
|
15 |
|
\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); |
|
16 |
|
\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); |
|
17 |
|
|
|
18 |
|
%\node[relationship] (boundary) [above of = COUNTRY] {S\_B\_W}; |
|
19 |
|
%\draw (COUNTRY) to node[left, pos=0.6] {$N$} (boundary.west); |
|
20 |
|
%\draw (COUNTRY) to node[right, pos=0.6] {$M$} (boundary.east); |
|
21 |
|
|
|
22 |
|
%\node[relationship] (conversion) [below of =LANGUAGE] {CONVERSION}; |
|
23 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (conversion.west); |
|
24 |
|
%\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (conversion.east); |
|
25 |
|
|
|
26 |
|
%\node[attribute] (timestamp) [below left of=conversion] {\key{Timestamp}} edge (conversion); |
|
27 |
|
%\node[attribute] (rate) [below right of=conversion] {Exchange\_rate} edge (conversion); |
|
28 |
|
|
|
29 |
|
\node[ident relationship] (hasfor) [right of=COUNTRY] {SINGS} edge node[above, pos=0.4] {$1$} (COUNTRY); |
|
30 |
|
\node[weak entity] (anthem) %[right of=hasfor] |
|
31 |
|
[right = 1cm of hasfor] {NATIONAL\_ANTHEM} edge[total] node[above, pos=0.6]{$M$} (hasfor); |
|
32 |
|
\node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); |
|
33 |
|
\node[attribute] (name) [below right of = anthem] {\pkey{Name}} edge (anthem); |
|
34 |
|
|
|
35 |
|
\node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; |
|
36 |
|
\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); |
|
37 |
|
\draw (anthem) to node[right, pos=0.6] {$M$} (WIN); |
|
38 |
|
\end{tikzpicture} |
|
39 |
|
|
|
40 |
|
\end{document} |
File notes/fig/er/customers.tex added (mode: 100644) (index 0000000..e9845ea) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=1.5cm] |
|
5 |
|
\node[entity] (CUSTOMER) {CUSTOMER}; |
|
6 |
|
\node[attribute] [above of=CUSTOMER] {Name} edge (CUSTOMER); |
|
7 |
|
\node[attribute] [right = .5cm of CUSTOMER] {\key{ID}} edge (CUSTOMER); |
|
8 |
|
\node[attribute] [below of=CUSTOMER] {Address} edge (CUSTOMER); |
|
9 |
|
% |
|
10 |
|
\node[ident relationship] (PASSEDBY) [left = 1.5cm of CUSTOMER] {PASSED\_BY} edge node[above, pos=0.4] {$1$} (CUSTOMER); |
|
11 |
|
\node[attribute] [above = .5cm of PASSEDBY] {DateTime} edge (PASSEDBY); |
|
12 |
|
% |
|
13 |
|
\node[weak entity] (ORDER) [left = 1.5cm of PASSEDBY] {ORDER} edge[total] node[above, pos=0.6]{$\cM$} (PASSEDBY); |
|
14 |
|
\node[attribute] [above of = ORDER] {\pkey{ID}} edge (ORDER); |
|
15 |
|
% |
|
16 |
|
\node[entity] (PRODUCT) [below = 4cm of ORDER] {PRODUCT};% edge node[right, pos=0.4] {$1$} (ASSIGNEDTO); |
|
17 |
|
\node[attribute] [above left = .5cm of PRODUCT] {\key{ID}} edge (PRODUCT); |
|
18 |
|
\node[attribute] [left = .5cm of PRODUCT] {Brand} edge (PRODUCT); |
|
19 |
|
\node[attribute] [right = .5cm of PRODUCT] {Price} edge (PRODUCT); |
|
20 |
|
\node[attribute] [below left = .5cm of PRODUCT] {Caution} edge (PRODUCT); |
|
21 |
|
\node[attribute] [below right = .5cm of PRODUCT] {Material} edge (PRODUCT); |
|
22 |
|
\node[attribute] [below = .7cm of PRODUCT] {Description} edge (PRODUCT); |
|
23 |
|
% |
|
24 |
|
\node[relationship] (CONTAINS) [below=1cm of ORDER] {CONTAINS} edge [total] node[right, pos=0.6] {$\cM$} (ORDER) edge node[right, pos=0.6] {$1$} (PRODUCT); |
|
25 |
|
\node[attribute] [right = .5cm of CONTAINS] {Quantity} edge (CONTAINS); |
|
26 |
|
\end{tikzpicture} |
|
27 |
|
|
|
28 |
|
\end{document} |
File notes/fig/er/entity_instructor.tex added (mode: 100644) (index 0000000..565c498) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=7em] |
|
5 |
|
\node[entity] (entity) {INSTRUCTOR}; |
|
6 |
|
\node[attribute] (pid) [left = 2em of entity] {\key{Login}} edge (entity); |
|
7 |
|
\node[attribute] (name) [above left of=entity] {Position Title} edge (entity); |
|
8 |
|
\node[attribute] (name) [above =5em of entity] {Name} edge (entity); |
|
9 |
|
\node[attribute] (fname) [above left of = name] {First Name} edge (name); |
|
10 |
|
\node[attribute] (lname) [above right of = name] {Last Name} edge (name); |
|
11 |
|
\node[multi attribute] (mname) [above of = name] {Middle Name} edge (name); |
|
12 |
|
\node[multi attribute] (phone) [right =2em of entity] {Phone} edge (entity); |
|
13 |
|
\node[attribute] (address) [below =1em of entity] {Location} edge (entity); |
|
14 |
|
\node[attribute] (street) [below right of=address] {Room \#} edge (address); |
|
15 |
|
\node[attribute] (city) [below left of=address] {Building} edge (address); |
|
16 |
|
\node[derived attribute] (age) [above right of=entity] {Tenured} edge (entity); |
|
17 |
|
|
|
18 |
|
\end{tikzpicture} |
|
19 |
|
|
|
20 |
|
\end{document} |
File notes/fig/er/job.tex added (mode: 100644) (index 0000000..45ae464) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=1.5cm] |
|
5 |
|
\node[entity] (COMPANY) {COMPANY}; |
|
6 |
|
\node[attribute] [above of=COMPANY] {\key{Name}} edge (COMPANY); |
|
7 |
|
\node[attribute] (Address) [right = .5cm of COMPANY] {Address} edge (COMPANY); |
|
8 |
|
\node[attribute] [right = .5cm of Address] {Physical} edge (Address); |
|
9 |
|
\node[attribute] [below right = .5cm of Address] {Numerical} edge (Address); |
|
10 |
|
\node[multi attribute] [above right = .5cm of COMPANY] {Benefits} edge (COMPANY); |
|
11 |
|
% |
|
12 |
|
\node[relationship] (ADVERTISEDBY) [left = 1.5cm of COMPANY] {ADVERTISED\_BY} edge node[above, pos=0.4] {$\c1$} (COMPANY); |
|
13 |
|
\node[attribute] [above = .3cm of ADVERTISEDBY] {URL} edge (ADVERTISEDBY); |
|
14 |
|
% |
|
15 |
|
\node[entity] (JOBAD) [left = 1.5cm of ADVERTISEDBY] {JOB\_AD} edge[total] node[above, pos=0.6]{$\cM$} (ADVERTISEDBY); |
|
16 |
|
\node[attribute] [above left of = JOBAD] {Title} edge (JOBAD); |
|
17 |
|
\node[attribute] [left = .5cm of JOBAD] {Salary Range} edge (JOBAD); |
|
18 |
|
\node[multi attribute] [below left = .5cm of JOBAD] {Requirement} edge (JOBAD); |
|
19 |
|
\node[attribute] [above right of = JOBAD] {\key{id}} edge (JOBAD); |
|
20 |
|
% |
|
21 |
|
\node[relationship] (EMPLOYS) [below =0.8cm of COMPANY] {EMPLOYS} edge node[right, pos=0.4] {$\cN$} (COMPANY); |
|
22 |
|
% |
|
23 |
|
\node[entity] (CONTACT) [below left = 3cm and 2cm of COMPANY] {CONTACT} edge node[above, pos=0.4] {$\cM$} (EMPLOYS); |
|
24 |
|
\node[attribute] [right = .5cm of CONTACT] {Name} edge (CONTACT); |
|
25 |
|
\node[attribute] [below right = .5cm and .2cm of CONTACT] {\key{Id}} edge (CONTACT); |
|
26 |
|
\node[attribute] [below = .5cm of CONTACT] {Role} edge (CONTACT); |
|
27 |
|
% |
|
28 |
|
\node[relationship] (DISCUSSED) [below right = 0.8cm and 1cm of JOBAD] {DISCUSSED\_BY} edge node[right, pos=0.4] {$\cN$} (CONTACT) edge node[above, pos=0.4] {$\cM$} (JOBAD); |
|
29 |
|
% \node[relationship] (REPAIREDBY) [below right =3cm of JOBAD] {REPAIRED\_BY} edge node[below, pos=0.6] {$\cM$} (JOBAD) edge node[below, pos=0.6] {$1$} (CONTACT); |
|
30 |
|
% |
|
31 |
|
|
|
32 |
|
\node[weak entity] (OFFER) [below = 5cm of JOBAD] {OFFER}; |
|
33 |
|
|
|
34 |
|
\node[attribute] [left = 0.5cm of OFFER] {Salary Offered} edge (OFFER); |
|
35 |
|
\node[attribute] [below left = 0.5cm of OFFER] {Start Date} edge (OFFER); |
|
36 |
|
|
|
37 |
|
\node[ident relationship] (RESULTEDIN) [below = 1 cm of JOBAD] {RESULTED\_IN} edge node[right, pos=0.4] {$1$} (JOBAD) edge[total] node[left]{$1$} (OFFER); |
|
38 |
|
|
|
39 |
|
\node[attribute] [below of = OFFER] {\pkey{Date}} edge (OFFER); |
|
40 |
|
|
|
41 |
|
%\node[entity] (COMPANY) {COMPANY}; |
|
42 |
|
% |
|
43 |
|
% |
|
44 |
|
% |
|
45 |
|
%\node[relationship] (SPEAKS) [below right of=COMPANY] {SPEAKS} edge node[right, pos=0.4] {$M$} (COMPANY); |
|
46 |
|
%\node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); |
|
47 |
|
%\node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); |
|
48 |
|
%\node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); |
|
49 |
|
% |
|
50 |
|
%\node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; |
|
51 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); |
|
52 |
|
%\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); |
|
53 |
|
% |
|
54 |
|
% |
|
55 |
|
%\node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); |
|
56 |
|
|
|
57 |
|
% |
|
58 |
|
%\node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; |
|
59 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); |
|
60 |
|
%\draw (anthem) to node[right, pos=0.6] {$M$} (WIN); |
|
61 |
|
|
|
62 |
|
\end{tikzpicture} |
|
63 |
|
|
|
64 |
|
\end{document} |
File notes/fig/er/library.tex added (mode: 100644) (index 0000000..217b341) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=1.5cm] |
|
5 |
|
\node[entity] (COPY) {COPY}; |
|
6 |
|
\node[attribute] [above of=COPY] {\key{Code}} edge (COPY); |
|
7 |
|
% |
|
8 |
|
\node[relationship] (POSSESSES) [left = 1.5cm of COPY] {POSSESSES} edge[total] node[above, pos=0.4] {$\cM$} (COPY); |
|
9 |
|
% |
|
10 |
|
\node[entity] (LIBRARY) [left = 1.5cm of POSSESSES] {LIBRARY} edge node[above, pos=0.6]{$1$} (POSSESSES); |
|
11 |
|
\node[attribute] [above of = LIBRARY] {\key{Name}} edge (LIBRARY); |
|
12 |
|
\node[attribute] (Address) [left = 0.5cm of LIBRARY] {Address} edge (LIBRARY); |
|
13 |
|
\node[attribute] [above left of = Address] {Number} edge (Address); |
|
14 |
|
\node[attribute] [left = .5cm of Address] {Street} edge (Address); |
|
15 |
|
\node[attribute] [below left of = Address] {Zip} edge (Address); |
|
16 |
|
% |
|
17 |
|
\node[relationship] (OF) [right = 1.5cm of COPY] {OF} edge[total] node[above, pos=0.4] {$\cM$} (COPY); |
|
18 |
|
% |
|
19 |
|
\node[entity] (DOCUMENT) [right = 1.5cm of OF] {DOCUMENT} edge node[above, pos=0.6]{$1$} (OF); |
|
20 |
|
\node[attribute] [below of = DOCUMENT] {\key{Catalog Number}} edge (DOCUMENT); |
|
21 |
|
\node[attribute] [above of = DOCUMENT] {Kind} edge (DOCUMENT); |
|
22 |
|
\node[attribute] [right = .5cm of DOCUMENT] {Title} edge (DOCUMENT); |
|
23 |
|
% |
|
24 |
|
\node[relationship] (BORROWEDBY) [below left = 2cm and 0.5cm of COPY] {BORROWED\_BY} edge node[left, pos=0.4] {$\cM$} (COPY); |
|
25 |
|
\node[attribute] [left = .5cm of BORROWEDBY] {Return\_Date} edge (BORROWEDBY); |
|
26 |
|
% |
|
27 |
|
\node[relationship] (HOLDBY) [below right = 2cm and 0.5cm of COPY] {HOLD\_BY} edge node[right, pos=0.4] {$\cM$} (COPY); |
|
28 |
|
\node[attribute] [right = .5cm of HOLDBY] {Expiration\_Date} edge (HOLDBY); |
|
29 |
|
% |
|
30 |
|
\node[entity] (PATRON) [below = 5cm of COPY] {PATRON} edge node[left] {$1$} (HOLDBY) edge node[right] {$1$} (BORROWEDBY); |
|
31 |
|
\node[attribute] [below right = 1cm of PATRON] {\key{Card Number}} edge (PATRON); |
|
32 |
|
\node[attribute] [below = 1cm of PATRON] {Name} edge (PATRON); |
|
33 |
|
\node[attribute] [below left = 1cm of PATRON] {Email} edge (PATRON); |
|
34 |
|
% |
|
35 |
|
% \node[relationship] (REPAIREDBY) [below right =3cm of LIBRARY] {REPAIRED\_BY} edge node[below, pos=0.6] {$\cM$} (LIBRARY) edge node[below, pos=0.6] {$1$} (PATRON); |
|
36 |
|
|
|
37 |
|
|
|
38 |
|
%\node[entity] (COPY) {COPY}; |
|
39 |
|
% |
|
40 |
|
% |
|
41 |
|
% |
|
42 |
|
%\node[relationship] (SPEAKS) [below right of=COPY] {SPEAKS} edge node[right, pos=0.4] {$M$} (COPY); |
|
43 |
|
%\node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); |
|
44 |
|
%\node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); |
|
45 |
|
%\node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); |
|
46 |
|
% |
|
47 |
|
%\node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; |
|
48 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); |
|
49 |
|
%\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); |
|
50 |
|
% |
|
51 |
|
% |
|
52 |
|
%\node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); |
|
53 |
|
|
|
54 |
|
% |
|
55 |
|
%\node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; |
|
56 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); |
|
57 |
|
%\draw (anthem) to node[right, pos=0.6] {$M$} (WIN); |
|
58 |
|
|
|
59 |
|
\end{tikzpicture} |
|
60 |
|
|
|
61 |
|
\end{document} |
File notes/fig/er/pet_03.tex added (mode: 100644) (index 0000000..fb30bef) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=8em] |
|
5 |
|
\node[entity] (FRIEND) {FRIEND}; |
|
6 |
|
\node[attribute] (make) [below of=FRIEND] {\key{Name}} edge (FRIEND); |
|
7 |
|
|
|
8 |
|
\node[ident relationship] (POSSESSES) [right of=FRIEND] {POSSESSES} edge node[above, pos=0.3] {$1$} (FRIEND); |
|
9 |
|
\node[weak entity] (PET) [right = 1cm of POSSESSES] {PET} edge[total] node[above, pos=0.7] {$\cN$} (POSSESSES); |
|
10 |
|
\node[attribute] [below right of =PET] {\pkey{Name}} edge (PET); |
|
11 |
|
\node[attribute] [below left of =PET] {Gender} edge (PET); |
|
12 |
|
\node[attribute] [below of =PET] {Specie} edge (PET); |
|
13 |
|
|
|
14 |
|
\node[entity] (FOOD) [above right= 3cm and 0cm of FRIEND] {FOOD}; |
|
15 |
|
\node[relationship] (LOVES) [below right of=FOOD] {LOVED\_BY} edge node[above, pos=0.5] {$\cM$} (PET) edge node[above, pos=0.3]{$\cN$}(FOOD); |
|
16 |
|
|
|
17 |
|
\node[ident relationship] (PLAYSWITH) [above right of =PET] {PLAYS WITH} edge node[above, pos=0.7] {$1$} (PET); |
|
18 |
|
\node[weak entity] (TOY) [right = 1cm of PLAYSWITH] {TOY} edge[total] node[above, pos=0.3] {$\cM$} (PLAYSWITH); |
|
19 |
|
\end{tikzpicture} |
|
20 |
|
|
|
21 |
|
\end{document} |
File notes/fig/er/pilot.tex added (mode: 100644) (index 0000000..a5ade41) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=8em] |
|
5 |
|
\node[entity] (person) {PILOT}; |
|
6 |
|
\node[attribute] (pid) [left of=person] {\key{ID}} edge (person); |
|
7 |
|
\node[attribute] (name) [above left of=person] {Name} edge (person); |
|
8 |
|
\node[attribute] (phone) [above of=person] {Experience} edge (person); |
|
9 |
|
|
|
10 |
|
\node[relationship] (drives) [below of=person] {ASSIGNED\_TO} edge node[right, pos=0.1] {$N$} (person); |
|
11 |
|
\node[entity] (plane) [below of=drives] {PLANE} edge [total] node[right, pos=0.7] {$1$} (drives); |
|
12 |
|
\node[attribute] (make) [left of=plane] {\key{TailID}} edge (plane); |
|
13 |
|
\node[attribute] (maxS) [below left of =plane] {MaxSpeed} edge (plane); |
|
14 |
|
\node[attribute] (airPlaneType) [below of = plane] {AirPlaneType} edge (plane); |
|
15 |
|
\end{tikzpicture} |
|
16 |
|
|
|
17 |
|
\end{document} |
File notes/fig/er/record.tex added (mode: 100644) (index 0000000..8576625) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=1.5cm] |
|
5 |
|
\node[entity] (LABEL) {LABEL}; |
|
6 |
|
\node[attribute] [above of=LABEL] {\key{Name}} edge (LABEL); |
|
7 |
|
\node[attribute] [right = .5cm of LABEL] {Phone} edge (LABEL); |
|
8 |
|
\node[multi attribute] [above right = .5cm of LABEL] {Genre} edge (LABEL); |
|
9 |
|
% |
|
10 |
|
\node[relationship] (RELEASEDBY) [left = 1.5cm of LABEL] {RELEASED\_BY} edge node[above, pos=0.4] {$\cN$} (LABEL); |
|
11 |
|
% |
|
12 |
|
\node[entity] (RECORDING) [left = 1.5cm of RELEASEDBY] {RECORDING} edge[total] node[above, pos=0.6]{$\cM$} (RELEASEDBY); |
|
13 |
|
\node[attribute] [above of = RECORDING] {\key{Title}} edge (RECORDING); |
|
14 |
|
% |
|
15 |
|
\node[ident relationship] (USES) [below =0.8cm of LABEL] {USES} edge [total] node[right, pos=0.4] {$1$} (LABEL); |
|
16 |
|
\node[attribute] [above = .5cm of RELEASEDBY] {Date} edge (RELEASEDBY); |
|
17 |
|
% |
|
18 |
|
\node[weak entity] (LOGO) [below = 3cm of LABEL] {LOGO} edge [total] node[right, pos=0.4] {$1$} (USES); |
|
19 |
|
\node[attribute] [right = .5cm of LOGO] {\pkey{Name}} edge (LOGO); |
|
20 |
|
\node[attribute] [below = .5cm of LOGO] {Color} edge (LOGO); |
|
21 |
|
% |
|
22 |
|
% \node[relationship] (REPAIREDBY) [below right =3cm of RECORDING] {REPAIRED\_BY} edge node[below, pos=0.6] {$\cM$} (RECORDING) edge node[below, pos=0.6] {$1$} (LOGO); |
|
23 |
|
% |
|
24 |
|
|
|
25 |
|
\node[relationship] (ISSOLDAT) [below left = 1.5cm of RECORDING] {IS\_SOLD\_AT} edge node[above, pos=0.4] {$\cN$} (RECORDING); |
|
26 |
|
\node[attribute] [left = .5cm of ISSOLDAT] {Number of copies} edge (ISSOLDAT); |
|
27 |
|
|
|
28 |
|
\node[entity] (SHOP) [below = 5cm of RECORDING] {RECORD SHOP} edge[total] node[right, pos=0.4]{$\cM$} (ISSOLDAT); |
|
29 |
|
|
|
30 |
|
\node[attribute] (Address) [left = 0.5cm of SHOP] {Address} edge (SHOP); |
|
31 |
|
\node[attribute] [above left of = Address] {Zip} edge (Address); |
|
32 |
|
\node[attribute] [below left of = Address] {Street Name} edge (Address); |
|
33 |
|
\node[attribute] [left = .6cm of Address] {City} edge (Address); |
|
34 |
|
|
|
35 |
|
\node[relationship] (ISPLAYEDAT) [below right = 1.5cm and 0cm of RECORDING] {IS\_AN\_EXCLUSIVITY\_OF} edge node[right, pos=0.4] {$\cN$} (RECORDING) edge node[left]{$1$} (SHOP); |
|
36 |
|
|
|
37 |
|
\node[attribute] [below of = SHOP] {\key{Name}} edge (SHOP); |
|
38 |
|
|
|
39 |
|
%\node[entity] (LABEL) {LABEL}; |
|
40 |
|
% |
|
41 |
|
% |
|
42 |
|
% |
|
43 |
|
%\node[relationship] (SPEAKS) [below right of=LABEL] {SPEAKS} edge node[right, pos=0.4] {$M$} (LABEL); |
|
44 |
|
%\node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); |
|
45 |
|
%\node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); |
|
46 |
|
%\node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); |
|
47 |
|
% |
|
48 |
|
%\node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; |
|
49 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); |
|
50 |
|
%\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); |
|
51 |
|
% |
|
52 |
|
% |
|
53 |
|
%\node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); |
|
54 |
|
|
|
55 |
|
% |
|
56 |
|
%\node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; |
|
57 |
|
%\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); |
|
58 |
|
%\draw (anthem) to node[right, pos=0.6] {$M$} (WIN); |
|
59 |
|
|
|
60 |
|
\end{tikzpicture} |
|
61 |
|
|
|
62 |
|
\end{document} |
File notes/fig/er/rel_instance.tex added (mode: 100644) (index 0000000..1fd7c9e) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=2em] |
|
5 |
|
\draw [fill= gray!20] (0,-1) ellipse (1cm and 2cm) node[above=2]{Entity Set 1}; |
|
6 |
|
\draw [fill= blue!20] (2.75, -1) ellipse (1cm and 2cm) node[above=2]{Relationship Set 1}; |
|
7 |
|
\draw [fill= green!20] (5.5, -1) ellipse (1cm and 2cm) node[above=2]{Entity Set 2}; |
|
8 |
|
% |
|
9 |
|
\node (e1) {\(e_1\)}; |
|
10 |
|
\node (e2) [below of = e1] {\(e_2\)}; |
|
11 |
|
\node (dots) [below of = e2] {\(\vdots\)}; |
|
12 |
|
\node (en) [below of = dots] {\(e_n\)}; |
|
13 |
|
% |
|
14 |
|
\node (c1) [right = 5 of e1]{\(c_1\)}; |
|
15 |
|
\node (c2) [below of = c1]{\(c_1\)}; |
|
16 |
|
\node (cdots) [below of = c2] {\(\vdots\)}; |
|
17 |
|
\node (cp) [below of = cdots] {\(c_p\)}; |
|
18 |
|
% |
|
19 |
|
\node (r1) [right = 2.25 of e2] {\(r_1\)}; |
|
20 |
|
\draw (r1) to (e1); |
|
21 |
|
\draw (r1) to (c2); |
|
22 |
|
% |
|
23 |
|
\node (r2) [below of = r1] {\(r_2\)}; |
|
24 |
|
\draw (r2) to (e2); |
|
25 |
|
\draw (r2) to (cp); |
|
26 |
|
\end{tikzpicture} |
|
27 |
|
|
|
28 |
|
\end{document} |
File notes/fig/er/song.tex added (mode: 100644) (index 0000000..def4a5b) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\input{template.def} |
|
3 |
|
|
|
4 |
|
\begin{tikzpicture}[node distance=5em] |
|
5 |
|
\node[entity] (ALBUM) {ALBUM}; |
|
6 |
|
\node[attribute] [left = .5cm of ALBUM] {\key{Name}} edge (ALBUM); |
|
7 |
|
\node[attribute] (Date) [above of=ALBUM] {Release Date} edge (ALBUM); |
|
8 |
|
\node[attribute] [above right of=Date] {Day} edge (Date); |
|
9 |
|
\node[attribute] [above = 1.2cm of Date] {Month} edge (Date); |
|
10 |
|
\node[attribute] [above left of=Date] {Year} edge (Date); |
|
11 |
|
|
|
12 |
|
\node[ident relationship] (CONTAINS) [right = 1cm of ALBUM] {CONTAINS} edge node[above, pos=0.3] {$1$} (ALBUM); |
|
13 |
|
\node[weak entity] (SONG) [right = 1cm of CONTAINS] {SONG} edge[total] node[above, pos=0.7] {$N$} (CONTAINS); |
|
14 |
|
\node[attribute] [right = .5cm of SONG] {\pkey{Track Number}} edge (SONG); |
|
15 |
|
|
|
16 |
|
\node[attribute] (Length) [above of =SONG] {Length} edge (SONG); |
|
17 |
|
\node[attribute] [above left of =Length] {Hours} edge (Length); |
|
18 |
|
\node[attribute] [above =1.3cm of Length] {Minutes} edge (Length); |
|
19 |
|
\node[attribute] [above right of =Length] {Seconds} edge (Length); |
|
20 |
|
\end{tikzpicture} |
|
21 |
|
|
|
22 |
|
\end{document} |
File notes/fig/er/template.def added (mode: 100644) (index 0000000..6f19033) |
|
1 |
|
\renewcommand\familydefault{\sfdefault} % Default family: serif |
|
2 |
|
%\usepackage[usenames,dvipsnames]{xcolor} |
|
3 |
|
\usepackage[x11names]{xcolor} |
|
4 |
|
\usepackage{tikz} |
|
5 |
|
\usepackage{soulutf8} |
|
6 |
|
\usetikzlibrary{arrows,fit,positioning,shapes,calc} |
|
7 |
|
|
|
8 |
|
%\definecolor{WIRE}{HTML}{002FA7} % Klein Blue |
|
9 |
|
\usepackage[normalem]{ulem} |
|
10 |
|
|
|
11 |
|
\tikzstyle{every entity} = [] |
|
12 |
|
\tikzstyle{every weak entity} = [] |
|
13 |
|
\tikzstyle{every attribute} = [] |
|
14 |
|
\tikzstyle{every relationship} = [] |
|
15 |
|
\tikzstyle{every link} = [] |
|
16 |
|
\tikzstyle{every isa} = [] |
|
17 |
|
|
|
18 |
|
\tikzstyle{link} = [>=triangle 60, draw, thick, every link] |
|
19 |
|
|
|
20 |
|
\tikzstyle{total} = [link, double, double distance=3pt] |
|
21 |
|
|
|
22 |
|
\tikzstyle{entity} = [rectangle, draw, black, very thick, |
|
23 |
|
minimum width=6em, minimum height=3em, |
|
24 |
|
every entity] |
|
25 |
|
|
|
26 |
|
\tikzstyle{weak entity} = [entity, double, double distance=2pt, |
|
27 |
|
every weak entity] |
|
28 |
|
|
|
29 |
|
\tikzstyle{attribute} = [ellipse, draw, black, very thick, |
|
30 |
|
minimum width=5em, minimum height=2em, |
|
31 |
|
every attribute] |
|
32 |
|
|
|
33 |
|
%\tikzstyle{key attribute} = [attribute, font=\bfseries] |
|
34 |
|
|
|
35 |
|
\tikzstyle{multi attribute} = [attribute, double, double distance=2pt] |
|
36 |
|
|
|
37 |
|
\tikzstyle{derived attribute} = [attribute, dashed] |
|
38 |
|
|
|
39 |
|
%\tikzstyle{discriminator} = [attribute, font=\itshape] |
|
40 |
|
|
|
41 |
|
\tikzstyle{relationship} = [diamond, draw, black, very thick, |
|
42 |
|
minimum width=2em, aspect=1, |
|
43 |
|
every relationship] |
|
44 |
|
|
|
45 |
|
\tikzstyle{ident relationship} = [relationship, double, double distance=2pt] |
|
46 |
|
|
|
47 |
|
\tikzstyle{isa} = [isosceles triangle, isosceles triangle apex angle=60, |
|
48 |
|
shape border rotate=-90, |
|
49 |
|
draw, black, very thick, minimum size=3em, |
|
50 |
|
every isa] |
|
51 |
|
|
|
52 |
|
% for text un key attributes |
|
53 |
|
\newcommand{\key}[1]{\underline{#1}} |
|
54 |
|
\newcommand{\pkey}[1]{\dashuline{#1}} |
|
55 |
|
|
|
56 |
|
% for text in discriminator attributes |
|
57 |
|
\def\discriminator{\bgroup |
|
58 |
|
\ifdim\ULdepth=\maxdimen % Set depth based on font, if not set already |
|
59 |
|
\settodepth\ULdepth{(j}\advance\ULdepth.4pt\fi |
|
60 |
|
\markoverwith{\kern.15em |
|
61 |
|
\vtop{\kern\ULdepth \hrule width .3em}% |
|
62 |
|
\kern.15em}\ULon} |
|
63 |
|
|
|
64 |
|
%% |
|
65 |
|
|
|
66 |
|
|
|
67 |
|
\definecolor{MediumPurple1}{rgb}{0.58, 0.44, 0.86} |
|
68 |
|
\definecolor{Chartreuse2}{rgb}{0.5, 1.0, 0.0} |
|
69 |
|
\tikzset{every entity/.style={draw=orange, fill=orange!20}} |
|
70 |
|
\tikzset{every attribute/.style={draw=MediumPurple1, fill=MediumPurple1!20}} |
|
71 |
|
\tikzset{every relationship/.style={draw=Chartreuse2, fill=Chartreuse2!20}} |
|
72 |
|
|
|
73 |
|
%% Variable for participation constraint |
|
74 |
|
\newcommand{\cM}{\mathrm{M}} |
|
75 |
|
\newcommand{\cN}{\mathrm{N}} |
|
76 |
|
\newcommand{\cO}{\mathrm{O}} |
|
77 |
|
\newcommand{\cP}{\mathrm{P}} |
|
78 |
|
|
|
79 |
|
\begin{document} |