|
@@ -203,8 +203,6 @@ Void function initialize_core():
|
|
|
instantiate_link(core, "owner", "", conf, admin_user)
|
|
|
String lnk
|
|
|
lnk = instantiate_link(core, "transformInput", "", conf, scd_model)
|
|
|
- instantiate_attribute(core, lnk, "name", "metamodel")
|
|
|
- lnk = instantiate_link(core, "transformInput", "", conf, scd_model)
|
|
|
instantiate_attribute(core, lnk, "name", "model")
|
|
|
|
|
|
// Add the core formalism already
|
|
@@ -543,9 +541,9 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
if (value_eq(read_attribute(core, trace_link_id, "type"), linktype)):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
|
|
|
- if (merged_metamodel_id != ""):
|
|
|
- // 2) Merge source models
|
|
|
+ // 2) Merge source models
|
|
|
|
|
|
+ if (merged_metamodel_id != ""):
|
|
|
model_tuples = create_node()
|
|
|
keys = dict_keys(input_models)
|
|
|
while (read_nr_out(keys) > 0):
|
|
@@ -553,58 +551,65 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(input_models[key]))))
|
|
|
|
|
|
merged_model = model_join(model_tuples, get_full_model(merged_metamodel_id), tracability_model)
|
|
|
-
|
|
|
- // 3) Transform
|
|
|
-
|
|
|
- if (exact_type == "ModelTransformation"):
|
|
|
- result = transform(merged_model, get_full_model(operation_id))
|
|
|
- elif (exact_type == "ManualOperation"):
|
|
|
- output("Please perform manual operation " + cast_v2s(read_attribute(core, operation_id, "name")))
|
|
|
- modify(merged_model, True)
|
|
|
- result = True
|
|
|
- elif (exact_type == "ActionLanguage"):
|
|
|
- Element func
|
|
|
- func = get_func_AL_model(get_full_model(operation_id))
|
|
|
- result = func(merged_model)
|
|
|
+ else:
|
|
|
+ if (bool_and(read_nr_out(input_models) == 1, read_nr_out(output_models) == 0)):
|
|
|
+ // Just skip the merge...
|
|
|
+ merged_model = model_copy(get_full_model(get_model_id(read_edge_dst(read_out(input_models, 0)))))
|
|
|
else:
|
|
|
+ log("Could not resolve intermediate merged metamodel")
|
|
|
+ output("Could not resolve intermediate merged metamodel")
|
|
|
return read_root()!
|
|
|
|
|
|
- // 4) Split in different models depending on type
|
|
|
+ // 3) Transform
|
|
|
+
|
|
|
+ if (exact_type == "ModelTransformation"):
|
|
|
+ result = transform(merged_model, get_full_model(operation_id))
|
|
|
+ elif (exact_type == "ManualOperation"):
|
|
|
+ output("Please perform manual operation " + cast_v2s(read_attribute(core, operation_id, "name")))
|
|
|
+ modify(merged_model, True)
|
|
|
+ result = True
|
|
|
+ elif (exact_type == "ActionLanguage"):
|
|
|
+ Element func
|
|
|
+ func = get_func_AL_model(get_full_model(operation_id))
|
|
|
+ result = func(merged_model)
|
|
|
+ else:
|
|
|
+ log("Unknown type of operation: " + exact_type)
|
|
|
+ output("Unknown type of operation: " + exact_type)
|
|
|
+ return read_root()!
|
|
|
|
|
|
- if (element_neq(tracability_model, read_root())):
|
|
|
- tracability = True
|
|
|
- else:
|
|
|
- tracability = False
|
|
|
-
|
|
|
- if (result):
|
|
|
- model_tuples = create_node()
|
|
|
- keys = dict_keys(output_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
- key = set_pop(keys)
|
|
|
- set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(output_models[key]))))
|
|
|
-
|
|
|
- result = model_split(merged_model, model_tuples, tracability)
|
|
|
-
|
|
|
- //log("Split up model")
|
|
|
- keys = dict_keys(result)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
- key = set_pop(keys)
|
|
|
- //log((cast_v2s(key) + " --> ") + cast_v2s(read_nr_out(result[key]["model"])))
|
|
|
-
|
|
|
- if (tracability):
|
|
|
- Element new_tracability_model
|
|
|
- new_tracability_model = result["__tracability"]
|
|
|
- dict_overwrite(tracability_model, "model", new_tracability_model["model"])
|
|
|
- dict_overwrite(tracability_model, "type_mapping", new_tracability_model["type_mapping"])
|
|
|
- dict_overwrite(tracability_model, "metamodel", new_tracability_model["metamodel"])
|
|
|
- dict_delete(result, "__tracability")
|
|
|
-
|
|
|
- return result!
|
|
|
- else:
|
|
|
- return read_root()!
|
|
|
+ // 4) Split in different models depending on type
|
|
|
|
|
|
+ if (element_neq(tracability_model, read_root())):
|
|
|
+ tracability = True
|
|
|
else:
|
|
|
- output("Could not resolve intermediate merged metamodel")
|
|
|
+ tracability = False
|
|
|
+
|
|
|
+ if (result):
|
|
|
+ model_tuples = create_node()
|
|
|
+ keys = dict_keys(output_models)
|
|
|
+ while (read_nr_out(keys) > 0):
|
|
|
+ key = set_pop(keys)
|
|
|
+ set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(output_models[key]))))
|
|
|
+
|
|
|
+ result = model_split(merged_model, model_tuples, tracability)
|
|
|
+
|
|
|
+ //log("Output models:")
|
|
|
+ //keys = dict_keys(result)
|
|
|
+ //while (read_nr_out(keys) > 0):
|
|
|
+ // key = set_pop(keys)
|
|
|
+ // log((cast_v2s(key) + " --> ") + cast_v2s(read_nr_out(result[key]["model"])))
|
|
|
+
|
|
|
+ if (tracability):
|
|
|
+ Element new_tracability_model
|
|
|
+ new_tracability_model = result["__tracability"]
|
|
|
+ dict_overwrite(tracability_model, "model", new_tracability_model["model"])
|
|
|
+ dict_overwrite(tracability_model, "type_mapping", new_tracability_model["type_mapping"])
|
|
|
+ dict_overwrite(tracability_model, "metamodel", new_tracability_model["metamodel"])
|
|
|
+ dict_delete(result, "__tracability")
|
|
|
+
|
|
|
+ return result!
|
|
|
+ else:
|
|
|
+ log("Negative result of execution")
|
|
|
return read_root()!
|
|
|
|
|
|
Boolean function enact_action(pm : Element, element : String, prefix : String, user_id : String):
|
|
@@ -1076,12 +1081,19 @@ String function cmd_verify(user_id : String, model_name : String):
|
|
|
// Check whether a model conforms to its specification (with the selected type mapping)
|
|
|
String model_id
|
|
|
String result
|
|
|
+ Element inputs
|
|
|
|
|
|
model_id = get_model_id(model_name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
- result = conformance_scd(get_full_model(model_id))
|
|
|
- return "Success: " + result!
|
|
|
+ String conformance_operation
|
|
|
+ Element conformance
|
|
|
+
|
|
|
+ conformance_operation = set_pop(allAssociationDestinations(core, get_instanceOf_link(model_id), "semantics"))
|
|
|
+ inputs = create_node()
|
|
|
+ dict_add(inputs, "SimpleClassDiagrams", model_name)
|
|
|
+ result = execute_operation(conformance_operation, inputs, create_node(), read_root())
|
|
|
+ return ""!
|
|
|
else:
|
|
|
return "Permission denied to model: " + model_name!
|
|
|
else:
|
|
@@ -1746,6 +1758,7 @@ String function cmd_admin_demote(user_id : String, other_user_name : String):
|
|
|
|
|
|
Void function user_function_skip_init(user_id : String):
|
|
|
String cmd
|
|
|
+ String result
|
|
|
|
|
|
output("Welcome to the Model Management Interface v2.0!")
|
|
|
output("Use the 'help' command for a list of possible commands")
|
|
@@ -1765,7 +1778,9 @@ Void function user_function_skip_init(user_id : String):
|
|
|
elif (cmd == "transformation_execute"):
|
|
|
output(cmd_transformation_execute(user_id, single_input("Transformation name?"), dict_input("Source models?"), dict_input("Target models?")))
|
|
|
elif (cmd == "verify"):
|
|
|
- output(cmd_verify(user_id, single_input("Model name?")))
|
|
|
+ result = cmd_verify(user_id, single_input("Model name?"))
|
|
|
+ if (result != ""):
|
|
|
+ output(result)
|
|
|
elif (cmd == "model_overwrite"):
|
|
|
output(cmd_model_overwrite(user_id, single_input("Model name?")))
|
|
|
elif (cmd == "model_modify"):
|