api_table.tex 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. \documentclass{article}
  2. \usepackage[left=1cm, right=1cm]{geometry} % reduce page margins
  3. \usepackage{amssymb}
  4. \usepackage{booktabs}
  5. \usepackage[normalem]{ulem}
  6. \usepackage[utf8]{inputenc}
  7. \usepackage{hyperref}
  8. \usepackage{graphicx}
  9. \usepackage{tikz}
  10. \usepackage{color,listings}
  11. \usepackage{awesomebox}
  12. \newcommand{\specialcell}[2][c]{%
  13. \begin{tabular}[#1]{@{}l@{}}#2\end{tabular}}
  14. \def\ck{\checkmark}
  15. \begin{document}
  16. \centering
  17. \begin{scriptsize}
  18. \begin{tabular}{|l|c|c|c|c|c|l|}
  19. \hline
  20. & \multicolumn{5}{c|}{Availability in Context} & \\
  21. \hline
  22. & \multicolumn{2}{c|}{ \specialcell{Meta-Model \\ Constraint}} & \multicolumn{2}{c|}{ \specialcell{Model Trans- \\ formation Rule} } & & \\
  23. \hline
  24. & \specialcell{ \textbf{Local} }
  25. & \specialcell{ \textbf{Global} }
  26. & \specialcell{ \textbf{NAC} \\ \textbf{LHS} }
  27. & \textbf{RHS}
  28. & \specialcell{ \textbf{OD-} \\ \textbf{API} }
  29. & \textbf{Meaning} \\
  30. \hline
  31. \hline
  32. \multicolumn{7}{|l|}{\textit{Querying}} \\
  33. \hline
  34. \texttt{this :obj} & \ck & & \ck & \ck & & Current object or link \\
  35. \hline
  36. \texttt{get\_name(:obj) :str} & \ck & \ck & \ck & \ck & \ck & Get name of object or link \\
  37. \hline
  38. \texttt{get(name:str) :obj} & \ck & \ck & \ck & \ck & \ck & Get object or link by name (inverse of \texttt{get\_name}) \\
  39. \hline
  40. \texttt{get\_type(:obj) :obj} & \ck & \ck & \ck & \ck & \ck & {Get type of object or link} \\
  41. \hline
  42. \texttt{get\_type\_name(:obj) :str} & \ck & \ck & \ck & \ck & \ck & {Same as \texttt{get\_name(get\_type(...))}} \\
  43. \hline
  44. \specialcell{
  45. \texttt{is\_instance(:obj, type\_name:str}
  46. \\ \texttt{ [,include\_subtypes:bool=True]) :bool}
  47. } & \ck & \ck & \ck & \ck & \ck & \specialcell{Is object instance of given type\\(or subtype thereof)?} \\
  48. \hline
  49. \texttt{get\_value(:obj) :int|str|bool} & \ck & \ck & \ck & \ck & \ck & \specialcell{Get value (only works on Integer,\\String, Boolean objects)} \\
  50. \hline
  51. \texttt{get\_target(:link) :obj} & \ck & \ck & \ck & \ck & \ck & {Get target of link} \\
  52. \hline
  53. \texttt{get\_source(:link) :obj} & \ck & \ck & \ck & \ck & \ck & {Get source of link} \\
  54. \hline
  55. \texttt{get\_slot(:obj, attr\_name:str) :link} & \ck & \ck & \ck & \ck & \ck & {Get slot-link (link connecting object to a value)} \\
  56. \hline
  57. \specialcell{
  58. \texttt{get\_slot\_value(:obj,}
  59. \\ \texttt{attr\_name:str) :int|str|bool}
  60. } & \ck & \ck & \ck & \ck & \ck & {Same as \texttt{get\_value(get\_slot(...))})} \\
  61. \hline
  62. \specialcell{
  63. \texttt{get\_all\_instances(type\_name:str}
  64. \\ \texttt{ [,include\_subtypes:bool=True]}
  65. \\ \texttt{) :list<(str, obj)>}
  66. } & \ck & \ck & \ck & \ck & \ck & \specialcell{Get list of tuples (name, object) \\ of given type (and its subtypes).} \\
  67. \hline
  68. \specialcell{
  69. \texttt{get\_outgoing(:obj,}
  70. \\ \texttt{ assoc\_name:str) :list<link>}
  71. } & \ck & \ck & \ck & \ck & \ck & {Get outgoing links of given type} \\
  72. \hline
  73. \specialcell{
  74. \texttt{get\_incoming(:obj,}
  75. \\ \texttt{ assoc\_name:str) :list<link>}
  76. } & \ck & \ck & \ck & \ck & \ck & {Get incoming links of given type} \\
  77. \hline
  78. \texttt{has\_slot(:obj, attr\_name:str) :bool} & \ck & \ck & \ck & \ck & \ck & {Does object have given slot?} \\
  79. \hline
  80. \texttt{matched(label:str) :obj} & & & \ck & \ck & & \specialcell{Get matched object by its label \\ (the name of the object in the pattern)} \\
  81. \hline
  82. \hline
  83. \multicolumn{7}{|l|}{\textit{Modifying}} \\
  84. \hline
  85. \texttt{delete(:obj)} & & & & \ck & \ck & {Delete object or link} \\
  86. \hline
  87. \specialcell{
  88. \texttt{set\_slot\_value(:obj, attr\_name:str,}
  89. \\ \texttt{ val:int|str|bool)}
  90. } & & & & \ck & \ck & \specialcell{Set value of slot.
  91. \\ Creates slot if it doesn't exist yet.} \\
  92. \hline
  93. \specialcell{
  94. \texttt{create\_link(link\_name:str|None,} \\
  95. \texttt{ assoc\_name:str, src:obj, tgt:obj) :link}
  96. } & & & & \ck & \ck & \specialcell{Create link (typed by given association). \\
  97. If \texttt{link\_name} is None, name is auto-generated.} \\
  98. \hline
  99. \specialcell{
  100. \texttt{create\_object(object\_name:str|None,} \\
  101. \texttt{ class\_name:str) :obj}
  102. } & & & & \ck & \ck & \specialcell{Create object (typed by given class). \\
  103. If \texttt{object\_name} is None, name is auto-generated.} \\
  104. \hline
  105. % \texttt{print(*args)} & \multicolumn{2}{c|}{Python's print function (useful for debugging)} & no, use the real print() \\
  106. \end{tabular}
  107. \end{scriptsize}
  108. \end{document}