modelling.alc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. include "primitives.alh"
  2. include "io.alh"
  3. include "object_operations.alh"
  4. include "constructors.alh"
  5. include "metamodels.alh"
  6. include "library.alh"
  7. Element global_models = ?
  8. String function instantiated_name(element : Element, original : String):
  9. if (original == ""):
  10. return "__" + cast_id2s(element)!
  11. else:
  12. return original!
  13. Element function instantiate_bottom():
  14. // Just create a new node that serves as the basis for everything
  15. // We don't know anything about the model yet, so just create an empty one
  16. Element new_model
  17. // The actual root node of the model
  18. new_model = create_node()
  19. // Add an empty model and empty type mapping
  20. dict_add_fast(new_model, "model", create_node())
  21. dict_add_fast(new_model, "type_mapping", create_node())
  22. // Return the created model
  23. return new_model!
  24. String function model_add_node(model : Element, name : String):
  25. // Adds a new node to the specified model with the desired name
  26. // This is a bottom operation, as it doesn't take any type
  27. Element new_node
  28. String actual_name
  29. new_node = create_node()
  30. actual_name = instantiated_name(new_node, name)
  31. dict_add_fast(model["model"], actual_name, new_node)
  32. return actual_name!
  33. String function model_add_value(model : Element, name : String, value : Element):
  34. // Similar to model_add_node, but add a value as well
  35. String actual_name
  36. actual_name = instantiated_name(value, name)
  37. dict_add_fast(model["model"], actual_name, value)
  38. return actual_name!
  39. String function model_add_edge(model : Element, name : String, source : String, destination : String):
  40. // Add an edge between the source and destination nodes
  41. // Nodes are specified using their string representation previously defined
  42. Element new_edge
  43. String actual_name
  44. if (bool_not(dict_in(model["model"], source))):
  45. log("In link " + name)
  46. log("ERROR: source of link unknown: " + source)
  47. log("Destination: " + destination)
  48. return ""!
  49. if (bool_not(dict_in(model["model"], destination))):
  50. log("In link " + name)
  51. log("ERROR: destination of link unknown: " + destination)
  52. log("Source: " + source)
  53. return ""!
  54. new_edge = create_edge(model["model"][source], model["model"][destination])
  55. actual_name = instantiated_name(new_edge, name)
  56. dict_add_fast(model["model"], actual_name, new_edge)
  57. return actual_name!
  58. Void function retype_model(model : Element, metamodel : Element):
  59. // Remove the type mapping and add a new one for the specified metamodel
  60. dict_delete(model, "type_mapping")
  61. dict_add_fast(model, "type_mapping", create_node())
  62. dict_add_fast(model, "metamodel", metamodel)
  63. return!
  64. Void function retype(model : Element, element : String, type : String):
  65. // Retype a model, deleting any previous type the element had
  66. // The type string is evaluated in the metamodel previously specified
  67. if (dict_in(model["type_mapping"], element)):
  68. dict_delete(model["type_mapping"], element)
  69. dict_add_fast(model["type_mapping"], element, type)
  70. return!
  71. Element function instantiate_model(metamodel : Element):
  72. // Instantiate a model
  73. // Basically create an untyped model and retype it
  74. Element model
  75. model = instantiate_bottom()
  76. retype_model(model, metamodel)
  77. return model!
  78. String function instantiate_node(model : Element, type_name : String, instance_name : String):
  79. String actual_name
  80. if (bool_not(dict_in(model["metamodel"]["model"], type_name))):
  81. log("ERROR: (instantiate_node) no such type in metamodel: " + type_name)
  82. log(" for " + instance_name)
  83. return ""!
  84. Element value
  85. value = create_node()
  86. actual_name = instantiated_name(value, instance_name)
  87. dict_add_fast(model["model"], actual_name, value)
  88. dict_add_fast(model["type_mapping"], actual_name, type_name)
  89. return actual_name!
  90. String function instantiate_value(model : Element, type_name : String, instance_name : String, value : Element):
  91. String actual_name
  92. if (bool_not(dict_in(model["metamodel"]["model"], type_name))):
  93. log("ERROR: (instantiate_value) no such type in metamodel: " + type_name)
  94. log(" for " + instance_name)
  95. return ""!
  96. actual_name = instantiated_name(value, instance_name)
  97. dict_add_fast(model["model"], actual_name, value)
  98. dict_add_fast(model["type_mapping"], actual_name, type_name)
  99. return actual_name!
  100. String function find_attribute_type(model : Element, elem : String, name : String):
  101. String mm_elem
  102. String direct_type
  103. String result
  104. direct_type = read_type(model, elem)
  105. if (direct_type == ""):
  106. return ""!
  107. mm_elem = find_attribute_definer(model["metamodel"], direct_type, name)
  108. if (value_eq(mm_elem, "")):
  109. // Couldn't find element, so is not allowed!
  110. return ""!
  111. else:
  112. result = reverseKeyLookup(model["metamodel"]["model"], dict_read_edge(model["metamodel"]["model"][mm_elem], name))
  113. return result!
  114. Element function get_subclasses(model : Element, name : String):
  115. Element result
  116. Integer i
  117. Integer j
  118. Integer num_edges
  119. Element edge
  120. String elem
  121. Element nodes
  122. nodes = create_node()
  123. set_add(nodes, name)
  124. // Initialize empty set
  125. result = create_node()
  126. i = 0
  127. while (list_len(nodes) > 0):
  128. elem = set_pop(nodes)
  129. if (bool_not(set_in(result, elem))):
  130. create_edge(result, elem)
  131. // Read out all incoming edges
  132. num_edges = read_nr_in(model["model"][elem])
  133. j = 0
  134. while (j < num_edges):
  135. edge = read_in(model["model"][elem], j)
  136. if (value_eq(model["type_mapping"][reverseKeyLookup(model["model"], edge)], "Inheritance")):
  137. set_add(nodes, reverseKeyLookup(model["model"], read_edge_src(edge)))
  138. j = j + 1
  139. return result!
  140. Element function get_superclasses(model : Element, name : String):
  141. Element result
  142. Integer i
  143. Integer j
  144. Integer num_edges
  145. Element edge
  146. String elem
  147. Element nodes
  148. nodes = create_node()
  149. set_add(nodes, name)
  150. // Initialize empty set
  151. result = create_node()
  152. i = 0
  153. while (list_len(nodes) > 0):
  154. elem = set_pop(nodes)
  155. if (bool_not(set_in(result, elem))):
  156. create_edge(result, elem)
  157. // Read out all outgoing edges
  158. num_edges = read_nr_out(model["model"][elem])
  159. j = 0
  160. while (j < num_edges):
  161. edge = read_out(model["model"][elem], j)
  162. if (value_eq(model["type_mapping"][reverseKeyLookup(model["model"], edge)], "Inheritance")):
  163. set_add(nodes, reverseKeyLookup(model["model"], read_edge_dst(edge)))
  164. j = j + 1
  165. return result!
  166. String function find_attribute_definer(model : Element, elem_name : String, name : String):
  167. Element superclasses
  168. String current
  169. Integer nr_out
  170. Element out
  171. String name_attr
  172. superclasses = get_superclasses(model, elem_name)
  173. while (list_len(superclasses) > 0):
  174. current = set_pop(superclasses)
  175. nr_out = read_nr_out(model["model"][current])
  176. while (nr_out > 0):
  177. nr_out = nr_out - 1
  178. out = read_out(model["model"][current], nr_out)
  179. name_attr = read_attribute(model, reverseKeyLookup(model["model"], out), "name")
  180. if (name_attr == name):
  181. return current!
  182. return ""!
  183. Void function instantiate_attribute(model : Element, element : String, attribute_name : String, value : Element):
  184. // Instantiate an attribute of something that needs to be instantiated
  185. // Actually a bit more difficult than all the rest, as we need to find the attribute to instantiate
  186. String attr_type
  187. String attr_name
  188. if (element_neq(read_attribute(model, element, attribute_name), read_root())):
  189. unset_attribute(model, element, attribute_name)
  190. attr_type = find_attribute_type(model, element, attribute_name)
  191. if (attr_type == ""):
  192. log("Could not find attribute " + cast_v2s(attribute_name))
  193. log("For element " + element)
  194. log("Type: " + read_type(model, element))
  195. return!
  196. if (has_value(value)):
  197. value = create_value(value)
  198. attr_name = model_add_value(model, (element + ".") + attribute_name, value)
  199. retype(model, attr_name, reverseKeyLookup(model["metamodel"]["model"], read_edge_dst(model["metamodel"]["model"][attr_type])))
  200. instantiate_link(model, attr_type, "", element, attr_name)
  201. return!
  202. Void function instantiate_attribute_ref(model : Element, element : String, attribute_name : String, ref : String):
  203. // Instantiate an attribute of something that needs to be instantiated
  204. // Actually a bit more difficult than all the rest, as we need to find the attribute to instantiate
  205. String attr_type
  206. String attr_name
  207. attr_type = find_attribute_type(model, element, attribute_name)
  208. if (attr_type == ""):
  209. log("Could not find attribute " + cast_v2s(attribute_name))
  210. return!
  211. instantiate_link(model, attr_type, "", element, ref)
  212. return!
  213. Void function add_code_model(model : Element, export_name : String, code : Element):
  214. Element code_model
  215. code_model = instantiate_model(model)
  216. add_AL(code_model, code)
  217. export_node(export_name, code_model)
  218. return !
  219. Void function instantiate_attribute_code(model : Element, element : String, attribute_name : String, code : Element):
  220. // First create a new model for the AL part
  221. String location
  222. location = "code/" + cast_id2s(code)
  223. add_code_model(import_node("models/ActionLanguage"), location, code)
  224. // Now link it with a complex attribute
  225. instantiate_attribute(model, element, attribute_name, location)
  226. return!
  227. Void function instantiate_existing_attribute(model : Element, element : String, attribute_name : String, attr_ref : String):
  228. // Instantiate an attribute of something that needs to be instantiated
  229. // Actually a bit more difficult than all the rest, as we need to find the attribute to instantiate
  230. String attr_type
  231. String attr_name
  232. attr_type = find_attribute_type(model, element, attribute_name)
  233. if (attr_type == ""):
  234. log("Could not find attribute " + cast_v2s(attribute_name))
  235. return!
  236. // Make a copy of the value, as it is likely that this value is reused later on
  237. retype(model, attr_ref, reverseKeyLookup(model["metamodel"]["model"], read_edge_dst(model["metamodel"]["model"][attr_type])))
  238. instantiate_link(model, attr_type, "", element, attr_ref)
  239. return!
  240. String function instantiate_link(model : Element, type : String, name : String, source : String, destination : String):
  241. // Create a typed link between two nodes
  242. String actual_name
  243. if (type == ""):
  244. // Have to find the type ourselves, as it isn't defined
  245. Element out
  246. Element in
  247. Element options
  248. options = allowedAssociationsBetween(model, source, destination)
  249. if (read_nr_out(options) == 1):
  250. type = set_pop(options)
  251. elif (read_nr_out(options) == 0):
  252. log("ERROR: cannot find possible link between entries")
  253. log(" for " + source)
  254. log(" to " + destination)
  255. return ""!
  256. else:
  257. log("ERROR: too many possible links between entries")
  258. log(" options: " + set_to_string(options))
  259. return ""!
  260. if (bool_not(dict_in(model["metamodel"]["model"], type))):
  261. log("ERROR: (instantiate_link) no such type in metamodel: " + type)
  262. log(" for " + name)
  263. return ""!
  264. Element v
  265. v = create_edge(model["model"][source], model["model"][destination])
  266. actual_name = instantiated_name(v, name)
  267. dict_add_fast(model["model"], actual_name, v)
  268. dict_add_fast(model["type_mapping"], actual_name, type)
  269. return actual_name!
  270. Void function model_delete_element(model : Element, name : String):
  271. // Remove the link
  272. // 1) from the type mapping
  273. dict_delete(model["type_mapping"], name)
  274. // 2) from the model
  275. delete_element(model["model"][name])
  276. return!
  277. String function model_define_attribute(model : Element, elem : String, name : String, optional : Boolean, type : String):
  278. // Create the necessary links to make it an attribute
  279. String edge_name
  280. edge_name = (elem + "_") + name
  281. while (dict_in(model["model"], edge_name)):
  282. // Already exists, so make random name
  283. edge_name = edge_name + cast_id2s(model["model"][elem])
  284. log("Name clash detected for attribute: try new name: " + edge_name)
  285. edge_name = instantiate_link(model, "AttributeLink", edge_name, elem, type)
  286. instantiate_attribute(model, edge_name, "name", name)
  287. instantiate_attribute(model, edge_name, "optional", optional)
  288. return edge_name!
  289. Element function read_attribute(model : Element, element : String, attribute : String):
  290. if (dict_in(model["model"], element)):
  291. Integer i
  292. Integer count
  293. Element edge
  294. Element edge_type
  295. Element elem
  296. Element typing
  297. Element name
  298. elem = model["model"][element]
  299. typing = model["type_mapping"]
  300. count = read_nr_out(elem)
  301. i = 0
  302. while (i < count):
  303. edge = read_out(elem, i)
  304. name = reverseKeyLookup(model["model"], edge)
  305. if (dict_in(typing, name)):
  306. edge_type = model["metamodel"]["model"][typing[name]]
  307. if (element_eq(edge_type, dict_read_edge(read_edge_src(edge_type), attribute))):
  308. return read_edge_dst(edge)!
  309. i = i + 1
  310. else:
  311. log("Element does not exist: " + element)
  312. // Not found: either element doesn't exist, or we couldn't find it
  313. return read_root()!
  314. Void function unset_attribute(model : Element, element : String, attribute : String):
  315. // Removes an attribute if it exists
  316. String attr_type
  317. Element attr_links
  318. String attr_link
  319. attr_type = find_attribute_type(model, element, attribute)
  320. attr_links = allOutgoingAssociationInstances(model, element, attr_type)
  321. while (list_len(attr_links) > 0):
  322. attr_link = set_pop(attr_links)
  323. dict_delete(model["type_mapping"], reverseKeyLookup(model["model"], read_edge_dst(model["model"][attr_link])))
  324. dict_delete(model["type_mapping"], attr_link)
  325. dict_delete_node(model["model"], reverseKeyLookup(model["model"], read_edge_dst(model["model"][attr_link])))
  326. delete_element(model["model"][attr_link])
  327. return!
  328. Void function add_AL_links(model : Element, list : Element, element : Element, type: String, linkname : String, expected_type : String):
  329. if (bool_not(dict_in(element, linkname))):
  330. return!
  331. Element link
  332. String link_name
  333. link = dict_read_edge(element, linkname)
  334. link_name = "__" + cast_id2s(link)
  335. // The link
  336. dict_add_fast(model["model"], link_name, link)
  337. dict_add_fast(model["type_mapping"], link_name, (type + "_") + linkname)
  338. // The name link
  339. link = read_out(link, 0)
  340. link_name = "__" + cast_id2s(link)
  341. dict_add_fast(model["model"], link_name, link)
  342. dict_add_fast(model["type_mapping"], link_name, "dict_link_name")
  343. // The name node
  344. link = read_edge_dst(link)
  345. link_name = "__" + cast_id2s(link)
  346. if (bool_not(set_in_node(model["model"], link))):
  347. dict_add_fast(model["model"], link_name, link)
  348. dict_add_fast(model["type_mapping"], link_name, "StringAttr")
  349. // Now add the destination to the worker list
  350. set_add(list, create_tuple(element[linkname], expected_type))
  351. return!
  352. String function add_AL(model : Element, element : Element):
  353. Element todo
  354. Element node
  355. Element work_node
  356. Element elem
  357. String type
  358. String elem_name
  359. todo = create_node()
  360. set_add(todo, create_tuple(element, "funcdef"))
  361. while (0 < dict_len(todo)):
  362. work_node = set_pop(todo)
  363. elem = list_read(work_node, 0)
  364. type = list_read(work_node, 1)
  365. if (bool_not(set_in_node(model["model"], elem))):
  366. // Determine the type if we don't know it
  367. if (type == ""):
  368. if (is_physical_action(elem)):
  369. type = cast_a2s(elem)
  370. else:
  371. type = "Element"
  372. // Add the node itself
  373. elem_name = "__" + cast_id2s(elem)
  374. dict_add_fast(model["model"], elem_name, elem)
  375. dict_add_fast(model["type_mapping"], elem_name, type)
  376. // Now add its edges
  377. if (type == "if"):
  378. add_AL_links(model, todo, elem, type, "cond", "")
  379. add_AL_links(model, todo, elem, type, "then", "")
  380. add_AL_links(model, todo, elem, type, "else", "")
  381. add_AL_links(model, todo, elem, type, "next", "")
  382. elif (type == "while"):
  383. add_AL_links(model, todo, elem, type, "cond", "")
  384. add_AL_links(model, todo, elem, type, "body", "")
  385. add_AL_links(model, todo, elem, type, "next", "")
  386. elif (type == "assign"):
  387. add_AL_links(model, todo, elem, type, "var", "resolve")
  388. add_AL_links(model, todo, elem, type, "value", "")
  389. add_AL_links(model, todo, elem, type, "next", "")
  390. elif (type == "break"):
  391. add_AL_links(model, todo, elem, type, "while", "while")
  392. elif (type == "continue"):
  393. add_AL_links(model, todo, elem, type, "while", "while")
  394. elif (type == "return"):
  395. add_AL_links(model, todo, elem, type, "value", "")
  396. elif (type == "resolve"):
  397. add_AL_links(model, todo, elem, type, "var", "")
  398. elif (type == "access"):
  399. add_AL_links(model, todo, elem, type, "var", "resolve")
  400. elif (type == "constant"):
  401. add_AL_links(model, todo, elem, type, "node", "")
  402. elif (type == "output"):
  403. add_AL_links(model, todo, elem, type, "node", "")
  404. add_AL_links(model, todo, elem, type, "next", "")
  405. elif (type == "global"):
  406. add_AL_links(model, todo, elem, type, "var", "String")
  407. add_AL_links(model, todo, elem, type, "next", "")
  408. elif (type == "param"):
  409. add_AL_links(model, todo, elem, type, "name", "String")
  410. add_AL_links(model, todo, elem, type, "value", "")
  411. add_AL_links(model, todo, elem, type, "next_param", "param")
  412. elif (type == "funcdef"):
  413. add_AL_links(model, todo, elem, type, "body", "")
  414. // TODO this should be added, but is not the same as "param"
  415. //add_AL_links(model, todo, elem, type, "params", "")
  416. add_AL_links(model, todo, elem, type, "next", "")
  417. elif (type == "call"):
  418. add_AL_links(model, todo, elem, type, "func", "")
  419. add_AL_links(model, todo, elem, type, "params", "param")
  420. add_AL_links(model, todo, elem, type, "last_param", "param")
  421. add_AL_links(model, todo, elem, type, "next", "")
  422. // Mark the node as first
  423. String initial
  424. initial = instantiate_node(model, "Initial", "")
  425. instantiate_link(model, "initial_funcdef", "", initial, reverseKeyLookup(model["model"], element))
  426. return reverseKeyLookup(model["model"], element)!
  427. Void function construct_model():
  428. String command
  429. while (True):
  430. command = input()
  431. if (command == "instantiate_bottom"):
  432. Element m
  433. m = instantiate_bottom()
  434. dict_add_fast(global_models, input(), m)
  435. elif (command == "add_node"):
  436. model_add_node(global_models[input()], input())
  437. elif (command == "add_value"):
  438. model_add_value(global_models[input()], input(), input())
  439. elif (command == "add_edge"):
  440. model_add_edge(global_models[input()], input(), input(), input())
  441. elif (command == "exit"):
  442. return!
  443. elif (command == "retype_model"):
  444. retype_model(global_models[input()], global_models[input()])
  445. elif (command == "retype"):
  446. retype(global_models[input()], input(), input())
  447. elif (command == "instantiate_model"):
  448. Element m
  449. m = instantiate_model(global_models[input()])
  450. dict_add_fast(global_models, input(), m)
  451. elif (command == "instantiate_node"):
  452. instantiate_node(global_models[input()], input(), input())
  453. elif (command == "instantiate_attribute"):
  454. instantiate_attribute(global_models[input()], input(), input(), input())
  455. elif (command == "instantiate_attribute_ref"):
  456. instantiate_attribute_ref(global_models[input()], input(), input(), input())
  457. elif (command == "instantiate_attribute_code"):
  458. instantiate_attribute_code(global_models[input()], input(), input(), construct_function())
  459. elif (command == "instantiate_link"):
  460. instantiate_link(global_models[input()], input(), input(), input(), input())
  461. elif (command == "model_define_attribute"):
  462. model_define_attribute(global_models[input()], input(), input(), input(), input())
  463. elif (command == "initialize_bottom"):
  464. initialize_bottom(input())
  465. elif (command == "export_node"):
  466. String local_name
  467. String location
  468. local_name = input()
  469. location = input()
  470. export_node(location, global_models[local_name])
  471. elif (command == "import_node"):
  472. Element m
  473. command = input()
  474. m = import_node(command)
  475. if (element_eq(m, read_root())):
  476. log("Error: import not found for " + command)
  477. else:
  478. dict_add_fast(global_models, input(), m)
  479. elif (command == "add_code_model"):
  480. add_code_model(global_models[input()], input(), construct_function())
  481. else:
  482. log("Modelling error: did not understand command " + command)
  483. Element function construct_model_raw(metamodel : Element):
  484. String command
  485. Element model
  486. model = instantiate_model(metamodel)
  487. while (True):
  488. command = input()
  489. if (command == "add_node"):
  490. input()
  491. model_add_node(model, input())
  492. elif (command == "add_value"):
  493. input()
  494. model_add_value(model, input(), input())
  495. elif (command == "add_edge"):
  496. input()
  497. model_add_edge(model, input(), input(), input())
  498. elif (command == "exit"):
  499. return model!
  500. elif (command == "instantiate_node"):
  501. input()
  502. instantiate_node(model, input(), input())
  503. elif (command == "model_define_attribute"):
  504. input()
  505. model_define_attribute(model, input(), input(), input(), input())
  506. elif (command == "instantiate_attribute"):
  507. input()
  508. instantiate_attribute(model, input(), input(), input())
  509. elif (command == "instantiate_attribute_ref"):
  510. input()
  511. instantiate_attribute_ref(model, input(), input(), input())
  512. elif (command == "instantiate_attribute_code"):
  513. input()
  514. instantiate_attribute_code(model, input(), input(), construct_function())
  515. elif (command == "instantiate_link"):
  516. input()
  517. instantiate_link(model, input(), input(), input(), input())
  518. elif (command == "import_node"):
  519. input()
  520. input()
  521. elif (command == "export_node"):
  522. input()
  523. input()
  524. elif (command == "instantiate_model"):
  525. input()
  526. input()
  527. elif (command == "add_code_model"):
  528. input()
  529. add_code_model(model, input(), construct_function())
  530. else:
  531. log("Modelling error: did not understand command " + command)
  532. Element function get_func_AL_model(al_model : Element):
  533. Element result
  534. Element initial_function
  535. // Find the initial function
  536. initial_function = allInstances(al_model, "Initial")
  537. if (read_nr_out(initial_function) == 0):
  538. log("Could not find function to execute in this model!")
  539. return create_node()!
  540. elif (read_nr_out(initial_function) > 1):
  541. log("Too many functions to execute in this model!")
  542. return create_node()!
  543. else:
  544. initial_function = al_model["model"][set_pop(allAssociationDestinations(al_model, set_pop(initial_function), "initial_funcdef"))]
  545. return initial_function!