Guest User

Untitled

a guest
Jun 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.24 KB | None | 0 0
  1. documentclass{tufte-handout}
  2. usepackage{tikz}
  3.  
  4. usetikzlibrary{shapes.multipart}
  5. usetikzlibrary{matrix}
  6. usetikzlibrary{positioning}
  7. usetikzlibrary{shadows}
  8. usetikzlibrary{calc}
  9.  
  10. makeatletter
  11. pgfarrowsdeclare{crow's foot}{crow's foot}
  12. {
  13. pgfarrowsleftextend{+-.5pgflinewidth}%
  14. pgfarrowsrightextend{+.5pgflinewidth}%
  15. }
  16. {
  17. pgfutil@tempdima=0.5pt%
  18. advancepgfutil@tempdima by.25pgflinewidth%
  19. pgfsetdash{}{+0pt}%
  20. pgfsetmiterjoin%
  21. pgfpathmoveto{pgfqpoint{0pt}{-6pgfutil@tempdima}}%
  22. pgfpathlineto{pgfqpoint{-6pgfutil@tempdima}{0pt}}%
  23. pgfpathlineto{pgfqpoint{0pt}{6pgfutil@tempdima}}%
  24. pgfusepathqstroke%
  25. }
  26.  
  27. tikzset{
  28. entity/.code={
  29. tikzset{
  30. label=above:#1,
  31. name=#1,
  32. inner sep=0pt,
  33. every entity/.try,
  34. fill=white,
  35. general shadow={
  36. shadow xshift=0.0625in,
  37. shadow yshift=-0.0625in,
  38. opacity=0.5,
  39. fill=black!50
  40. }
  41. }%
  42. defentityname{#1}%
  43. },
  44. entity anchor/.style={matrix anchor=#1.center},
  45. every entity/.style={
  46. draw,
  47. },
  48. every property/.style={
  49. inner xsep=0.25cm, inner ysep=0.125cm, anchor=west, text width=1.45in
  50. },
  51. zig zag to/.style={
  52. to path={(tikztostart) -| ($(tikztostart)!#1!(tikztotarget)$) |- (tikztotarget)}
  53. },
  54. zig zag to/.default=0.5,
  55. one to many/.style={
  56. -crow's foot, zig zag to
  57. },
  58. many to one/.style={
  59. crow's foot-, zig zag to
  60. },
  61. many to many/.style={
  62. crow's foot-crow's foot, zig zag to
  63. }
  64. }
  65.  
  66. defproperty#1{node[name=entityname-#1, every property/.try]{#1};}
  67. defproperties{begingroupcatcode`_=11relaxprocessproperties}
  68. defprocessproperties#1{endgroup%
  69. defpropertycode{}%
  70. foreach p in {#1}{%
  71. expandafterexpandafterexpandaftergdefexpandafterexpandafterexpandafterpropertycode%
  72. expandafterexpandafterexpandafter{expandafterpropertycodeexpandafterpropertyexpandafter{p}\}%
  73. }%
  74. propertycode%
  75. }
  76. begin{document}
  77. begin{tikzpicture}[every node/.style={font=ttfamily}, node distance=1in]
  78.  
  79. matrix [entity=Mspstring_Supportstring_Period] {
  80. properties{
  81. spe_refno,
  82. spe_peo_refno,
  83. spe_spcs_refno,
  84. spe_start,
  85. spe_expected_end,
  86. (etc)
  87. }
  88. };
  89.  
  90. matrix [entity=People,
  91. right=3cm of Mspstring_Supportstring_Period-spe_refno,
  92. entity anchor=People-peo_refno] {
  93. properties{
  94. peo_refno,
  95. peo_surname,
  96. peo_dob,
  97. peo_hrv_ethnic,
  98. (etc)
  99. }
  100. };
  101.  
  102. matrix [entity=Spstring_Contractedstring_Services,
  103. below left =4.5cm and -1cm of Mspstring_Supportstring_Period-spe_refno,
  104. entity anchor=Spstring_Contractedstring_Services-spcs_spcn_contract_id] {
  105. properties{
  106. spcs_spcn_contract_id,
  107. exp_org_name,
  108. exp_hrv_exp_type,
  109. (etc)
  110. }
  111. };
  112.  
  113. matrix [entity=Mspstring_Referral,
  114. below right =4cm and -1cm of People-peo_refno,
  115. entity anchor=Mspstring_Referral-ref_peo_refno] {
  116. properties{
  117. ref_peo_refno,
  118. ref_exp_refno,
  119. ref_spcs_refno,
  120. ref_type,
  121. ref_received_by,
  122. ref_reject_date,
  123. (etc)
  124. }
  125. };
  126.  
  127. matrix [entity=Houstring_Refstring_Values,
  128. right=4cm of People-peo_refno,
  129. entity anchor=Houstring_Refstring_Values-hrv_code] {
  130. properties{
  131. hrv_code,
  132. hrv_hrd_domain,
  133. hrv_name,
  134. (etc)
  135. }
  136. };
  137.  
  138. matrix [entity=Mspstring_Externalstring_Parties,
  139. below right=4cm and 7.5cm of Mspstring_Referral-ref_exp_refno,
  140. entity anchor=Mspstring_Referral-ref_exp_refno] {
  141. properties{
  142. exp_refno,
  143. exp_org_name,
  144. exp_hrv_exp_type,
  145. (etc)
  146. }
  147. };
  148.  
  149. draw [many to one] (Mspstring_Supportstring_Period-spe_refno) to (People-peo_refno);
  150. draw [many to one] (Mspstring_Supportstring_Period-spe_spcs_refno) to (Spstring_Contractedstring_Services-spcs_spcn_contract_id);
  151. draw [many to one] (People-peo_refno) to (Mspstring_Referral-ref_peo_refno);
  152. draw [many to one] (Mspstring_Referral-ref_spcs_refno) to (Spstring_Contractedstring_Services-spcs_spcn_contract_id);
  153. draw [many to one] (Mspstring_Referral-ref_exp_refno) to (Msp_External_Parties-exp_refno);
  154.  
  155. end{tikzpicture}
  156. end{document}
Add Comment
Please, Sign In to add comment