|
@@ -567,7 +567,6 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
schedule_model = get_full_model(transformation_id)
|
|
|
|
|
|
- // Need to fall back to the default approach, which is way slower
|
|
|
// 1) Create empty instance of merged metamodel
|
|
|
|
|
|
ramified_metamodel_id = set_pop(followAssociation(core, transformation_id, "instanceOf"))
|
|
@@ -619,7 +618,22 @@ Void function user_function_skip_init(user_id : String):
|
|
|
else:
|
|
|
output("Could not resolve intermediate merged metamodel")
|
|
|
elif (exact_type == "ActionLanguage"):
|
|
|
- output("Not Implemented yet!")
|
|
|
+ output("Action Language execution starts!")
|
|
|
+ action_model = get_full_model(transformation_id)
|
|
|
+
|
|
|
+ // 1) Group source models in dictionary
|
|
|
+ input_keys = dict_keys(inputs)
|
|
|
+ while (read_nr_out(input_keys) > 0):
|
|
|
+ key = set_pop(input_keys)
|
|
|
+
|
|
|
+ // 2) Execute action language model
|
|
|
+ func = get_func_AL_model(action_model)
|
|
|
+
|
|
|
+ // 3) Split output dictionary back to seperate models
|
|
|
+ output_keys = dict_keys(outputs)
|
|
|
+ while (read_nr_out(output_keys) > 0):
|
|
|
+ key = set_pop(output_keys)
|
|
|
+
|
|
|
else:
|
|
|
output("Did not know how to interpret model of type " + exact_type)
|
|
|
else:
|
|
@@ -828,6 +842,71 @@ Void function user_function_skip_init(user_id : String):
|
|
|
else:
|
|
|
output("No such model")
|
|
|
|
|
|
+ elif (cmd == "transformation_add_AL"):
|
|
|
+ // Add an action language transformation model
|
|
|
+ output("Which metamodels do you want to use as source for the action code (empty string to finish)?")
|
|
|
+ name = input()
|
|
|
+ while (name != ""):
|
|
|
+ model_id = get_model_id(name)
|
|
|
+ if (model_id != ""):
|
|
|
+ if (set_in(supported, model_id)):
|
|
|
+ if (bool_not(set_in(source, model_id))):
|
|
|
+ set_add(source, model_id)
|
|
|
+ output("Model added as source")
|
|
|
+ else:
|
|
|
+ output("Model already selected as source")
|
|
|
+ else:
|
|
|
+ output("Model is not supported by RAMified metamodel!")
|
|
|
+ else:
|
|
|
+ output("No such model; try again")
|
|
|
+
|
|
|
+ name = input()
|
|
|
+
|
|
|
+ output("Which metamodels do you want to use as target for the action code (empty string to finish)?")
|
|
|
+ name = input()
|
|
|
+ while (name != ""):
|
|
|
+ model_id = get_model_id(name)
|
|
|
+ if (model_id != ""):
|
|
|
+ if (set_in(supported, model_id)):
|
|
|
+ if (bool_not(set_in(target, model_id))):
|
|
|
+ set_add(target, model_id)
|
|
|
+ output("Model added as target")
|
|
|
+ else:
|
|
|
+ output("Model already selected as target")
|
|
|
+ else:
|
|
|
+ output("Model is not supported by RAMified metamodel!")
|
|
|
+ else:
|
|
|
+ output("No such model; try again")
|
|
|
+
|
|
|
+ name = input()
|
|
|
+
|
|
|
+ output("Name of Action Language model?")
|
|
|
+ name = input()
|
|
|
+
|
|
|
+ if (get_model_id(name) == ""):
|
|
|
+ String new_model
|
|
|
+ // Finished with all information, now create the model itself!
|
|
|
+ output("Waiting for model constructors...")
|
|
|
+ new_model = construct_model_raw(import_node("models/ActionLanguage"))
|
|
|
+ model_create(new_model, name, user_id, ramified_metamodel_id, "ActionLanguage")
|
|
|
+ model_id = get_model_id(name)
|
|
|
+
|
|
|
+ // Extend metadata with info on source and target
|
|
|
+ String link
|
|
|
+ String dst
|
|
|
+
|
|
|
+ while (read_nr_out(source) > 0):
|
|
|
+ dst = set_pop(source)
|
|
|
+ link = instantiate_link(core, "transformInput", "", model_id, dst)
|
|
|
+ instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
+
|
|
|
+ while (read_nr_out(target) > 0):
|
|
|
+ dst = set_pop(target)
|
|
|
+ link = instantiate_link(core, "transformOutput", "", model_id, dst)
|
|
|
+ instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
+ else:
|
|
|
+ output("Model already exists")
|
|
|
+
|
|
|
elif (cmd == "transformation_add_MT"):
|
|
|
// Add a model transformation model
|
|
|
// Just a usual model instantiation, but need to add the source and target links based on user info
|