| 1 |
.PS |
| 2 |
# Metamodel: |
| 3 |
# https://tex.stackexchange.com/questions/615463/how-to-draw-meta-models-in-tikz |
| 4 |
gen_init |
| 5 |
|
| 6 |
lineht = 0.4 |
| 7 |
arrowht = arrowht*3/2; arrowwid = arrowwid*2 |
| 8 |
fillv = 0.9 |
| 9 |
define bx {box fill_(fillv) rad 5bp__ $1} |
| 10 |
up_ |
| 11 |
|
| 12 |
Event: bx(ht boxht "Event") |
| 13 |
sarrow(,type=D); {"{\tt<}contains{\tt>}" at last arrow rjust} |
| 14 |
Trace: bx(ht boxht "Trace") |
| 15 |
sarrow(,type=D); {"{\tt<}contains{\tt>}" at last arrow rjust} |
| 16 |
Log: bx(ht boxwid "Log") |
| 17 |
Att: bx(ht boxwid wid boxwid*5/4 "Attribute" dashed) \ |
| 18 |
with .nw at Log.ne + (boxwid*2,0) |
| 19 |
|
| 20 |
fillv = 0.8 |
| 21 |
ww = Log.ht |
| 22 |
move to (Att.w,Att.n) - (0,ww/9) |
| 23 |
{ sarrow(to (Log.e,Here),type=D) |
| 24 |
{"{\tt<}trace-global{\tt>}" at last arrow above} } |
| 25 |
move down_ ww/3 |
| 26 |
{ sarrow(to (Log.e,Here),type=D) |
| 27 |
{"{\tt<}event-global{\tt>}" at last arrow above} } |
| 28 |
move down_ ww/3 |
| 29 |
{ sarrow(to (Log.e,Here),type=D) } |
| 30 |
T: 0.8 between last arrow.start and last arrow.end |
| 31 |
move down_ ww/9 |
| 32 |
line dashed left ww/3 then down ww/2 then right ww/2 |
| 33 |
sarrow(up ww*7/18, type=D;shaft=dashed) |
| 34 |
"{\tt<}contains{\tt>}" at (last arrow.end,Att.s)-(ww/4,ww*7/18) below |
| 35 |
|
| 36 |
line from T to (T,Event); sarrow(to Event.e,type=D) |
| 37 |
sarrow(from (T,Trace) to Trace.e,type=D) |
| 38 |
|
| 39 |
ellipsewid = boxwid*0.9 |
| 40 |
ellipseht = ellipsewid/2 |
| 41 |
move to (Att.e,Att.s)+(ww/6,-ww/8) |
| 42 |
y = Here.x-Att.c.x-boxwid/2 |
| 43 |
down_ |
| 44 |
Loopover_(`Z',`Z: bx(ht boxht*3/4 "Z") |
| 45 |
{sarrow(from Z.e+(y,0) to Z.e,type=D)} |
| 46 |
{ifelse(Z,Boolean, |
| 47 |
`move to last arrow.start; line to (Here,String) |
| 48 |
line from Z.w to (Att,Z.w); sarrow(to Att.s,type=O)', |
| 49 |
`line from Z.w to (Att,Z.w)')} |
| 50 |
move down_ ww/16', |
| 51 |
String,Date,Int,Float,Boolean) |
| 52 |
|
| 53 |
line from Int.e+(y,0) right_ ww/4; Value: ellipse fill_(fillv) "Value" |
| 54 |
Key: ellipse fill_(fillv) "Key" with .w at Att.e+(y*2,0) |
| 55 |
sarrow(from last ellipse.w to Att.e,type=D) |
| 56 |
|
| 57 |
Class: bx(ht boxht*3/4 "Classifier") \ |
| 58 |
with .s at (0.5 between Log and Att,Att.n)+(0,boxht/2) |
| 59 |
line from Class.w to (Log,Class); sarrow(to Log.n,type=D) |
| 60 |
"{\tt<}defines{\tt>}" at (0.5 between Log and Class.w,Class) above |
| 61 |
line from Att.n to (Att,Class); sarrow(to Class.e,type=D) |
| 62 |
"{\tt<}defines{\tt>}" at (0.5 between Att and Class.e,Class) above |
| 63 |
|
| 64 |
Ext: bx(ht boxht*3/4 "Extension") with .e at (Att.e,Class+(0,boxht*3/2)) |
| 65 |
move to (Att.e,Att.n)-(Att.wid/8,0) |
| 66 |
sarrow(to (Here,Ext.s),type=D;shaft=dashed) |
| 67 |
"{\tt<}defines{\tt>}" at (last arrow,Ext.s)-(0,y) rjust |
| 68 |
line dashed from Ext.w to (Log,Ext) then to (Log,Class) |
| 69 |
"{\tt<}declares{\tt>}" at (0.5 between Log and Class,Ext) below |
| 70 |
|
| 71 |
ellipse fill_(fillv) "name" at (Key,Ext) |
| 72 |
sarrow(from last ellipse.w to Ext.e,type=D) |
| 73 |
ellipse fill_(fillv) "prefix" with .n at last ellipse.s+(0,-ww/16) |
| 74 |
line from last ellipse.w left y |
| 75 |
URI: ellipse fill_(fillv) "URI" with .n at last ellipse.s+(0,-ww/16) |
| 76 |
line from last ellipse.w left y then up Ext.y - URI.y |
| 77 |
|
| 78 |
.PE |