| 1 |
\def\filedate{2010/03/25} |
| 2 |
\def\docdate{2010/09/25} |
| 3 |
\def\fileversion{0.16} |
| 4 |
\def\basename{pst-dbicons} |
| 5 |
% |
| 6 |
% \iffalse meta-comment |
| 7 |
% |
| 8 |
% Package 'pst-dbicons' to use with LaTeX2e and PSTricks |
| 9 |
% (formerly dbicons) |
| 10 |
% Copyright 1997-2010 by Wolfgang May. All rights reserved. |
| 11 |
% |
| 12 |
% This package is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 |
% |
| 16 |
% Written and maintained by |
| 17 |
% Wolfgang May |
| 18 |
% |
| 19 |
% Error Reports in case of UNCHANGED versions to |
| 20 |
% |
| 21 |
% Wolfgang May |
| 22 |
% Institut f"ur Informatik, Universit"at G"ottingen |
| 23 |
% Goldschmidtstrasse 7 |
| 24 |
% D-37077 Goettingen, Germany |
| 25 |
% e-mail: [email protected] |
| 26 |
% |
| 27 |
% You are not allowed to change this file. |
| 28 |
% |
| 29 |
% You are allowed to distribute this file under the condition that |
| 30 |
% it is distributed UNCHANGED. You are NOT ALLOWED to take money for |
| 31 |
% the distribution or use of either this file or a changed version, |
| 32 |
% except for a nominal charge for copying etc. |
| 33 |
% \fi |
| 34 |
% |
| 35 |
% \CheckSum{576} |
| 36 |
%% \CharacterTable |
| 37 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 38 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 39 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 40 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 41 |
%% Dollar \$ Percent \% Ampersand \& |
| 42 |
%% Acute accent \' Left paren \( Right paren \) |
| 43 |
%% Asterisk \* Plus \+ Comma \, |
| 44 |
%% Minus \- Point \. Solidus \/ |
| 45 |
%% Colon \: Semicolon \; Less than \< |
| 46 |
%% Equals \= Greater than \> Question mark \? |
| 47 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 48 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 49 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 50 |
%% Right brace \} Tilde \~} |
| 51 |
% |
| 52 |
% \RecordChanges |
| 53 |
% |
| 54 |
% \MakeShortVerb{\|} |
| 55 |
% \makeatletter |
| 56 |
% \def\Codelabel#1{\@bsphack |
| 57 |
% \protected@write\@auxout{}{\string\newlabel{#1}{{\number\the |
| 58 |
% \c@CodelineNo}{\thepage}}}\@esphack} |
| 59 |
% \newcounter{tmpcount} |
| 60 |
% \def\Coderef#1#2{\setcounter{tmpcount}{0}\@ifundefined{r@#1}\relax |
| 61 |
% {\setcounter{tmpcount}{\ref{#1}}}\relax |
| 62 |
% \addtocounter{tmpcount}{#2}\arabic{tmpcount}} |
| 63 |
% \makeatother |
| 64 |
% |
| 65 |
% \title{PSTricks Macros for Databases\thanks{This |
| 66 |
% file has version number \fileversion{}, last revised \filedate.}} |
| 67 |
% \author{Wolfgang May\\ |
| 68 |
% \texttt{[email protected]}\\ |
| 69 |
% Institut f\"ur Informatik \\ |
| 70 |
% Universit\"at G\"ottingen \\ |
| 71 |
% Goldschmidtstrasse 7 \\ |
| 72 |
% D-37077 G\"ottingen\\ |
| 73 |
% Germany} |
| 74 |
% \date{\filedate} |
| 75 |
% \maketitle |
| 76 |
% |
| 77 |
% \begin{abstract} |
| 78 |
% \noindent |
| 79 |
% The \emph{pst-dbicons} package (originally called \em{dbicons} only) |
| 80 |
% provides some useful macros in the |
| 81 |
% database area. It focusses on typesetting ER-Diagrams in a |
| 82 |
% declarative style, i.e., by positioning some nodes and defining |
| 83 |
% the position of all other nodes relative to them by using the |
| 84 |
% standard database terminology. |
| 85 |
% The PSTricks package is required for using pst-dbicons, but |
| 86 |
% there is no deep knowledge of PSTricks commands required |
| 87 |
% (although this is useful for exploiting the full functionality). |
| 88 |
% \end{abstract} |
| 89 |
% |
| 90 |
% \section{Commands} |
| 91 |
% |
| 92 |
% \subsection{ER-Diagrams} |
| 93 |
% |
| 94 |
% ER-Diagrams are a widely used graphical representation |
| 95 |
% formalism for conceptual modeling; especially used in the |
| 96 |
% database community. Their main notions are \emph{entities} |
| 97 |
% (e.g., persons, cities, or countries), \emph{attributes} of |
| 98 |
% entities (e.g., name, id-number, age), and relationships |
| 99 |
% between entities (e.g., belongs\_to, is\_capital\_of). |
| 100 |
% |
| 101 |
% \DescribeMacro\seticonparams |
| 102 |
% With |
| 103 |
% \begin{quote} |
| 104 |
% |\seticonparams{|\meta{icon-type}|}{|\meta{graphics parameters}|}| |
| 105 |
% \end{quote} |
| 106 |
% the graphical layout of icons (entities, relationships, and attributes) |
| 107 |
% can be specified (by giving the optional argument for PSTricks' |
| 108 |
% boxes). Default is |
| 109 |
% |[fillstyle=none]| for all of them. |
| 110 |
% in this documentation, we modify it to |
| 111 |
% |
| 112 |
%\begin{verbatim} |
| 113 |
%\seticonparams{entity}{shadow=true,fillcolor=lightgray,fillstyle=solid} |
| 114 |
%\seticonparams{attribute}{fillcolor=lightgray,fillstyle=solid} |
| 115 |
%\seticonparams{relationship}{shadow=true,fillcolor=lightgray,fillstyle=solid}\end{verbatim} |
| 116 |
%\seticonparams{entity}{shadow=true,fillcolor=lightgray,fillstyle=solid} |
| 117 |
%\seticonparams{attribute}{fillcolor=lightgray,fillstyle=solid} |
| 118 |
%\seticonparams{relationship}{shadow=true,fillcolor=lightgray,fillstyle=solid} |
| 119 |
% |
| 120 |
% From the user's point of view, every ER-icon (entities, relationships, |
| 121 |
% attributes) |
| 122 |
% has a name which should be typeset in the respective box. Additionally, |
| 123 |
% there are \emph{internal} identifiers of the boxes/nodes to allow for |
| 124 |
% referencing by graphics commands in the standard PSTricks way. |
| 125 |
% These \emph{internal id}'s must start with a letter and must contain |
| 126 |
% only letters |
| 127 |
% and digits. In general, id's must be unique on every |
| 128 |
% page.\footnote{people who are familiar with PSTricks know under which |
| 129 |
% conditions non-unique node identifiers can be used.} |
| 130 |
% Often, the \emph{name} of the entity/relationship/attribute satisfies |
| 131 |
% these conditions; in these cases, the name is also used as id. |
| 132 |
% in other cases, name and id must be specified. |
| 133 |
% |
| 134 |
% Thus, for all commands for typesetting ER-icons, the node id |
| 135 |
% \emph{must} be given, whereas the name to be typeset in the box |
| 136 |
% is optional; if no name is specified, the id is typeset as the name. |
| 137 |
% |
| 138 |
% |
| 139 |
% \subsection{Entities and Attributes} |
| 140 |
% \DescribeMacro\entity |
| 141 |
% With |
| 142 |
% \begin{quote} |
| 143 |
% |\entity[|\meta{property}|]{|\meta{id}|}[|\meta{text}|]| |
| 144 |
% \end{quote} |
| 145 |
% an entity type is set as a rectangular node. |
| 146 |
% If the optional argument \meta{text} is not given, \meta{id} also |
| 147 |
% provides the entity's text. \meta{property} is used for \emph{weak} |
| 148 |
% entitiy types which are denoted by double lines: |
| 149 |
% |
| 150 |
% Here is a simple entity |\entity{Person}| \quad\entity{Person}\quad where |
| 151 |
% |Person| serves also as node text; |\entity[weak]{cty}[City]| |
| 152 |
% \entity[weak]{cty}[City] makes up a weak entity type where the |
| 153 |
% displayed name is different from the internal name. |
| 154 |
% |
| 155 |
% |
| 156 |
% \DescribeMacro\attribute |
| 157 |
% Attribute icons are set as an oval nodes by |
| 158 |
% \begin{quote} |
| 159 |
% |\attribute[|\meta{property}|]{|\meta{id}|}[|\meta{text}|]| |
| 160 |
% \end{quote} |
| 161 |
% Here, the optional argument \meta{property} can take the |
| 162 |
% values |mv| (multivalued; resulting in a double-lined oval) or |
| 163 |
% |key| (key attribute; resulting in underlining the attribute name). |
| 164 |
% Here are three attributes: |
| 165 |
% \begin{itemize} |
| 166 |
% \item an ordinary one, |\attribute{phone}[phone\_no]| |
| 167 |
% \quad\attribute{phone}[phone\_no]\quad, |
| 168 |
% \item a multivalued attribute, |\attribute[mv]{nickname}| |
| 169 |
% \quad\attribute[mv]{nickname}\quad, |
| 170 |
% \item a key attribute, |\attribute[key]{pid}[person\_id]| |
| 171 |
% \quad\attribute[key]{pid}[person\_id]\quad. |
| 172 |
% \end{itemize} |
| 173 |
% Note that with \emph{phone\_no}, the optional argument is |
| 174 |
% used for the node text (in case that the node text contains |
| 175 |
% stuff that is not allowed in internal postscript ids -- |
| 176 |
% as a rough rule, only characters (and since dbicons v1.14, |
| 177 |
% underscores) are allowed in ids). |
| 178 |
% |
| 179 |
% In Section~\ref{sec-relationships}, relationship nodes are defined |
| 180 |
% analogously. |
| 181 |
% \DescribeMacro\attributeof |
| 182 |
% \DescribeMacro\attrdist |
| 183 |
% At first, it is described how to attach attributes with entities: |
| 184 |
% |
| 185 |
% \begin{quote} |
| 186 |
% |\attributeof{|\meta{id}|}[|\meta{dist}|]{|\ignorespaces |
| 187 |
% \meta{angle}|}[|\meta{property}|]{|\meta{id$_2$}|}[|\meta{text}|]| |
| 188 |
% \end{quote} |
| 189 |
% typesets an attribute node at angle \meta{angle} in distance |
| 190 |
% \meta{dist} from the node which is identified by \meta{id} |
| 191 |
% (which can be either an entity node or a relationship node). |
| 192 |
% The attribute is made a node named \meta{id$_2$}. |
| 193 |
% \meta{id$_2$} and \meta{text} work as for |\entity|. |
| 194 |
% The argument \meta{dist} is optional, it has not to be given |
| 195 |
% with \emph{every} attribute. By |\attrdist{|\meta{dist}|}|, this |
| 196 |
% value can be set to a default (as startup default, 2em is set). |
| 197 |
% |
| 198 |
% |
| 199 |
% \attrdist2.5em |
| 200 |
% \hspace*{0.5cm}\entity{Person}\hspace*{2cm} |
| 201 |
% \attributeof{Person}{30}[key]{Name} |
| 202 |
% \attributeof{Person}{90}[mv]{Nickname} |
| 203 |
% \attributeof{Person}[4em]{150}{phone}[phone\_no] |
| 204 |
% \attributeof{Person}[2em]{270}[mv]{wt}[weight\_at] |
| 205 |
% \attributeof{wt}{240}{date} |
| 206 |
% \attributeof{wt}{300}{weight} |
| 207 |
% \begin{tabular}{p{8.2cm}} |
| 208 |
% \attrdist2.5em |
| 209 |
% |\entity{Person}| \\ |
| 210 |
% |\attributeof{Person}{30}[key]{Name}| \\ |
| 211 |
% |\attributeof{Person}{90}[mv]{Nickname}| \\ |
| 212 |
% |\attributeof{Person}[4em]{150}| \\ |
| 213 |
% | {phone}[phone\_no]| \\ |
| 214 |
% |\attributeof{Person}{270}[mv]{wt}[weight\_at]| \\ |
| 215 |
% |\attributeof{wt}{220}{date}| \\ |
| 216 |
% |\attributeof{wt}{300}{weight}| \bigskip\\ |
| 217 |
% |
| 218 |
% Note that \emph{phone\_no} is set with a bigger distance to |
| 219 |
% \emph{person}. |
| 220 |
% Additionally, the example shows how complex attributes can be set |
| 221 |
% with these commands. |
| 222 |
% \end{tabular} |
| 223 |
% |
| 224 |
%\subsection{Relationships}\label{sec-relationships} |
| 225 |
% \DescribeMacro\relationship |
| 226 |
% With |\relationship[|\meta{property}|]{|\meta{id}|}[|\meta{text}|]|, a relationship |
| 227 |
% type is set as a diamond-shaped node. |
| 228 |
% Here, the optional argument \meta{property} is used to represent |
| 229 |
% \emph{identifying} relationships, used for \emph{weak} entities -- |
| 230 |
% thus \meta{property} can be equivalently |weak| or |ident| which |
| 231 |
% results in a double-lined relationship type. |
| 232 |
% |
| 233 |
% \DescribeMacro\relationshipbetween |
| 234 |
% For declaratively specifying nodes representing relationships |
| 235 |
% between entities, |
| 236 |
% \begin{quote} |
| 237 |
% |\relationshipbetween[|\meta{property}|]{|\meta{entity-is$_1$}|}{|\meta{entity-id$_2$}|}|\\ |
| 238 |
% | {|\meta{relationship-id}|}[|\meta{relationship-name}|]| |
| 239 |
% \end{quote} |
| 240 |
% is used (which can be augmented with several optional arguments). |
| 241 |
% In the simplest version, as given above, a relationship node is set |
| 242 |
% in-between two entity nodes: |
| 243 |
% |
| 244 |
% \begin{quote} |
| 245 |
% | \entity{Person} \hspace*{6cm} \entity{Company}| \\ |
| 246 |
% | \relationshipbetween{Person}{Company}{worksat}[works\_at]| |
| 247 |
% \bigskip \\ |
| 248 |
% \entity{Person} \hspace*{6cm} \entity{Company} |
| 249 |
% \relationshipbetween{Person}{Company}{worksat}[works\_at] |
| 250 |
% \end{quote} |
| 251 |
% |
| 252 |
% Additionally, the \emph{roles} of the entities in the relationship, |
| 253 |
% and the cardinalities can be given (both as independent optional |
| 254 |
% arguments): |
| 255 |
% \begin{quote} |
| 256 |
% |\relationshipbetween[|\meta{property}|]|\\ |
| 257 |
% | {|\meta{entity-id$_1$}|}(|\ignorespaces |
| 258 |
% \meta{role$_1$}|)[|\meta{card$_1$}|]|\\ |
| 259 |
% | {|\meta{entity-id$_2$}|}(|\ignorespaces |
| 260 |
% \meta{role$_2$}|)[|\meta{card$_2$}|]|\\ |
| 261 |
% | {|\meta{relationship-id}|}[|\meta{relationship-name}|]| |
| 262 |
% \end{quote} |
| 263 |
% |
| 264 |
% \begin{quote} |
| 265 |
% |\entity{Country} \hspace*{6cm} \entity{City}| \\ |
| 266 |
% |\relationshipbetween{Country}(of)[1:1]{City}(is)[0:1]{capital}| |
| 267 |
% \bigskip \\ |
| 268 |
% \entity{Country} \hspace*{6cm} \entity{City} |
| 269 |
% \relationshipbetween{Country}(of)[1:1]{City}(is)[0:1]{capital} |
| 270 |
% \end{quote} |
| 271 |
% |
| 272 |
% Moreover, the placement of the relationship node wrt.\ the |
| 273 |
% entities can be specified: above, the relationship node was |
| 274 |
% put in the middle of an imaginary line in-between the entity |
| 275 |
% nodes. |
| 276 |
% |
| 277 |
% As a first, small, extension, the placement ratio of the |
| 278 |
% diamond between the entities can be changed (default: 0.5): |
| 279 |
% \begin{quote} |
| 280 |
% |\relationshipbetween[|\meta{property}|]{|\meta{entity-id$_1$}|}...{|\ignorespaces |
| 281 |
% \meta{entity-id$_2$}|}...|\\ |
| 282 |
% | {|\meta{relationship-id}|}[|\ignorespaces |
| 283 |
% \meta{relationship-name}|](|\meta{placement-ratio}|)| |
| 284 |
% \end{quote} |
| 285 |
% |
| 286 |
% \begin{quote} |
| 287 |
% |\entity{Country} \hspace*{6cm} \entity[weak]{City}| \\ |
| 288 |
% |\relationshipbetween[ident]{Country}[0:n]{City}[1:1]{in}(0.8)| |
| 289 |
% \bigskip \\ |
| 290 |
% \entity{Country} \hspace*{6cm} \entity[weak]{City} |
| 291 |
% \relationshipbetween[ident]{Country}[0:n]{City}[1:1]{in}(0.8) |
| 292 |
% \end{quote} |
| 293 |
% |
| 294 |
% If this is still not enough, instead of an imaginary straight line, |
| 295 |
% any other PSTricks node connection command can be used, most |
| 296 |
% likely |\ncarc[...]| with suitable optional arguments: |
| 297 |
% |
| 298 |
% \begin{quote} |
| 299 |
% |\relationshipbetween[|\meta{property}|]| \\ |
| 300 |
% | {|\meta{entity-id$_1$}|}...{|\ignorespaces |
| 301 |
% \meta{entity-id$_2$}|}...|\\ |
| 302 |
% | {|\meta{relationship-id}|}[|\ignorespaces |
| 303 |
% \meta{relationship-name}|]|\\ |
| 304 |
% | /|\meta{connection}|/(|\meta{placement-ratio}|)| |
| 305 |
% \end{quote} |
| 306 |
% \begin{quote} |
| 307 |
% |\entity{Country} \hspace*{6cm} \entity{City}| \\ |
| 308 |
% |\relationshipbetween{Country}[0:n]{City}[1:1]|\\ |
| 309 |
% | {in}/\ncarc[arcangle=20]/(0.4)| |
| 310 |
% \vspace*{1cm} \\ |
| 311 |
% \entity{Country} \hspace*{6cm} \entity{City} |
| 312 |
% \relationshipbetween{Country}[0:n]{City}[1:1]{in}/\ncarc[arcangle=20]/(0.4) |
| 313 |
% \end{quote} |
| 314 |
% |
| 315 |
% For \TeX-insiders: Note that the use of |/.../| as argument delimiter |
| 316 |
% avoids collisions with the delimiters used by PSTricks which |
| 317 |
% thus can be used inside |/.../|. |
| 318 |
% |
| 319 |
% In the above example, although the relationship is placed on an |
| 320 |
% imaginary arc, the \emph{connections} are straight lines. |
| 321 |
% For these lines, PSTricks commands can be given, too. |
| 322 |
% With this, the \emph{full} syntax is |
| 323 |
% \begin{quote} |
| 324 |
% |\relationshipbetween[|\meta{property}|]|\\ |
| 325 |
% | {|\meta{entity-id$_1$}|}(|\ignorespaces |
| 326 |
% \meta{role$_1$}|)[|\meta{card$_1$}|]/|\meta{connection$_1$}|/|\\ |
| 327 |
% | {|\meta{entity-id$_2$}|}(|\meta{role$_2$}|)[|\ignorespaces |
| 328 |
% [\meta{card$_2$}|]/|\meta{connection$_2$}|/|\\ |
| 329 |
% | {|\meta{relationship-id}|}[|\meta{relationship-name}|]/|% |
| 330 |
% \meta{connection}|/(|\meta{placement-ratio}|)| |
| 331 |
% \end{quote} |
| 332 |
% |
| 333 |
% where all arguments embraced with |(...)|, |[...]|, or |/.../| are |
| 334 |
% optional. |
| 335 |
% |
| 336 |
% With this, an example can be given where two different relationships |
| 337 |
% can hold between a pair of entity types: |
| 338 |
% |
| 339 |
% \begin{quote} |
| 340 |
% |\entity{Country} \hspace*{6cm} \entity{City}| \\ |
| 341 |
% |\relationshipbetween{Country}[0:n]{City}[1:1]{in}|\\ |
| 342 |
% |/\ncarc[arcangle=20]/(0.4)|\\ |
| 343 |
% |\relationshipbetween{Country}[1:1]/\ncarc[arcangle=-18]/|\\ |
| 344 |
% | {City}[0:1]/\ncarc[arcangle=-12]/|\\ |
| 345 |
% | {Capital}/\ncarc[arcangle=-30]/(0.6)| |
| 346 |
% \vspace*{1cm} \\ |
| 347 |
% \entity{Country} \hspace*{6cm} \entity{City} |
| 348 |
% \relationshipbetween{Country}[0:n]{City}[1:1]{in}/\ncarc[arcangle=20]/(0.4) |
| 349 |
% \relationshipbetween{Country}[1:1]/\ncarc[arcangle=-18]/ |
| 350 |
% {City}[0:1]/\ncarc[arcangle=12]/ |
| 351 |
% {Capital}/\ncarc[arcangle=-30]/(0.6) |
| 352 |
% \vspace*{1.2cm} |
| 353 |
% \end{quote} |
| 354 |
% Note that for \emph{capital}, |\ncarc| is used for the lines, |
| 355 |
% where the |arcangle| of the whole arc is divided suitably |
| 356 |
% to the placement ratio of the diamond node, and that the |
| 357 |
% |arcangle| of the second entity is negative (since the connection |
| 358 |
% always points from the entity to the relationship). |
| 359 |
% |
| 360 |
% There is one more interesting special case of binary relationships: |
| 361 |
% recursive relationships. There, the entity node cannot be set |
| 362 |
% ``between'' the nodes -- it has to be placed relative to the |
| 363 |
% entity type which is involved in the relationship. |
| 364 |
% |
| 365 |
% In this case, the argument \meta{connection} has no effect, and last |
| 366 |
% argument (\meta{placement ratio}) has the syntax |
| 367 |
% |(|\meta{distance},\meta{angle}|)|: the relationship node is set |
| 368 |
% at angle \meta{angle} in distance \meta{dist} from the entity node. |
| 369 |
% The default for \meta{connection$_1$} and \meta{connection$_2$} |
| 370 |
% is set to |\ncarc[arcangleA=10,arcangleB=45]}| and \\ |
| 371 |
% |\ncarc[arcangleA=-10,arcangleB=-45]|, |
| 372 |
% respectively. |
| 373 |
% \begin{quote} |
| 374 |
% |\hspace*{6cm}\entity{Country}|\\ |
| 375 |
% |\relationshipbetween{Country}(A)[0:n]{Country}(B)[0:n]|\\ |
| 376 |
% | {Neighbor}(8em,180)| |
| 377 |
% \vspace*{0.8cm}\\ |
| 378 |
% \hspace*{6cm}\entity{Country} |
| 379 |
% \relationshipbetween{Country}(A)[0:n]{Country}(B)[0:n]{Neighbor}(8em,180) |
| 380 |
% \bigskip |
| 381 |
% \end{quote} |
| 382 |
% |
| 383 |
% With the above commands, only binary relationships can be |
| 384 |
% represented. Thus, there is one more macro, relating |
| 385 |
% entity nodes with already existing relationship nodes: |
| 386 |
% |
| 387 |
% \DescribeMacro\inrelationship |
| 388 |
% \begin{quote} |
| 389 |
% |\inrelationship[|\meta{property}|]{|\meta{entity-id}|}(|\meta{role}|)[|\ignorespaces |
| 390 |
% \meta{card}|]|\\ |
| 391 |
% | /|\meta{connection}|/{|\meta{relationship-id}|}| |
| 392 |
% \end{quote} |
| 393 |
% |
| 394 |
% With this, n-ary relations can be represented: |
| 395 |
% \begin{quote} |
| 396 |
% |\begin{tabular}{c}| \\ |
| 397 |
% |\entity{Person} \hspace*{6cm} \entity{Project} \\[2cm]| \\ |
| 398 |
% |\entity{Machine}| \\ |
| 399 |
% |\end{tabular}| \\ |
| 400 |
% |\relationshipbetween{Person}{Project}{worksatwith}|\ignorespaces |
| 401 |
% |[works\_at\_with]|\\ |
| 402 |
% | /\ncarc[arcangle=-20]/|\\ |
| 403 |
% |\inrelationship{Machine}{worksatwith}| |
| 404 |
% \bigskip\\ |
| 405 |
% \begin{tabular}{c} |
| 406 |
% \entity{Person} \hspace*{6cm} \entity{Project} \\[2cm] |
| 407 |
% \entity{Machine} |
| 408 |
% \end{tabular} |
| 409 |
% \relationshipbetween{Person}{Project}{worksatwith}[works\_at\_with] |
| 410 |
% /\ncarc[arcangle=-20]/ |
| 411 |
% \inrelationship{Machine}{worksatwith} |
| 412 |
% \end{quote} |
| 413 |
% |
| 414 |
% Additionally, there is a straightforward extension of |
| 415 |
% |\inrelationship| to relationship |
| 416 |
% nodes which do not already exist but are set by the command: |
| 417 |
% |
| 418 |
% \begin{quote} |
| 419 |
% |\inrelationship{|\meta{entity-id}|}(|\meta{role}|)|\ignorespaces |
| 420 |
% |[|\meta{card}|]/|\meta{connection}|/|\\ |
| 421 |
% | {|\meta{relationship-id}|}[|\meta{relationship-name}|]|\ignorespaces |
| 422 |
% |(|\meta{distance},\meta{angle}|)| |
| 423 |
% \end{quote} |
| 424 |
% |
| 425 |
% \begin{quote} |
| 426 |
% |\begin{tabular}{c}| \\ |
| 427 |
% |\entity{Person} \hspace*{6cm} \entity{Project} \\[2cm]| \\ |
| 428 |
% |\entity{Machine}| \\ |
| 429 |
% |\end{tabular}| \\ |
| 430 |
% |\inrelationship{Machine}{worksatwith}[works\_at\_with](4em,90)| \\ |
| 431 |
% |\inrelationship{Person}{worksatwith}| \\ |
| 432 |
% |\inrelationship{Project}{worksatwith}| |
| 433 |
% \bigskip \\ |
| 434 |
% \begin{tabular}{c} |
| 435 |
% \entity{Person} \hspace*{6cm} \entity{Project} \\[2cm] |
| 436 |
% \entity{Machine} |
| 437 |
% \end{tabular} |
| 438 |
% \inrelationship{Machine}{worksatwith}[works\_at\_with](4em,90) |
| 439 |
% \inrelationship{Person}{worksatwith} |
| 440 |
% \inrelationship{Project}{worksatwith} |
| 441 |
% \end{quote} |
| 442 |
% |
| 443 |
% \DescribeMacro\rolepos |
| 444 |
% The position where roles and cardinalities are placed on the |
| 445 |
% node connection is determined by |\rolepos| and |\cardpos| which |
| 446 |
% \DescribeMacro\cardpos |
| 447 |
% can be set by |\rolepos{|\meta{number}|}| and |
| 448 |
% |\cardpos{|\meta{number}|}|, where number underlies the same |
| 449 |
% constraints as for |npos| in PSTricks (i.e., for |\ncline| and |
| 450 |
% |\ncarc|, it has to be between 0 and 1, other values are allowed |
| 451 |
% e.g.\ for |\ncbar|). The default setting is |\cardpos{0.5}| and |
| 452 |
% |\rolepos{0.85}|. |
| 453 |
% |
| 454 |
% \subsection{Annotations to Objects} |
| 455 |
% \DescribeMacro\annote |
| 456 |
% With |
| 457 |
% \begin{quote} |
| 458 |
% |\annote{|\meta{id}|}{|\meta{text}|}(|\meta{distance},\meta{angle}|)| |
| 459 |
% \end{quote} |
| 460 |
% a node \meta{id} can be annoted with a comment \meta{text}. |
| 461 |
% |
| 462 |
% \subsection{Usage} |
| 463 |
% |
| 464 |
% The package is intended to be used for two purposes: |
| 465 |
% \begin{itemize} |
| 466 |
% \item Typesetting small fragments of ER-diagrams, e.g., for |
| 467 |
% lecture notes and slides: as shown in the above |
| 468 |
% documentation, fragments of ER-diagrams can easily be integrated |
| 469 |
% with the running text. |
| 470 |
% \item Typesetting ER-Diagrams for project documentation: |
| 471 |
% here the standard procedure is to design the ER-diagram based |
| 472 |
% on a |tabular| environment in which the entity nodes are positioned; |
| 473 |
% Then, attributes and relationships are positioned in the above |
| 474 |
% declarative way. Using basic PSTricks commands, additional |
| 475 |
% entity nodes can also be placed declaratively. |
| 476 |
% \end{itemize} |
| 477 |
% |
| 478 |
% There are the following advantages compared to using graphics tools, |
| 479 |
% e.g., xfig: |
| 480 |
% \begin{itemize} |
| 481 |
% \item the source code of the diagrams is written into the running |
| 482 |
% source code of the document, thus there is no need for a bunch |
| 483 |
% of separate |.fig| and |.eps| files. |
| 484 |
% \item more flexibility wrt.\ renaming and layout changes. |
| 485 |
% \item given the positions of some basic objects, the other |
| 486 |
% objects are set with declarative commands, i.e.\ they |
| 487 |
% automatically adjust when the positions change. |
| 488 |
% \end{itemize} |
| 489 |
% |
| 490 |
% \subsection{Example} |
| 491 |
% |
| 492 |
% TO BE FILLED |
| 493 |
% |
| 494 |
% \subsection{Miscellaneous} |
| 495 |
% |
| 496 |
% \DescribeMacro\nodeconnections |
| 497 |
% With |\nodeconnections{|\meta{PSTricks-node-connections}|}|, |
| 498 |
% the PSTricks-node connections and label commands do not require any |
| 499 |
% extra horizontal or vertical space. |
| 500 |
% |
| 501 |
% \DescribeMacro\database |
| 502 |
% The command |
| 503 |
% \begin{quote} |
| 504 |
% |\database[|\meta{pos}|]{|\meta{width}|}{|\ignorespaces |
| 505 |
% \meta{height}|}[|\meta{graph\_params}|]{|\ignorespaces |
| 506 |
% \meta{text}|}[|\meta{id}|]| |
| 507 |
% \end{quote} |
| 508 |
% defines a database barrel as a tabular which is vertically |
| 509 |
% centered as given in the optional argument \meta{pos} (Default: |[c]|). |
| 510 |
% \meta{text} is the text to be written on the front of the barrel, |
| 511 |
% \meta{width} and \meta{height} give the width and height of the |
| 512 |
% barrel; both must be a dimension, e.g., {2cm}. With the optional |
| 513 |
% graphics parameter \meta{graph\_params}, the pstricks parameters |
| 514 |
% \textsf{fillstyle} and |
| 515 |
% \textsf{fillcolor} for the database can be set (see example below). |
| 516 |
% The optional argument \meta{id} is used as an internal name, |
| 517 |
% it must start with a letter and must contain only letters and |
| 518 |
% digits. \meta{id} is used for |\rnode| definitions: |
| 519 |
% \meta{id} is the whole barrel |
| 520 |
% |lu|\meta{id}, |ru|\meta{id}, |mu|\meta{id}, and |muf|\meta{id} |
| 521 |
% denote the points at the upper left corner, upper right corner, |
| 522 |
% upper middle behind and aupper middle in front of the barrel. |
| 523 |
% Analogously, |ll|\meta{id}, |rl|\meta{id}, and |ml|\meta{id}, |
| 524 |
% denote the lower left and lower right corner and lower middle in |
| 525 |
% front of the barrel. \medskip |
| 526 |
% |
| 527 |
% \begin{tabular}{lc} |
| 528 |
% |\psset{nodesep=2pt}|\\ |
| 529 |
% |\begin{tabular}{lc}| \\ |
| 530 |
% | &\rnode{lu}{lu}\quad\rnode{mu}{mu}\quad| \\ |
| 531 |
% | \rnode{muf}{muf}\quad\rnode{ru}{ru}\\[1em]| \\ |
| 532 |
% | \rnode{db}{database}|\\ |
| 533 |
% | &\database[t]{2cm}{1cm}| \\ |
| 534 |
% | [fillstyle=solid,fillcolor=red]| \\ |
| 535 |
% | {database}[example] \\[5em]| \\ |
| 536 |
% | &\rnode{ll}{ll}\qquad\rnode{ml}{ml}|\\ |
| 537 |
% | \qquad\rnode{rl}{rl}| \\ |
| 538 |
% |\end{tabular}| \\ |
| 539 |
% |\nodeconnections{%| \\ |
| 540 |
% |\ncline{->}{lu}{luexample}| \\ |
| 541 |
% |\ncline{->}{mu}{muexample}| \\ |
| 542 |
% |\ncline{->}{muf}{mufexample}| \\ |
| 543 |
% |\ncline{->}{ru}{ruexample}| \\ |
| 544 |
% |\ncline{->}{ll}{llexample}| \\ |
| 545 |
% |\ncline{->}{ml}{mlexample}| \\ |
| 546 |
% |\ncline{->}{db}{example}| \\ |
| 547 |
% |\ncline{->}{rl}{rlexample}}| |
| 548 |
% \end{tabular} |
| 549 |
% \hspace*{-1.5cm} |
| 550 |
% \psset{nodesep=2pt} |
| 551 |
%\begin{tabular}{lc} |
| 552 |
% &\rnode{lu}{lu}\quad\rnode{mu}{mu}\quad |
| 553 |
% \rnode{muf}{muf}\quad\rnode{ru}{ru}\\[1em] |
| 554 |
% \rnode{db}{database} |
| 555 |
% &\database[t]{2cm}{1cm} |
| 556 |
% [fillstyle=solid,fillcolor=red] |
| 557 |
% {database}[example] \\[5em] |
| 558 |
% &\rnode{ll}{ll}\qquad\rnode{ml}{ml}\qquad\rnode{rl}{rl} |
| 559 |
% \end{tabular} |
| 560 |
% \nodeconnections{% |
| 561 |
% \ncline{->}{lu}{luexample} |
| 562 |
% \ncline{->}{mu}{muexample} |
| 563 |
% \ncline{->}{muf}{mufexample} |
| 564 |
% \ncline{->}{ru}{ruexample} |
| 565 |
% \ncline{->}{ll}{llexample} |
| 566 |
% \ncline{->}{ml}{mlexample} |
| 567 |
% \ncline{->}{db}{example} |
| 568 |
% \ncline{->}{rl}{rlexample}} |
| 569 |
% |
| 570 |
% \section{Code Documentation}\label{sec:code} |
| 571 |
% \iffalse |
| 572 |
% \subsection{The documentation driver file} |
| 573 |
% |
| 574 |
% The next bit of code contains the documentation driver file for |
| 575 |
% \TeX{}, i.e., the file that will produce the documentation you are |
| 576 |
% currently reading. It will be extracted from this file by the |
| 577 |
% \texttt{docstrip} program. Since it is the first code in the file |
| 578 |
% one can alternatively process this file directly with \LaTeXe{} to |
| 579 |
% obtain the documentation. |
| 580 |
% |
| 581 |
% \begin{macrocode} |
| 582 |
%<*driver> |
| 583 |
\documentclass{ltxdoc} \usepackage{latexsym} |
| 584 |
\usepackage{pstricks,pst-node} \usepackage{pst-dbicons} |
| 585 |
\parindent0pt\hfuzz2pt \setlength{\textwidth}{360pt} |
| 586 |
\begin{document} |
| 587 |
\DocInput{pst-dbicons.dtx} |
| 588 |
\end{document} |
| 589 |
%</driver> |
| 590 |
% \end{macrocode} |
| 591 |
%\fi |
| 592 |
% \setcounter{CodelineNo}{0} |
| 593 |
%\iffalse |
| 594 |
%<*package>\fi |
| 595 |
% \begin{macrocode} |
| 596 |
\typeout{Style `\basename', Version \fileversion\space <\filedate>} |
| 597 |
\ProvidesPackage{pst-dbicons}[\filedate \space\fileversion] |
| 598 |
% \end{macrocode} |
| 599 |
% |
| 600 |
% \begin{macro}{\seticonparams} |
| 601 |
% |\seticonparams{#1}{#2}| |
| 602 |
% \Codelabel{seticonparams} |
| 603 |
% \begin{macrocode} |
| 604 |
\def\seticonparams#1#2{\expandafter\def\csname #1@parm\endcsname{[#2]}} |
| 605 |
\seticonparams{entity}{fillstyle=none} |
| 606 |
\seticonparams{relationship}{fillstyle=none} |
| 607 |
\seticonparams{attribute}{fillstyle=none} |
| 608 |
% \end{macrocode} |
| 609 |
% \end{macro} |
| 610 |
% \begin{macro}{\purifylabel} |
| 611 |
% \changes{v0.14}{02/11/21}{macro added} |
| 612 |
% Macro |\@purifylabel| expands the string given in |#2| |
| 613 |
% and stores the result in command given in |#1|. |
| 614 |
% Supported TeX commands in string |#2|: |
| 615 |
% |\_|, |\textunderscore| |
| 616 |
% Example: |\@purifylabel{\templabel}{has\_hq\_in}|, then use |
| 617 |
% |\templabel| as nodelabel for pstricks. |
| 618 |
% \Codelabel{purifylabel} |
| 619 |
% \begin{macrocode} |
| 620 |
\def\dbi@purifylabel#1#2{% |
| 621 |
\begingroup |
| 622 |
\edef\_{\string_}% |
| 623 |
\edef\textunderscore{\string_}% |
| 624 |
\edef\x{\endgroup |
| 625 |
\def\noexpand#1{#2}% |
| 626 |
}% |
| 627 |
\x |
| 628 |
} |
| 629 |
% \end{macrocode} |
| 630 |
% \end{macro} |
| 631 |
% |
| 632 |
% \begin{macro}{\entity} |
| 633 |
% \changes{v0.11}{98/10/15}{added optional property of entities} |
| 634 |
% |\entity[#1a]{#1b}[#2]| |
| 635 |
% \Codelabel{entity} |
| 636 |
% \begin{macrocode} |
| 637 |
\def\entity{% |
| 638 |
\@ifnextchar[{\entity@i}{\entity@i[normal]}} |
| 639 |
\def\entity@i[#1]#2{% |
| 640 |
\@ifnextchar[{\entity@ii{#1}{#2}}{\entity@ii{#1}{#2}[#2]}} |
| 641 |
\def\entity@ii#1#2[#3]{\csname entity@#1\endcsname{#2}{#3}} |
| 642 |
\def\entity@normal#1#2{% |
| 643 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 644 |
\rnode{\dbi@prfd@nodename}{\expandafter\psframebox\entity@parm{\strut#2}}} |
| 645 |
\def\entity@weak#1#2{% |
| 646 |
{\psset{doubleline=true}% |
| 647 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 648 |
\rnode{\dbi@prfd@nodename}{\expandafter\psframebox\entity@parm{\strut#2}}}} |
| 649 |
% \end{macrocode} |
| 650 |
% \end{macro} |
| 651 |
% |
| 652 |
% \begin{macro}{\attribute} |
| 653 |
% |\attribute[#1]{#2}[#3]| |
| 654 |
% \Codelabel{attribute} |
| 655 |
% \begin{macrocode} |
| 656 |
\def\attribute{% |
| 657 |
\@ifnextchar[{\attribute@i}{\attribute@i[sv]}} |
| 658 |
\def\attribute@i[#1]#2{% |
| 659 |
\@ifnextchar[{\attribute@ii{#1}{#2}}{\attribute@ii{#1}{#2}[#2]}} |
| 660 |
\def\attribute@ii#1#2[#3]{\csname attribute@#1\endcsname{#2}{#3}} |
| 661 |
\def\attribute@mv#1#2{{\psset{doubleline=true}% |
| 662 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 663 |
\expandafter\ovalnode\attribute@parm{\dbi@prfd@nodename}{#2}}} |
| 664 |
\def\attribute@sv#1#2{% |
| 665 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 666 |
\expandafter\ovalnode\attribute@parm{\dbi@prfd@nodename}{#2}} |
| 667 |
\def\attribute@key#1#2{ |
| 668 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 669 |
\expandafter\ovalnode\attribute@parm{\dbi@prfd@nodename}{\underline{#2}}} |
| 670 |
% \end{macrocode} |
| 671 |
% \end{macro} |
| 672 |
% |
| 673 |
% \begin{macro}{\attributeof} |
| 674 |
% |\attributeof{#1}[#2]{#3}[#4]{#5}[#6]| |
| 675 |
% \begin{macrocode} |
| 676 |
\newdimen\@attrdist |
| 677 |
\@attrdist2em % Default value for distance of attribute from entity |
| 678 |
\def\attrdist#1{\@attrdist#1} % set default distance |
| 679 |
% \end{macrocode} |
| 680 |
% |
| 681 |
% \Codelabel{attributeof} |
| 682 |
% \changes{v0.16}{2010/03/25}{fixed first optional argument} |
| 683 |
% \begin{macrocode} |
| 684 |
\def\attributeof#1{% |
| 685 |
\@ifnextchar[{\attributeof@i{#1}}{\attributeof@i{#1}[\@attrdist]}} |
| 686 |
\def\attributeof@i#1[#2]#3{% |
| 687 |
\@ifnextchar[{\attributeof@ii{#1}[#2]{#3}}{\attributeof@ii{#1}[#2]{#3}[sv]}} |
| 688 |
\def\attributeof@ii#1[#2]#3[#4]#5{% |
| 689 |
\@ifnextchar[{\attributeof@iii{#1}[#2]{#3}[#4]{#5}}% |
| 690 |
{\attributeof@iii{#1}[#2]{#3}[#4]{#5}[#5]}} |
| 691 |
\def\attributeof@iii#1[#2]#3[#4]#5[#6]{% |
| 692 |
\SpecialCoor |
| 693 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 694 |
\uput{#2}[#3]{0}(\dbi@prfd@nodename){\attribute[#4]{#5}[#6]}% |
| 695 |
\NormalCoor |
| 696 |
\ncline{-}{#1}{#5}} |
| 697 |
% \end{macrocode} |
| 698 |
% \end{macro} |
| 699 |
% |
| 700 |
% \begin{macro}{\relationship} |
| 701 |
% \changes{v0.11}{98/10/15}{added optional property of relationships} |
| 702 |
% |\relationship[#1a]{#1b}[#2]| |
| 703 |
% \Codelabel{relationship} |
| 704 |
% \begin{macrocode} |
| 705 |
\def\relationship{% |
| 706 |
\@ifnextchar[{\relationship@i}{\relationship@i[normal]}} |
| 707 |
\def\relationship@i[#1]#2{% |
| 708 |
\@ifnextchar[{\relationship@ii{#1}{#2}}{\relationship@ii{#1}{#2}[#2]}} |
| 709 |
\def\relationship@ii#1#2[#3]{\csname relationship@#1\endcsname{#2}{#3}} |
| 710 |
\def\relationship@normal#1#2{% |
| 711 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 712 |
\expandafter\dianode\relationship@parm{\dbi@prfd@nodename}{#2}} |
| 713 |
\def\relationship@weak#1#2{% |
| 714 |
{\psset{doubleline=true}% |
| 715 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 716 |
\expandafter\dianode\relationship@parm{\dbi@prfd@nodename}{#2}}} |
| 717 |
\let\relationship@ident\relationship@weak |
| 718 |
% \end{macrocode} |
| 719 |
% \end{macro} |
| 720 |
% |
| 721 |
% \begin{macro}{\relationshipbetween} |
| 722 |
% \changes{v0.11}{98/10/15}{added optional property of relationships} |
| 723 |
% |\relationshipbetween[#1a]{#1b}(#2)[#3]/#4/{#5}(#6)[#7]/#8/{#9}[#10]/#11/(#12)| |
| 724 |
% \Codelabel{relationshipbetween} |
| 725 |
% \begin{macrocode} |
| 726 |
\newtoks\rolepos |
| 727 |
\rolepos{0.85}% |
| 728 |
\newtoks\cardpos |
| 729 |
\cardpos{0.5}% |
| 730 |
\newif\ifdbi@recursive |
| 731 |
\def\relationshipbetween{% |
| 732 |
\@ifnextchar[{\relationshipbetween@type}{\relationshipbetween@type[normal]}} |
| 733 |
\def\relationshipbetween@type[#1]#2{\dbi@recursivefalse% |
| 734 |
\def\relationtype{#1}% |
| 735 |
\@ifnextchar({\relationshipbetween@i@role{#2}}% |
| 736 |
{\relationshipbetween@i@role{#2}(\relax)}} |
| 737 |
\def\relationshipbetween@i@role#1(#2){% |
| 738 |
\@ifnextchar[{\relationshipbetween@i@card{#1}{#2}}% |
| 739 |
{\relationshipbetween@i@card{#1}{#2}[\relax]}} |
| 740 |
\def\relationshipbetween@i@card#1#2[#3]{% |
| 741 |
\@ifnextchar/{\relationshipbetween@i@linetype{#1}{#2}{#3}}% |
| 742 |
{\relationshipbetween@i@linetype{#1}{#2}{#3}/\relax/}}% |
| 743 |
\def\relationshipbetween@i@linetype#1#2#3/#4/#5{% |
| 744 |
\def\dbi@linecmd@i{#4}% |
| 745 |
\def\dbi@tempa{#1}\def\dbi@tempb{#5}% |
| 746 |
\ifx\dbi@tempa\dbi@tempb\dbi@recursivetrue\fi |
| 747 |
\ifx#4\relax |
| 748 |
\ifdbi@recursive |
| 749 |
\def\dbi@linecmd@i{\ncarc[arcangleA=10,arcangleB=45]}% |
| 750 |
\else\def\dbi@linecmd@i{\ncline}\fi\fi |
| 751 |
\@ifnextchar({\relationshipbetween@ii@role{#1}{#2}{#3}{#5}}% |
| 752 |
{\relationshipbetween@ii@role{#1}{#2}{#3}{#5}(\relax)}}% |
| 753 |
\def\relationshipbetween@ii@role#1#2#3#4(#5){% |
| 754 |
\@ifnextchar[{\relationshipbetween@ii@card{#1}{#2}{#3}{#4}{#5}}% |
| 755 |
{\relationshipbetween@ii@card{#1}{#2}{#3}{#4}{#5}[\relax]}} |
| 756 |
\def\relationshipbetween@ii@card#1#2#3#4#5[#6]{% |
| 757 |
\@ifnextchar/{\relationshipbetween@ii@linetype{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 758 |
{\relationshipbetween@ii@linetype{#1}{#2}{#3}{#4}{#5}{#6}% |
| 759 |
/\relax/}}% |
| 760 |
\def\relationshipbetween@ii@linetype#1#2#3#4#5#6/#7/#8{% |
| 761 |
\def\dbi@linecmd@ii{#7}% |
| 762 |
\ifx#7\relax |
| 763 |
\ifdbi@recursive |
| 764 |
\def\dbi@linecmd@ii{\ncarc[arcangleA=-10,arcangleB=-45]}% |
| 765 |
\else\def\dbi@linecmd@ii{\ncline}\fi\fi |
| 766 |
\@ifnextchar[{\relationshipbetween@optname{#1}{#2}{#3}{#4}{#5}{#6}{#8}}% |
| 767 |
{\relationshipbetween@optname{#1}{#2}{#3}{#4}{#5}{#6}{#8}[#8]}}% |
| 768 |
\def\relationshipbetween@optname#1#2#3#4#5#6#7[#8]{% |
| 769 |
\@ifnextchar/{\relationshipbetween@linetype{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% |
| 770 |
{\relationshipbetween@linetype{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% |
| 771 |
/\ncline/}}% |
| 772 |
\def\relationshipbetween@linetype#1#2#3#4#5#6#7#8/#9/{% |
| 773 |
\def\dbi@linecmd{#9}% |
| 774 |
\@ifnextchar({\relationshipbetween@pos{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% |
| 775 |
{\relationshipbetween@pos{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}(0.5)}}% |
| 776 |
\def\relationshipbetween@pos#1#2#3#4#5#6#7#8(#9){% |
| 777 |
\ifdbi@recursive |
| 778 |
\relationshipbetween@rec{#1}{#2}{#3}{#5}{#6}{#7}{#8}(#9)\else |
| 779 |
\relationshipbetween@nonrec{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}(#9)\fi} |
| 780 |
% \end{macrocode} |
| 781 |
% |
| 782 |
% \Codelabel{relationshipbetweennonrec} |
| 783 |
% \begin{macrocode} |
| 784 |
\def\relationshipbetween@nonrec#1#2#3#4#5#6#7#8(#9){% |
| 785 |
\dbi@purifylabel{\dbi@prfd@nodename@i}{#1}% |
| 786 |
\dbi@purifylabel{\dbi@prfd@nodename@ii}{#4}% |
| 787 |
\dbi@purifylabel{\dbi@prfd@nodename@iii}{#7}% |
| 788 |
{\psset{linestyle=none}% |
| 789 |
\dbi@linecmd{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}}% |
| 790 |
\ncput[npos=#9]{\relationship[\relationtype]{#7}[#8]}% |
| 791 |
\dbi@linecmd@i{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@iii}% |
| 792 |
\ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi |
| 793 |
\ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi |
| 794 |
\dbi@linecmd@ii{-}{\dbi@prfd@nodename@ii}{\dbi@prfd@nodename@iii}% |
| 795 |
\ifx#6\relax\else\ncput*[npos=\the\cardpos]{#6}\fi |
| 796 |
\ifx#5\relax\else\ncput*[npos=\the\rolepos]{#5}\fi} |
| 797 |
% \end{macrocode} |
| 798 |
% |
| 799 |
% \Codelabel{relationshipbetweenrec} |
| 800 |
% \begin{macrocode} |
| 801 |
\def\relationshipbetween@rec#1#2#3#4#5#6#7(#8,#9){% |
| 802 |
\dbi@purifylabel{\dbi@prfd@nodename@i}{#1}% |
| 803 |
\dbi@purifylabel{\dbi@prfd@nodename@ii}{#6}% |
| 804 |
\SpecialCoor |
| 805 |
\uput{#8}[#9]{0}(\dbi@prfd@nodename@i)% |
| 806 |
{\relationship[\relationtype]{#6}[#7]}% |
| 807 |
\NormalCoor |
| 808 |
\dbi@linecmd@i{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}% |
| 809 |
\ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi |
| 810 |
\ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi |
| 811 |
\dbi@linecmd@ii{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}% |
| 812 |
\ifx#5\relax\else\ncput*[npos=\the\cardpos]{#5}\fi |
| 813 |
\ifx#4\relax\else\ncput*[npos=\the\rolepos]{#4}\fi} |
| 814 |
% \end{macrocode} |
| 815 |
% \end{macro} |
| 816 |
% |
| 817 |
% \begin{macro}{\inrelationship} |
| 818 |
% \changes{v0.11}{98/10/15}{added optional property of relationships} |
| 819 |
% |\inrelationship[#1a]{#1b}(#2)[#3]/#4/{#5}[#6](#7,#8)| |
| 820 |
% \Codelabel{inrelationship} |
| 821 |
% \begin{macrocode} |
| 822 |
\def\inrelationship{% |
| 823 |
\@ifnextchar[{\inrelationship@type}{\inrelationship@type[normal]}} |
| 824 |
\def\inrelationship@type[#1]#2{% |
| 825 |
\def\relationtype{#1}% |
| 826 |
\@ifnextchar({\inrelationship@role{#2}}% |
| 827 |
{\inrelationship@role{#2}(\relax)}} |
| 828 |
\def\inrelationship@role#1(#2){% |
| 829 |
\@ifnextchar[{\inrelationship@card{#1}{#2}}% |
| 830 |
{\inrelationship@card{#1}{#2}[\relax]}} |
| 831 |
\def\inrelationship@card#1#2[#3]{% |
| 832 |
\@ifnextchar/{\inrelationship@linetype{#1}{#2}{#3}}% |
| 833 |
{\inrelationship@linetype{#1}{#2}{#3}/\ncline/}}% |
| 834 |
\def\inrelationship@linetype#1#2#3/#4/#5{% |
| 835 |
\dbi@purifylabel{\dbi@prfd@nodename@i}{#1}% |
| 836 |
\dbi@purifylabel{\dbi@prfd@nodename@ii}{#5}% |
| 837 |
\def\dbi@linecmd{#4}% |
| 838 |
\@ifnextchar[{\inrelationship@newrel{#1}{#2}{#3}{#5}}% |
| 839 |
{\@ifnextchar({% |
| 840 |
\inrelationship@newrel{#1}{#2}{#3}{#5}[#5]}% |
| 841 |
{\dbi@linecmd{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii} |
| 842 |
\ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi |
| 843 |
\ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi}}}% |
| 844 |
% \end{macrocode} |
| 845 |
% |
| 846 |
% \Codelabel{inrelationshipnewrel} |
| 847 |
% \begin{macrocode} |
| 848 |
\def\inrelationship@newrel#1#2#3#4[#5]{% |
| 849 |
\@ifnextchar({\inrelationship@newrel@pos{#1}{#2}{#3}{#4}{#5}}% |
| 850 |
{\PackageError{\basename}{Position of relationship #4 |
| 851 |
undefined.}\@eha}} |
| 852 |
\def\inrelationship@newrel@pos#1#2#3#4#5(#6,#7){% |
| 853 |
\SpecialCoor |
| 854 |
\dbi@purifylabel{\dbi@prfd@nodename@i}{#1}% |
| 855 |
\dbi@purifylabel{\dbi@prfd@nodename@ii}{#4}% |
| 856 |
\uput{#6}[#7]{0}(\dbi@prfd@nodename@i){\relationship[\relationtype]{#4}[#5]}% |
| 857 |
\NormalCoor |
| 858 |
\dbi@linecmd{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii} |
| 859 |
\ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi |
| 860 |
\ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi} |
| 861 |
% \end{macrocode} |
| 862 |
% \end{macro} |
| 863 |
% |
| 864 |
% \begin{macro}{\annote} |
| 865 |
% \setcounter{CodelineNo}{0} |
| 866 |
% \changes{v0.11}{98/09/24}{added annote} |
| 867 |
% \begin{macrocode} |
| 868 |
\def\annote#1#2(#3,#4){% |
| 869 |
\dbi@purifylabel{\dbi@prfd@nodename}{#1}% |
| 870 |
\SpecialCoor |
| 871 |
\uput{#3}[#4]{0}(\dbi@prfd@nodename){#2}% |
| 872 |
\NormalCoor} |
| 873 |
% \end{macrocode} |
| 874 |
% \end{macro} |
| 875 |
% |
| 876 |
% \begin{macro}{\nodeconnections} |
| 877 |
% \setcounter{CodelineNo}{0} |
| 878 |
% \begin{macrocode} |
| 879 |
\def\nodeconnections#1{\hbox to 0cm{\vbox to 0cm {#1}}} |
| 880 |
% \end{macrocode} |
| 881 |
% \end{macro} |
| 882 |
% |
| 883 |
% \begin{macro}{\database} |
| 884 |
% \changes{v0.13}{98/11/22}{added graphics parameters to database} |
| 885 |
% \changes{v0.15}{05/09/09}{debugged vertical placement} |
| 886 |
% |\database[#1]{#2}{#3}[#4]{#5}[#6]| |
| 887 |
% \Codelabel{database} |
| 888 |
% \begin{macrocode} |
| 889 |
\def\database{\@ifnextchar[{\database@i}{\database@i[c]}} |
| 890 |
\def\database@i[#1]#2#3{% |
| 891 |
\@ifnextchar[{\database@ii{#1}{#2}{#3}}% |
| 892 |
{\database@ii{#1}{#2}{#3}[fillstyle=none]}} |
| 893 |
\def\database@ii#1#2#3[#4]#5{% |
| 894 |
\@ifnextchar[{\database@iii{#1}{#2}{#3}{#4}{#5}}% |
| 895 |
{\database@iii{#1}{#2}{#3}{#4}{#5}[#5]}} |
| 896 |
\def\database@iii#1#2#3#4#5[#6]{% |
| 897 |
\psset{nodesep=0pt}% |
| 898 |
\dbi@purifylabel{\dbi@prfd@nodename}{#6}% |
| 899 |
\rnode{\dbi@prfd@nodename}{% |
| 900 |
\begin{tabular}[#1]{c}% |
| 901 |
\rnode{lu\dbi@prfd@nodename}{}\hspace{#2}\rnode{ru\dbi@prfd@nodename}{}\\[#3] |
| 902 |
\rnode{ll\dbi@prfd@nodename}{}\hspace{#2}\rnode{rl\dbi@prfd@nodename}{}% |
| 903 |
\end{tabular}}% |
| 904 |
\nodeconnections{% |
| 905 |
\ncbar[linestyle=none,#4, |
| 906 |
angleA=180,angleB=180,armB=0]{ru\dbi@prfd@nodename}{ll\dbi@prfd@nodename} |
| 907 |
\ncbar[linestyle=none,#4, |
| 908 |
angleA=0,angleB=0,armA=0]{ru\dbi@prfd@nodename}{ll\dbi@prfd@nodename} |
| 909 |
\nccurve[#4,angleA=90,angleB=90,ncurv=.6]{lu\dbi@prfd@nodename}{ru\dbi@prfd@nodename}% |
| 910 |
\ncput{\rnode{mu\dbi@prfd@nodename}{}}% |
| 911 |
\nccurve[angleA=-90,angleB=-90,ncurv=.6]{lu\dbi@prfd@nodename}{ru\dbi@prfd@nodename}% |
| 912 |
\ncput{\rnode{muf\dbi@prfd@nodename}{}}% |
| 913 |
\nccurve[#4,angleA=-90,angleB=-90,ncurv=.6]{ll\dbi@prfd@nodename}{rl\dbi@prfd@nodename}% |
| 914 |
\ncput{\rnode{ml\dbi@prfd@nodename}{}}% |
| 915 |
\ncline{lu\dbi@prfd@nodename}{ll\dbi@prfd@nodename}% |
| 916 |
\ncline{ru\dbi@prfd@nodename}{rl\dbi@prfd@nodename}% |
| 917 |
\ncline[linestyle=none]{muf\dbi@prfd@nodename}{ml\dbi@prfd@nodename}\ncput[npos=0.4]{#5}}} |
| 918 |
% \end{macrocode} |
| 919 |
% \end{macro} |
| 920 |
% |
| 921 |
%\iffalse |
| 922 |
%</package>\fi |
| 923 |
% \GlossaryPrologue{} |
| 924 |
% |
| 925 |
% \IfFileExists{pst-dbicons.gls}{\PrintChanges} |
| 926 |
% {\begin{quote}You should create the list of changes by |
| 927 |
% |
| 928 |
% ~~~ \texttt{makeindex -s gglo.ist -o pst-dbicons.gls pst-dbicons.glo} |
| 929 |
% |
| 930 |
% and running \texttt{latex pst-dbicons.drv} again.\end{quote}} |
| 931 |
% |
| 932 |
% |
| 933 |
% \subsection{Acknowledgements} |
| 934 |
% |
| 935 |
% Thanx to Heiko Oberdiek for adding the handling of ids for |
| 936 |
% internal use in postcsript (used in the |purifylabel| macro). |
| 937 |
% |
| 938 |
% \Finale |
| 939 |
\endinput |
| 940 |
|
| 941 |
% Local Variables: |
| 942 |
% TeX-command-default: "LaTeX" |
| 943 |
% TeX-master: t |
| 944 |
% End: |
| 945 |
% mode: latex |