PM_to_SCCD.mvc 100 KB

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