|
@@ -510,12 +510,13 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
Boolean tracability
|
|
|
|
|
|
// 1) Find merged metamodel
|
|
|
+ log("Find merged")
|
|
|
|
|
|
exact_type = read_type(core, operation_id)
|
|
|
|
|
|
if (exact_type == "ModelTransformation"):
|
|
|
linktype = "RAMified"
|
|
|
- ramified_metamodel_id = set_pop(followAssociation(core, operation_id, "instanceOf"))
|
|
|
+ ramified_metamodel_id = set_pop(allAssociationDestinations(core, operation_id, "instanceOf"))
|
|
|
trace_links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
linktype = "operatesOn"
|
|
@@ -535,6 +536,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
|
|
|
if (merged_metamodel_id != ""):
|
|
|
// 2) Merge source models
|
|
|
+ log("Merge source")
|
|
|
|
|
|
model_tuples = create_node()
|
|
|
while (read_nr_out(input_models) > 0):
|
|
@@ -546,6 +548,10 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
merged_model = model_join(model_tuples, get_full_model(merged_metamodel_id), read_root())
|
|
|
|
|
|
// 3) Transform
|
|
|
+ log("Transform")
|
|
|
+ log("Source model: " + pretty_print(merged_model))
|
|
|
+ log("Types of merged: " + set_to_string(dict_keys(merged_model["metamodel"]["model"])))
|
|
|
+ log("operation: " + pretty_print(get_full_model(operation_id)))
|
|
|
|
|
|
if (exact_type == "ModelTransformation"):
|
|
|
result = transform(merged_model, get_full_model(operation_id))
|
|
@@ -561,6 +567,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
log("ERROR")
|
|
|
|
|
|
// 4) Split in different models depending on type
|
|
|
+ log("Split")
|
|
|
|
|
|
if (element_neq(tracability_model, read_root())):
|
|
|
tracability = True
|
|
@@ -578,6 +585,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
result = model_split(merged_model, model_tuples, tracability)
|
|
|
|
|
|
if (tracability):
|
|
|
+ log("Trace")
|
|
|
Element new_tracability_model
|
|
|
new_tracability_model = result["__tracability"]
|
|
|
dict_overwrite(tracability_model, "model", new_tracability_model["model"])
|
|
@@ -585,6 +593,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
dict_overwrite(tracability_model, "metamodel", new_tracability_model["metamodel"])
|
|
|
dict_delete(result, "__tracability")
|
|
|
|
|
|
+ log("Done")
|
|
|
return result!
|
|
|
else:
|
|
|
return read_root()!
|
|
@@ -879,7 +888,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
// Generate a new rendered model only (no write to original model!)
|
|
|
outputs = create_node()
|
|
|
- type_ID = followAssociation(core, mapper_ID, "transformOutput")
|
|
|
+ type_ID = set_pop(allAssociationDestinations(core, mapper_ID, "transformOutput"))
|
|
|
set_add(outputs, read_attribute(core, type_ID, "name"))
|
|
|
|
|
|
// Rendered model doesn't exist yet, so create first
|
|
@@ -897,12 +906,15 @@ Void function user_function_skip_init(user_id : String):
|
|
|
tracability_model = get_full_model(get_model_id(tracability_name))
|
|
|
|
|
|
// Do the operation itself!
|
|
|
+ log("Start transformation!")
|
|
|
result = execute_operation(mapper_ID, inputs, outputs, tracability_model)
|
|
|
+ log("Transformation done")
|
|
|
|
|
|
// Overwrite the previous rendered model; tracability updated in-place
|
|
|
model_overwrite(result[read_attribute(core, type_ID, "name")], get_model_id(rendered_name))
|
|
|
|
|
|
// Also output the resulting model
|
|
|
+ output("Mapping success!")
|
|
|
output(pretty_print(rendered_name))
|
|
|
|
|
|
else:
|
|
@@ -1035,9 +1047,9 @@ Void function user_function_skip_init(user_id : String):
|
|
|
model_id = get_model_id(input())
|
|
|
if (model_id != ""):
|
|
|
if (allow_write(user_id, model_id)):
|
|
|
- if (allow_read(user_id, set_pop(followAssociation(core, model_id, "instanceOf")))):
|
|
|
+ if (allow_read(user_id, set_pop(allAssociationDestinations(core, model_id, "instanceOf")))):
|
|
|
output("Waiting for model constructors...")
|
|
|
- new_model = construct_model_raw(get_full_model(set_pop(followAssociation(core, model_id, "instanceOf"))))
|
|
|
+ new_model = construct_model_raw(get_full_model(set_pop(allAssociationDestinations(core, model_id, "instanceOf"))))
|
|
|
model_overwrite(new_model, model_id)
|
|
|
output("Model overwrite success!")
|
|
|
else:
|
|
@@ -1088,7 +1100,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
models = allInstances(core, "Model")
|
|
|
while (read_nr_out(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
- output(string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(followAssociation(core, m, "instanceOf")), "name")))
|
|
|
+ output(string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name")))
|
|
|
|
|
|
elif (cmd == "model_list_full"):
|
|
|
// List all models with full info
|
|
@@ -1444,7 +1456,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
models = allInstances(core, "Transformation")
|
|
|
while (read_nr_out(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
- output(string_join(("[" + read_type(core, m)) + "]", string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(followAssociation(core, m, "instanceOf")), "name"))))
|
|
|
+ output(string_join(("[" + read_type(core, m)) + "]", string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name"))))
|
|
|
|
|
|
elif (cmd == "transformation_list_full"):
|
|
|
// List all models with full info
|