|
@@ -427,12 +427,6 @@ Void function model_overwrite(model : Element, model_id : String, metamodel_id :
|
|
|
|
|
|
return!
|
|
|
|
|
|
-Boolean function check_conformance(model_id : String):
|
|
|
- // TODO check if it actually conforms, considering that instanceOf link
|
|
|
- // --> in-depth check
|
|
|
-
|
|
|
- return True!
|
|
|
-
|
|
|
Element function merge_models(models_dict : Element, operation_name : String):
|
|
|
core = import_node(core_model_location)
|
|
|
// 0) Find operation signature
|
|
@@ -454,7 +448,6 @@ Element function merge_models(models_dict : Element, operation_name : String):
|
|
|
Element trace_links
|
|
|
|
|
|
// 1) Find merged metamodel
|
|
|
-
|
|
|
trace_links = allOutgoingAssociationInstances(core, operation_id, "tracability")
|
|
|
merged_metamodel_id = ""
|
|
|
while (set_len(trace_links) > 0):
|
|
@@ -463,7 +456,6 @@ Element function merge_models(models_dict : Element, operation_name : String):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
|
|
|
// 2) Merge source models
|
|
|
-
|
|
|
if (merged_metamodel_id != ""):
|
|
|
Element model_tuples
|
|
|
Element keys
|
|
@@ -512,6 +504,12 @@ Element function split_model(model : Element, metamodels_dict : Element):
|
|
|
|
|
|
return model_split(model, model_tuples, read_root())!
|
|
|
|
|
|
+Boolean function check_conformance(model_id : String):
|
|
|
+ // TODO check if it actually conforms, considering that instanceOf link
|
|
|
+ // --> in-depth check
|
|
|
+
|
|
|
+ return True!
|
|
|
+
|
|
|
Element function get_model(model_name : String, metamodel_name : String):
|
|
|
core = import_node(core_model_location)
|
|
|
return get_full_model(get_entry_id(model_name), get_entry_id(metamodel_name))!
|
|
@@ -620,15 +618,13 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
cmd_model_add(input_metamodels[key], input_models[key], "")
|
|
|
mm = get_full_model(get_entry_id(input_models[key]), get_entry_id(input_metamodels[key]))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
- output("Signature mismatch in operation for tag " + key)
|
|
|
- return read_root()!
|
|
|
+ return "Signature mismatch in operation for tag: " + key!
|
|
|
set_add_node(model_tuples, create_tuple(key, mm))
|
|
|
|
|
|
Element merged_metamodel
|
|
|
merged_metamodel = get_full_model(merged_metamodel_id, get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
if (element_eq(merged_metamodel, read_root())):
|
|
|
- output("Type cannot be typed as formalisms/SimpleClassDiagrams: 'merged'")
|
|
|
- return read_root()!
|
|
|
+ return "Type cannot be typed as formalisms/SimpleClassDiagrams: 'merged'"!
|
|
|
|
|
|
merged_model = model_join(model_tuples, merged_metamodel, tracability_model)
|
|
|
else:
|
|
@@ -637,14 +633,12 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
Element m
|
|
|
m = get_full_model(get_entry_id(input_models[set_pop(dict_keys(input_models))]), get_entry_id(input_metamodels[set_pop(dict_keys(input_metamodels))]))
|
|
|
if (element_eq(m, read_root())):
|
|
|
- output("Signature mismatch in operation for tag " + cast_value(set_pop(dict_keys(input_models))))
|
|
|
- return read_root()!
|
|
|
+ return "Signature mismatch in operation for tag: " + cast_value(set_pop(dict_keys(input_models)))!
|
|
|
merged_model = model_copy(m)
|
|
|
elif (bool_and(dict_len(input_models) == 0, dict_len(output_metamodels) == 0)):
|
|
|
merged_model = read_root()
|
|
|
else:
|
|
|
- output("Could not resolve intermediate merged metamodel")
|
|
|
- return read_root()!
|
|
|
+ return "Could not resolve intermediate merged metamodel"!
|
|
|
|
|
|
// 3) Transform
|
|
|
|
|
@@ -659,11 +653,11 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
Element operation
|
|
|
operation = get_full_model(operation_id, ramified_metamodel_id)
|
|
|
if (element_eq(operation, read_root())):
|
|
|
- output("Operation could not be typed by specified RAMified metamodel!")
|
|
|
- return read_root()!
|
|
|
+ return "Operation could not be typed by specified RAMified metamodel!"!
|
|
|
result = transform(merged_model, operation)
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
output("Please perform manual operation " + cast_value(full_name(operation_id)))
|
|
|
+ log("Performing manual")
|
|
|
if (element_neq(merged_model, read_root())):
|
|
|
String model_name
|
|
|
model_name = ""
|
|
@@ -683,13 +677,11 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
Element al
|
|
|
al = get_full_model(operation_id, get_entry_id("formalisms/ActionLanguage"))
|
|
|
if (element_eq(al, read_root())):
|
|
|
- output("Action Language operation not typed by ActionLanguage metamodel!")
|
|
|
- return read_root()!
|
|
|
+ return "Action Language operation not typed by ActionLanguage metamodel!"!
|
|
|
func = get_func_AL_model(al)
|
|
|
result = func(merged_model)
|
|
|
else:
|
|
|
- output("Unknown type of operation: " + exact_type)
|
|
|
- return read_root()!
|
|
|
+ return "Unknown type of operation: " + exact_type!
|
|
|
|
|
|
// 4) Split in different models depending on type
|
|
|
|
|
@@ -706,8 +698,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
Element mm
|
|
|
mm = get_full_model(get_entry_id(output_metamodels[key]), get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
if (element_eq(mm, read_root())):
|
|
|
- output("Type cannot be typed as formalisms/SimpleClassDiagrams: " + key)
|
|
|
- return read_root()!
|
|
|
+ return "Type cannot be typed as formalisms/SimpleClassDiagrams: " + key!
|
|
|
set_add_node(model_tuples, create_tuple(key, mm))
|
|
|
|
|
|
result = model_split(merged_model, model_tuples, tracability)
|
|
@@ -722,7 +713,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
|
|
|
return result!
|
|
|
else:
|
|
|
- return read_root()!
|
|
|
+ return "Failure"!
|
|
|
|
|
|
Boolean function enact_action(pm : Element, element : String, mapping : Element):
|
|
|
Boolean result
|
|
@@ -797,7 +788,7 @@ Boolean function enact_action(pm : Element, element : String, mapping : Element)
|
|
|
|
|
|
log(string_join("Finished: ", read_attribute(pm, element, "name")))
|
|
|
|
|
|
- if (element_eq(result, read_root())):
|
|
|
+ if (is_physical_string(result)):
|
|
|
// Something went wrong!
|
|
|
output("Failure")
|
|
|
return False!
|
|
@@ -1382,7 +1373,7 @@ Boolean function do_spawn_modify(model_name : String, write : Boolean):
|
|
|
input()
|
|
|
return False!
|
|
|
|
|
|
-Boolean function do_spawn_activity(transformation_id : String, tracability_name : String, inputs : Element, outputs : Element, output_map : Element):
|
|
|
+String function do_spawn_activity(transformation_id : String, tracability_name : String, inputs : Element, outputs : Element, output_map : Element):
|
|
|
Element lst
|
|
|
Element returnvalue
|
|
|
String taskname
|
|
@@ -1403,7 +1394,7 @@ Boolean function do_spawn_activity(transformation_id : String, tracability_name
|
|
|
sleep(0.1)
|
|
|
|
|
|
output("Finished task: " + taskname)
|
|
|
- return cast_boolean(set_pop(returnvalue))!
|
|
|
+ return set_pop(returnvalue)!
|
|
|
|
|
|
Void function spawn_activity(returnvalue : Element, transformation_id : String, tracability_name : String, inputs : Element, outputs : Element, output_map : Element):
|
|
|
Element result
|
|
@@ -1438,10 +1429,10 @@ Void function spawn_activity(returnvalue : Element, transformation_id : String,
|
|
|
model_overwrite(tracability_model, get_entry_id(tracability_name), get_entry_id("formalisms/Tracability"))
|
|
|
|
|
|
// Now write out the models again
|
|
|
- if (element_eq(result, read_root())):
|
|
|
+ if (is_physical_string(result)):
|
|
|
// Something went wrong!
|
|
|
- set_add(returnvalue, False)
|
|
|
- output("Failure")
|
|
|
+ set_add(returnvalue, result)
|
|
|
+ output("Nothing to modify")
|
|
|
else:
|
|
|
keys = dict_keys(outputs)
|
|
|
while (set_len(keys) > 0):
|
|
@@ -1453,8 +1444,7 @@ Void function spawn_activity(returnvalue : Element, transformation_id : String,
|
|
|
else:
|
|
|
model_overwrite(result[key], get_entry_id(outputs[key]), get_entry_id(output_map[key]))
|
|
|
|
|
|
- set_add(returnvalue, True)
|
|
|
- output("Success")
|
|
|
+ set_add(returnvalue, "Success")
|
|
|
|
|
|
while (other_has_output(get_taskname())):
|
|
|
sleep(1)
|
|
@@ -1533,10 +1523,7 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
else:
|
|
|
return "Write permission denied to: " + target_model_name!
|
|
|
|
|
|
- if (do_spawn_activity(transformation_id, tracability_name, inputs, outputs, output_map)):
|
|
|
- return "Success"!
|
|
|
- else:
|
|
|
- return "Failure"!
|
|
|
+ return do_spawn_activity(transformation_id, tracability_name, inputs, outputs, output_map)!
|
|
|
else:
|
|
|
return "Execute permission denied to: " + transformation_name!
|
|
|
else:
|