summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/pst-dbicons/pst-dbicons.dtx
blob: a2d49316cb1984f7f8e1f3f3dbc74d9a5b136136 (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
\def\filedate{2006/11/26}
\def\docdate{2006/11/26}
\def\fileversion{0.2}
\def\basename{pst-dbicons}
%
% \iffalse meta-comment
%
% Package 'pst-dbicons to use with LaTeX2e and PSTricks
% Copyright 1997-2006 by Wolfgang May.
% may@informatik.uni-goettingen.de
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN archives
% in directory macros/latex/base/lppl.txt.
% 
% \fi
%
% \changes{v0.20}{2006/11/26}{First CTAN release (hv)}
%
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
% \RecordChanges
%
% \MakeShortVerb{\|}
% \makeatletter
% \def\Codelabel#1{\@bsphack  
%  \protected@write\@auxout{}{\string\newlabel{#1}{{\number\the
%            \c@CodelineNo}{\thepage}}}\@esphack}
% \newcounter{tmpcount}
% \def\Coderef#1#2{\setcounter{tmpcount}{0}\@ifundefined{r@#1}\relax
%           {\setcounter{tmpcount}{\ref{#1}}}\relax
%           \addtocounter{tmpcount}{#2}\arabic{tmpcount}}
% \makeatother
%
% \title{PSTricks Macros for Databases\thanks{This 
%          file has version number \fileversion{}, last revised \filedate.}}
% \author{Wolfgang May\thanks{\texttt{may@informatik.uni-goettingen.de}}}
% \date{\filedate}
% \maketitle          
%
% \begin{abstract}
%  \noindent
% The \emph{pst-dbicons} package provides some useful macros in the 
% database area. It focusses on typesetting ER-Diagrams in a 
% declarative style, i.e., by positioning some nodes and defining
% the position of all other nodes relative to them by using the 
% standard database terminology.
% The PSTricks package is required for using pst-dbicons, but
% there is no deep knowledge of PSTricks commands required 
% (although this is useful for exploiting the full functionality).
% \end{abstract}
%
% \section{Commands}
%
% \subsection{ER-Diagrams}
%
% ER-Diagrams are a widely used graphical representation 
% formalism for conceptual modeling; especially used in the
% database community. Their main notions are \emph{entities}
% (e.g., persons, cities, or countries), \emph{attributes} of
% entities (e.g., name, id-number, age), and relationships 
% between entities (e.g., belongs\_to, is\_capital\_of). 
% 
% \DescribeMacro\seticonparams
% With 
% \begin{quote}
% |\seticonparams{|\meta{icon-type}|}{|\meta{graphics parameters}|}|
% \end{quote}
% the graphical layout of icons (entities, relationships, and attributes)
% can be specified (by giving the optional argument for PSTricks'
% boxes). Default is
% |[fillstyle=none]| for all of them.
% in this documentation, we modify it to
%
%\begin{verbatim}
%\seticonparams{entity}{shadow=true,fillcolor=lightgray,fillstyle=solid}
%\seticonparams{attribute}{fillcolor=lightgray,fillstyle=solid}
%\seticonparams{relationship}{shadow=true,fillcolor=lightgray,fillstyle=solid}\end{verbatim}
%\seticonparams{entity}{shadow=true,fillcolor=lightgray,fillstyle=solid}
%\seticonparams{attribute}{fillcolor=lightgray,fillstyle=solid}
%\seticonparams{relationship}{shadow=true,fillcolor=lightgray,fillstyle=solid}
%
% From the user's point of view, every ER-icon (entities, relationships,
% attributes)
% has a name which should be typeset in the respective box. Additionally,
% there are \emph{internal} identifiers of the boxes/nodes to allow for
% referencing by graphics commands in the standard PSTricks way.
% These \emph{internal id}'s must start with a letter and must contain 
% only letters 
% and digits. In general, id's must be unique on every 
% page.\footnote{people who are familiar with PSTricks know under which
% conditions non-unique node identifiers can be used.} 
% Often, the \emph{name} of the entity/relationship/attribute satisfies
% these conditions; in these cases, the name is also used as id. 
% in other cases, name and id must be specified. 
%
% Thus, for all commands for typesetting ER-icons, the node id 
% \emph{must} be given, whereas the name to be typeset in the box 
% is optional; if no name is specified, the id is typeset as the name.
%
%
% \subsection{Entities and Attributes}
% \DescribeMacro\entity
% With 
% \begin{quote}
% |\entity[|\meta{property}|]{|\meta{id}|}[|\meta{text}|]|
% \end{quote}
% an entity type is set as a rectangular node.
% If the optional argument \meta{text} is not given, \meta{id} also
% provides the entity's text. \meta{property} is used for \emph{weak}
% entitiy types which are denoted by double lines:
% 
% Here is a simple entity |\entity{Person}| \quad\entity{Person}\quad where 
% |Person| serves also as node text; |\entity[weak]{cty}[City]| 
% \entity[weak]{cty}[City] makes up a weak entity type where the
% displayed name is different from the internal name.
% 
%
% \DescribeMacro\attribute
% Attribute icons are set as an oval nodes by 
% \begin{quote}
% |\attribute[|\meta{property}|]{|\meta{id}|}[|\meta{text}|]|
% \end{quote}
% Here, the optional argument \meta{property} can take the
% values |mv| (multivalued; resulting in a double-lined oval) or
% |key| (key attribute; resulting in underlining the attribute name).
% Here are three attributes:
% \begin{itemize} 
% \item an ordinary one, |\attribute{phone}[phone\_no]| 
%   \quad\attribute{phone}[phone\_no]\quad,
% \item a multivalued attribute, |\attribute[mv]{nickname}| 
%   \quad\attribute[mv]{nickname}\quad,
% \item a key attribute, |\attribute[key]{pid}[person\_id]| 
%   \quad\attribute[key]{pid}[person\_id]\quad.
% \end{itemize}
% Note that with \emph{phone\_no}, the optional argument is 
% used for the node text (in case that the node text contains 
% stuff that is not allowed in internal postscript ids -- 
% as a rough rule, only characters (and since dbicons 1.14,
% underscores) are allowed in ids).
%
% In Section~\ref{sec-relationships}, relationship nodes are defined
% analogously. 
% \DescribeMacro\attributeof
% \DescribeMacro\attrdist
% At first, it is described how to attach attributes with entities:
% 
% \begin{quote}
% |\attributeof{|\meta{id}|}[|\meta{dist}|]{|\ignorespaces
% \meta{angle}|}[|\meta{property}|]{|\meta{id$_2$}|}[|\meta{text}|]|
% \end{quote}
% typesets an attribute node at angle \meta{angle} in distance
% \meta{dist} from the node which is identified by \meta{id}
% (which can be either an entity node or a relationship node).
% The attribute is made a node named \meta{id$_2$}. 
% \meta{id$_2$} and \meta{text} work as for |\entity|.
% The argument \meta{dist} is optional, it has not to be given 
% with \emph{every} attribute. By |\attrdist{|\meta{dist}|}|, this
% value can be set to a default (as startup default, 2em is set).
% 
% 
% \attrdist2.5em
% \hspace*{0.5cm}\entity{Person}\hspace*{2cm}
% \attributeof{Person}{30}[key]{Name} 
% \attributeof{Person}{90}[mv]{Nickname} 
% \attributeof{Person}[4em]{150}{phone}[phone\_no]
% \attributeof{Person}[2em]{270}[mv]{wt}[weight\_at]
% \attributeof{wt}{240}{date}
% \attributeof{wt}{300}{weight}
% \begin{tabular}{p{8.2cm}}
% \attrdist2.5em
% |\entity{Person}| \\
% |\attributeof{Person}{30}[key]{Name}| \\
% |\attributeof{Person}{90}[mv]{Nickname}| \\
% |\attributeof{Person}[4em]{150}| \\
% |            {phone}[phone\_no]| \\
% |\attributeof{Person}{270}[mv]{wt}[weight\_at]| \\
% |\attributeof{wt}{220}{date}| \\
% |\attributeof{wt}{300}{weight}| \bigskip\\
%
% Note that \emph{phone\_no} is set with a bigger distance to 
% \emph{person}.
% Additionally, the example shows how complex attributes can be set 
% with these commands.
% \end{tabular}
%
%\subsection{Relationships}\label{sec-relationships}
% \DescribeMacro\relationship
% With |\relationship[|\meta{property}|]{|\meta{id}|}[|\meta{text}|]|, a relationship 
% type is set as a diamond-shaped node.
% Here, the optional argument \meta{property} is used to represent
% \emph{identifying} relationships, used for \emph{weak} entities --
% thus \meta{property} can be equivalently |weak| or |ident| which 
% results in a double-lined relationship type.
%
% \DescribeMacro\relationshipbetween
% For declaratively specifying nodes representing relationships
% between entities, 
% \begin{quote}
% |\relationshipbetween[|\meta{property}|]{|\meta{entity-is$_1$}|}{|\meta{entity-id$_2$}|}|\\
% |                    {|\meta{relationship-id}|}[|\meta{relationship-name}|]| 
% \end{quote}
% is used (which can be augmented with several optional arguments). 
% In the simplest version, as given above, a relationship node is set 
% in-between two entity nodes:
%
% \begin{quote}
% | \entity{Person} \hspace*{6cm} \entity{Company}| \\
% | \relationshipbetween{Person}{Company}{worksat}[works\_at]| 
% \bigskip \\
% \entity{Person} \hspace*{6cm} \entity{Company}
% \relationshipbetween{Person}{Company}{worksat}[works\_at]
% \end{quote}
%
% Additionally, the \emph{roles} of the entities in the relationship,
% and the cardinalities can be given (both as independent optional
% arguments):
% \begin{quote}
% |\relationshipbetween[|\meta{property}|]|\\
% |     {|\meta{entity-id$_1$}|}(|\ignorespaces
%       \meta{role$_1$}|)[|\meta{card$_1$}|]|\\
% |     {|\meta{entity-id$_2$}|}(|\ignorespaces
%       \meta{role$_2$}|)[|\meta{card$_2$}|]|\\
% |     {|\meta{relationship-id}|}[|\meta{relationship-name}|]| 
% \end{quote}
%
% \begin{quote}
% |\entity{Country} \hspace*{6cm} \entity{City}| \\
% |\relationshipbetween{Country}(of)[1:1]{City}(is)[0:1]{capital}|
% \bigskip \\
% \entity{Country} \hspace*{6cm} \entity{City}
% \relationshipbetween{Country}(of)[1:1]{City}(is)[0:1]{capital}
% \end{quote}
% 
% Moreover, the placement of the relationship node wrt.\ the
% entities can be specified: above, the relationship node was
% put in the middle of an imaginary line in-between the entity 
% nodes.
%
% As a first, small, extension, the placement ratio of the 
% diamond between the entities can be changed (default: 0.5):
% \begin{quote}
% |\relationshipbetween[|\meta{property}|]{|\meta{entity-id$_1$}|}...{|\ignorespaces
%     \meta{entity-id$_2$}|}...|\\
% |         {|\meta{relationship-id}|}[|\ignorespaces
%     \meta{relationship-name}|](|\meta{placement-ratio}|)| 
% \end{quote}
%
% \begin{quote}
% |\entity{Country} \hspace*{6cm} \entity[weak]{City}| \\
% |\relationshipbetween[ident]{Country}[0:n]{City}[1:1]{in}(0.8)|
% \bigskip \\
% \entity{Country} \hspace*{6cm} \entity[weak]{City}
% \relationshipbetween[ident]{Country}[0:n]{City}[1:1]{in}(0.8)
% \end{quote}
%
% If this is still not enough, instead of an imaginary straight line,
% any other PSTricks node connection command can be used, most
% likely |\ncarc[...]| with suitable optional arguments:
%
% \begin{quote}
% |\relationshipbetween[|\meta{property}|]| \\
% |     {|\meta{entity-id$_1$}|}...{|\ignorespaces
%     \meta{entity-id$_2$}|}...|\\
% |     {|\meta{relationship-id}|}[|\ignorespaces
%     \meta{relationship-name}|]|\\
% |     /|\meta{connection}|/(|\meta{placement-ratio}|)| 
% \end{quote}
% \begin{quote}
% |\entity{Country} \hspace*{6cm} \entity{City}| \\
% |\relationshipbetween{Country}[0:n]{City}[1:1]|\\
% |       {in}/\ncarc[arcangle=20]/(0.4)|
% \vspace*{1cm} \\
% \entity{Country} \hspace*{6cm} \entity{City}
% \relationshipbetween{Country}[0:n]{City}[1:1]{in}/\ncarc[arcangle=20]/(0.4)
% \end{quote}
%
% For \TeX-insiders: Note that the use of |/.../| as argument delimiter
% avoids collisions with the delimiters used by PSTricks which
% thus can be used inside |/.../|.
%
% In the above example, although the relationship is placed on an
% imaginary arc, the \emph{connections} are straight lines.
% For these lines, PSTricks commands can be given, too. 
% With this, the \emph{full} syntax is 
% \begin{quote}
% |\relationshipbetween[|\meta{property}|]|\\
% |   {|\meta{entity-id$_1$}|}(|\ignorespaces
%       \meta{role$_1$}|)[|\meta{card$_1$}|]/|\meta{connection$_1$}|/|\\
% |   {|\meta{entity-id$_2$}|}(|\meta{role$_2$}|)[|\ignorespaces
%       [\meta{card$_2$}|]/|\meta{connection$_2$}|/|\\
% |   {|\meta{relationship-id}|}[|\meta{relationship-name}|]/|%
%     \meta{connection}|/(|\meta{placement-ratio}|)| 
% \end{quote}
%
% where all arguments embraced with |(...)|, |[...]|, or |/.../| are
% optional.
%
% With this, an example can be given where two different relationships
% can hold between a pair of entity types:
%
% \begin{quote}
% |\entity{Country} \hspace*{6cm} \entity{City}| \\
% |\relationshipbetween{Country}[0:n]{City}[1:1]{in}|\\
%      |/\ncarc[arcangle=20]/(0.4)|\\
% |\relationshipbetween{Country}[1:1]/\ncarc[arcangle=-18]/|\\
% |     {City}[0:1]/\ncarc[arcangle=-12]/|\\
% |     {Capital}/\ncarc[arcangle=-30]/(0.6)|
% \vspace*{1cm} \\
% \entity{Country} \hspace*{6cm} \entity{City}
% \relationshipbetween{Country}[0:n]{City}[1:1]{in}/\ncarc[arcangle=20]/(0.4)
% \relationshipbetween{Country}[1:1]/\ncarc[arcangle=-18]/
%              {City}[0:1]/\ncarc[arcangle=12]/
%              {Capital}/\ncarc[arcangle=-30]/(0.6)
% \vspace*{1.2cm} 
% \end{quote}
% Note that for \emph{capital}, |\ncarc| is used for the lines,
% where the |arcangle| of the whole arc is divided suitably 
% to the placement ratio of the diamond node, and that the
% |arcangle| of the second entity is negative (since the connection
% always points from the entity to the relationship).
%
% There is one more interesting special case of binary relationships: 
% recursive relationships. There, the entity node cannot be set
% ``between'' the nodes -- it has to be placed relative to the
% entity type which is involved in the relationship. 
%
% In this case, the argument \meta{connection} has no effect, and last
% argument (\meta{placement ratio}) has the syntax 
% |(|\meta{distance},\meta{angle}|)|: the relationship node is set
% at angle \meta{angle} in distance \meta{dist} from the entity node.
% The default for \meta{connection$_1$} and \meta{connection$_2$}
% is set to |\ncarc[arcangleA=10,arcangleB=45]}| and \\
% |\ncarc[arcangleA=-10,arcangleB=-45]|, 
% respectively.
% \begin{quote}
% |\hspace*{6cm}\entity{Country}|\\
% |\relationshipbetween{Country}(A)[0:n]{Country}(B)[0:n]|\\
% |         {Neighbor}(8em,180)|
% \vspace*{0.8cm}\\
% \hspace*{6cm}\entity{Country} 
% \relationshipbetween{Country}(A)[0:n]{Country}(B)[0:n]{Neighbor}(8em,180) 
% \bigskip
% \end{quote}
%
% With the above commands, only binary relationships can be 
% represented. Thus, there is one more macro, relating
% entity nodes with already existing relationship nodes:
%
% \DescribeMacro\inrelationship
% \begin{quote}
% |\inrelationship[|\meta{property}|]{|\meta{entity-id}|}(|\meta{role}|)[|\ignorespaces
%       \meta{card}|]|\\
% |    /|\meta{connection}|/{|\meta{relationship-id}|}|
% \end{quote}
%
% With this, n-ary relations can be represented:
% \begin{quote}
% |\begin{tabular}{c}| \\
% |\entity{Person} \hspace*{6cm} \entity{Project} \\[2cm]| \\
% |\entity{Machine}| \\
% |\end{tabular}| \\                        
% |\relationshipbetween{Person}{Project}{worksatwith}|\ignorespaces
%        |[works\_at\_with]|\\
% |      /\ncarc[arcangle=-20]/|\\
% |\inrelationship{Machine}{worksatwith}|
% \bigskip\\
% \begin{tabular}{c}
% \entity{Person} \hspace*{6cm} \entity{Project} \\[2cm]
% \entity{Machine}
% \end{tabular}                              
% \relationshipbetween{Person}{Project}{worksatwith}[works\_at\_with]
%        /\ncarc[arcangle=-20]/
% \inrelationship{Machine}{worksatwith}
% \end{quote}
%
% Additionally, there is a straightforward extension of 
% |\inrelationship| to relationship
% nodes which do not already exist but are set by the command:
%
% \begin{quote}
% |\inrelationship{|\meta{entity-id}|}(|\meta{role}|)|\ignorespaces
%       |[|\meta{card}|]/|\meta{connection}|/|\\
% |     {|\meta{relationship-id}|}[|\meta{relationship-name}|]|\ignorespaces
%       |(|\meta{distance},\meta{angle}|)| 
% \end{quote}
%
% \begin{quote}
% |\begin{tabular}{c}| \\
% |\entity{Person} \hspace*{6cm} \entity{Project} \\[2cm]| \\
% |\entity{Machine}| \\
% |\end{tabular}| \\
% |\inrelationship{Machine}{worksatwith}[works\_at\_with](4em,90)| \\
% |\inrelationship{Person}{worksatwith}| \\
% |\inrelationship{Project}{worksatwith}| 
% \bigskip \\
% \begin{tabular}{c}
% \entity{Person} \hspace*{6cm} \entity{Project} \\[2cm]
% \entity{Machine}
% \end{tabular}                              
% \inrelationship{Machine}{worksatwith}[works\_at\_with](4em,90)
% \inrelationship{Person}{worksatwith}
% \inrelationship{Project}{worksatwith}
% \end{quote}
%
% \DescribeMacro\rolepos
% The position where roles and cardinalities are placed on the 
% node connection is determined by |\rolepos| and |\cardpos| which
% \DescribeMacro\cardpos
% can be set by |\rolepos{|\meta{number}|}| and
% |\cardpos{|\meta{number}|}|, where number underlies the same
% constraints as for |npos| in PSTricks (i.e., for |\ncline| and
% |\ncarc|, it has to be between 0 and 1, other values are allowed
% e.g.\ for |\ncbar|). The default setting is |\cardpos{0.5}| and
% |\rolepos{0.85}|.
%
% \subsection{Annotations to Objects}
% \DescribeMacro\annote
% With 
% \begin{quote}
% |\annote{|\meta{id}|}{|\meta{text}|}(|\meta{distance},\meta{angle}|)| 
% \end{quote}
% a node \meta{id} can be annoted with a comment \meta{text}.
%
% \subsection{Usage}
%
% The package is intended to be used for two purposes: 
% \begin{itemize}
% \item Typesetting small fragments of ER-diagrams, e.g., for 
% lecture notes and slides: as shown in the above 
% documentation, fragments of ER-diagrams can easily be integrated
% with the running text.
% \item Typesetting ER-Diagrams for project documentation:
% here the standard procedure is to design the ER-diagram based
% on a |tabular| environment in which the entity nodes are positioned;
% Then, attributes and relationships are positioned in the above
% declarative way. Using basic PSTricks commands, additional 
% entity nodes can also be placed declaratively.
% \end{itemize}
%
% There are the following advantages compared to using graphics tools,
% e.g., xfig:
% \begin{itemize}
% \item the source code of the diagrams is written into the running
% source code of the document, thus there is no need for a bunch
% of separate |.fig| and |.eps| files.
% \item more flexibility wrt.\ renaming and layout changes.
% \item given the positions of some basic objects, the other
%  objects are set with declarative commands, i.e.\ they
%  automatically adjust when the positions change.
% \end{itemize}
%
% \subsection{Example}
%
% \begin{landscape}
% \newcommand*{\Mondial}{\textsc{Mondial}}
% \newif\ifblackwhite 
% \blackwhitefalse
% \ifblackwhite
%  \definecolor{verylightgray}{gray}{0.95}
%  \seticonparams{entity}{shadow=true,fillcolor=lightgray,fillstyle=solid}
%  \seticonparams{attribute}{fillcolor=lightgray,fillstyle=solid}
%  \seticonparams{relationship}{shadow=true,fillcolor=lightgray,fillstyle=solid}
% \else
%  \definecolor{lightblue}{rgb}{0.68, 0.85, 0.95}
%  \definecolor{verylightblue}{rgb}{0.34, 0.42, 0.5}
%  \definecolor{lightgreen}{rgb}{0.00, 0.98, 0.60}
%  \definecolor{verylightgreen}{rgb}{0.00, 0.5, 0.30}
%  \definecolor{lightred}{rgb}{1.00, 0.71, 0.76}
%  \definecolor{verylightred}{rgb}{0.50, 0.351, 0.38}
%  \seticonparams{entity}{shadow=true,fillcolor=lightred,fillstyle=solid}
%  \seticonparams{attribute}{fillcolor=lightblue,fillstyle=solid}
%  \seticonparams{relationship}{shadow=true,fillcolor=lightgreen,fillstyle=solid}
% \fi
%
% \psset{nodesep=0pt}
% \resizebox{1.25\textheight}{!}{%
% \begin{tabular}{ccc}
% \begin{tabular}{c}
% \entity{Language} \\[12em]
% \entity{EthnicGrp}[Ethnic Grp] \\[12em]
% \entity{Religion}
% \end{tabular}
% \hspace{10em}
% \begin{tabular}{c@{\hspace{10em}}c}
% &\entity[weak]{City} \\[2em]
% \entity{Organization}\\[12em]
% \entity{Country} \\[12em]
% \entity{Continent}\\[2em]
% &\entity[weak]{Province}
% \end{tabular} 
% \hspace{10em}
% \begin{tabular}{c}
% \entity{Lake} \\[5em]
% \entity{River} \\[5em]
% \entity{Sea}\\[9em]
% \entity{Mountain}\\[7em]
% \entity{Island}\\[7em]
% \entity{Desert}
% \end{tabular}
% \end{tabular}
% \nodeconnections{\small
% \relationshipbetween{Country}{City}{capital}[is\_capital]
% \relationshipbetween{Province}{City}{capital}[is\_capital](0.4)
% \relationshipbetween[ident]{Province}{City}{in}/\ncarc[arcangle=-30]/
% \relationshipbetween[weak]{Province}{Country}{of}
% \relationshipbetween{Country}{Organization}{ismember}[is\_member](0.6)
% \relationshipbetween{Organization}{City}{hashqin}[has\_hq\_in]
% \relationshipbetween{Country}{Continent}{encompasses}(0.8)
% \relationshipbetween{Country}(A)
% /\ncline[nodesepB=-1cm,offsetA=0.1em,offsetB=0.4cm]/
%                     {Country}(B)
% /\ncline[nodesepB=-1cm,offsetA=-0.1em,offsetB=-0.4cm]/
%                    {borders}(7em,0)
% \relationshipbetween{Province}{Lake}{in}
% \relationshipbetween{Province}{River}{in}
% \relationshipbetween{Province}{Sea}{in}
% \relationshipbetween{Province}{Mountain}{in}
% \relationshipbetween{Province}{Island}{in}
% \relationshipbetween{Province}{Desert}{in}
% \relationshipbetween{City}{Lake}{at}
% \relationshipbetween{City}{River}{at}
% \relationshipbetween{City}{Sea}{at}
% \inrelationship{River}(main)/\ncarc[arcangle=30]/{flows into}
%  [flows into](4em,0)
% \inrelationship{River}(trib.)/\ncarc[arcangle=-30]/{flowsinto}
% \inrelationship{Lake}{flowsinto}
% \inrelationship{Sea}{flowsinto}
% \relationshipbetween{Sea}(A){Sea}(B){merges}(4em,270)
% \relationshipbetween{EthnicGrp}{Country}{belong}(0.3)
% \relationshipbetween{Religion}{Country}{believe}(0.3)
% \relationshipbetween{Language}{Country}{speak}(0.4)
% \attributeof{City}{90}[key]{name}
% \attributeof{City}{45}{pop.}
% \attributeof{City}{0}{longitude}
% \attributeof{City}{-45}{latitude}
% \attributeof{Organization}{70}[key]{abbrev}
% \attributeof{Organization}{130}{name}
% \attributeof{Organization}[4em]{1800}{establ.}
% \attributeof{ismember}{40}{type}
% \attributeof{borders}{60}{length}
% \attributeof{Country}[3em]{30}{name}
% \attributeof{Country}{70}[key]{code}
% \attributeof{Country}{130}{pop.}
% \attributeof{Country}[3em]{190}{area}
% \attributeof{Country}{230}{gov.}
% \attributeof{Country}{280}{infl.}
% \attributeof{Country}[3em]{330}{gdp}
% \attributeof{Country}[4em]{100}{pop.grw}
% \attributeof{Country}[5em]{160}{inf.mort}
% \attributeof{Country}[6.5em]{-30}{gdp.agr}
% \attributeof{Country}[5.5em]{-50}{gdp.serv}
% \attributeof{Country}[5em]{-80}{gdp.ind}
% \attributeof{Country}[5em]{-120}{governm.}
% \attributeof{Continent}{-60}[key]{name}
% \attributeof{Continent}{-120}{area}
% \attributeof{Language}{90}[key]{name}
% \attributeof{speak}{60}{percent}
% \attributeof{EthnicGrp}{90}[key]{name}
% \attributeof{belong}{-90}{percent}
% \attributeof{Religion}{90}[key]{name}
% \attributeof{believe}{-90}{percent}
% \attributeof{encompasses}[4em]{-160}{percent}
% \attributeof{Province}[4em]{180}[key]{name}
% \attributeof{Province}{225}{pop.}
% \attributeof{Province}{270}{area}
% \attributeof{Lake}{0}[key]{name}
% \attributeof{Lake}{180}{area}
% \attributeof{River}{90}[key]{name}
% \attributeof{River}{180}{length}
% \attributeof{Sea}{0}[key]{name}
% \attributeof{Sea}{180}{depth}
% \attributeof{Mountain}{135}[key]{name}
% \attributeof{Mountain}{45}{height}
% \attributeof{Mountain}{-90}{mtcoord}[geo coord]
% \attributeof{mtcoord}[3em]{20}{longitude}
% \attributeof{mtcoord}[3em]{-20}{latitude}
% \attributeof{Island}{90}[key]{name}
% \attributeof{Island}{40}{islands}
% \attributeof{Island}{-90}{islcoord}[geo coord]
% \attributeof{islcoord}[3em]{20}{longitude}
% \attributeof{islcoord}[3em]{-20}{latitude}
% \attributeof{Desert}{90}[key]{name}
% \attributeof{Desert}{0}{area}
% }}
% \end{landscape}
%
% \subsection{Miscellaneous}
%
% \DescribeMacro\nodeconnections
% With |\nodeconnections{|\meta{PSTricks-node-connections}|}|,
% the PSTricks-node connections and label commands do not require any
% extra horizontal or vertical space.
%
% \DescribeMacro\database
% The command
% \begin{quote}
% |\database[|\meta{pos}|]{|\meta{width}|}{|\ignorespaces
%    \meta{height}|}[|\meta{graph\_params}|]{|\ignorespaces
%    \meta{text}|}[|\meta{id}|]|
% \end{quote}
% defines a database barrel as a tabular which is vertically
% centered as given in the optional argument \meta{pos} (Default: |[c]|).
% \meta{text} is the text to be written on the front of the barrel,
% \meta{width} and \meta{height} give the width and height of the 
% barrel; both must be a dimension, e.g., {2cm}. With the optional 
% graphics parameter \meta{graph\_params}, the pstricks parameters
% \textsf{fillstyle} and
% \textsf{fillcolor} for the database can be set (see example below).
% The optional argument \meta{id} is used as an internal name,
% it must start with a letter and must contain only letters and 
% digits. \meta{id} is used for |\rnode| definitions:
% \meta{id} is the whole barrel
% |lu|\meta{id}, |ru|\meta{id}, |mu|\meta{id}, and |muf|\meta{id} 
% denote the points at the upper left corner, upper right corner,
% upper middle behind and aupper middle in front of the barrel.
% Analogously, |ll|\meta{id}, |rl|\meta{id}, and |ml|\meta{id},
% denote the lower left and lower right corner and lower middle in
% front of the barrel. \medskip
%
% \begin{tabular}{lc}
% |\psset{nodesep=2pt}|\\
% |\begin{tabular}{lc}| \\
% |  &\rnode{lu}{lu}\quad\rnode{mu}{mu}\quad| \\
% |   \rnode{muf}{muf}\quad\rnode{ru}{ru}\\[1em]| \\
% |  \rnode{db}{database}|\\
% |   &\database[t]{2cm}{1cm}| \\
% |       [fillstyle=solid,fillcolor=red]| \\
% |       {database}[example] \\[5em]| \\
% |  &\rnode{ll}{ll}\qquad\rnode{ml}{ml}|\\
% |    \qquad\rnode{rl}{rl}| \\
% |\end{tabular}| \\
% |\nodeconnections{%| \\
% |\ncline{->}{lu}{luexample}| \\
% |\ncline{->}{mu}{muexample}| \\
% |\ncline{->}{muf}{mufexample}| \\
% |\ncline{->}{ru}{ruexample}| \\
% |\ncline{->}{ll}{llexample}| \\
% |\ncline{->}{ml}{mlexample}| \\
% |\ncline{->}{db}{example}| \\
% |\ncline{->}{rl}{rlexample}}| 
% \end{tabular} 
% \hspace*{-1.5cm}
% \psset{nodesep=2pt}
%\begin{tabular}{lc}
%     &\rnode{lu}{lu}\quad\rnode{mu}{mu}\quad
%      \rnode{muf}{muf}\quad\rnode{ru}{ru}\\[1em]
%     \rnode{db}{database} 
%     &\database[t]{2cm}{1cm}
%          [fillstyle=solid,fillcolor=red]
%        {database}[example] \\[5em]
%     &\rnode{ll}{ll}\qquad\rnode{ml}{ml}\qquad\rnode{rl}{rl}
% \end{tabular}
% \nodeconnections{%
% \ncline{->}{lu}{luexample}
% \ncline{->}{mu}{muexample}
% \ncline{->}{muf}{mufexample}
% \ncline{->}{ru}{ruexample}
% \ncline{->}{ll}{llexample}
% \ncline{->}{ml}{mlexample}
% \ncline{->}{db}{example}
% \ncline{->}{rl}{rlexample}}
%
% \section{Code Documentation}\label{sec:code}
% \iffalse
% \subsection{The documentation driver file}
%
% The next bit of code contains the documentation driver file for
% \TeX{}, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the
% \texttt{docstrip} program. Since it is the first code in the file
% one can alternatively process this file directly with \LaTeXe{} to
% obtain the documentation.
%
% \begin{macrocode}
%<*driver>
\documentclass{ltxdoc} 
\usepackage[dvips]{geometry}
\usepackage{latexsym}
\usepackage{pst-dbicons,lscape}
\parindent0pt\hfuzz2pt 
\begin{document}
 \DocInput{pst-dbicons.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%\fi
% \setcounter{CodelineNo}{0}
%\iffalse
%<*package>\fi
%
% Required packages from the PSTricks bundle
%
%    \begin{macrocode}
\RequirePackage{pstricks}
\RequirePackage{pst-node}
%    \end{macrocode}
%
%    \begin{macrocode}
\typeout{Style `\basename', Version \fileversion\space <\filedate>}
\ProvidesPackage{pst-dbicons}[\filedate \space\fileversion]
%    \end{macrocode}
%
% \begin{macro}{\seticonparams}
% |\seticonparams{#1}{#2}|
% \Codelabel{seticonparams}
%    \begin{macrocode} 
\def\seticonparams#1#2{\expandafter\def\csname #1@parm\endcsname{[#2]}}
\seticonparams{entity}{fillstyle=none}
\seticonparams{relationship}{fillstyle=none}
\seticonparams{attribute}{fillstyle=none}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\purifylabel}
% \changes{v0.14}{02/11/21}{macro added}
% Macro |\@purifylabel| expands the string given in |#2|
% and stores the result in command given in |#1|.
% Supported TeX commands in string |#2|:
%   |\_|, |\textunderscore|
% Example: |\@purifylabel{\templabel}{has\_hq\_in}|, then use 
% |\templabel| as nodelabel for pstricks.
% \Codelabel{purifylabel}
%    \begin{macrocode} 
\def\dbi@purifylabel#1#2{%
  \begingroup
    \edef\_{\string_}%
    \edef\textunderscore{\string_}%
    \edef\x{\endgroup
      \def\noexpand#1{#2}%
    }%
  \x
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\entity}
% \changes{v0.11}{98/10/15}{added optional property of entities}
% |\entity[#1a]{#1b}[#2]|
% \Codelabel{entity}
%    \begin{macrocode} 
\def\entity{%
 \@ifnextchar[{\entity@i}{\entity@i[normal]}}
\def\entity@i[#1]#2{%
 \@ifnextchar[{\entity@ii{#1}{#2}}{\entity@ii{#1}{#2}[#2]}}
\def\entity@ii#1#2[#3]{\csname entity@#1\endcsname{#2}{#3}}
\def\entity@normal#1#2{%
  \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
  \rnode{\dbi@prfd@nodename}{\expandafter\psframebox\entity@parm{\strut#2}}}
\def\entity@weak#1#2{%
  {\psset{doubleline=true}%
   \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
   \rnode{\dbi@prfd@nodename}{\expandafter\psframebox\entity@parm{\strut#2}}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\attribute}
% |\attribute[#1]{#2}[#3]|
% \Codelabel{attribute}
%    \begin{macrocode} 
\def\attribute{%
 \@ifnextchar[{\attribute@i}{\attribute@i[sv]}}
\def\attribute@i[#1]#2{%
 \@ifnextchar[{\attribute@ii{#1}{#2}}{\attribute@ii{#1}{#2}[#2]}}
\def\attribute@ii#1#2[#3]{\csname attribute@#1\endcsname{#2}{#3}}
\def\attribute@mv#1#2{{\psset{doubleline=true}%
  \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
  \expandafter\ovalnode\attribute@parm{\dbi@prfd@nodename}{#2}}}
\def\attribute@sv#1#2{%
  \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
  \expandafter\ovalnode\attribute@parm{\dbi@prfd@nodename}{#2}}
\def\attribute@key#1#2{
  \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
  \expandafter\ovalnode\attribute@parm{\dbi@prfd@nodename}{\underline{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\attributeof}
% |\attributeof{#1}[#2]{#3}[#4]{#5}[#6]|
%    \begin{macrocode} 
\newdimen\@attrdist
\@attrdist2em  % Default value for distance of attribute from entity
\def\attrdist#1{\@attrdist#1} % set default distance
%    \end{macrocode}
%
% \Codelabel{attributeof}
%    \begin{macrocode} 
\def\attributeof#1{%
 \@ifnextchar[{\attributeof@i{#1}}{\attributeof@i{#1}[\attrdist]}}
\def\attributeof@i#1[#2]#3{%
 \@ifnextchar[{\attributeof@ii{#1}[#2]{#3}}{\attributeof@ii{#1}[#2]{#3}[sv]}}
\def\attributeof@ii#1[#2]#3[#4]#5{%
 \@ifnextchar[{\attributeof@iii{#1}[#2]{#3}[#4]{#5}}%
              {\attributeof@iii{#1}[#2]{#3}[#4]{#5}[#5]}}
\def\attributeof@iii#1[#2]#3[#4]#5[#6]{%
  \SpecialCoor
  \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
  \uput{#2}[#3]{0}(\dbi@prfd@nodename){\attribute[#4]{#5}[#6]}%
  \NormalCoor
  \ncline{-}{#1}{#5}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\relationship}
% \changes{v0.11}{98/10/15}{added optional property of relationships}
% |\relationship[#1a]{#1b}[#2]|
% \Codelabel{relationship}
%    \begin{macrocode} 
\def\relationship{%
 \@ifnextchar[{\relationship@i}{\relationship@i[normal]}}
\def\relationship@i[#1]#2{%
 \@ifnextchar[{\relationship@ii{#1}{#2}}{\relationship@ii{#1}{#2}[#2]}}
\def\relationship@ii#1#2[#3]{\csname relationship@#1\endcsname{#2}{#3}}
\def\relationship@normal#1#2{%
   \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
   \expandafter\dianode\relationship@parm{\dbi@prfd@nodename}{#2}}
\def\relationship@weak#1#2{%
  {\psset{doubleline=true}%
   \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
   \expandafter\dianode\relationship@parm{\dbi@prfd@nodename}{#2}}}
\let\relationship@ident\relationship@weak
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\relationshipbetween}
% \changes{v0.11}{98/10/15}{added optional property of relationships}
% |\relationshipbetween[#1a]{#1b}(#2)[#3]/#4/{#5}(#6)[#7]/#8/{#9}[#10]/#11/(#12)|
% \Codelabel{relationshipbetween}
%    \begin{macrocode} 
\newtoks\rolepos
\rolepos{0.85}%
\newtoks\cardpos
\cardpos{0.5}%
\newif\ifdbi@recursive
\def\relationshipbetween{%
 \@ifnextchar[{\relationshipbetween@type}{\relationshipbetween@type[normal]}}
\def\relationshipbetween@type[#1]#2{\dbi@recursivefalse%
 \def\relationtype{#1}%
 \@ifnextchar({\relationshipbetween@i@role{#2}}%
              {\relationshipbetween@i@role{#2}(\relax)}}
\def\relationshipbetween@i@role#1(#2){%
 \@ifnextchar[{\relationshipbetween@i@card{#1}{#2}}%
              {\relationshipbetween@i@card{#1}{#2}[\relax]}}
\def\relationshipbetween@i@card#1#2[#3]{%
 \@ifnextchar/{\relationshipbetween@i@linetype{#1}{#2}{#3}}%
              {\relationshipbetween@i@linetype{#1}{#2}{#3}/\relax/}}%
\def\relationshipbetween@i@linetype#1#2#3/#4/#5{%
 \def\dbi@linecmd@i{#4}%
 \def\dbi@tempa{#1}\def\dbi@tempb{#5}%
 \ifx\dbi@tempa\dbi@tempb\dbi@recursivetrue\fi
 \ifx#4\relax
    \ifdbi@recursive
       \def\dbi@linecmd@i{\ncarc[arcangleA=10,arcangleB=45]}%
      \else\def\dbi@linecmd@i{\ncline}\fi\fi
 \@ifnextchar({\relationshipbetween@ii@role{#1}{#2}{#3}{#5}}%
              {\relationshipbetween@ii@role{#1}{#2}{#3}{#5}(\relax)}}%
\def\relationshipbetween@ii@role#1#2#3#4(#5){%
 \@ifnextchar[{\relationshipbetween@ii@card{#1}{#2}{#3}{#4}{#5}}%
              {\relationshipbetween@ii@card{#1}{#2}{#3}{#4}{#5}[\relax]}}
\def\relationshipbetween@ii@card#1#2#3#4#5[#6]{%
 \@ifnextchar/{\relationshipbetween@ii@linetype{#1}{#2}{#3}{#4}{#5}{#6}}%
              {\relationshipbetween@ii@linetype{#1}{#2}{#3}{#4}{#5}{#6}%
               /\relax/}}%
\def\relationshipbetween@ii@linetype#1#2#3#4#5#6/#7/#8{%
 \def\dbi@linecmd@ii{#7}%
 \ifx#7\relax
    \ifdbi@recursive
       \def\dbi@linecmd@ii{\ncarc[arcangleA=-10,arcangleB=-45]}%
      \else\def\dbi@linecmd@ii{\ncline}\fi\fi
 \@ifnextchar[{\relationshipbetween@optname{#1}{#2}{#3}{#4}{#5}{#6}{#8}}%
              {\relationshipbetween@optname{#1}{#2}{#3}{#4}{#5}{#6}{#8}[#8]}}%
\def\relationshipbetween@optname#1#2#3#4#5#6#7[#8]{%
 \@ifnextchar/{\relationshipbetween@linetype{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
              {\relationshipbetween@linetype{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
               /\ncline/}}%
\def\relationshipbetween@linetype#1#2#3#4#5#6#7#8/#9/{%
 \def\dbi@linecmd{#9}%
 \@ifnextchar({\relationshipbetween@pos{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
              {\relationshipbetween@pos{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}(0.5)}}%
\def\relationshipbetween@pos#1#2#3#4#5#6#7#8(#9){%
   \ifdbi@recursive
     \relationshipbetween@rec{#1}{#2}{#3}{#5}{#6}{#7}{#8}(#9)\else
     \relationshipbetween@nonrec{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}(#9)\fi}
%    \end{macrocode}
%
% \Codelabel{relationshipbetweennonrec}
%    \begin{macrocode} 
\def\relationshipbetween@nonrec#1#2#3#4#5#6#7#8(#9){%
 \dbi@purifylabel{\dbi@prfd@nodename@i}{#1}%
 \dbi@purifylabel{\dbi@prfd@nodename@ii}{#4}%
 \dbi@purifylabel{\dbi@prfd@nodename@iii}{#7}%
 {\psset{linestyle=none}%
  \dbi@linecmd{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}}%
 \ncput[npos=#9]{\relationship[\relationtype]{#7}[#8]}%
 \dbi@linecmd@i{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@iii}%
  \ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi
  \ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi
 \dbi@linecmd@ii{-}{\dbi@prfd@nodename@ii}{\dbi@prfd@nodename@iii}%
  \ifx#6\relax\else\ncput*[npos=\the\cardpos]{#6}\fi
  \ifx#5\relax\else\ncput*[npos=\the\rolepos]{#5}\fi}
%    \end{macrocode}
%
% \Codelabel{relationshipbetweenrec}
%    \begin{macrocode} 
\def\relationshipbetween@rec#1#2#3#4#5#6#7(#8,#9){%
  \dbi@purifylabel{\dbi@prfd@nodename@i}{#1}%
  \dbi@purifylabel{\dbi@prfd@nodename@ii}{#6}%
  \SpecialCoor
  \uput{#8}[#9]{0}(\dbi@prfd@nodename@i)%
         {\relationship[\relationtype]{#6}[#7]}%
  \NormalCoor
  \dbi@linecmd@i{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}%
   \ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi
   \ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi
  \dbi@linecmd@ii{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}%
   \ifx#5\relax\else\ncput*[npos=\the\cardpos]{#5}\fi
   \ifx#4\relax\else\ncput*[npos=\the\rolepos]{#4}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\inrelationship}
% \changes{v0.11}{98/10/15}{added optional property of relationships}
% |\inrelationship[#1a]{#1b}(#2)[#3]/#4/{#5}[#6](#7,#8)|
% \Codelabel{inrelationship}
%    \begin{macrocode} 
\def\inrelationship{%
 \@ifnextchar[{\inrelationship@type}{\inrelationship@type[normal]}}
\def\inrelationship@type[#1]#2{%
 \def\relationtype{#1}%
 \@ifnextchar({\inrelationship@role{#2}}%
              {\inrelationship@role{#2}(\relax)}}
\def\inrelationship@role#1(#2){%
 \@ifnextchar[{\inrelationship@card{#1}{#2}}%
              {\inrelationship@card{#1}{#2}[\relax]}}
\def\inrelationship@card#1#2[#3]{%
 \@ifnextchar/{\inrelationship@linetype{#1}{#2}{#3}}%
              {\inrelationship@linetype{#1}{#2}{#3}/\ncline/}}%
\def\inrelationship@linetype#1#2#3/#4/#5{%
 \dbi@purifylabel{\dbi@prfd@nodename@i}{#1}%
 \dbi@purifylabel{\dbi@prfd@nodename@ii}{#5}%
 \def\dbi@linecmd{#4}%
 \@ifnextchar[{\inrelationship@newrel{#1}{#2}{#3}{#5}}%
              {\@ifnextchar({%
                \inrelationship@newrel{#1}{#2}{#3}{#5}[#5]}%
               {\dbi@linecmd{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}
                \ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi
                \ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi}}}%
%    \end{macrocode}
%
% \Codelabel{inrelationshipnewrel}
%    \begin{macrocode} 
\def\inrelationship@newrel#1#2#3#4[#5]{%
 \@ifnextchar({\inrelationship@newrel@pos{#1}{#2}{#3}{#4}{#5}}%
              {\PackageError{\basename}{Position of relationship #4 
                undefined.}\@eha}}
\def\inrelationship@newrel@pos#1#2#3#4#5(#6,#7){%
  \SpecialCoor
  \dbi@purifylabel{\dbi@prfd@nodename@i}{#1}%
  \dbi@purifylabel{\dbi@prfd@nodename@ii}{#4}%
  \uput{#6}[#7]{0}(\dbi@prfd@nodename@i){\relationship[\relationtype]{#4}[#5]}%
  \NormalCoor
  \dbi@linecmd{-}{\dbi@prfd@nodename@i}{\dbi@prfd@nodename@ii}
  \ifx#3\relax\else\ncput*[npos=\the\cardpos]{#3}\fi
  \ifx#2\relax\else\ncput*[npos=\the\rolepos]{#2}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\annote}
% \setcounter{CodelineNo}{0}
% \changes{v0.11}{98/09/24}{added annote}
%    \begin{macrocode} 
\def\annote#1#2(#3,#4){%
  \dbi@purifylabel{\dbi@prfd@nodename}{#1}%
  \SpecialCoor
  \uput{#3}[#4]{0}(\dbi@prfd@nodename){#2}%
  \NormalCoor}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\nodeconnections}
% \setcounter{CodelineNo}{0}
%    \begin{macrocode} 
\def\nodeconnections#1{\hbox to 0cm{\vbox to 0cm {#1}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\database}
% \changes{v0.13}{98/11/22}{added graphics parameters to database}
% \changes{v0.15}{05/09/09}{debugged vertical placement}
% |\database[#1]{#2}{#3}[#4]{#5}[#6]|
% \Codelabel{database}
%    \begin{macrocode} 
\def\database{\@ifnextchar[{\database@i}{\database@i[c]}}
\def\database@i[#1]#2#3{%
 \@ifnextchar[{\database@ii{#1}{#2}{#3}}%
              {\database@ii{#1}{#2}{#3}[fillstyle=none]}}
\def\database@ii#1#2#3[#4]#5{%
 \@ifnextchar[{\database@iii{#1}{#2}{#3}{#4}{#5}}%
              {\database@iii{#1}{#2}{#3}{#4}{#5}[#5]}}
\def\database@iii#1#2#3#4#5[#6]{%
 \psset{nodesep=0pt}%
 \dbi@purifylabel{\dbi@prfd@nodename}{#6}%
 \rnode{\dbi@prfd@nodename}{%
 \begin{tabular}[#1]{c}%
 \rnode{lu\dbi@prfd@nodename}{}\hspace{#2}\rnode{ru\dbi@prfd@nodename}{}\\[#3]
 \rnode{ll\dbi@prfd@nodename}{}\hspace{#2}\rnode{rl\dbi@prfd@nodename}{}%
 \end{tabular}}%
 \nodeconnections{%
 \ncbar[linestyle=none,#4,
        angleA=180,angleB=180,armB=0]{ru\dbi@prfd@nodename}{ll\dbi@prfd@nodename}
 \ncbar[linestyle=none,#4,
        angleA=0,angleB=0,armA=0]{ru\dbi@prfd@nodename}{ll\dbi@prfd@nodename}
 \nccurve[#4,angleA=90,angleB=90,ncurv=.6]{lu\dbi@prfd@nodename}{ru\dbi@prfd@nodename}%
      \ncput{\rnode{mu\dbi@prfd@nodename}{}}%
 \nccurve[angleA=-90,angleB=-90,ncurv=.6]{lu\dbi@prfd@nodename}{ru\dbi@prfd@nodename}%
      \ncput{\rnode{muf\dbi@prfd@nodename}{}}%
 \nccurve[#4,angleA=-90,angleB=-90,ncurv=.6]{ll\dbi@prfd@nodename}{rl\dbi@prfd@nodename}%
      \ncput{\rnode{ml\dbi@prfd@nodename}{}}%
 \ncline{lu\dbi@prfd@nodename}{ll\dbi@prfd@nodename}%
 \ncline{ru\dbi@prfd@nodename}{rl\dbi@prfd@nodename}%
 \ncline[linestyle=none]{muf\dbi@prfd@nodename}{ml\dbi@prfd@nodename}\ncput[npos=0.4]{#5}}}
%    \end{macrocode}
% \end{macro}
%
%\iffalse
%</package>
%\fi
% \GlossaryPrologue{}
%
% \IfFileExists{pst-dbicons.gls}{\PrintChanges}
% {\begin{quote}You should create the list of changes by 
% 
% ~~~ \texttt{makeindex -s gglo.ist -o dbicons.gls dbicons.glo}
%
% and running \texttt{latex pst-dbicons.drv} again.\end{quote}}
%
%
% \subsection{Acknowledgements}
%
% Thanx to Heiko Oberdiek for adding the handling of ids for
% internal use in postcsript (used in the |purifylabel| macro).
%
% \Finale
\endinput