mm_design.od 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. ##################################################
  2. pm_Model:Class
  3. ##################################################
  4. pm_Stateful:Class
  5. ##################################################
  6. pm_ModelElement:Class {
  7. abstract = True;
  8. }
  9. ##################################################
  10. pm_Activity:Class
  11. :Inheritance (pm_Activity -> pm_ModelElement)
  12. pm_Activity_name:AttributeLink (pm_Activity -> String) {
  13. name = "name";
  14. optional = False;
  15. }
  16. pm_Activity_composite:AttributeLink (pm_Activity -> Boolean) {
  17. name = "composite";
  18. optional = False;
  19. }
  20. pm_Activity_subworkflow_path:AttributeLink (pm_Activity -> String) {
  21. name = "subworkflow_path";
  22. optional = True;
  23. }
  24. pm_AutomatedActivity:Class {
  25. abstract = True;
  26. } :Inheritance (pm_AutomatedActivity -> pm_Activity)
  27. pm_AutomatedActivity_input_or:AttributeLink (pm_AutomatedActivity -> Boolean) {
  28. name = "input_or";
  29. optional = False;
  30. }
  31. pm_PythonAutomatedActivity:Class
  32. :Inheritance (pm_PythonAutomatedActivity -> pm_AutomatedActivity)
  33. pm_PythonAutomatedActivity_func:AttributeLink (pm_PythonAutomatedActivity -> ActionCode) {
  34. name = "func";
  35. optional = False;
  36. }
  37. ##################################################
  38. pm_Artefact:Class
  39. :Inheritance (pm_Artefact -> pm_ModelElement)
  40. :Inheritance (pm_Artefact -> pm_Stateful)
  41. ##################################################
  42. pm_CtrlPort:Class {
  43. abstract = True;
  44. } :Inheritance (pm_CtrlPort -> pm_Stateful)
  45. pm_CtrlIn:Class {
  46. abstract = True;
  47. } :Inheritance (pm_CtrlIn -> pm_CtrlPort)
  48. pm_CtrlSink:Class {
  49. # 1) A control sink port must have at least one incoming control flow
  50. # 2) A control sink port can't have any control flow output
  51. constraint = ```
  52. has_incoming = len(get_incoming(this, "pm_CtrlFlow")) > 0
  53. no_outgoing = len(get_outgoing(this, "pm_CtrlFlow")) == 0
  54. # Return constraint
  55. has_incoming and no_outgoing
  56. ```;
  57. } :Inheritance (pm_CtrlSink -> pm_CtrlIn)
  58. pm_CtrlActivityIn:Class {
  59. # 1) Must have at least one incoming control flow
  60. constraint = ```
  61. has_incoming = len(get_incoming(this, "pm_CtrlFlow")) > 0
  62. # Return constraint
  63. has_incoming
  64. ```;
  65. } :Inheritance (pm_CtrlActivityIn -> pm_CtrlIn)
  66. pm_CtrlOut:Class {
  67. abstract = True;
  68. } :Inheritance (pm_CtrlOut -> pm_CtrlPort)
  69. pm_CtrlSource:Class {
  70. # 1) A control source port can't have any control flow inputs
  71. # 2) A control source port must have at least one outgoing control flow
  72. constraint = ```
  73. no_incoming = len(get_incoming(this, "pm_CtrlFlow")) == 0
  74. has_outgoing = len(get_outgoing(this, "pm_CtrlFlow")) > 0
  75. # Return constraint
  76. no_incoming and has_outgoing
  77. ```;
  78. } :Inheritance (pm_CtrlSource -> pm_CtrlOut)
  79. pm_CtrlActivityOut:Class {
  80. # 1) Must have at least one outgoing control flow
  81. constraint = ```
  82. has_outgoing = len(get_outgoing(this, "pm_CtrlFlow")) > 0
  83. # Return constraint
  84. has_outgoing
  85. ```;
  86. } :Inheritance (pm_CtrlActivityOut -> pm_CtrlOut)
  87. ##################################################
  88. pm_DataPort:Class {
  89. abstract = True;
  90. }
  91. pm_DataIn:Class {
  92. abstract = True;
  93. } :Inheritance (pm_DataIn -> pm_DataPort)
  94. pm_DataSink:Class
  95. :Inheritance (pm_DataSink -> pm_DataIn)
  96. pm_DataActivityIn:Class
  97. :Inheritance (pm_DataActivityIn -> pm_DataIn)
  98. pm_DataOut:Class {
  99. abstract = True;
  100. } :Inheritance (pm_DataOut -> pm_DataPort)
  101. pm_DataSource:Class
  102. :Inheritance (pm_DataSource -> pm_DataOut)
  103. pm_DataActivityOut:Class
  104. :Inheritance (pm_DataActivityOut -> pm_DataOut)
  105. ##################################################
  106. ##################################################
  107. pm_Owns:Association (pm_Model -> pm_ModelElement) {
  108. source_lower_cardinality = 1;
  109. source_upper_cardinality = 1;
  110. }
  111. ##################################################
  112. pm_CtrlFlow:Association (pm_CtrlPort -> pm_CtrlPort)
  113. ##################################################
  114. pm_HasCtrlIn:Association (pm_Activity -> pm_CtrlIn) {
  115. source_upper_cardinality = 1;
  116. target_lower_cardinality = 1;
  117. }
  118. pm_HasCtrlOut:Association (pm_Activity -> pm_CtrlOut) {
  119. source_upper_cardinality = 1;
  120. target_lower_cardinality = 1;
  121. }
  122. pm_HasDataIn:Association (pm_Activity -> pm_DataIn) {
  123. source_upper_cardinality = 1;
  124. }
  125. pm_HasDataOut:Association (pm_Activity -> pm_DataOut) {
  126. source_upper_cardinality = 1;
  127. }
  128. ##################################################
  129. pm_DataFlowIn:Association (pm_DataOut -> pm_Artefact) {
  130. source_lower_cardinality = 1;
  131. target_lower_cardinality = 1;
  132. }
  133. pm_DataFlowOut:Association (pm_Artefact -> pm_DataIn) {
  134. source_lower_cardinality = 1;
  135. target_lower_cardinality = 1;
  136. }
  137. ##################################################
  138. ##################################################
  139. has_source_and_sink:GlobalConstraint {
  140. # There should be at least one source and sink control port
  141. constraint = ```
  142. contains_source = len(get_all_instances("pm_CtrlSource")) > 0
  143. contains_sink = len(get_all_instances("pm_CtrlSink")) > 0
  144. # return constraint
  145. contains_source and contains_sink
  146. ```;
  147. }
  148. ##################################################