|
@@ -75,8 +75,8 @@ String function get_instanceOf_link(model_id : String, metamodel_id : String):
|
|
|
log("WARNING: multiple instanceOf relations were detected for this model; picking one at random!")
|
|
|
elif (set_len(all_links) == 0):
|
|
|
log("No types found!")
|
|
|
- log("Source model: " + cast_v2s(read_attribute(core, model_id, "name")))
|
|
|
- log("Target meta-model: " + cast_v2s(read_attribute(core, metamodel_id, "name")))
|
|
|
+ log("Source model: " + cast_value(read_attribute(core, model_id, "name")))
|
|
|
+ log("Target meta-model: " + cast_value(read_attribute(core, metamodel_id, "name")))
|
|
|
return read_root()!
|
|
|
|
|
|
choice = set_pop(all_links)
|
|
@@ -110,9 +110,11 @@ Element function get_full_model(model_id : String, metamodel_id : String):
|
|
|
dict_add(m, "metamodel", mm)
|
|
|
|
|
|
if (element_neq(choice, read_root())):
|
|
|
- if (set_len(allAssociationDestinations(core, choice, "typing")) == 1):
|
|
|
+ Element types
|
|
|
+ types = allAssociationDestinations(core, choice, "typing")
|
|
|
+ if (set_len(types) == 1):
|
|
|
// Add the preferred original type mapping
|
|
|
- set_type_mapping(m, import_node(read_attribute(core, set_pop(allAssociationDestinations(core, choice, "typing")), "location")))
|
|
|
+ set_type_mapping(m, import_node(read_attribute(core, set_pop(types), "location")))
|
|
|
else:
|
|
|
// Start from scratch
|
|
|
new_type_mapping(m)
|
|
@@ -125,8 +127,8 @@ Element function get_full_model(model_id : String, metamodel_id : String):
|
|
|
return m!
|
|
|
else:
|
|
|
log("No type mapping could be deduced!")
|
|
|
- log("Error for " + cast_v2s(read_attribute(core, model_id, "name")))
|
|
|
- log(" and type " + cast_v2s(read_attribute(core, metamodel_id, "name")))
|
|
|
+ log("Error for " + cast_value(read_attribute(core, model_id, "name")))
|
|
|
+ log(" and type " + cast_value(read_attribute(core, metamodel_id, "name")))
|
|
|
return read_root()!
|
|
|
|
|
|
Integer function get_relation_to_model(user_id : String, model_id : String):
|
|
@@ -382,7 +384,7 @@ String function export_typing(model : Element, name : String):
|
|
|
|
|
|
// Create type mapping model
|
|
|
String location
|
|
|
- location = "type mappings/" + cast_id2s(get_type_mapping(model))
|
|
|
+ location = "type mappings/" + cast_id(get_type_mapping(model))
|
|
|
export_node(location, get_type_mapping(model))
|
|
|
|
|
|
String instance_of
|
|
@@ -403,7 +405,7 @@ Void function model_create(model : Element, name : String, type_id : String, kin
|
|
|
String instance_of
|
|
|
|
|
|
// Create model itself
|
|
|
- location = "models/" + cast_id2s(model)
|
|
|
+ location = "models/" + cast_id(model)
|
|
|
export_node(location, model["model"])
|
|
|
|
|
|
model_id = instantiate_node(core, kind, "")
|
|
@@ -426,7 +428,7 @@ Void function model_overwrite(model : Element, model_id : String, metamodel_id :
|
|
|
String location
|
|
|
String instanceOf_link
|
|
|
|
|
|
- location = "models/" + cast_id2s(model)
|
|
|
+ location = "models/" + cast_id(model)
|
|
|
export_node(location, model["model"])
|
|
|
|
|
|
// Change location in meta-data
|
|
@@ -639,7 +641,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
while (set_len(iter) > 0):
|
|
|
edge = set_pop(iter)
|
|
|
dict_add(output_metamodels, read_attribute(core, edge, "name"), full_name(readAssociationDestination(core, edge)))
|
|
|
-
|
|
|
+
|
|
|
// 1) Find merged metamodel
|
|
|
|
|
|
exact_type = read_type(core, operation_id)
|
|
@@ -679,8 +681,8 @@ 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())):
|
|
|
- log("Signature mismatch in operation for tag " + cast_v2s(set_pop(dict_keys(input_models))))
|
|
|
- output("Signature mismatch in operation for tag " + cast_v2s(set_pop(dict_keys(input_models))))
|
|
|
+ log("Signature mismatch in operation for tag " + cast_value(set_pop(dict_keys(input_models))))
|
|
|
+ output("Signature mismatch in operation for tag " + cast_value(set_pop(dict_keys(input_models))))
|
|
|
return read_root()!
|
|
|
merged_model = model_copy(m)
|
|
|
elif (bool_and(dict_len(input_models) == 0, dict_len(output_metamodels) == 0)):
|
|
@@ -708,7 +710,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
return read_root()!
|
|
|
result = transform(merged_model, operation)
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
- output("Please perform manual operation " + cast_v2s(full_name(operation_id)))
|
|
|
+ output("Please perform manual operation " + cast_value(full_name(operation_id)))
|
|
|
modify(merged_model, True)
|
|
|
result = True
|
|
|
elif (exact_type == "ActionLanguage"):
|
|
@@ -835,7 +837,6 @@ Boolean function enact_action(pm : Element, element : String, prefix : String):
|
|
|
Void function enact_PM(pm : Element, prefix : String):
|
|
|
Element worklist
|
|
|
String element
|
|
|
- String start
|
|
|
String type
|
|
|
Boolean result
|
|
|
Element tuple
|
|
@@ -1035,40 +1036,96 @@ String function cmd_process_execute(process : String, prefix : String):
|
|
|
else:
|
|
|
return "Model not found: " + process!
|
|
|
|
|
|
-String function cmd_transformation_between(source_name : String, target_name : String):
|
|
|
- String source_id
|
|
|
- String target_id
|
|
|
- Element onSource
|
|
|
- Element onTarget
|
|
|
+String function cmd_transformation_between(source_dict : String, target_dict : String):
|
|
|
Element result
|
|
|
- String transformation
|
|
|
+ Element subresult
|
|
|
+ String tag
|
|
|
+ String mm
|
|
|
+ String mm_id
|
|
|
+ Element links
|
|
|
+ String link
|
|
|
+ Element keys
|
|
|
|
|
|
- source_id = get_entry_id(source_name)
|
|
|
- if (source_id != ""):
|
|
|
- target_id = get_entry_id(target_name)
|
|
|
+ result = allInstances(core, "Transformation")
|
|
|
|
|
|
- if (target_id != ""):
|
|
|
- onSource = allAssociationOrigins(core, source_id, "transformInput")
|
|
|
- onTarget = allAssociationOrigins(core, target_id, "transformOutput")
|
|
|
+ // Iterate over all inputs
|
|
|
+ keys = dict_keys(source_dict)
|
|
|
+ while (set_len(keys) > 0):
|
|
|
+ subresult = set_create()
|
|
|
+ tag = set_pop(keys)
|
|
|
+ mm = source_dict[tag]
|
|
|
+ mm_id = get_entry_id(mm)
|
|
|
+
|
|
|
+ if (mm_id != ""):
|
|
|
+ links = allIncomingAssociationInstances(core, mm_id, "transformInput")
|
|
|
+
|
|
|
+ while (set_len(links) > 0):
|
|
|
+ link = set_pop(links)
|
|
|
+ if (value_eq(read_attribute(core, link, "name"), tag)):
|
|
|
+ // Correct tag, so make transformation a possibility
|
|
|
+ set_add(subresult, readAssociationSource(core, link))
|
|
|
+ else:
|
|
|
+ return "Model not found: " + mm!
|
|
|
|
|
|
- result = set_overlap(onSource, onTarget)
|
|
|
+ // Got a set of subresults now, which we use to find the overlap
|
|
|
+ result = set_overlap(result, subresult)
|
|
|
|
|
|
- String r
|
|
|
- r = "Success: "
|
|
|
- while (set_len(result) > 0):
|
|
|
- transformation = set_pop(result)
|
|
|
- if (allow_read(current_user_id, transformation)):
|
|
|
- r = r + string_join(full_name(transformation), "\n")
|
|
|
- return r!
|
|
|
+ keys = dict_keys(target_dict)
|
|
|
+ while (set_len(keys) > 0):
|
|
|
+ subresult = set_create()
|
|
|
+ tag = set_pop(keys)
|
|
|
+ mm = target_dict[tag]
|
|
|
+ mm_id = get_entry_id(mm)
|
|
|
+
|
|
|
+ if (mm_id != ""):
|
|
|
+ links = allIncomingAssociationInstances(core, mm_id, "transformOutput")
|
|
|
+
|
|
|
+ while (set_len(links) > 0):
|
|
|
+ link = set_pop(links)
|
|
|
+ if (value_eq(read_attribute(core, link, "name"), tag)):
|
|
|
+ // Correct tag, so make transformation a possibility
|
|
|
+ set_add(subresult, readAssociationSource(core, link))
|
|
|
else:
|
|
|
- return "Model not found: " + target_name!
|
|
|
- else:
|
|
|
- return "Model not found: " + source_name!
|
|
|
+ return "Model not found: " + mm!
|
|
|
|
|
|
-String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
+ // Got a set of subresults now, which we use to find the overlap
|
|
|
+ result = set_overlap(result, subresult)
|
|
|
+
|
|
|
+ String r
|
|
|
+ String transformation
|
|
|
+ r = "Success: "
|
|
|
+ while (set_len(result) > 0):
|
|
|
+ transformation = set_pop(result)
|
|
|
+ if (allow_read(current_user_id, transformation)):
|
|
|
+ r = r + string_join(full_name(transformation), "\n")
|
|
|
+ return r!
|
|
|
+
|
|
|
+String function cmd_model_rendered(model_name : String, mapper_name : String):
|
|
|
+ Element trace_links
|
|
|
+ String rendered
|
|
|
+ String trace_link_id
|
|
|
+ String allowed_rendered
|
|
|
+ Element trace_links_2
|
|
|
+ String trace_link_2_id
|
|
|
+
|
|
|
+ allowed_rendered = "Success: "
|
|
|
+ trace_links = allOutgoingAssociationInstances(core, get_entry_id(model_name), "tracability")
|
|
|
+ while (set_len(trace_links) > 0):
|
|
|
+ trace_link_id = set_pop(trace_links)
|
|
|
+ if (value_eq(read_attribute(core, trace_link_id, "type"), "CS_perceptualized")):
|
|
|
+ rendered = readAssociationDestination(core, trace_link_id)
|
|
|
+ trace_links_2 = allOutgoingAssociationInstances(core, rendered, "tracability")
|
|
|
+ while (set_len(trace_links_2) > 0):
|
|
|
+ trace_link_2_id = set_pop(trace_links_2)
|
|
|
+ if (value_eq(read_attribute(core, readAssociationDestination(core, trace_link_2_id), "name"), mapper_name)):
|
|
|
+ if (value_eq(read_attribute(core, trace_link_2_id, "type"), "CS_mapper")):
|
|
|
+ allowed_rendered = string_join(allowed_rendered, read_attribute(core, rendered, "name")) + "\n"
|
|
|
+
|
|
|
+ return allowed_rendered!
|
|
|
+
|
|
|
+String function cmd_model_render(model_name : String, mapper_name : String, rendered_name : String):
|
|
|
String model_ID
|
|
|
String mapper_ID
|
|
|
- String rendered_name
|
|
|
String tracability_name
|
|
|
Element inputs
|
|
|
Element output_map
|
|
@@ -1078,6 +1135,12 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
Element out_links
|
|
|
String link
|
|
|
|
|
|
+ String ID_rendered_M
|
|
|
+ String ID_rendered_MM
|
|
|
+ String ID_SCD
|
|
|
+ String ID_tracability_MM
|
|
|
+ String ID_tracability_M
|
|
|
+
|
|
|
model_ID = get_entry_id(model_name)
|
|
|
|
|
|
if (model_ID != ""):
|
|
@@ -1088,8 +1151,7 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
if (allow_read(current_user_id, mapper_ID)):
|
|
|
// Everything is fine; start the actual operation
|
|
|
// Find metamodel to render to
|
|
|
- rendered_name = ("rendered/" + model_name) + mapper_name
|
|
|
- tracability_name = ("tracability/" + model_name) + mapper_name
|
|
|
+ tracability_name = "tracability/" + rendered_name
|
|
|
|
|
|
// Take the abstract syntax model and the previously rendered model
|
|
|
inputs = dict_create()
|
|
@@ -1103,24 +1165,33 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
link = set_pop(out_links)
|
|
|
dict_add(output_map, read_attribute(core, link, "name"), full_name(readAssociationDestination(core, link)))
|
|
|
|
|
|
- if (get_entry_id(rendered_name) == ""):
|
|
|
+ ID_rendered_MM = get_entry_id(output_map["rendered"])
|
|
|
+ ID_SCD = get_entry_id("formalisms/SimpleClassDiagrams")
|
|
|
+ ID_tracability_MM = get_entry_id("formalisms/Tracability")
|
|
|
+ ID_tracability_M = get_entry_id(tracability_name)
|
|
|
+ ID_rendered_M = get_entry_id(rendered_name)
|
|
|
+
|
|
|
+ if (ID_rendered_M == ""):
|
|
|
// Instantiate
|
|
|
Element rendered
|
|
|
- rendered = get_full_model(get_entry_id(output_map["rendered"]), get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
+ rendered = get_full_model(ID_rendered_MM, ID_SCD)
|
|
|
if (element_eq(rendered, read_root())):
|
|
|
- return "Rendered metamodel cannot conform to formalisms/SimpleClassDiagrams"!
|
|
|
+ return "Rendered metamodel doesn't conform to formalisms/SimpleClassDiagrams"!
|
|
|
|
|
|
rendered_model = instantiate_model(rendered)
|
|
|
|
|
|
- model_create(rendered_model, rendered_name, get_entry_id(output_map["rendered"]), "Model")
|
|
|
+ model_create(rendered_model, rendered_name, ID_rendered_MM, "Model")
|
|
|
|
|
|
// Tracability model won't exist either
|
|
|
- tracability_model = instantiate_model(get_full_model(get_entry_id("formalisms/Tracability"), get_entry_id("formalisms/SimpleClassDiagrams")))
|
|
|
- model_create(tracability_model, tracability_name, get_entry_id("formalisms/Tracability"), "Model")
|
|
|
+ tracability_model = instantiate_model(get_full_model(ID_tracability_MM, ID_SCD))
|
|
|
+ model_create(tracability_model, tracability_name, ID_tracability_MM, "Model")
|
|
|
+
|
|
|
+ ID_rendered_M = get_entry_id(rendered_name)
|
|
|
+ ID_tracability_M = get_entry_id(tracability_name)
|
|
|
|
|
|
else:
|
|
|
// Read out tracability model
|
|
|
- tracability_model = get_full_model(get_entry_id(tracability_name), get_entry_id("formalisms/Tracability"))
|
|
|
+ tracability_model = get_full_model(ID_tracability_M, ID_tracability_MM)
|
|
|
if (element_eq(tracability_model, read_root())):
|
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
|
|
|
@@ -1128,17 +1199,24 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
result = execute_operation(mapper_ID, inputs, tracability_model)
|
|
|
|
|
|
// Overwrite the previous rendered model
|
|
|
- model_overwrite(result["rendered"], get_entry_id(rendered_name), get_entry_id(output_map["rendered"]))
|
|
|
- model_overwrite(result["abstract"], get_entry_id(model_name), get_entry_id(output_map["abstract"]))
|
|
|
+ model_overwrite(result["rendered"], ID_rendered_M, ID_rendered_MM)
|
|
|
|
|
|
// Tracability updated in-place
|
|
|
- model_overwrite(tracability_model, get_entry_id(tracability_name), get_entry_id("formalisms/Tracability"))
|
|
|
- tracability_model = get_full_model(get_entry_id(tracability_name), get_entry_id("formalisms/Tracability"))
|
|
|
+ model_overwrite(tracability_model, ID_tracability_M, ID_tracability_MM)
|
|
|
if (element_eq(tracability_model, read_root())):
|
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
|
|
|
|
- // Also output the resulting model
|
|
|
- return "Success: " + JSON_print(get_full_model(get_entry_id(rendered_name), get_entry_id(output_map["rendered"])))!
|
|
|
+ // Link all information in the megamodel
|
|
|
+ String tr_link
|
|
|
+ tr_link = instantiate_link(core, "tracability", "", get_entry_id(model_name), ID_rendered_M)
|
|
|
+ instantiate_attribute(core, tr_link, "type", "CS_perceptualized")
|
|
|
+ tr_link = instantiate_link(core, "tracability", "", ID_rendered_M, get_entry_id(mapper_name))
|
|
|
+ instantiate_attribute(core, tr_link, "type", "CS_mapper")
|
|
|
+
|
|
|
+ // Output the resulting model
|
|
|
+ String value
|
|
|
+ value = JSON_print(result["rendered"])
|
|
|
+ return ("Success: " + value) !
|
|
|
else:
|
|
|
return "Permission denied to model: " + mapper_name!
|
|
|
else:
|
|
@@ -1148,7 +1226,14 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
else:
|
|
|
return "Model not found: " + model_name!
|
|
|
|
|
|
-String function cmd_transformation_execute(transformation_name : String, source_models : Element, target_models : Element):
|
|
|
+ //trace_links = allOutgoingAssociationInstances(core, operation_id, "tracability")
|
|
|
+ //merged_metamodel_id = ""
|
|
|
+ //while (set_len(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)
|
|
|
+
|
|
|
+String function cmd_transformation_execute(transformation_name : String, source_models : Element, target_models : Element, tracability_name : String):
|
|
|
// Execute a transformation, whatever type it is
|
|
|
// First we detect the type, so we know how to prepare for invocation
|
|
|
String transformation_id
|
|
@@ -1204,26 +1289,24 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
assoc_name = read_attribute(core, target, "name")
|
|
|
if (dict_in(target_models, assoc_name)):
|
|
|
target_model_name = target_models[assoc_name]
|
|
|
- else:
|
|
|
- return "Target model not bound: " + assoc_name!
|
|
|
|
|
|
- if (get_entry_id(target_model_name) == ""):
|
|
|
- // Doesn't exist yet, so we can easily create
|
|
|
- if (get_entry_id(get_foldername(target_model_name)) == ""):
|
|
|
- return "Folder not found: " + get_foldername(target_model_name)!
|
|
|
+ if (get_entry_id(target_model_name) == ""):
|
|
|
+ // Doesn't exist yet, so we can easily create
|
|
|
+ if (get_entry_id(get_foldername(target_model_name)) == ""):
|
|
|
+ return "Folder not found: " + get_foldername(target_model_name)!
|
|
|
+ else:
|
|
|
+ if (allow_write(current_user_id, get_entry_id(get_foldername(target_model_name)))):
|
|
|
+ dict_add(output_map, assoc_name, full_name(readAssociationDestination(core, target)))
|
|
|
+ dict_add(outputs, assoc_name, target_model_name)
|
|
|
+ else:
|
|
|
+ return "Permission denied to folder: " + get_foldername(target_model_name)!
|
|
|
else:
|
|
|
- if (allow_write(current_user_id, get_entry_id(get_foldername(target_model_name)))):
|
|
|
- dict_add(output_map, assoc_name, full_name(readAssociationDestination(core, target)))
|
|
|
+ // Already exists, so we need to check for write access
|
|
|
+ if (allow_write(current_user_id, get_entry_id(target_model_name))):
|
|
|
+ dict_add(output_map, assoc_name, read_attribute(core, readAssociationDestination(core, target), "name"))
|
|
|
dict_add(outputs, assoc_name, target_model_name)
|
|
|
else:
|
|
|
- return "Permission denied to folder: " + get_foldername(target_model_name)!
|
|
|
- else:
|
|
|
- // Already exists, so we need to check for write access
|
|
|
- if (allow_write(current_user_id, get_entry_id(target_model_name))):
|
|
|
- dict_add(output_map, assoc_name, read_attribute(core, readAssociationDestination(core, target), "name"))
|
|
|
- dict_add(outputs, assoc_name, target_model_name)
|
|
|
- else:
|
|
|
- return "Permission denied to model: " + target_model_name!
|
|
|
+ return "Permission denied to model: " + target_model_name!
|
|
|
|
|
|
if (read_type(core, transformation_id) == "ActionLanguage"):
|
|
|
output("Success: ready for AL execution")
|
|
@@ -1232,7 +1315,25 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
else:
|
|
|
output("Success: ready for MT execution")
|
|
|
|
|
|
- result = execute_operation(transformation_id, inputs, read_root())
|
|
|
+ // Do tracability
|
|
|
+ Element tracability_model
|
|
|
+ if (tracability_name != ""):
|
|
|
+ // Check if exists
|
|
|
+ if (get_entry_id(tracability_name) == ""):
|
|
|
+ // No, so create
|
|
|
+ tracability_model = instantiate_model(get_full_model(get_entry_id("formalisms/Tracability"), get_entry_id("formalisms/SimpleClassDiagrams")))
|
|
|
+ model_create(tracability_model, tracability_name, get_entry_id("formalisms/Tracability"), "Model")
|
|
|
+ else:
|
|
|
+ // Yes, so read out
|
|
|
+ tracability_model = get_full_model(get_entry_id(tracability_name), get_entry_id("formalisms/Tracability"))
|
|
|
+ else:
|
|
|
+ tracability_model = read_root()
|
|
|
+
|
|
|
+ result = execute_operation(transformation_id, inputs, tracability_model)
|
|
|
+
|
|
|
+ // Flush tracability again, just to be sure
|
|
|
+ if (tracability_name != ""):
|
|
|
+ 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())):
|
|
@@ -1416,7 +1517,7 @@ String function cmd_model_list_full(location : String):
|
|
|
name = get_filename(read_attribute(core, m, "name")) + "/"
|
|
|
else:
|
|
|
name = get_filename(read_attribute(core, m, "name"))
|
|
|
- result = result + (((((((permissions + " ") + owner) + " ") + group) + " ") + name) + "\n")
|
|
|
+ result = result + permissions + " " + owner + " " + group + " " + name + "\n"
|
|
|
return result!
|
|
|
else:
|
|
|
return "Permission denied to folder: " + location!
|
|
@@ -1510,7 +1611,9 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
// New location is available, so write
|
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
|
merged_formalism = model_fuse(formalism_map)
|
|
|
+ model_create(merged_formalism, "merged/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
|
modify(merged_formalism, True)
|
|
|
+ model_overwrite(merged_formalism, get_entry_id("merged/" + operation_name), get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
|
|
|
if (operation_type == "manual"):
|
|
|
// Finished with all information, now create the model itself!
|
|
@@ -1535,7 +1638,6 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
model_id = get_entry_id(operation_name)
|
|
|
|
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
|
- model_create(merged_formalism, "merged/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
|
merged_formalism_id = get_entry_id("merged/" + operation_name)
|
|
|
|
|
|
// Add tracability links at this level
|
|
@@ -1651,7 +1753,9 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
|
|
|
return "Model not found: " + name!
|
|
|
|
|
|
merged_formalism = model_fuse(to_ramify)
|
|
|
+ model_create(merged_formalism, "merged/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
|
modify(merged_formalism, True)
|
|
|
+ model_overwrite(merged_formalism, get_entry_id("merged/" + operation_name), get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
|
|
|
ramified_metamodel = ramify(merged_formalism)
|
|
|
model_create(ramified_metamodel, "RAMified/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
@@ -1717,7 +1821,7 @@ String function cmd_permission_modify(model_name : String, permissions : String)
|
|
|
fail = True
|
|
|
|
|
|
while (i < 3):
|
|
|
- permission = cast_s2i(string_get(permissions, i))
|
|
|
+ permission = cast_integer(string_get(permissions, i))
|
|
|
if (bool_or(permission < 0, permission > 2)):
|
|
|
fail = True
|
|
|
break!
|
|
@@ -1966,7 +2070,7 @@ String function cmd_service_register(service_name : String):
|
|
|
output("Success: " + get_taskname())
|
|
|
|
|
|
// Wait until we can stop the service
|
|
|
- while (cast_v2s(input()) != "\"service_stop\""):
|
|
|
+ while (cast_value(input()) != "\"service_stop\""):
|
|
|
output("Service is running on this task: stop it by sending 'service_stop'")
|
|
|
|
|
|
model_delete_element(core, service)
|
|
@@ -2002,12 +2106,12 @@ String function cmd_transformation_signature(transformation_name : String):
|
|
|
inputs = allOutgoingAssociationInstances(core, model_id, "transformInput")
|
|
|
while (set_len(inputs) > 0):
|
|
|
elem = set_pop(inputs)
|
|
|
- result = string_join(string_join(string_join(string_join("I ", read_attribute(core, elem, "name")), " "), full_name(readAssociationDestination(core, elem))), "\n")
|
|
|
+ result = string_join(string_join(string_join(string_join(result + "I ", read_attribute(core, elem, "name")), " "), full_name(readAssociationDestination(core, elem))), "\n")
|
|
|
|
|
|
outputs = allOutgoingAssociationInstances(core, model_id, "transformOutput")
|
|
|
while (set_len(outputs) > 0):
|
|
|
elem = set_pop(outputs)
|
|
|
- result = string_join(string_join(string_join(string_join("O ", read_attribute(core, elem, "name")), " "), full_name(readAssociationDestination(core, elem))), "\n")
|
|
|
+ result = string_join(string_join(string_join(string_join(result + "O ", read_attribute(core, elem, "name")), " "), full_name(readAssociationDestination(core, elem))), "\n")
|
|
|
|
|
|
return result!
|
|
|
else:
|
|
@@ -2045,6 +2149,12 @@ String function cmd_folder_create(folder_name : String):
|
|
|
else:
|
|
|
return "Folder alreay exists: " + folder_name!
|
|
|
|
|
|
+String function cmd_conformance_add(model_name : String, metamodel_name : String):
|
|
|
+ // Create a new instanceOf relation now
|
|
|
+ String instance_of
|
|
|
+ instance_of = instantiate_link(core, "instanceOf", "", get_entry_id(model_name), get_entry_id(metamodel_name))
|
|
|
+ return "Success"!
|
|
|
+
|
|
|
Void function user_function_skip_init(user_id : String):
|
|
|
String cmd
|
|
|
String result
|
|
@@ -2079,11 +2189,13 @@ Void function user_function_skip_init(user_id : String):
|
|
|
elif (cmd == "process_execute"):
|
|
|
output(cmd_process_execute(single_input("Process to execute?"), single_input("Model prefix to use?")))
|
|
|
elif (cmd == "transformation_between"):
|
|
|
- output(cmd_transformation_between(single_input("Source type?"), single_input("Target type?")))
|
|
|
+ output(cmd_transformation_between(dict_input("Source signature?"), dict_input("Target signature?")))
|
|
|
elif (cmd == "model_render"):
|
|
|
- output(cmd_model_render(single_input("Model name?"), single_input("Mapper name?")))
|
|
|
+ output(cmd_model_render(single_input("Model name?"), single_input("Mapper name?"), single_input("Rendered name?")))
|
|
|
+ elif (cmd == "model_rendered"):
|
|
|
+ output(cmd_model_rendered(single_input("Model name?"), single_input("Mapper name?")))
|
|
|
elif (cmd == "transformation_execute"):
|
|
|
- output(cmd_transformation_execute(single_input("Transformation name?"), dict_input("Source models?"), dict_input("Target models?")))
|
|
|
+ output(cmd_transformation_execute(single_input("Transformation name?"), dict_input("Source models?"), dict_input("Target models?"), single_input("Tracability model?")))
|
|
|
elif (cmd == "verify"):
|
|
|
result = cmd_verify(single_input("Model name?"), single_input("Metamodel name?"))
|
|
|
if (result != ""):
|
|
@@ -2154,7 +2266,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output(cmd_folder_create(single_input("Folder name?")))
|
|
|
elif (cmd == "add_conformance"):
|
|
|
// TODO
|
|
|
- cmd = "FAIL"
|
|
|
+ output(cmd_conformance_add(single_input("Model name?"), single_input("Metamodel name?")))
|
|
|
elif (cmd == "remove_conformance"):
|
|
|
// TODO
|
|
|
cmd = "FAIL"
|