PM_to_SCCD.mvc 104 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. include "compiler.alh"
  5. Composite schedule {
  6. {Contains} Failure failure {}
  7. {Contains} Success success {}
  8. {Contains} Atomic create_orchestrator {
  9. LHS {
  10. Pre_SCCD/Diagram pre_diagram_0 {
  11. label = "0"
  12. }
  13. }
  14. RHS {
  15. Post_SCCD/Diagram post_diagram_0 {
  16. label = "0"
  17. }
  18. Post_SCCD/Class post_class_1 {
  19. label = "1"
  20. value_name = $
  21. String function value(model : Element, name : String, mapping : Element):
  22. return "Orchestrator"!
  23. $
  24. value_constructor_body = $
  25. Element function value(model : Element, name : String, mapping : Element):
  26. Element result
  27. String code
  28. code = "include \"primitives.alh\"\n"
  29. code = string_join(code, "Void function constructor_body (attributes : Element, parameters : Element):\n")
  30. code = string_join(code, "\tdict_add(attributes, \"id\",'")
  31. code = string_join(code, name)
  32. code = string_join(code, "')\n")
  33. code = string_join(code, "\tdict_add(attributes, \"queue\", list_create())\n")
  34. code = string_join(code, "\tdict_add(attributes, \"finish\", dict_create())\n")
  35. code = string_join(code, "\tdict_add(attributes, \"token\", dict_create())\n")
  36. code = string_join(code, "\tdict_add(attributes, \"data\", dict_create())\n")
  37. code = string_join(code, "\tdict_add(attributes, \"decision_consumes\", dict_create())\n")
  38. code = string_join(code, "\tdict_add(attributes, \"assn_names\", dict_create())\n")
  39. code = string_join(code, "\tlog(\"INSIDE ORCHESTRATOR CLASS CONSTRUCTOR\")\n")
  40. code = string_join(code, "\treturn!")
  41. result = compile_code(code)
  42. log(code)
  43. if element_eq(result, read_root()):
  44. return read_root()!
  45. else:
  46. return result!
  47. $
  48. value_default = $
  49. Boolean function value(model : Element, name : String, mapping : Element):
  50. return True!
  51. $
  52. }
  53. Post_SCCD/diagram_classes (post_diagram_0, post_class_1) {
  54. label = "2"
  55. }
  56. Post_SCCD/CompositeState post_cs_3 {
  57. label = "3"
  58. value_name = $
  59. String function value(model : Element, name : String, mapping : Element):
  60. return "Root"!
  61. $
  62. }
  63. Post_SCCD/behaviour (post_class_1, post_cs_3) {
  64. label = "4"
  65. }
  66. Post_SCCD/BasicState post_bs_5 {
  67. label = "5"
  68. value_name = $
  69. String function value(model : Element, name : String, mapping : Element):
  70. return "Init"!
  71. $
  72. value_isInitial = $
  73. Boolean function value(model : Element, name : String, mapping : Element):
  74. return True!
  75. $
  76. }
  77. Post_SCCD/composite_children (post_cs_3, post_bs_5) {
  78. label = "6"
  79. }
  80. Post_SCCD/ParallelState post_ps_7 {
  81. label = "7"
  82. value_name = $
  83. String function value(model : Element, name : String, mapping : Element):
  84. return "Running"!
  85. $
  86. value_onEntryScript = $
  87. Element function value(model : Element, name : String, mapping : Element):
  88. Element result
  89. String code
  90. code = "include \"primitives.alh\"\n"
  91. code = string_join(code, "Void function constructor_body (attributes : Element):\n")
  92. code = string_join(code, "\tlog(\"INSIDE PARALLEL RUNNING STATE\")\n")
  93. code = string_join(code, "\treturn!")
  94. result = compile_code(code)
  95. if element_eq(result, read_root()):
  96. return read_root()!
  97. else:
  98. return result!
  99. $
  100. }
  101. Post_SCCD/transition (post_bs_5, post_ps_7) {
  102. label = "8"
  103. value_name = $
  104. String function value(model : Element, name : String, mapping : Element):
  105. return name!
  106. $
  107. }
  108. Post_SCCD/CompositeState post_cs_9 {
  109. label = "9"
  110. value_name = $
  111. String function value(model : Element, name : String, mapping : Element):
  112. return "Queue_spawn"!
  113. $
  114. }
  115. Post_SCCD/CompositeState post_cs_10 {
  116. label = "10"
  117. value_name = $
  118. String function value(model : Element, name : String, mapping : Element):
  119. return "Spawning"!
  120. $
  121. }
  122. Post_SCCD/parallel_children (post_ps_7, post_cs_9) {
  123. label = "11"
  124. }
  125. Post_SCCD/parallel_children (post_ps_7, post_cs_10) {
  126. label = "12"
  127. }
  128. Post_SCCD/composite_children (post_cs_3, post_ps_7) {
  129. label = "13"
  130. }
  131. Post_SCCD/BasicState post_bs_14 {
  132. label = "14"
  133. value_name = $
  134. String function value(model : Element, name : String, mapping : Element):
  135. return "Waiting"!
  136. $
  137. value_isInitial = $
  138. Boolean function value(model : Element, name : String, mapping : Element):
  139. return True!
  140. $
  141. }
  142. Post_SCCD/transition post_trans_15(post_bs_14, post_bs_14) {
  143. label = "15"
  144. value_name = $
  145. String function value(model : Element, name : String, mapping : Element):
  146. return name!
  147. $
  148. value_event = $
  149. String function value(model : Element, name : String, mapping : Element):
  150. return "spawn_exec"!
  151. $
  152. value_script = $
  153. Element function value(model : Element, name : String, mapping : Element):
  154. String code
  155. Element result
  156. code = "include \"primitives.alh\"\n"
  157. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  158. code = string_join(code, "\tlist_append(attributes[\"queue\"], parameters[0])\n")
  159. code = string_join(code, "\treturn!")
  160. result = compile_code(code)
  161. if element_eq(result, read_root()):
  162. return read_root()!
  163. else:
  164. return result!
  165. $
  166. }
  167. Post_SCCD/FormalParameter post_fp_16 {
  168. label = "16"
  169. value_name = $
  170. String function value(model : Element, name : String, mapping : Element):
  171. return "exec_name"!
  172. $
  173. }
  174. Post_SCCD/transition_parameters (post_trans_15, post_fp_16) {
  175. label = "17"
  176. value_order = $
  177. Integer function value(model : Element, name : String, mapping : Element):
  178. return 0!
  179. $
  180. }
  181. Post_SCCD/composite_children (post_cs_9, post_bs_14) {
  182. label = "18"
  183. }
  184. Post_SCCD/BasicState post_bs_19 {
  185. label = "19"
  186. value_name = $
  187. String function value(model : Element, name : String, mapping : Element):
  188. return "Waiting"!
  189. $
  190. value_isInitial = $
  191. Boolean function value(model : Element, name : String, mapping : Element):
  192. return True!
  193. $
  194. }
  195. Post_SCCD/BasicState post_bs_20 {
  196. label = "20"
  197. value_name = $
  198. String function value(model : Element, name : String, mapping : Element):
  199. return "Creating"!
  200. $
  201. }
  202. Post_SCCD/composite_children (post_cs_10, post_bs_19) {
  203. label = "21"
  204. }
  205. Post_SCCD/composite_children (post_cs_10, post_bs_20) {
  206. label = "22"
  207. }
  208. Post_SCCD/transition post_trans_23 (post_bs_19, post_bs_20) {
  209. label = "23"
  210. value_name = $
  211. String function value(model : Element, name : String, mapping : Element):
  212. return name!
  213. $
  214. value_cond = $
  215. Element function value(model : Element, name : String, mapping : Element):
  216. String code
  217. Element result
  218. code = "include \"primitives.alh\"\n"
  219. code = string_join(code, "Boolean function script(attributes : Element, parameters : Element):\n")
  220. code = string_join(code, "\treturn integer_gt(list_len(attributes[\"queue\"]), 0)!")
  221. result = compile_code(code)
  222. if element_eq(result, read_root()):
  223. return read_root()!
  224. else:
  225. return result!
  226. $
  227. }
  228. Post_SCCD/Raise post_re_24 {
  229. label = "24"
  230. value_event = $
  231. String function value(model : Element, name : String, mapping : Element):
  232. return "create_instance"!
  233. $
  234. value_scope = $
  235. String function value(model : Element, name : String, mapping : Element):
  236. return "cd"!
  237. $
  238. value_parameter = $
  239. Element function raise(model : Element, name : String, mapping : Element):
  240. String code
  241. Element result
  242. code = "include \"primitives.alh\"\n"
  243. code = string_join(code, "Element function script(attributes : Element, parameters : Element):\n")
  244. code = string_join(code, "\tElement param\n")
  245. code = string_join(code, "\tparam = list_create()\n")
  246. code = string_join(code, "\tlist_append(param, 'association_name')\n")
  247. code = string_join(code, "\tlist_append(param, list_read(attributes[\"queue\"], 0))\n")
  248. code = string_join(code, "\tlist_append(param, read_root())\n")
  249. code = string_join(code, "\treturn param!")
  250. result = compile_code(code)
  251. if element_eq(result, read_root()):
  252. return read_root()!
  253. else:
  254. return result!
  255. $
  256. }
  257. Post_SCCD/ActualParameter post_ap_25 {
  258. label = "25"
  259. value_exp = $
  260. String function value(model : Element, name : String, mapping : Element):
  261. return "'children'"!
  262. $
  263. }
  264. Post_SCCD/ActualParameter post_ap_26 {
  265. label = "26"
  266. value_exp = $
  267. String function value(model : Element, name : String, mapping : Element):
  268. return "'Activity'"!
  269. $
  270. }
  271. Post_SCCD/raise_parameters (post_re_24, post_ap_25) {
  272. label = "27"
  273. value_order = $
  274. Integer function value(model : Element, name : String, mapping : Element):
  275. return 0!
  276. $
  277. }
  278. Post_SCCD/raise_parameters (post_re_24, post_ap_26) {
  279. label = "28"
  280. value_order = $
  281. Integer function value(model : Element, name : String, mapping : Element):
  282. return 1!
  283. $
  284. }
  285. Post_SCCD/transition_raises (post_trans_23, post_re_24) {
  286. label = "29"
  287. }
  288. Post_SCCD/transition post_trans_30 (post_bs_20, post_bs_19) {
  289. label = "30"
  290. value_name = $
  291. String function value(model : Element, name : String, mapping : Element):
  292. return name!
  293. $
  294. value_event = $
  295. String function value(model : Element, name : String, mapping : Element):
  296. return "instance_created"!
  297. $
  298. value_script = $
  299. Element function value(model : Element, name : String, mapping : Element):
  300. String code
  301. Element result
  302. code = "include \"primitives.alh\"\n"
  303. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  304. code = string_join(code, "\tString exec_name\n")
  305. code = string_join(code, "\texec_name = list_pop(attributes['queue'], 0)\n")
  306. code = string_join(code, "\tdict_overwrite(attributes['assn_names'], exec_name, parameters[0])\n")
  307. code = string_join(code, "\treturn!")
  308. result = compile_code(code)
  309. if element_eq(result, read_root()):
  310. return read_root()!
  311. else:
  312. return result!
  313. $
  314. }
  315. Post_SCCD/Raise post_re_36 {
  316. label = "36"
  317. value_event = $
  318. String function value(model : Element, name : String, mapping : Element):
  319. return "set_id"!
  320. $
  321. value_scope = $
  322. String function value(model : Element, name : String, mapping : Element):
  323. return "narrow"!
  324. $
  325. value_target = $
  326. String function value(model : Element, name : String, mapping : Element):
  327. String code
  328. Element result
  329. code = "include \"primitives.alh\"\n"
  330. code = string_join(code, "String function script(attributes : Element, parameters : Element):\n")
  331. code = string_join(code, "\tlog(\"TARGET\")\n")
  332. code = string_join(code, "\tlog(parameters[0])\n")
  333. code = string_join(code, "\treturn parameters[0]!")
  334. result = compile_code(code)
  335. if element_eq(result, read_root()):
  336. return read_root()!
  337. else:
  338. return result!
  339. $
  340. value_parameter = $
  341. Element function raise(model : Element, name : String, mapping : Element):
  342. String code
  343. Element result
  344. code = "include \"primitives.alh\"\n"
  345. code = string_join(code, "Element function script(attributes : Element, parameters : Element):\n")
  346. code = string_join(code, "\tElement param\n")
  347. code = string_join(code, "\tparam = list_create()\n")
  348. code = string_join(code, "\tlist_append(param, parameters[0])\n")
  349. code = string_join(code, "\tlist_append(param, attributes[\"id\"])\n")
  350. code = string_join(code, "\treturn param!")
  351. result = compile_code(code)
  352. if element_eq(result, read_root()):
  353. return read_root()!
  354. else:
  355. return result!
  356. $
  357. }
  358. Post_SCCD/transition_raises (post_trans_30, post_re_36) {
  359. label = "37"
  360. }
  361. Post_SCCD/FormalParameter post_fp_31 {
  362. label = "31"
  363. value_name = $
  364. String function value(model : Element, name : String, mapping : Element):
  365. return "association_name"!
  366. $
  367. }
  368. Post_SCCD/transition_parameters (post_trans_30, post_fp_31) {
  369. label = "32"
  370. value_order = $
  371. Integer function value(model : Element, name : String, mapping : Element):
  372. return 0!
  373. $
  374. }
  375. Post_SCCD/BasicState post_bs_33 {
  376. label = "33"
  377. value_name = $
  378. String function value(model : Element, name : String, mapping : Element):
  379. return "End"!
  380. $
  381. }
  382. Post_SCCD/composite_children (post_cs_3, post_bs_33) {
  383. label = "34"
  384. }
  385. Post_SCCD/transition post_trans_35 (post_ps_7, post_bs_33) {
  386. label = "35"
  387. value_name = $
  388. String function value(model : Element, name : String, mapping : Element):
  389. return name!
  390. $
  391. value_event = $
  392. String function value(model : Element, name : String, mapping : Element):
  393. return "process_done"!
  394. $
  395. }
  396. }
  397. }
  398. {Contains} ForAll create_class_association {
  399. LHS {
  400. Pre_SCCD/Class {
  401. label = "0"
  402. constraint_name = $
  403. Boolean function constraint(value : String):
  404. return (value != "Orchestrator")!
  405. $
  406. }
  407. Pre_SCCD/Class {
  408. label = "1"
  409. constraint_name = $
  410. Boolean function constraint(value : String):
  411. return (value == "Orchestrator")!
  412. $
  413. }
  414. }
  415. RHS {
  416. Post_SCCD/Class post_exec_class_0{
  417. label = "0"
  418. }
  419. Post_SCCD/Class post_orchestrator_class_1{
  420. label = "1"
  421. }
  422. Post_SCCD/association (post_orchestrator_class_1, post_exec_class_0){
  423. label = "3"
  424. value_name = $
  425. String function value(model : Element, name : String, mapping : Element):
  426. return "children"!
  427. $
  428. }
  429. }
  430. }
  431. {Contains} Atomic ModifyFork2Fork {
  432. LHS {
  433. Pre_PM/Fork pre_f0{
  434. label = "0"
  435. }
  436. Pre_PM/Fork pre_f1{
  437. label = "1"
  438. }
  439. Pre_PM/Activity pre_a1{
  440. label = "2"
  441. }
  442. Pre_PM/Next (pre_f0, pre_f1) {
  443. label = "3"
  444. }
  445. Pre_PM/Next (pre_f1, pre_a1) {
  446. label = "4"
  447. }
  448. }
  449. RHS {
  450. Post_PM/Fork post_f0{
  451. label = "0"
  452. }
  453. Post_PM/Fork post_f1{
  454. label = "1"
  455. }
  456. Post_PM/Activity post_a1{
  457. label = "2"
  458. }
  459. Post_PM/Next (post_f0, post_f1){
  460. label = "3"
  461. }
  462. Post_PM/Next (post_f0, post_a1) {
  463. label = "5"
  464. value_id = $
  465. String function value(model : Element, name : String, mapping : Element):
  466. return name!
  467. $
  468. }
  469. }
  470. }
  471. {Contains} ForAll RemoveFork2Fork {
  472. LHS {
  473. Pre_PM/Fork f0{
  474. label = "0"
  475. }
  476. Pre_PM/Fork f1{
  477. label = "1"
  478. }
  479. Pre_PM/Next (f0, f1) {
  480. label = "3"
  481. }
  482. }
  483. RHS {
  484. Post_PM/Fork f{
  485. label = "0"
  486. }
  487. }
  488. }
  489. {Contains} ForAll initialize {
  490. LHS {
  491. Pre_PM/Activity {
  492. label = "0"
  493. }
  494. Pre_SCCD/BasicState {
  495. label = "1"
  496. constraint_name = $
  497. Boolean function constraint(value : String):
  498. return (value == "Init")!
  499. $
  500. }
  501. constraint = $
  502. Boolean function constraint (model : Element, mapping : Element):
  503. Element children
  504. String parent
  505. Element class_beh
  506. String class
  507. children = allIncomingAssociationInstances(model, mapping["1"], "SCCD/composite_children")
  508. if list_len(children) >0:
  509. parent = readAssociationSource(model, set_pop(children))
  510. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  511. if list_len(class_beh) >0:
  512. class = readAssociationSource(model, set_pop(class_beh))
  513. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  514. return True!
  515. else:
  516. return False!
  517. else:
  518. return False!
  519. else:
  520. return False!
  521. $
  522. }
  523. RHS {
  524. Post_PM/Activity post_activity_0{
  525. label = "0"
  526. }
  527. Post_SCCD/BasicState post_init_bs_1{
  528. label = "1"
  529. value_onEntryScript = $
  530. String function value(model : Element, name : String, mapping : Element):
  531. String type
  532. String joined_str
  533. Element outgoing_assns
  534. String edge
  535. String activity
  536. String onEntryScript
  537. type = read_type(model, mapping["0"])
  538. onEntryScript = read_attribute(model, mapping["1"], "onEntryScript")
  539. if value_eq(has_value(onEntryScript),False):
  540. onEntryScript = ""
  541. if (type == "PM/Start"):
  542. joined_str = string_join("\tdict_overwrite(attributes['token'],'", read_attribute(model, mapping["0"], "id"))
  543. joined_str = string_join(joined_str,"',True)\n")
  544. return string_join(onEntryScript, joined_str)!
  545. elif (type == "PM/Decision"):
  546. joined_str = string_join("\tdict_overwrite(attributes['token'],'", read_attribute(model, mapping["0"], "id"))
  547. joined_str = string_join(joined_str, "',False)\n")
  548. joined_str = string_join(joined_str, "\tdict_overwrite(attributes['decision_consumes'],'")
  549. joined_str = string_join(joined_str, read_attribute(model, mapping["0"], "id"))
  550. joined_str = string_join(joined_str, "','')\n")
  551. return string_join(onEntryScript, joined_str)!
  552. elif bool_or(type == "PM/Join", type == "PM/Finish"):
  553. joined_str = string_join("\tdict_overwrite(attributes['token'],'", read_attribute(model, mapping["0"], "id"))
  554. joined_str = string_join(joined_str, "', False)\n")
  555. return string_join(onEntryScript, joined_str)!
  556. elif (type == "PM/Exec"):
  557. joined_str = string_join("\tdict_overwrite(attributes['token'],'", read_attribute(model, mapping["0"], "id"))
  558. joined_str = string_join(joined_str, "', False)\n")
  559. joined_str = string_join(joined_str, "\tdict_overwrite(attributes['finish'],'")
  560. joined_str = string_join(joined_str, read_attribute(model, mapping["0"], "id"))
  561. joined_str = string_join(joined_str, "',False)\n")
  562. return string_join(onEntryScript, joined_str)!
  563. elif (type == "PM/Fork"):
  564. joined_str = string_join("\tdict_overwrite(attributes['token'],'", read_attribute(model, mapping["0"], "id"))
  565. joined_str = string_join(joined_str, "', False)\n")
  566. joined_str = string_join(joined_str, "\tdict_overwrite(attributes['finish'],'")
  567. joined_str = string_join(joined_str, read_attribute(model, mapping["0"], "id"))
  568. joined_str = string_join(joined_str, "', dict_create())\n")
  569. outgoing_assns = allOutgoingAssociationInstances(model, mapping["0"], "PM/Next")
  570. while (read_nr_out(outgoing_assns) > 0):
  571. edge = set_pop(outgoing_assns)
  572. activity = readAssociationDestination(model, edge)
  573. joined_str = string_join(joined_str,"\tdict_overwrite(attributes['finish']['")
  574. joined_str = string_join(joined_str, read_attribute(model, mapping["0"], "id"))
  575. joined_str = string_join(joined_str, "'],'")
  576. joined_str = string_join(joined_str, read_attribute(model, activity, "id"))
  577. joined_str = string_join(joined_str, "', False)\n")
  578. return string_join(onEntryScript, joined_str)!
  579. $
  580. }
  581. }
  582. }
  583. {Contains} Atomic compile_init_script {
  584. LHS {
  585. Pre_SCCD/BasicState pre_init_0 {
  586. label = "0"
  587. constraint_name = $
  588. Boolean function constraint(value : String):
  589. return (value == "Init")!
  590. $
  591. }
  592. constraint = $
  593. Boolean function constraint (model : Element, mapping : Element):
  594. Element children
  595. String parent
  596. Element class_beh
  597. String class
  598. children = allIncomingAssociationInstances(model, mapping["0"], "SCCD/composite_children")
  599. if list_len(children) >0:
  600. parent = readAssociationSource(model, set_pop(children))
  601. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  602. if list_len(class_beh) >0:
  603. class = readAssociationSource(model, set_pop(class_beh))
  604. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  605. return True!
  606. else:
  607. return False!
  608. else:
  609. return False!
  610. else:
  611. return False!
  612. $
  613. }
  614. RHS {
  615. Post_SCCD/BasicState post_init_0{
  616. label = "0"
  617. value_onEntryScript = $
  618. Element function value(model : Element, name : String, mapping : Element):
  619. String code
  620. Element result
  621. String script
  622. script = read_attribute(model, mapping["0"], "onEntryScript")
  623. code = "include \"primitives.alh\"\n"
  624. code = string_join(code, "Void function onEntryScript (attributes : Element):\n")
  625. code = string_join(code, "\tlog(\"INSIDE INIT STATE\")\n")
  626. code = string_join(code, script)
  627. code = string_join(code, "\tlog(\"FINISHED EXECUTING INIT ONENTRY\")\n")
  628. code = string_join(code, "\treturn!")
  629. log(code)
  630. result = compile_code(code)
  631. if element_eq(result, read_root()):
  632. return read_root()!
  633. else:
  634. return result!
  635. $
  636. }
  637. }
  638. }
  639. {Contains} ForAll map_exec {
  640. LHS {
  641. Pre_PM/Activity pre_exec_0 {
  642. label = "0"
  643. }
  644. Pre_PM/Exec pre_exec_1 {
  645. label = "1"
  646. }
  647. Pre_PM/Next pre_next_2 (pre_exec_0, pre_exec_1) {
  648. label = "2"
  649. }
  650. Pre_SCCD/ParallelState pre_ps_3 {
  651. label = "3"
  652. constraint_name = $
  653. Boolean function constraint(value : String):
  654. return (value == "Running")!
  655. $
  656. }
  657. constraint = $
  658. Boolean function constraint (model : Element, mapping : Element):
  659. Element children
  660. String parent
  661. Element class_beh
  662. String class
  663. children = allIncomingAssociationInstances(model, mapping["3"], "SCCD/composite_children")
  664. if list_len(children) >0:
  665. parent = readAssociationSource(model, set_pop(children))
  666. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  667. if list_len(class_beh) >0:
  668. class = readAssociationSource(model, set_pop(class_beh))
  669. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  670. return True!
  671. else:
  672. return False!
  673. else:
  674. return False!
  675. else:
  676. return False!
  677. $
  678. }
  679. RHS {
  680. Post_PM/Activity post_exec_0 {
  681. label = "0"
  682. }
  683. Post_PM/Exec post_exec_1 {
  684. label = "1"
  685. }
  686. Post_PM/Next post_flow_2 (post_exec_0, post_exec_1) {
  687. label = "2"
  688. }
  689. Post_SCCD/ParallelState post_ps_3 {
  690. label = "3"
  691. }
  692. Post_SCCD/CompositeState post_cs_4 {
  693. label = "4"
  694. value_name = $
  695. String function value(model : Element, name : String, mapping : Element):
  696. return name!
  697. $
  698. }
  699. Post_SCCD/parallel_children post_ps_5 (post_ps_3, post_cs_4) {
  700. label = "5"
  701. }
  702. Post_SCCD/BasicState post_bs_6 {
  703. label = "6"
  704. value_name = $
  705. String function value(model : Element, name : String, mapping : Element):
  706. return "Waiting"!
  707. $
  708. value_isInitial = $
  709. Boolean function value(model : Element, name : String, mapping : Element):
  710. return True!
  711. $
  712. value_onEntryScript = $
  713. Element function value(model : Element, name : String, mapping : Element):
  714. Element result
  715. String code
  716. code = "include \"primitives.alh\"\n"
  717. code = string_join(code, "Void function constructor_body (attributes : Element):\n")
  718. code = string_join(code, "\tlog(\"INSIDE EXEC WAITING STATE\")\n")
  719. code = string_join(code, "\treturn!")
  720. result = compile_code(code)
  721. if element_eq(result, read_root()):
  722. return read_root()!
  723. else:
  724. return result!
  725. $
  726. }
  727. Post_SCCD/BasicState post_bs_7 {
  728. label = "7"
  729. value_name = $
  730. String function value(model : Element, name : String, mapping : Element):
  731. return "Running"!
  732. $
  733. }
  734. Post_SCCD/composite_children post_cc_8 (post_cs_4, post_bs_6) {
  735. label = "8"
  736. }
  737. Post_SCCD/composite_children post_cc_9 (post_cs_4, post_bs_7) {
  738. label = "9"
  739. }
  740. Post_SCCD/transition post_trans_10 (post_bs_6, post_bs_7) {
  741. label = "10"
  742. value_name = $
  743. String function value(model : Element, name : String, mapping : Element):
  744. return name!
  745. $
  746. value_cond = $
  747. Element function value(model : Element, name : String, mapping : Element):
  748. String type
  749. String code
  750. Element result
  751. code = "include \"primitives.alh\"\n"
  752. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  753. code = string_join(code, "\tBoolean guard\n")
  754. type = read_type(model, mapping["0"])
  755. if bool_or(type == "PM/Join", type == "PM/Start"):
  756. code = string_join(code, "\treturn value_eq(attributes['token']['")
  757. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  758. code = string_join(code, "'], True)!")
  759. elif (type == "PM/Decision"):
  760. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  761. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  762. code = string_join(code, "'], True), value_eq(attributes['decision_consumes']['")
  763. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  764. code = string_join(code, "'],")
  765. code = string_join(code, read_attribute(model, mapping["2"], "value"))
  766. code = string_join(code, "))!")
  767. elif (type == "PM/Exec"):
  768. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  769. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  770. code = string_join(code, "'], True) , value_eq(attributes['finish']['")
  771. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  772. code = string_join(code, "'], True))!")
  773. elif (type == "PM/Fork"):
  774. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  775. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  776. code = string_join(code, "'], True), value_eq(attributes['finish']['")
  777. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  778. code = string_join(code, "']['")
  779. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  780. code = string_join(code, "'],False))!")
  781. result = compile_code(code)
  782. if element_eq(result, read_root()):
  783. return read_root()!
  784. else:
  785. return result!
  786. $
  787. value_script = $
  788. Element function value(model : Element, name : String, mapping : Element):
  789. String type
  790. String code
  791. Element result
  792. code = "include \"primitives.alh\"\n"
  793. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  794. type = read_type(model, mapping["0"])
  795. if bool_or(bool_or(type == "PM/Join", type == "PM/Start"), type == "PM/Decision"):
  796. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  797. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  798. code = string_join(code, "', False)\n")
  799. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  800. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  801. code = string_join(code, "',True)\n\tlog(\"START TRIGGERED\")")
  802. elif (type == "PM/Fork"):
  803. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  804. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  805. code = string_join(code, "', True)")
  806. elif (type == "PM/Exec"):
  807. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  808. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  809. code = string_join(code, "', False)\n")
  810. code = string_join(code, "\tdict_overwrite(attributes['finish'],'")
  811. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  812. code = string_join(code, "', False)\n")
  813. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  814. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  815. code = string_join(code, "',True)")
  816. code = string_join(code, "\n\treturn!")
  817. result = compile_code(code)
  818. if element_eq(result, read_root()):
  819. return read_root()!
  820. else:
  821. return result!
  822. $
  823. }
  824. Post_SCCD/Raise post_re_11 {
  825. label = "11"
  826. value_event = $
  827. String function value(model : Element, name : String, mapping : Element):
  828. return "spawn_exec"!
  829. $
  830. value_scope = $
  831. String function value(model : Element, name : String, mapping : Element):
  832. return "local"!
  833. $
  834. value_parameter = $
  835. Element function raise(model : Element, name : String, mapping : Element):
  836. String code
  837. Element result
  838. code = "include \"primitives.alh\"\n"
  839. code = string_join(code, "Element function parameter(attributes : Element, parameters : Element):\n")
  840. code = string_join(code, "\tElement param\n")
  841. code = string_join(code, "\tparam = list_create()\n")
  842. code = string_join(code, "\tlist_append(param,'")
  843. code = string_join(code, read_attribute(model, mapping["1"], "name"))
  844. code = string_join(code, "')\n")
  845. code = string_join(code, "\treturn param!")
  846. result = compile_code(code)
  847. if element_eq(result, read_root()):
  848. return read_root()!
  849. else:
  850. return result!
  851. $
  852. }
  853. Post_SCCD/ActualParameter post_rap_25 {
  854. label = "12"
  855. value_exp = $
  856. String function value(model : Element, name : String, mapping : Element):
  857. return read_attribute(model, mapping["1"], "name")!
  858. $
  859. }
  860. Post_SCCD/raise_parameters (post_re_11, post_rap_25) {
  861. label = "13"
  862. value_order = $
  863. Integer function value(model : Element, name : String, mapping : Element):
  864. return 0!
  865. $
  866. }
  867. Post_SCCD/transition_raises (post_trans_10, post_re_11) {
  868. label = "14"
  869. }
  870. Post_SCCD/transition post_etrans_15 (post_bs_7, post_bs_6) {
  871. label = "15"
  872. value_name = $
  873. String function value(model : Element, name : String, mapping : Element):
  874. return name!
  875. $
  876. value_event = $
  877. String function value(model : Element, name : String, mapping : Element):
  878. return "terminated"!
  879. $
  880. value_cond = $
  881. Element function value(model : Element, name : String, mapping : Element):
  882. String code
  883. Element result
  884. code = "include \"primitives.alh\"\n"
  885. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  886. code = string_join(code, "\treturn value_eq('")
  887. code = string_join(code, read_attribute(model, mapping["1"], "name"))
  888. code = string_join(code, "',parameters[0])!")
  889. result = compile_code(code)
  890. if element_eq(result, read_root()):
  891. return read_root()!
  892. else:
  893. return result!
  894. $
  895. value_script = $
  896. Element function value(model : Element, name : String, mapping : Element):
  897. String type
  898. String code
  899. Element result
  900. code = "include \"primitives.alh\"\n"
  901. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  902. type = read_type(model, mapping["0"])
  903. if (type == "PM/Fork"):
  904. code = string_join(code,"\tdict_overwrite(attributes['finish'],'")
  905. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  906. code = string_join(code, "',True)\n")
  907. code = string_join(code, "\tdict_overwrite(attributes['finish']['")
  908. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  909. code = string_join(code, "'],'")
  910. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  911. code = string_join(code, "',True)")
  912. else:
  913. code = string_join(code, "\tdict_overwrite(attributes['finish'],'")
  914. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  915. code = string_join(code, "',True)")
  916. code = string_join(code, "\n\treturn!")
  917. result = compile_code(code)
  918. if element_eq(result, read_root()):
  919. return read_root()!
  920. else:
  921. return result!
  922. $
  923. }
  924. Post_SCCD/FormalParameter post_efp_16 {
  925. label = "16"
  926. value_name = $
  927. String function value(model : Element, name : String, mapping : Element):
  928. return "exec_name"!
  929. $
  930. }
  931. Post_SCCD/transition_parameters (post_etrans_15, post_efp_16) {
  932. label = "17"
  933. value_order = $
  934. Integer function value(model : Element, name : String, mapping : Element):
  935. return 0!
  936. $
  937. }
  938. Post_Activity2State_link (post_exec_1, post_cs_4){
  939. label = "18"
  940. }
  941. }
  942. }
  943. {Contains} ForAll data_produces {
  944. LHS {
  945. Pre_PM/Exec pre_exec_data_0 {
  946. label = "0"
  947. }
  948. Pre_PM/Data pre_data_1 {
  949. label = "1"
  950. }
  951. Pre_PM/Produces pre_pro_2 (pre_exec_data_0, pre_data_1) {
  952. label = "2"
  953. }
  954. Pre_SCCD/CompositeState pre_co_3 {
  955. label = "3"
  956. }
  957. Pre_Activity2State_link (pre_exec_data_0, pre_co_3){
  958. label = "4"
  959. }
  960. Pre_SCCD/BasicState pre_bs_5 {
  961. label = "5"
  962. constraint_name = $
  963. Boolean function constraint(value : String):
  964. return (value == "Running")!
  965. $
  966. }
  967. Pre_SCCD/composite_children (pre_co_3, pre_bs_5) {
  968. label = "6"
  969. }
  970. }
  971. RHS {
  972. Post_PM/Exec post_exec_data_0 {
  973. label = "0"
  974. }
  975. Post_PM/Data post_data_1 {
  976. label = "1"
  977. }
  978. Post_PM/Produces post_pro_2 (post_exec_data_0, post_data_1) {
  979. label = "2"
  980. }
  981. Post_SCCD/CompositeState post_co_3 {
  982. label = "3"
  983. }
  984. Post_Activity2State_link (post_exec_data_0, post_co_3){
  985. label = "4"
  986. }
  987. Post_SCCD/BasicState post_pbs_5 {
  988. label = "5"
  989. }
  990. Post_SCCD/composite_children (post_co_3, post_pbs_5) {
  991. label = "6"
  992. }
  993. Post_SCCD/transition post_trans_7 (post_pbs_5, post_pbs_5) {
  994. label = "7"
  995. value_name = $
  996. String function value(model : Element, name : String, mapping : Element):
  997. return name!
  998. $
  999. value_event = $
  1000. String function value(model : Element, name : String, mapping : Element):
  1001. return "save"!
  1002. $
  1003. value_cond = $
  1004. Element function value(model : Element, name : String, mapping : Element):
  1005. String code
  1006. Element result
  1007. code = "include \"primitives.alh\"\n"
  1008. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1009. code = string_join(code, "\treturn value_eq('")
  1010. code = string_join(code, read_attribute(model, mapping["0"], "name"))
  1011. code = string_join(code, "',parameters[1])!")
  1012. result = compile_code(code)
  1013. if element_eq(result, read_root()):
  1014. return read_root()!
  1015. else:
  1016. return result!
  1017. $
  1018. value_script = $
  1019. Element function value(model : Element, name : String, mapping : Element):
  1020. String code
  1021. Element result
  1022. code = "include \"primitives.alh\"\n"
  1023. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  1024. code = string_join(code, "\tdict_overwrite(attributes['data'], parameters[0], False)")
  1025. code = string_join(code, "\n\treturn!")
  1026. result = compile_code(code)
  1027. if element_eq(result, read_root()):
  1028. return read_root()!
  1029. else:
  1030. return result!
  1031. $
  1032. }
  1033. Post_SCCD/FormalParameter post_fp_8 {
  1034. label = "8"
  1035. value_name = $
  1036. String function value(model : Element, name : String, mapping : Element):
  1037. return "data_name"!
  1038. $
  1039. }
  1040. Post_SCCD/FormalParameter post_fp_9 {
  1041. label = "9"
  1042. value_name = $
  1043. String function value(model : Element, name : String, mapping : Element):
  1044. return "exec_name"!
  1045. $
  1046. }
  1047. Post_SCCD/transition_parameters (post_trans_7, post_fp_8) {
  1048. label = "10"
  1049. value_order = $
  1050. Integer function value(model : Element, name : String, mapping : Element):
  1051. return 0!
  1052. $
  1053. }
  1054. Post_SCCD/transition_parameters (post_trans_7, post_fp_9) {
  1055. label = "11"
  1056. value_order = $
  1057. Integer function value(model : Element, name : String, mapping : Element):
  1058. return 1!
  1059. $
  1060. }
  1061. }
  1062. }
  1063. {Contains} ForAll exec_data_consumes {
  1064. LHS {
  1065. Pre_PM/Exec pre_exec_consumes_0 {
  1066. label = "0"
  1067. }
  1068. Pre_PM/Data pre_data_consumes_1 {
  1069. label = "1"
  1070. }
  1071. Pre_PM/Consumes pre_con_2 (pre_exec_consumes_0, pre_data_consumes_1) {
  1072. label = "2"
  1073. }
  1074. Pre_SCCD/CompositeState pre_cs_3 {
  1075. label = "3"
  1076. }
  1077. Pre_Activity2State_link (pre_exec_consumes_0, pre_cs_3){
  1078. label = "4"
  1079. }
  1080. Pre_SCCD/BasicState pre_consumes_bs_5 {
  1081. label = "5"
  1082. constraint_name = $
  1083. Boolean function constraint(value : String):
  1084. return (value == "Running")!
  1085. $
  1086. }
  1087. Pre_SCCD/composite_children (pre_cs_3, pre_consumes_bs_5) {
  1088. label = "6"
  1089. }
  1090. }
  1091. RHS {
  1092. Post_PM/Exec post_exec_consumes_0 {
  1093. label = "0"
  1094. }
  1095. Post_PM/Data post_data_consumes_1 {
  1096. label = "1"
  1097. }
  1098. Post_PM/Consumes post_con_2 (post_exec_consumes_0, post_data_consumes_1) {
  1099. label = "2"
  1100. }
  1101. Post_SCCD/CompositeState post_ccs_3 {
  1102. label = "3"
  1103. }
  1104. Post_Activity2State_link (post_exec_consumes_0, post_ccs_3){
  1105. label = "4"
  1106. }
  1107. Post_SCCD/BasicState post_bs_consumes_5 {
  1108. label = "5"
  1109. }
  1110. Post_SCCD/composite_children (post_ccs_3, post_bs_consumes_5) {
  1111. label = "6"
  1112. }
  1113. Post_SCCD/transition post_trans_consumes_7 (post_bs_consumes_5, post_bs_consumes_5) {
  1114. label = "7"
  1115. value_name = $
  1116. String function value(model : Element, name : String, mapping : Element):
  1117. return name!
  1118. $
  1119. value_event = $
  1120. String function value(model : Element, name : String, mapping : Element):
  1121. return "load"!
  1122. $
  1123. value_cond = $
  1124. Element function value(model : Element, name : String, mapping : Element):
  1125. String code
  1126. Element result
  1127. code = "include \"primitives.alh\"\n"
  1128. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1129. code = string_join(code, "\treturn value_eq('")
  1130. code = string_join(code, read_attribute(model, mapping["0"], "name"))
  1131. code = string_join(code, "',parameters[1])!")
  1132. result = compile_code(code)
  1133. if element_eq(result, read_root()):
  1134. return read_root()!
  1135. else:
  1136. return result!
  1137. $
  1138. }
  1139. Post_SCCD/FormalParameter post_trans_fp_8 {
  1140. label = "8"
  1141. value_name = $
  1142. String function value(model : Element, name : String, mapping : Element):
  1143. return "data_name"!
  1144. $
  1145. }
  1146. Post_SCCD/FormalParameter post_trans_fp_9 {
  1147. label = "9"
  1148. value_name = $
  1149. String function value(model : Element, name : String, mapping : Element):
  1150. return "exec_name"!
  1151. $
  1152. }
  1153. Post_SCCD/transition_parameters (post_trans_consumes_7, post_trans_fp_8) {
  1154. label = "10"
  1155. value_order = $
  1156. Integer function value(model : Element, name : String, mapping : Element):
  1157. return 0!
  1158. $
  1159. }
  1160. Post_SCCD/transition_parameters (post_trans_consumes_7, post_trans_fp_9) {
  1161. label = "11"
  1162. value_order = $
  1163. Integer function value(model : Element, name : String, mapping : Element):
  1164. return 1!
  1165. $
  1166. }
  1167. Post_SCCD/Raise post_re_12 {
  1168. label = "12"
  1169. value_event = $
  1170. String function value(model : Element, name : String, mapping : Element):
  1171. return "load"!
  1172. $
  1173. value_scope = $
  1174. String function value(model : Element, name : String, mapping : Element):
  1175. return "narrow"!
  1176. $
  1177. value_target = $
  1178. String function value(model : Element, name : String, mapping : Element):
  1179. String code
  1180. Element result
  1181. code = "include \"primitives.alh\"\n"
  1182. code = string_join(code, "String function target(attributes : Element, parameters : Element):\n")
  1183. code = string_join(code, "\treturn attributes['assn_names']['")
  1184. code = string_join(code, read_attribute(model, mapping["0"], "name"))
  1185. code = string_join(code, "']!")
  1186. result = compile_code(code)
  1187. if element_eq(result, read_root()):
  1188. return read_root()!
  1189. else:
  1190. return result!
  1191. $
  1192. }
  1193. Post_SCCD/ActualParameter post_ap_13 {
  1194. label = "13"
  1195. value_exp = $
  1196. Element function value(model : Element, name : String, mapping : Element):
  1197. String code
  1198. Element result
  1199. code = "include \"primitives.alh\"\n"
  1200. code = string_join(code, "String function exp(attributes : Element, parameters : Element):\n")
  1201. code = string_join(code, "\treturn attributes['data'][parameters[0]]!")
  1202. result = compile_code(code)
  1203. if element_eq(result, read_root()):
  1204. return read_root()!
  1205. else:
  1206. return result!
  1207. $
  1208. }
  1209. Post_SCCD/raise_parameters (post_re_12, post_ap_13) {
  1210. label = "14"
  1211. value_order = $
  1212. Integer function value(model : Element, name : String, mapping : Element):
  1213. return 0!
  1214. $
  1215. }
  1216. Post_SCCD/transition_raises (post_trans_consumes_7, post_re_12){
  1217. label = "15"
  1218. }
  1219. }
  1220. }
  1221. {Contains} ForAll map_decision {
  1222. LHS {
  1223. Pre_PM/Activity pre_0 {
  1224. label = "0"
  1225. }
  1226. Pre_PM/Decision pre_1 {
  1227. label = "1"
  1228. }
  1229. Pre_PM/Next (pre_0, pre_1) {
  1230. label = "2"
  1231. }
  1232. Pre_PM/Data pre_3 {
  1233. label = "3"
  1234. }
  1235. Pre_PM/DecisionConsumes (pre_1, pre_3) {
  1236. label = "4"
  1237. }
  1238. Pre_SCCD/ParallelState pre_5 {
  1239. label = "5"
  1240. constraint_name = $
  1241. Boolean function constraint(value : String):
  1242. return (value == "Running")!
  1243. $
  1244. }
  1245. constraint = $
  1246. Boolean function constraint (model : Element, mapping : Element):
  1247. Element children
  1248. String parent
  1249. Element class_beh
  1250. String class
  1251. children = allIncomingAssociationInstances(model, mapping["5"], "SCCD/composite_children")
  1252. if list_len(children) >0:
  1253. parent = readAssociationSource(model, set_pop(children))
  1254. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  1255. if list_len(class_beh) >0:
  1256. class = readAssociationSource(model, set_pop(class_beh))
  1257. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  1258. return True!
  1259. else:
  1260. return False!
  1261. else:
  1262. return False!
  1263. else:
  1264. return False!
  1265. $
  1266. }
  1267. RHS {
  1268. Post_PM/Activity post_0 {
  1269. label = "0"
  1270. }
  1271. Post_PM/Decision post_1 {
  1272. label = "1"
  1273. }
  1274. Post_PM/Next (post_0, post_1) {
  1275. label = "2"
  1276. }
  1277. Post_PM/Data post_3 {
  1278. label = "3"
  1279. }
  1280. Post_PM/DecisionConsumes (post_1, post_3) {
  1281. label = "4"
  1282. }
  1283. Post_SCCD/ParallelState post_5 {
  1284. label = "5"
  1285. }
  1286. Post_SCCD/CompositeState post_6 {
  1287. label = "6"
  1288. value_name = $
  1289. String function value(model : Element, name : String, mapping : Element):
  1290. return name!
  1291. $
  1292. }
  1293. Post_SCCD/parallel_children (post_5, post_6) {
  1294. label = "7"
  1295. }
  1296. Post_SCCD/BasicState post_8 {
  1297. label = "8"
  1298. value_name = $
  1299. String function value(model : Element, name : String, mapping : Element):
  1300. return "Waiting"!
  1301. $
  1302. value_isInitial = $
  1303. Boolean function value(model : Element, name : String, mapping : Element):
  1304. return True!
  1305. $
  1306. }
  1307. Post_SCCD/composite_children (post_6, post_8) {
  1308. label = "9"
  1309. }
  1310. Post_SCCD/transition post_10(post_8, post_8) {
  1311. label = "10"
  1312. value_name = $
  1313. String function value(model : Element, name : String, mapping : Element):
  1314. return name!
  1315. $
  1316. value_cond = $
  1317. Element function value(model : Element, name : String, mapping : Element):
  1318. String type
  1319. String code
  1320. Element result
  1321. code = "include \"primitives.alh\"\n"
  1322. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1323. type = read_type(model, mapping["0"])
  1324. if bool_or(type == "PM/Join", type == "PM/Start"):
  1325. code = string_join(code, "\treturn value_eq(attributes['token']['")
  1326. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1327. code = string_join(code, "'], True)!")
  1328. elif (type == "PM/Decision"):
  1329. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  1330. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1331. code = string_join(code, "'], True),value_eq(attributes['decision_consumes']['")
  1332. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1333. code = string_join(code, "'],")
  1334. code = string_join(code, read_attribute(model, mapping["2"], "value"))
  1335. code = string_join(code, "))!")
  1336. elif (type == "PM/Exec"):
  1337. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  1338. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1339. code = string_join(code, "'],True), value_eq(attributes['finish']['")
  1340. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1341. code = string_join(code, "'],True))!")
  1342. elif (type == "PM/Fork"):
  1343. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  1344. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1345. code = string_join(code, "'],True),value_eq(attributes['finish']['")
  1346. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1347. code = string_join(code, "']['")
  1348. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1349. code = string_join(code, "'],False))!")
  1350. result = compile_code(code)
  1351. if element_eq(result, read_root()):
  1352. return read_root()!
  1353. else:
  1354. return result!
  1355. $
  1356. value_script = $
  1357. String function value(model : Element, name : String, mapping : Element):
  1358. String type
  1359. String code
  1360. Element result
  1361. code = "include \"primitives.alh\"\n"
  1362. code = string_join(code, "Void function cond(attributes : Element, parameters : Element):\n")
  1363. type = read_type(model, mapping["0"])
  1364. if bool_or(bool_or(type == "PM/Join", type == "PM/Start"), type == "PM/Decision"):
  1365. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1366. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1367. code = string_join(code, "',False)\n")
  1368. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1369. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1370. code = string_join(code, "',True)\n")
  1371. code = string_join(code, "\tdict_overwrite(attributes['decision_consumes'],'")
  1372. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1373. code = string_join(code, "',attributes['data']['")
  1374. code = string_join(code, read_attribute(model, mapping["3"], "name"))
  1375. code = string_join(code, "'])")
  1376. elif (type == "PM/Fork"):
  1377. code = string_join(code,"\tdict_overwrite(attributes['token'],'")
  1378. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1379. code = string_join(code, "',True)\n")
  1380. code = string_join(code, "\tdict_overwrite(attributes['finish']['")
  1381. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1382. code = string_join(code, "'],'")
  1383. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1384. code = string_join(code, "',True)\n")
  1385. code = string_join(code, "\tdict_overwrite(attributes['decision_consumes'],'")
  1386. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1387. code = string_join(code, "', attributes['data']['")
  1388. code = string_join(code, read_attribute(model, mapping["3"], "name"))
  1389. code = string_join(code, "'])")
  1390. elif (type == "PM/Exec"):
  1391. code = string_join(code,"\tdict_overwrite(attributes['token'],'")
  1392. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1393. code = string_join(code, "',False) \n")
  1394. code = string_join(code, "\tdict_overwrite(attributes['finish'],'")
  1395. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1396. code = string_join(code, "',False) \n")
  1397. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1398. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1399. code = string_join(code, "',True) \n")
  1400. code = string_join(code, "\tdict_overwrite(attributes['decision_consumes'],'")
  1401. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1402. code = string_join(code, "', attributes['data']['")
  1403. code = string_join(code, read_attribute(model, mapping["3"], "name"))
  1404. code = string_join(code, "'])")
  1405. code = string_join(code, "\n\treturn!")
  1406. result = compile_code(code)
  1407. if element_eq(result, read_root()):
  1408. return read_root()!
  1409. else:
  1410. return result!
  1411. $
  1412. }
  1413. Post_Activity2State_link (post_1, post_6){
  1414. label = "11"
  1415. }
  1416. }
  1417. }
  1418. {Contains} ForAll map_fork {
  1419. LHS {
  1420. Pre_PM/Activity pre_f_0 {
  1421. label = "0"
  1422. }
  1423. Pre_PM/Fork pre_f_1 {
  1424. label = "1"
  1425. }
  1426. Pre_PM/Next (pre_f_0, pre_f_1) {
  1427. label = "2"
  1428. }
  1429. Pre_SCCD/ParallelState pre_f_3 {
  1430. label = "3"
  1431. constraint_name = $
  1432. Boolean function constraint(value : String):
  1433. return (value == "Running")!
  1434. $
  1435. }
  1436. constraint = $
  1437. Boolean function constraint (model : Element, mapping : Element):
  1438. Element children
  1439. String parent
  1440. Element class_beh
  1441. String class
  1442. children = allIncomingAssociationInstances(model, mapping["3"], "SCCD/composite_children")
  1443. if list_len(children) >0:
  1444. parent = readAssociationSource(model, set_pop(children))
  1445. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  1446. if list_len(class_beh) >0:
  1447. class = readAssociationSource(model, set_pop(class_beh))
  1448. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  1449. return True!
  1450. else:
  1451. return False!
  1452. else:
  1453. return False!
  1454. else:
  1455. return False!
  1456. $
  1457. }
  1458. RHS {
  1459. Post_PM/Activity post_f_0 {
  1460. label = "0"
  1461. }
  1462. Post_PM/Fork post_f_1 {
  1463. label = "1"
  1464. }
  1465. Post_PM/Next (post_f_0, post_f_1) {
  1466. label = "2"
  1467. }
  1468. Post_SCCD/ParallelState post_f_3 {
  1469. label = "3"
  1470. }
  1471. Post_SCCD/CompositeState post_f_6 {
  1472. label = "6"
  1473. value_name = $
  1474. String function value(model : Element, name : String, mapping : Element):
  1475. return name!
  1476. $
  1477. }
  1478. Post_SCCD/parallel_children (post_f_3, post_f_6) {
  1479. label = "7"
  1480. }
  1481. Post_SCCD/BasicState post_f_8 {
  1482. label = "8"
  1483. value_name = $
  1484. String function value(model : Element, name : String, mapping : Element):
  1485. return "Waiting"!
  1486. $
  1487. value_isInitial = $
  1488. Boolean function value(model : Element, name : String, mapping : Element):
  1489. return True!
  1490. $
  1491. }
  1492. Post_SCCD/BasicState post_f_9 {
  1493. label = "9"
  1494. value_name = $
  1495. String function value(model : Element, name : String, mapping : Element):
  1496. return "Running"!
  1497. $
  1498. }
  1499. Post_SCCD/composite_children (post_f_6, post_f_8) {
  1500. label = "10"
  1501. }
  1502. Post_SCCD/composite_children (post_f_6, post_f_9) {
  1503. label = "11"
  1504. }
  1505. Post_SCCD/transition post_f_12(post_f_8, post_f_9) {
  1506. label = "12"
  1507. value_name = $
  1508. String function value(model : Element, name : String, mapping : Element):
  1509. return name!
  1510. $
  1511. value_cond = $
  1512. String function value(model : Element, name : String, mapping : Element):
  1513. String type
  1514. String code
  1515. Element result
  1516. code = "include \"primitives.alh\"\n"
  1517. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1518. type = read_type(model, mapping["0"])
  1519. if bool_or(type == "PM/Join", type == "PM/Start"):
  1520. code = string_join(code,"\treturn bool_and(value_eq(attributes['token']['")
  1521. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1522. code = string_join(code, "'],True), value_eq(attributes['token']['")
  1523. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1524. code = string_join(code, "'],False))!")
  1525. elif (type == "PM/Decision"):
  1526. code = string_join(code,"\treturn bool_and(bool_and(value_eq(attributes['token']['")
  1527. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1528. code = string_join(code, "'],True), value_eq(attributes['decision_consumes']['")
  1529. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1530. code = string_join(code, "'],")
  1531. code = string_join(code, read_attribute(model, mapping["2"], "value"))
  1532. code = string_join(code, ")), value_eq(attributes['token']['")
  1533. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1534. code = string_join(code, "'],False))!")
  1535. elif (type == "PM/Exec"):
  1536. code = string_join(code,"\treturn bool_and(bool_and(value_eq(attributes['token']['")
  1537. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1538. code = string_join(code, "'],True), value_eq(attributes['finish']['")
  1539. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1540. code = string_join(code, "'],True)), value_eq(attributes['token']['")
  1541. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1542. code = string_join(code, "'],False))!")
  1543. result = compile_code(code)
  1544. if element_eq(result, read_root()):
  1545. return read_root()!
  1546. else:
  1547. return result!
  1548. $
  1549. value_script = $
  1550. String function value(model : Element, name : String, mapping : Element):
  1551. String type
  1552. String code
  1553. Element result
  1554. code = "include \"primitives.alh\"\n"
  1555. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  1556. type = read_type(model, mapping["0"])
  1557. if bool_or(bool_or(type == "PM/Join", type == "PM/Start"), type == "PM/Decision"):
  1558. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1559. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1560. code = string_join(code, "',False) \n")
  1561. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1562. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1563. code = string_join(code, "',True)")
  1564. elif (type == "PM/Exec"):
  1565. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1566. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1567. code = string_join(code, "',False) \n")
  1568. code = string_join(code, "\tdict_overwrite(attributes['finish'],'")
  1569. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1570. code = string_join(code, "',False) \n")
  1571. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1572. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1573. code = string_join(code, "',True)")
  1574. code = string_join(code, "\n\treturn!")
  1575. result = compile_code(code)
  1576. if element_eq(result, read_root()):
  1577. return read_root()!
  1578. else:
  1579. return result!
  1580. $
  1581. }
  1582. Post_SCCD/transition post_f_13(post_f_9, post_f_8) {
  1583. label = "13"
  1584. value_name = $
  1585. String function value(model : Element, name : String, mapping : Element):
  1586. return name!
  1587. $
  1588. value_cond = $
  1589. Element function value(model : Element, name : String, mapping : Element):
  1590. String joined_str
  1591. Element outgoing_assns
  1592. String edge
  1593. String activity
  1594. Element pairs
  1595. String last_operand
  1596. String code
  1597. Element result
  1598. code = "include \"primitives.alh\"\n"
  1599. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1600. last_operand = ""
  1601. pairs = create_node()
  1602. outgoing_assns = allOutgoingAssociationInstances(model, mapping["1"], "PM/Next")
  1603. while (read_nr_out(outgoing_assns) > 0):
  1604. edge = set_pop(outgoing_assns)
  1605. activity = readAssociationDestination(model, edge)
  1606. if list_len(outgoing_assns)>1:
  1607. joined_str = string_join("bool_and(value_eq(attributes['finish']['", read_attribute(model, mapping["1"], "id"))
  1608. joined_str = string_join(joined_str, "']['")
  1609. joined_str = string_join(joined_str,read_attribute(model, activity, "id"))
  1610. joined_str = string_join(joined_str, "'],True), value_eq(attributes['finish']['")
  1611. joined_str = string_join(joined_str, read_attribute(model, mapping["1"], "id"))
  1612. joined_str = string_join(joined_str, "']['")
  1613. edge = set_pop(outgoing_assns)
  1614. activity = readAssociationDestination(model, edge)
  1615. joined_str = string_join(joined_str,read_attribute(model, activity, "id"))
  1616. joined_str = string_join(joined_str, "'],True))")
  1617. list_append(pairs, joined_str)
  1618. else:
  1619. joined_str = string_join("value_eq(attributes['finish']['", read_attribute(model, mapping["1"], "id"))
  1620. joined_str = string_join(joined_str, "']['")
  1621. joined_str = string_join(joined_str,read_attribute(model, activity, "id"))
  1622. joined_str = string_join(joined_str, "'],True)")
  1623. last_operand = joined_str
  1624. joined_str = ""
  1625. if list_len(pairs)>1:
  1626. Integer i
  1627. i = 0
  1628. while (i < list_len(pairs)):
  1629. if joined_str == "":
  1630. joined_str = string_join("bool_and(", list_read(pairs, i))
  1631. i = i + 1
  1632. joined_str = string_join(joined_str," , ")
  1633. joined_str = string_join(joined_str, list_read(pairs, i))
  1634. i = i + 1
  1635. joined_str = string_join(joined_str, ")")
  1636. else:
  1637. joined_str = string_join("bool_and(", joined_str)
  1638. joined_str = string_join(joined_str, ",")
  1639. joined_str = string_join(joined_str, list_read(pairs, i))
  1640. i = i + 1
  1641. joined_str = string_join(joined_str, ")")
  1642. if last_operand != "":
  1643. joined_str = string_join("bool_and(", joined_str)
  1644. joined_str = string_join(joined_str, ",")
  1645. joined_str = string_join(joined_str, last_operand)
  1646. joined_str = string_join(joined_str, ")")
  1647. elif bool_and(last_operand != "", list_len(pairs) == 1):
  1648. joined_str = string_join("bool_and(", list_read(pairs, 0))
  1649. joined_str = string_join(joined_str, ",")
  1650. joined_str = string_join(joined_str, last_operand)
  1651. joined_str = string_join(joined_str, ")")
  1652. elif list_len(pairs) == 1:
  1653. joined_str = list_read(pairs, 0)
  1654. code = string_join(code, "\treturn ")
  1655. code = string_join(code, joined_str)
  1656. code = string_join(code, "!")
  1657. result = compile_code(code)
  1658. if element_eq(result, read_root()):
  1659. return read_root()!
  1660. else:
  1661. return result!
  1662. $
  1663. value_script = $
  1664. Element function value(model : Element, name : String, mapping : Element):
  1665. Element outgoing_assns
  1666. String edge
  1667. String activity
  1668. String code
  1669. Element result
  1670. code = "include \"primitives.alh\"\n"
  1671. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  1672. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1673. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1674. code = string_join(code, "', False)\n")
  1675. outgoing_assns = allOutgoingAssociationInstances(model, mapping["1"], "PM/Next")
  1676. while (read_nr_out(outgoing_assns) > 0):
  1677. edge = set_pop(outgoing_assns)
  1678. activity = readAssociationDestination(model, edge)
  1679. code = string_join(code, "\tdict_overwrite(attributes['finish']['")
  1680. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  1681. code = string_join(code, "'],'")
  1682. code = string_join(code,read_attribute(model, activity, "id"))
  1683. code = string_join(code, "', False)\n")
  1684. code = string_join(code, "\n\treturn!")
  1685. result = compile_code(code)
  1686. if element_eq(result, read_root()):
  1687. return read_root()!
  1688. else:
  1689. return result!
  1690. $
  1691. }
  1692. Post_Activity2State_link (post_f_1, post_f_6){
  1693. label = "14"
  1694. }
  1695. }
  1696. }
  1697. {Contains} ForAll map_join {
  1698. LHS {
  1699. Pre_PM/Join pre_j_0 {
  1700. label = "0"
  1701. }
  1702. Pre_SCCD/ParallelState pre_j_1 {
  1703. label = "1"
  1704. constraint_name = $
  1705. Boolean function constraint(value : String):
  1706. return (value == "Running")!
  1707. $
  1708. }
  1709. constraint = $
  1710. Boolean function constraint (model : Element, mapping : Element):
  1711. Element children
  1712. String parent
  1713. Element class_beh
  1714. String class
  1715. children = allIncomingAssociationInstances(model, mapping["1"], "SCCD/composite_children")
  1716. if list_len(children) >0:
  1717. parent = readAssociationSource(model, set_pop(children))
  1718. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  1719. if list_len(class_beh) >0:
  1720. class = readAssociationSource(model, set_pop(class_beh))
  1721. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  1722. return True!
  1723. else:
  1724. return False!
  1725. else:
  1726. return False!
  1727. else:
  1728. return False!
  1729. $
  1730. }
  1731. RHS {
  1732. Post_PM/Join post_j_0 {
  1733. label = "0"
  1734. }
  1735. Post_SCCD/ParallelState post_j_1 {
  1736. label = "1"
  1737. }
  1738. Post_SCCD/CompositeState post_j_6 {
  1739. label = "6"
  1740. value_name = $
  1741. String function value(model : Element, name : String, mapping : Element):
  1742. return name!
  1743. $
  1744. }
  1745. Post_SCCD/parallel_children (post_j_1, post_j_6) {
  1746. label = "7"
  1747. }
  1748. Post_SCCD/BasicState post_j_8 {
  1749. label = "8"
  1750. value_name = $
  1751. String function value(model : Element, name : String, mapping : Element):
  1752. return "Waiting"!
  1753. $
  1754. value_isInitial = $
  1755. Boolean function value(model : Element, name : String, mapping : Element):
  1756. return True!
  1757. $
  1758. }
  1759. Post_SCCD/composite_children (post_j_6, post_j_8) {
  1760. label = "9"
  1761. }
  1762. Post_SCCD/transition post_j_10(post_j_8, post_j_8) {
  1763. label = "10"
  1764. value_name = $
  1765. String function value(model : Element, name : String, mapping : Element):
  1766. return name!
  1767. $
  1768. value_cond = $
  1769. Element function value(model : Element, name : String, mapping : Element):
  1770. String joined_str
  1771. Element incoming_assns
  1772. String edge
  1773. String type
  1774. String activity
  1775. Element pairs
  1776. String code
  1777. Element result
  1778. code = "include \"primitives.alh\"\n"
  1779. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1780. pairs = create_node()
  1781. incoming_assns = allIncomingAssociationInstances(model, mapping["0"], "PM/Next")
  1782. while (read_nr_out(incoming_assns) > 0):
  1783. edge = set_pop(incoming_assns)
  1784. activity = readAssociationSource(model, edge)
  1785. type = read_type(model, activity)
  1786. if (type == "PM/Exec"):
  1787. joined_str = string_join("bool_and(value_eq(attributes['finish']['",read_attribute(model, activity, "id"))
  1788. joined_str = string_join(joined_str, "'],True), value_eq(attributes['token']['")
  1789. joined_str = string_join(joined_str,read_attribute(model, activity, "id"))
  1790. joined_str = string_join(joined_str, "'], True))")
  1791. list_append(pairs, joined_str)
  1792. elif (type == "PM/Decision"):
  1793. joined_str = string_join("bool_and(value_eq(attributes['token']['", read_attribute(model, activity, "id"))
  1794. joined_str = string_join(joined_str, "'],True), value_eq(attributes['decision_consumes']['")
  1795. joined_str = string_join(joined_str,read_attribute(model, activity, "id"))
  1796. joined_str = string_join(joined_str, "'],")
  1797. joined_str = string_join(joined_str,read_attribute(model, edge, "value"))
  1798. joined_str = string_join(joined_str, "))")
  1799. list_append(pairs, joined_str)
  1800. elif (type == "PM/Join"):
  1801. joined_str = string_join("value_eq(attributes['token']['", read_attribute(model, activity, "id"))
  1802. joined_str = string_join(joined_str, "'],True)")
  1803. list_append(pairs, joined_str)
  1804. elif (type == "PM/Fork"):
  1805. joined_str = string_join("bool_and(value_eq(attributes['token']['", read_attribute(model, activity, "id"))
  1806. joined_str = string_join(joined_str, "'],True), value_eq(attributes['finish']['")
  1807. joined_str = string_join(joined_str, read_attribute(model, activity, "id"))
  1808. joined_str = string_join(joined_str, "'],'")
  1809. joined_str = string_join(joined_str, read_attribute(model, mapping["0"], "id"))
  1810. joined_str = string_join(joined_str, "',False))")
  1811. list_append(pairs, joined_str)
  1812. joined_str = ""
  1813. if list_len(pairs)>1:
  1814. Integer i
  1815. i = 0
  1816. while (i < list_len(pairs)):
  1817. if joined_str == "":
  1818. joined_str = string_join("\treturn bool_and(", list_read(pairs,i))
  1819. i = i + 1
  1820. joined_str = string_join(joined_str," , ")
  1821. joined_str = string_join(joined_str, list_read(pairs,i))
  1822. i = i + 1
  1823. joined_str = string_join(joined_str, ")")
  1824. else:
  1825. joined_str = string_join("bool_and(", joined_str)
  1826. joined_str = string_join(joined_str, ",")
  1827. joined_str = string_join(joined_str, list_read(pairs, i))
  1828. i = i + 1
  1829. joined_str = string_join(joined_str, ")")
  1830. elif value_eq(list_len(pairs), 1):
  1831. joined_str = string_join("\treturn ", list_read(pairs, 0))
  1832. code = string_join(code, joined_str)
  1833. code = string_join(code, "!")
  1834. result = compile_code(code)
  1835. if element_eq(result, read_root()):
  1836. return read_root()!
  1837. else:
  1838. return result!
  1839. $
  1840. value_script = $
  1841. Element function value(model : Element, name : String, mapping : Element):
  1842. Element outgoing_assns
  1843. String edge
  1844. String type
  1845. String activity
  1846. String code
  1847. Element result
  1848. code = "include \"primitives.alh\"\n"
  1849. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  1850. outgoing_assns = allIncomingAssociationInstances(model, mapping["0"], "PM/Next")
  1851. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1852. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1853. code = string_join(code, "',True)\n")
  1854. while (read_nr_out(outgoing_assns) > 0):
  1855. edge = set_pop(outgoing_assns)
  1856. activity = readAssociationSource(model, edge)
  1857. type = read_type(model, activity)
  1858. if (type == "PM/Exec"):
  1859. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1860. code = string_join(code, read_attribute(model, activity, "id"))
  1861. code = string_join(code, "',False) \n")
  1862. code = string_join(code, "\tdict_overwrite(attributes['finish'],'")
  1863. code = string_join(code, read_attribute(model, activity, "id"))
  1864. code = string_join(code, "',False)\n")
  1865. elif bool_or(type == "PM/Decision", type == "PM/Join"):
  1866. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  1867. code = string_join(code, read_attribute(model, activity, "id"))
  1868. code = string_join(code, "', False)\n")
  1869. elif type == "PM/Fork":
  1870. code = string_join(code, "\tdict_overwrite(attributes['finish'],['")
  1871. code = string_join(code, read_attribute(model, activity, "id"))
  1872. code = string_join(code, "'], '")
  1873. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1874. code = string_join(code, "', True)\n")
  1875. code = string_join(code, "\n\treturn!")
  1876. result = compile_code(code)
  1877. if element_eq(result, read_root()):
  1878. return read_root()!
  1879. else:
  1880. return result!
  1881. $
  1882. }
  1883. Post_Activity2State_link (post_j_0, post_j_6){
  1884. label = "14"
  1885. }
  1886. }
  1887. }
  1888. {Contains} ForAll map_finish {
  1889. LHS {
  1890. Pre_PM/Activity pre_e_0 {
  1891. label = "0"
  1892. }
  1893. Pre_PM/Finish pre_e_1 {
  1894. label = "1"
  1895. }
  1896. Pre_SCCD/ParallelState pre_e_2 {
  1897. label = "2"
  1898. constraint_name = $
  1899. Boolean function constraint(value : String):
  1900. return (value == "Running")!
  1901. $
  1902. }
  1903. Pre_PM/Next (pre_e_0, pre_e_1){
  1904. label = "11"
  1905. }
  1906. constraint = $
  1907. Boolean function constraint (model : Element, mapping : Element):
  1908. Element children
  1909. String parent
  1910. Element class_beh
  1911. String class
  1912. children = allIncomingAssociationInstances(model, mapping["2"], "SCCD/composite_children")
  1913. if list_len(children) >0:
  1914. parent = readAssociationSource(model, set_pop(children))
  1915. class_beh = allIncomingAssociationInstances(model, parent, "SCCD/behaviour")
  1916. if list_len(class_beh) >0:
  1917. class = readAssociationSource(model, set_pop(class_beh))
  1918. if (value_eq(read_attribute(model, class, "name"), "Orchestrator")):
  1919. return True!
  1920. else:
  1921. return False!
  1922. else:
  1923. return False!
  1924. else:
  1925. return False!
  1926. $
  1927. }
  1928. RHS {
  1929. Post_PM/Activity post_e_0 {
  1930. label = "0"
  1931. }
  1932. Post_PM/Finish post_e_1 {
  1933. label = "1"
  1934. }
  1935. Post_PM/Next (post_e_0, post_e_1){
  1936. label = "11"
  1937. }
  1938. Post_SCCD/ParallelState post_e_2 {
  1939. label = "2"
  1940. }
  1941. Post_SCCD/CompositeState post_e_3 {
  1942. label = "3"
  1943. value_name = $
  1944. String function value(model : Element, name : String, mapping : Element):
  1945. return name!
  1946. $
  1947. }
  1948. Post_SCCD/parallel_children (post_e_2, post_e_3) {
  1949. label = "4"
  1950. }
  1951. Post_SCCD/BasicState post_e_5 {
  1952. label = "5"
  1953. value_name = $
  1954. String function value(model : Element, name : String, mapping : Element):
  1955. return "Waiting"!
  1956. $
  1957. value_isInitial = $
  1958. Boolean function value(model : Element, name : String, mapping : Element):
  1959. return True!
  1960. $
  1961. }
  1962. Post_SCCD/composite_children (post_e_3, post_e_5) {
  1963. label = "6"
  1964. }
  1965. Post_SCCD/transition post_e_7(post_e_5, post_e_5) {
  1966. label = "7"
  1967. value_name = $
  1968. String function value(model : Element, name : String, mapping : Element):
  1969. return name!
  1970. $
  1971. value_cond = $
  1972. Element function value(model : Element, name : String, mapping : Element):
  1973. String type
  1974. String code
  1975. Element result
  1976. code = "include \"primitives.alh\"\n"
  1977. code = string_join(code, "Boolean function cond(attributes : Element, parameters : Element):\n")
  1978. type = read_type(model, mapping["0"])
  1979. if bool_or(bool_or(type == "PM/Join", type == "PM/Fork"),type=="PM/Start"):
  1980. code = string_join(code, "\treturn value_eq(attributes['token']['")
  1981. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1982. code = string_join(code, "'],True)!")
  1983. elif (type == "PM/Decision"):
  1984. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  1985. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1986. code = string_join(code, "'],True), value_eq(attributes['decision_consumes']['")
  1987. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1988. code = string_join(code, "'],")
  1989. code = string_join(code, read_attribute(model, mapping["11"], "value"))
  1990. code = string_join(code, "))!")
  1991. elif (type == "PM/Exec"):
  1992. code = string_join(code, "\treturn bool_and(value_eq(attributes['token']['")
  1993. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1994. code = string_join(code, "'],True), value_eq(attributes['finish']['")
  1995. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  1996. code = string_join(code, "'],True))!")
  1997. result = compile_code(code)
  1998. if element_eq(result, read_root()):
  1999. return read_root()!
  2000. else:
  2001. return result!
  2002. $
  2003. value_script = $
  2004. Element function value(model : Element, name : String, mapping : Element):
  2005. String code
  2006. Element result
  2007. code = "include \"primitives.alh\"\n"
  2008. code = string_join(code, "Void function script(attributes : Element, parameters : Element):\n")
  2009. code = string_join(code,"\tdict_overwrite(attributes['token'],'")
  2010. code = string_join(code, read_attribute(model, mapping["0"], "id"))
  2011. code = string_join(code, "',False) \n")
  2012. code = string_join(code, "\tdict_overwrite(attributes['token'],'")
  2013. code = string_join(code, read_attribute(model, mapping["1"], "id"))
  2014. code = string_join(code, "',True)")
  2015. code = string_join(code, "\n\treturn!")
  2016. result = compile_code(code)
  2017. if element_eq(result, read_root()):
  2018. return read_root()!
  2019. else:
  2020. return result!
  2021. $
  2022. }
  2023. Post_SCCD/Raise post_e_8 {
  2024. label = "8"
  2025. value_event = $
  2026. String function value(model : Element, name : String, mapping : Element):
  2027. return "process_done"!
  2028. $
  2029. value_scope = $
  2030. String function value(model : Element, name : String, mapping : Element):
  2031. return "local"!
  2032. $
  2033. }
  2034. Post_SCCD/transition_raises (post_e_7, post_e_8) {
  2035. label = "9"
  2036. }
  2037. Post_Activity2State_link (post_e_1, post_e_3){
  2038. label = "10"
  2039. }
  2040. }
  2041. }
  2042. }
  2043. Initial (schedule, create_orchestrator) {}
  2044. OnSuccess (create_orchestrator, create_class_association) {}
  2045. OnSuccess (create_class_association, ModifyFork2Fork) {}
  2046. OnSuccess (ModifyFork2Fork, ModifyFork2Fork) {}
  2047. OnSuccess (RemoveFork2Fork, initialize) {}
  2048. OnSuccess (initialize, compile_init_script) {}
  2049. OnSuccess (compile_init_script, map_exec) {}
  2050. OnSuccess (map_exec, data_produces) {}
  2051. OnSuccess (data_produces, exec_data_consumes) {}
  2052. OnSuccess (exec_data_consumes, map_decision) {}
  2053. OnSuccess (map_decision, map_fork) {}
  2054. OnSuccess (map_fork, map_join) {}
  2055. OnSuccess (map_join, map_finish) {}
  2056. OnSuccess (map_finish, success) {}
  2057. OnFailure (create_orchestrator, create_class_association) {}
  2058. OnFailure (create_class_association, ModifyFork2Fork) {}
  2059. OnFailure (ModifyFork2Fork, RemoveFork2Fork) {}
  2060. OnFailure (RemoveFork2Fork, initialize) {}
  2061. OnFailure (initialize, compile_init_script) {}
  2062. OnFailure (compile_init_script, map_exec) {}
  2063. OnFailure (map_exec, data_produces) {}
  2064. OnFailure (data_produces, exec_data_consumes) {}
  2065. OnFailure (exec_data_consumes, map_decision) {}
  2066. OnFailure (map_decision, map_fork) {}
  2067. OnFailure (map_fork, map_join) {}
  2068. OnFailure (map_join, map_finish) {}
  2069. OnFailure (map_finish, success) {}