|
@@ -653,6 +653,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
model_overwrite(split_off_model, get_model_id(outputs[key]))
|
|
|
else:
|
|
|
output("Could not resolve intermediate merged metamodel")
|
|
|
+
|
|
|
elif (exact_type == "ActionLanguage"):
|
|
|
Element dictionary
|
|
|
Element new_inputs
|
|
@@ -702,6 +703,59 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
log("Finished")
|
|
|
|
|
|
+ elif (exact_type == "ManualOperation"):
|
|
|
+ log("Manual operation starts!")
|
|
|
+ // Identical to model transformations, but give control to users for modification
|
|
|
+ // 1) Create empty instance of merged metamodel
|
|
|
+ Element input_model
|
|
|
+ String trace_link_id
|
|
|
+ Element merged_model
|
|
|
+ String merged_metamodel_id
|
|
|
+
|
|
|
+ trace_links = allOutgoingAssociationInstances(core, transformation_id, "tracability")
|
|
|
+ merged_metamodel_id = ""
|
|
|
+ while (read_nr_out(trace_links) > 0):
|
|
|
+ trace_link_id = set_pop(trace_links)
|
|
|
+ if (value_eq(read_attribute(core, trace_link_id, "type"), "operatesOn")):
|
|
|
+ merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
+ if (merged_metamodel_id != ""):
|
|
|
+ merged_model = instantiate_model(get_full_model(merged_metamodel_id))
|
|
|
+
|
|
|
+ // 2) Merge source models
|
|
|
+
|
|
|
+ String key
|
|
|
+ Element keys
|
|
|
+ Element input_keys
|
|
|
+ Element output_keys
|
|
|
+
|
|
|
+ input_keys = dict_keys(inputs)
|
|
|
+ while (read_nr_out(input_keys) > 0):
|
|
|
+ key = set_pop(input_keys)
|
|
|
+ model_join(merged_model, get_full_model(get_model_id(inputs[key])), key + "/")
|
|
|
+
|
|
|
+ // 3) Transform
|
|
|
+
|
|
|
+ modify(merged_model, True)
|
|
|
+
|
|
|
+ // 4) Split in different files depending on type
|
|
|
+
|
|
|
+ String desired_metamodel_id
|
|
|
+ Element split_off_model
|
|
|
+
|
|
|
+ output_keys = dict_keys(outputs)
|
|
|
+ while (read_nr_out(output_keys) > 0):
|
|
|
+ key = set_pop(output_keys)
|
|
|
+ desired_metamodel_id = get_model_id(key)
|
|
|
+ split_off_model = model_split(merged_model, get_full_model(desired_metamodel_id), key + "/")
|
|
|
+
|
|
|
+ // Check if the destination model already exists
|
|
|
+ if (get_model_id(outputs[key]) == ""):
|
|
|
+ // New model
|
|
|
+ model_create(split_off_model, outputs[key], user_id, desired_metamodel_id, "Model")
|
|
|
+ else:
|
|
|
+ // Model exists, so we overwrite
|
|
|
+ model_overwrite(split_off_model, get_model_id(outputs[key]))
|
|
|
+
|
|
|
else:
|
|
|
output("Did not know how to interpret model of type " + exact_type)
|
|
|
else:
|
|
@@ -850,7 +904,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
name = input()
|
|
|
|
|
|
- // Merge both into a single metamodel
|
|
|
+ // Merge all into a single metamodel
|
|
|
if (read_nr_out(all_formalisms) > 0):
|
|
|
output("Name of the RAMified transformation metamodel?")
|
|
|
name = input()
|
|
@@ -934,16 +988,24 @@ Void function user_function_skip_init(user_id : String):
|
|
|
Element source
|
|
|
Element target
|
|
|
String name
|
|
|
+ Element all_formalisms
|
|
|
+ Element merged_formalism
|
|
|
+ String merged_formalism_id
|
|
|
+ String source_formalism_id
|
|
|
+ String type_id
|
|
|
+ String tracability_link
|
|
|
|
|
|
name = input()
|
|
|
source = create_node()
|
|
|
target = create_node()
|
|
|
+ all_formalisms = create_node()
|
|
|
|
|
|
while (name != ""):
|
|
|
model_id = get_model_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (bool_not(set_in(source, model_id))):
|
|
|
set_add(source, model_id)
|
|
|
+ set_add(all_formalisms, create_tuple(name, get_full_model(model_id)))
|
|
|
output("Model added as source")
|
|
|
else:
|
|
|
output("Model already selected as source")
|
|
@@ -959,6 +1021,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
if (model_id != ""):
|
|
|
if (bool_not(set_in(target, model_id))):
|
|
|
set_add(target, model_id)
|
|
|
+ set_add(all_formalisms, create_tuple(name, get_full_model(model_id)))
|
|
|
output("Model added as target")
|
|
|
else:
|
|
|
output("Model already selected as target")
|
|
@@ -975,6 +1038,20 @@ Void function user_function_skip_init(user_id : String):
|
|
|
model_create(instantiate_model(get_full_model(get_model_id("ManualOperation"))), name, user_id, get_model_id("ManualOperation"), "ManualOperation")
|
|
|
model_id = get_model_id(name)
|
|
|
|
|
|
+ // Write out a merged metamodel containing all these models: this is the MM for the manual operation
|
|
|
+ // New location is available, so write
|
|
|
+ log("FUSE")
|
|
|
+ merged_formalism = model_fuse(set_copy(all_formalisms))
|
|
|
+ log("Fuse OK")
|
|
|
+ model_create(merged_formalism, "__merged_" + name, user_id, type_id, "Model")
|
|
|
+ merged_formalism_id = get_model_id("__merged_" + name)
|
|
|
+
|
|
|
+ // Add tracability links at this level
|
|
|
+ while (read_nr_out(all_formalisms) > 0):
|
|
|
+ source_formalism_id = get_model_id(list_read(set_pop(all_formalisms), 0))
|
|
|
+ tracability_link = instantiate_link(core, "tracability", "", merged_formalism_id, source_formalism_id)
|
|
|
+ instantiate_attribute(core, tracability_link, "type", "operatesOn")
|
|
|
+
|
|
|
// Extend metadata with info on source and target
|
|
|
String link
|
|
|
String dst
|