to_SCCD.mvc 84 KB

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