File notes/fig/misc/crow_foot.tex added (mode: 100644) (index 0000000..9300781) |
|
1 |
|
\documentclass[border=20pt]{standalone} |
|
2 |
|
\usepackage{tikz} |
|
3 |
|
\usetikzlibrary{% |
|
4 |
|
chains, |
|
5 |
|
calc |
|
6 |
|
} |
|
7 |
|
\tikzset{ |
|
8 |
|
dummy/.style={ |
|
9 |
|
rectangle, |
|
10 |
|
rounded corners, |
|
11 |
|
draw=white, very thick, |
|
12 |
|
text centered}, |
|
13 |
|
zig zag to/.style={ |
|
14 |
|
to path={(\tikztostart) -| ($(\tikztostart)!#1!(\tikztotarget)$) |- (\tikztotarget) \tikztonodes} |
|
15 |
|
}, |
|
16 |
|
zig zag to/.default=0.5, |
|
17 |
|
one to one/.style={ |
|
18 |
|
one-one, zig zag to |
|
19 |
|
}, |
|
20 |
|
one to none/.style={ |
|
21 |
|
one-, zig zag to |
|
22 |
|
}, |
|
23 |
|
oone to none/.style={ |
|
24 |
|
oone-, zig zag to |
|
25 |
|
}, |
|
26 |
|
omany to none/.style={ |
|
27 |
|
omany-, zig zag to |
|
28 |
|
}, |
|
29 |
|
one to many/.style={ |
|
30 |
|
one-crow's foot, zig zag to, |
|
31 |
|
}, |
|
32 |
|
one to omany/.style={ |
|
33 |
|
one-omany, zig zag to |
|
34 |
|
}, |
|
35 |
|
many to one/.style={ |
|
36 |
|
crow's foot-one, zig zag to |
|
37 |
|
}, |
|
38 |
|
many to many/.style={ |
|
39 |
|
crow's foot-crow's foot, zig zag to |
|
40 |
|
}, |
|
41 |
|
many to none/.style={ |
|
42 |
|
crow's foot-, zig zag to |
|
43 |
|
} |
|
44 |
|
} |
|
45 |
|
\makeatletter |
|
46 |
|
\pgfarrowsdeclare{crow's foot}{crow's foot} |
|
47 |
|
{ |
|
48 |
|
\pgfarrowsleftextend{+-.5\pgflinewidth}% |
|
49 |
|
\pgfarrowsrightextend{+.5\pgflinewidth}% |
|
50 |
|
} |
|
51 |
|
{ |
|
52 |
|
\pgfutil@tempdima=0.6pt% |
|
53 |
|
%\advance\pgfutil@tempdima by.25\pgflinewidth% |
|
54 |
|
\pgfsetdash{}{+0pt}% |
|
55 |
|
\pgfsetmiterjoin% |
|
56 |
|
\pgfpathmoveto{\pgfqpoint{0pt}{-9\pgfutil@tempdima}}% |
|
57 |
|
\pgfpathlineto{\pgfqpoint{-13\pgfutil@tempdima}{0pt}}% |
|
58 |
|
\pgfpathlineto{\pgfqpoint{0pt}{9\pgfutil@tempdima}}% |
|
59 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
60 |
|
\pgfpathmoveto{\pgfqpoint{-8pt}{-6pt}}% |
|
61 |
|
\pgfpathlineto{\pgfqpoint{-8pt}{-6pt}}% |
|
62 |
|
\pgfpathlineto{\pgfqpoint{-8pt}{6pt}}% |
|
63 |
|
\pgfusepathqstroke% |
|
64 |
|
} |
|
65 |
|
|
|
66 |
|
\pgfarrowsdeclare{omany}{omany} |
|
67 |
|
{ |
|
68 |
|
\pgfarrowsleftextend{+-.5\pgflinewidth}% |
|
69 |
|
\pgfarrowsrightextend{+.5\pgflinewidth}% |
|
70 |
|
} |
|
71 |
|
{ |
|
72 |
|
\pgfutil@tempdima=0.6pt% |
|
73 |
|
%\advance\pgfutil@tempdima by.25\pgflinewidth% |
|
74 |
|
\pgfsetdash{}{+0pt}% |
|
75 |
|
\pgfsetmiterjoin% |
|
76 |
|
\pgfpathmoveto{\pgfqpoint{0pt}{-9\pgfutil@tempdima}}% |
|
77 |
|
\pgfpathlineto{\pgfqpoint{-13\pgfutil@tempdima}{0pt}}% |
|
78 |
|
\pgfpathlineto{\pgfqpoint{0pt}{9\pgfutil@tempdima}}% |
|
79 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
80 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
81 |
|
\pgfpathmoveto{\pgfqpoint{-6pt}{-6pt}}% |
|
82 |
|
\pgfpathcircle{\pgfpoint{-11.5pt}{0}} {3.5pt} |
|
83 |
|
\pgfusepathqstroke% |
|
84 |
|
} |
|
85 |
|
|
|
86 |
|
\pgfarrowsdeclare{oone}{oone} |
|
87 |
|
{ |
|
88 |
|
\pgfarrowsleftextend{+-.5\pgflinewidth}% |
|
89 |
|
\pgfarrowsrightextend{+.5\pgflinewidth}% |
|
90 |
|
} |
|
91 |
|
{ |
|
92 |
|
\pgfutil@tempdima=0.6pt% |
|
93 |
|
%\advance\pgfutil@tempdima by.25\pgflinewidth% |
|
94 |
|
\pgfsetdash{}{+0pt}% |
|
95 |
|
\pgfsetmiterjoin% |
|
96 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
97 |
|
\pgfpathmoveto{\pgfqpoint{-6pt}{-6pt}}% |
|
98 |
|
\pgfpathlineto{\pgfqpoint{-6pt}{-6pt}}% |
|
99 |
|
\pgfpathlineto{\pgfqpoint{-6pt}{6pt}}% |
|
100 |
|
\pgfpathcircle{\pgfpoint{-11.5pt}{0}} {3.5pt} |
|
101 |
|
\pgfusepathqstroke% |
|
102 |
|
} |
|
103 |
|
|
|
104 |
|
\pgfarrowsdeclare{one}{one} |
|
105 |
|
{ |
|
106 |
|
\pgfarrowsleftextend{+-.5\pgflinewidth}% |
|
107 |
|
\pgfarrowsrightextend{+.5\pgflinewidth}% |
|
108 |
|
} |
|
109 |
|
{ |
|
110 |
|
\pgfutil@tempdima=0.6pt% |
|
111 |
|
%\advance\pgfutil@tempdima by.25\pgflinewidth% |
|
112 |
|
\pgfsetdash{}{+0pt}% |
|
113 |
|
\pgfsetmiterjoin% |
|
114 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
115 |
|
\pgfpathmoveto{\pgfqpoint{-6pt}{-6pt}}% |
|
116 |
|
\pgfpathlineto{\pgfqpoint{-6pt}{-6pt}}% |
|
117 |
|
\pgfpathlineto{\pgfqpoint{-6pt}{6pt}}% |
|
118 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
119 |
|
\pgfpathmoveto{\pgfqpoint{-8pt}{-6pt}}% |
|
120 |
|
\pgfpathlineto{\pgfqpoint{-8pt}{-6pt}}% |
|
121 |
|
\pgfpathlineto{\pgfqpoint{-8pt}{6pt}}% |
|
122 |
|
\pgfusepathqstroke% |
|
123 |
|
} |
|
124 |
|
\pgfarrowsdeclare{oone}{oone} |
|
125 |
|
{ |
|
126 |
|
\pgfarrowsleftextend{+-.5\pgflinewidth}% |
|
127 |
|
\pgfarrowsrightextend{+.5\pgflinewidth}% |
|
128 |
|
} |
|
129 |
|
{ |
|
130 |
|
\pgfutil@tempdima=0.6pt% |
|
131 |
|
%\advance\pgfutil@tempdima by.25\pgflinewidth% |
|
132 |
|
\pgfsetdash{}{+0pt}% |
|
133 |
|
\pgfsetmiterjoin% |
|
134 |
|
\pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}% |
|
135 |
|
\pgfpathmoveto{\pgfqpoint{-6pt}{-6pt}}% |
|
136 |
|
\pgfpathlineto{\pgfqpoint{-6pt}{-6pt}}% |
|
137 |
|
\pgfpathlineto{\pgfqpoint{-6pt}{6pt}}% |
|
138 |
|
\pgfpathcircle{\pgfpoint{-11.5pt}{0}} {3.5pt} |
|
139 |
|
\pgfusepathqstroke% |
|
140 |
|
} |
|
141 |
|
\def\property#1{\node[name=\entityname-#1, every property/.try]{#1};} |
|
142 |
|
\def\properties{\begingroup\catcode`\_=11\relax\processproperties} |
|
143 |
|
\def\processproperties#1{\endgroup% |
|
144 |
|
\def\propertycode{}% |
|
145 |
|
\foreach \p in {#1}{% |
|
146 |
|
\expandafter\expandafter\expandafter\gdef\expandafter\expandafter\expandafter\propertycode% |
|
147 |
|
\expandafter\expandafter\expandafter{\expandafter\propertycode\expandafter\property\expandafter{\p}\\}% |
|
148 |
|
}% |
|
149 |
|
\propertycode% |
|
150 |
|
} |
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
\begin{document} |
|
155 |
|
|
|
156 |
|
\begin{tikzpicture} |
|
157 |
|
\node (a0) {}; |
|
158 |
|
\node[right=2cm of a0] (b0) {}; |
|
159 |
|
\draw (b0.west) -- (a0.east); |
|
160 |
|
\draw ($(b0) +(-0.4, -0.2)$) -- ($(b0) +(-0.4, 0.2)$); |
|
161 |
|
\node[left =1cm of a0]{One}; |
|
162 |
|
|
|
163 |
|
\node[ below of = a0] (a1) {}; |
|
164 |
|
\node[right=2cm of a1] (b1) {}; |
|
165 |
|
\draw (b1.west) -- (a1.east); |
|
166 |
|
\draw ($(b1) +(-0.2, -0.2)$) -- ($(b1) + (-0.5, 0)$) -- ($(b1) +(-0.2, 0.2)$); |
|
167 |
|
\node[left =1cm of a1]{Many}; |
|
168 |
|
|
|
169 |
|
\node (meta1) at (4, -0.5) {\(\left.\rule{0cm}{1cm}\right\}\) Only the max.}; |
|
170 |
|
|
|
171 |
|
\node[ below of = a1] (a2) {}; |
|
172 |
|
\node[right=2cm of a2] (b2) {}; |
|
173 |
|
\draw[one to none] (b2.west) -- (a2.east); |
|
174 |
|
\node[left =1cm of a2]{Exactly one}; |
|
175 |
|
|
|
176 |
|
\node[ below of = a2] (a3) {}; |
|
177 |
|
\node[right=2cm of a3] (b3) {}; |
|
178 |
|
\draw[oone to none] (b3.west) -- (a3.east); |
|
179 |
|
\node[left =1cm of a3]{Zero or one}; |
|
180 |
|
|
|
181 |
|
|
|
182 |
|
\node[ below of = a3] (a4) {}; |
|
183 |
|
\node[right=2cm of a4] (b4) {}; |
|
184 |
|
\draw[many to none] (b4.west) -- (a4.east); |
|
185 |
|
\node[left =1cm of a4]{One or many}; |
|
186 |
|
|
|
187 |
|
\node[ below of = a4] (a5) {}; |
|
188 |
|
\node[right=2cm of a5] (b5) {}; |
|
189 |
|
\draw[omany to none] (b5.west) -- (a5.east); |
|
190 |
|
\node[left =1cm of a5]{Zero or many}; |
|
191 |
|
|
|
192 |
|
\node (meta2) at (4, -3.5) {\(\left.\rule{0cm}{2cm}\right\}\) Min. and max.}; |
|
193 |
|
\end{tikzpicture} |
|
194 |
|
|
|
195 |
|
|
|
196 |
|
\end{document} |