|
@@ -388,8 +388,9 @@ Void function user_function_skip_init(user_id : String):
|
|
|
// Read out source and target links
|
|
|
sources = allOutgoingAssociationInstances(core, transformation_id, "transformInput")
|
|
|
inputs = create_node()
|
|
|
- while (read_nr_out(source) > 0):
|
|
|
+ while (read_nr_out(sources) > 0):
|
|
|
source = set_pop(sources)
|
|
|
+ log("Got source link: " + cast_e2s(source))
|
|
|
output(string_join("Which model to bind for source element ", read_attribute(core, source, "name")))
|
|
|
name_id = get_model_id(input())
|
|
|
if (name_id != ""):
|
|
@@ -428,22 +429,26 @@ Void function user_function_skip_init(user_id : String):
|
|
|
Element merged_model
|
|
|
String merged_metamodel_id
|
|
|
String ramified_metamodel_id
|
|
|
+ Boolean result
|
|
|
|
|
|
schedule_model = import_node(read_attribute(core, transformation_id, "location"))
|
|
|
if (bool_and(bool_and(read_nr_out(inputs) == 1, read_nr_out(outputs) == 1), set_equality(inputs, outputs))):
|
|
|
// inputs and outputs have the same values and there is only one: keep in-place without additional bookkeeping
|
|
|
input_model = import_node(read_attribute(core, set_pop(inputs), "location"))
|
|
|
- transform(input_model, schedule_model)
|
|
|
+ result = transform(input_model, schedule_model)
|
|
|
+ output("Transformation executed with result: " + cast_v2s(result))
|
|
|
else:
|
|
|
// 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"))
|
|
|
+ log("Got ramified MM: " + ramified_metamodel_id)
|
|
|
trace_links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
|
|
|
+ log("With tracability links: " + set_to_string(trace_links))
|
|
|
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"), "ramified")):
|
|
|
+ if (value_eq(read_attribute(core, trace_link_id, "type"), "RAMified")):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
if (merged_metamodel_id != ""):
|
|
|
merged_model = instantiate_model(import_node(read_attribute(core, merged_metamodel_id, "location")))
|
|
@@ -458,11 +463,11 @@ Void function user_function_skip_init(user_id : String):
|
|
|
input_keys = dict_keys(inputs)
|
|
|
while (read_nr_out(input_keys) > 0):
|
|
|
key = set_pop(input_keys)
|
|
|
- model_join(merged_model, import_node(read_attribute(core, inputs[key], "location")), key)
|
|
|
+ model_join(merged_model, import_node(read_attribute(core, inputs[key], "location")), key + "_")
|
|
|
|
|
|
// 3) Transform
|
|
|
|
|
|
- transform(merged_model, schedule_model)
|
|
|
+ result = transform(merged_model, schedule_model)
|
|
|
|
|
|
// 4) Split in different files depending on type
|
|
|
|
|
@@ -473,7 +478,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
while (read_nr_out(output_keys) > 0):
|
|
|
key = set_pop(output_keys)
|
|
|
desired_metamodel_id = set_pop(followAssociation(core, outputs[key], "instanceOf"))
|
|
|
- split_off_model = model_split(merged_model, import_node(read_attribute(core, desired_metamodel_id, "location")), key)
|
|
|
+ split_off_model = model_split(merged_model, import_node(read_attribute(core, desired_metamodel_id, "location")), key + "+")
|
|
|
|
|
|
// Check if the destination model already exists
|
|
|
if (get_model_id(outputs[key]) == ""):
|
|
@@ -482,7 +487,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
else:
|
|
|
// Model exists, so we overwrite
|
|
|
model_overwrite(split_off_model, outputs[key])
|
|
|
-
|
|
|
+ output("Transformation executed with result: " + cast_v2s(result))
|
|
|
else:
|
|
|
output("Could not resolve intermediate merged metamodel")
|
|
|
elif (exact_type == "ActionLanguage"):
|
|
@@ -741,10 +746,18 @@ Void function user_function_skip_init(user_id : String):
|
|
|
model_id = get_model_id(name)
|
|
|
|
|
|
// Extend metadata with info on source and target
|
|
|
+ String link
|
|
|
+ String dst
|
|
|
+
|
|
|
while (read_nr_out(source) > 0):
|
|
|
- instantiate_link(core, "transformInput", "", model_id, set_pop(source))
|
|
|
+ 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):
|
|
|
- instantiate_link(core, "transformOutput", "", model_id, set_pop(target))
|
|
|
+ dst = set_pop(target)
|
|
|
+ link = instantiate_link(core, "transformOutput", "", model_id, dst)
|
|
|
+ instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
|
|
|
output("Meta-info correctly set!")
|
|
|
else:
|