# htsql / doc / dia / sample-model.tex

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113  \documentclass{article} \include{prelude} \begin{document} \tikzset{ > = stealth', shorten > = 1pt, shorten < = 1pt, node distance = 3cm and 3cm, unit/.style = {fill, star, star points=8, inner sep=0pt, minimum size=3mm}, entity/.style = {fill, circle, inner sep=0pt, minimum size=2mm}, value/.style = {fill, rectangle, inner sep=0pt, minimum size=2mm}, link/.style = {font=\small\ttfamily, above, sloped}, label/.style = {font=\small\color{black!70}}, information/.style = {rounded corners, inner sep=1ex, fill=blue!5} } \pgfdeclarelayer{background} \pgfsetlayers{background,main} \begin{tikzpicture} \node[unit] (unit) {}; \node[entity] (school) [below right=3cm and 1.5cm of unit] {}; \node[entity] (program) [right=of school] {}; \node[entity] (department) [below left=3cm and 1.5cm of unit] {}; \node[entity] (course) [left=of department] {}; \node[value] (string) [below=of department] {}; \draw[->] (unit) to[bend left] node[link, near end] {program} (program); \draw[->, very thick] (unit) to[bend left] node[link] {school} (school); \draw[->] (unit) to[bend right] node[link] {department} (department); \draw[->] (unit) to[bend right] node[link, near end] {course} (course); \draw[->] (program) to[bend right] node[link] {school} (school); \draw[->] (school) to[bend right] node[link] {program} (program); \draw[->, very thick] (school) to[bend right] node[link] {department} (department); \draw[->] (department) to[bend right] node[link] {school} (school); \draw[->] (department) to[bend right] node[link] {course} (course); \draw[->] (course) to[bend right] node[link] {department} (department); \draw[->] (program) edge[loop, min distance=2cm, in=-35, out=35] node[link] {part\_of} (program); \draw[<-] (program) edge[loop, min distance=6cm, in=-60, out=60] node[link] {program\_via\_part\_of} (program); \draw[->] (department) to[bend left] node[link] {code} (string); \draw[->, very thick] (department) to node[link] {name} (string); \draw[->] (department) to[bend right] node[link, below, rotate=180] {school\_code} (string); \node[unit] (unit info) [below=2 of school] {}; \node[entity] (entity info) [below=1ex of unit info] {}; \node[value] (value info) [below=1ex of entity info] {}; \node[label] (unit label) [right=.5em of unit info] {unit class}; \node[label] (entity label) [right=.5em of entity info] {entity class}; \node[label] (value label) [right=.5em of value info] {value class}; \begin{pgfonlayer}{background} \node[information] [fit=(unit info) (entity info) (value info) (unit label) (entity label) (value label)] {}; \end{pgfonlayer} \end{tikzpicture} \end{document}