|
@@ -110,9 +110,11 @@ Element function get_full_model(model_id : String, metamodel_id : String):
|
|
|
dict_add(m, "metamodel", mm)
|
|
dict_add(m, "metamodel", mm)
|
|
|
|
|
|
|
|
if (element_neq(choice, read_root())):
|
|
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
|
|
// 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:
|
|
else:
|
|
|
// Start from scratch
|
|
// Start from scratch
|
|
|
new_type_mapping(m)
|
|
new_type_mapping(m)
|
|
@@ -639,7 +641,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
while (set_len(iter) > 0):
|
|
while (set_len(iter) > 0):
|
|
|
edge = set_pop(iter)
|
|
edge = set_pop(iter)
|
|
|
dict_add(output_metamodels, read_attribute(core, edge, "name"), full_name(readAssociationDestination(core, edge)))
|
|
dict_add(output_metamodels, read_attribute(core, edge, "name"), full_name(readAssociationDestination(core, edge)))
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 1) Find merged metamodel
|
|
// 1) Find merged metamodel
|
|
|
|
|
|
|
|
exact_type = read_type(core, operation_id)
|
|
exact_type = read_type(core, operation_id)
|
|
@@ -835,7 +837,6 @@ Boolean function enact_action(pm : Element, element : String, prefix : String):
|
|
|
Void function enact_PM(pm : Element, prefix : String):
|
|
Void function enact_PM(pm : Element, prefix : String):
|
|
|
Element worklist
|
|
Element worklist
|
|
|
String element
|
|
String element
|
|
|
- String start
|
|
|
|
|
String type
|
|
String type
|
|
|
Boolean result
|
|
Boolean result
|
|
|
Element tuple
|
|
Element tuple
|
|
@@ -897,6 +898,7 @@ Void function enact_PM(pm : Element, prefix : String):
|
|
|
// This the difficult part!
|
|
// This the difficult part!
|
|
|
|
|
|
|
|
result = enact_action(pm, element, prefix)
|
|
result = enact_action(pm, element, prefix)
|
|
|
|
|
+ output("Success")
|
|
|
|
|
|
|
|
elif (type == "Decision"):
|
|
elif (type == "Decision"):
|
|
|
// If the previous result is true, we add the normal one, otherwise the false one
|
|
// If the previous result is true, we add the normal one, otherwise the false one
|
|
@@ -919,7 +921,6 @@ Void function enact_PM(pm : Element, prefix : String):
|
|
|
set_add_node(worklist, create_tuple(next, result))
|
|
set_add_node(worklist, create_tuple(next, result))
|
|
|
|
|
|
|
|
// Reached a finish element, so stop
|
|
// Reached a finish element, so stop
|
|
|
- output("Success")
|
|
|
|
|
return !
|
|
return !
|
|
|
|
|
|
|
|
String function cmd_help():
|
|
String function cmd_help():
|
|
@@ -975,7 +976,7 @@ String function cmd_help():
|
|
|
|
|
|
|
|
return result!
|
|
return result!
|
|
|
|
|
|
|
|
-String function cmd_model_add(type : String, name : String):
|
|
|
|
|
|
|
+String function cmd_model_add(type : String, name : String, code : String):
|
|
|
// Model addition operation, which uses model upload commands of the compiler
|
|
// Model addition operation, which uses model upload commands of the compiler
|
|
|
String location
|
|
String location
|
|
|
String type_id
|
|
String type_id
|
|
@@ -998,8 +999,7 @@ String function cmd_model_add(type : String, name : String):
|
|
|
if (element_eq(mm, read_root())):
|
|
if (element_eq(mm, read_root())):
|
|
|
return "Type is not typed by formalisms/SimpleClassDiagrams: " + type!
|
|
return "Type is not typed by formalisms/SimpleClassDiagrams: " + type!
|
|
|
|
|
|
|
|
- output("Waiting for model constructors...")
|
|
|
|
|
- new_model = compile_model(input(), mm)
|
|
|
|
|
|
|
+ new_model = compile_model(code, mm)
|
|
|
|
|
|
|
|
if (element_eq(new_model, read_root())):
|
|
if (element_eq(new_model, read_root())):
|
|
|
return "Compilation error"!
|
|
return "Compilation error"!
|
|
@@ -1036,40 +1036,96 @@ String function cmd_process_execute(process : String, prefix : String):
|
|
|
else:
|
|
else:
|
|
|
return "Model not found: " + process!
|
|
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
|
|
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:
|
|
else:
|
|
|
- return "Model not found: " + target_name!
|
|
|
|
|
- else:
|
|
|
|
|
- return "Model not found: " + source_name!
|
|
|
|
|
|
|
+ return "Model not found: " + mm!
|
|
|
|
|
+
|
|
|
|
|
+ // Got a set of subresults now, which we use to find the overlap
|
|
|
|
|
+ result = set_overlap(result, subresult)
|
|
|
|
|
|
|
|
-String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
|
|
|
|
+ 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 model_ID
|
|
|
String mapper_ID
|
|
String mapper_ID
|
|
|
- String rendered_name
|
|
|
|
|
String tracability_name
|
|
String tracability_name
|
|
|
Element inputs
|
|
Element inputs
|
|
|
Element output_map
|
|
Element output_map
|
|
@@ -1079,6 +1135,12 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
Element out_links
|
|
Element out_links
|
|
|
String link
|
|
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)
|
|
model_ID = get_entry_id(model_name)
|
|
|
|
|
|
|
|
if (model_ID != ""):
|
|
if (model_ID != ""):
|
|
@@ -1089,8 +1151,7 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
if (allow_read(current_user_id, mapper_ID)):
|
|
if (allow_read(current_user_id, mapper_ID)):
|
|
|
// Everything is fine; start the actual operation
|
|
// Everything is fine; start the actual operation
|
|
|
// Find metamodel to render to
|
|
// 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
|
|
// Take the abstract syntax model and the previously rendered model
|
|
|
inputs = dict_create()
|
|
inputs = dict_create()
|
|
@@ -1104,24 +1165,33 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
link = set_pop(out_links)
|
|
link = set_pop(out_links)
|
|
|
dict_add(output_map, read_attribute(core, link, "name"), full_name(readAssociationDestination(core, link)))
|
|
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
|
|
// Instantiate
|
|
|
Element rendered
|
|
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())):
|
|
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)
|
|
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 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:
|
|
else:
|
|
|
// Read out tracability model
|
|
// 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())):
|
|
if (element_eq(tracability_model, read_root())):
|
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
|
|
|
|
|
@@ -1129,17 +1199,24 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
result = execute_operation(mapper_ID, inputs, tracability_model)
|
|
result = execute_operation(mapper_ID, inputs, tracability_model)
|
|
|
|
|
|
|
|
// Overwrite the previous rendered 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
|
|
// 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())):
|
|
if (element_eq(tracability_model, read_root())):
|
|
|
return "Tracability model not typed by Tracability metamodel: " + tracability_name!
|
|
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:
|
|
else:
|
|
|
return "Permission denied to model: " + mapper_name!
|
|
return "Permission denied to model: " + mapper_name!
|
|
|
else:
|
|
else:
|
|
@@ -1149,6 +1226,13 @@ String function cmd_model_render(model_name : String, mapper_name : String):
|
|
|
else:
|
|
else:
|
|
|
return "Model not found: " + model_name!
|
|
return "Model not found: " + model_name!
|
|
|
|
|
|
|
|
|
|
+ //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):
|
|
String function cmd_transformation_execute(transformation_name : String, source_models : Element, target_models : Element, tracability_name : String):
|
|
|
// Execute a transformation, whatever type it is
|
|
// Execute a transformation, whatever type it is
|
|
|
// First we detect the type, so we know how to prepare for invocation
|
|
// First we detect the type, so we know how to prepare for invocation
|
|
@@ -1205,26 +1289,24 @@ String function cmd_transformation_execute(transformation_name : String, source_
|
|
|
assoc_name = read_attribute(core, target, "name")
|
|
assoc_name = read_attribute(core, target, "name")
|
|
|
if (dict_in(target_models, assoc_name)):
|
|
if (dict_in(target_models, assoc_name)):
|
|
|
target_model_name = 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:
|
|
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)
|
|
dict_add(outputs, assoc_name, target_model_name)
|
|
|
else:
|
|
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"):
|
|
if (read_type(core, transformation_id) == "ActionLanguage"):
|
|
|
output("Success: ready for AL execution")
|
|
output("Success: ready for AL execution")
|
|
@@ -1348,7 +1430,6 @@ String function cmd_model_modify(model_name : String, metamodel_name : String):
|
|
|
new_model = get_full_model(model_id, get_entry_id(metamodel_name))
|
|
new_model = get_full_model(model_id, get_entry_id(metamodel_name))
|
|
|
if (element_eq(new_model, read_root())):
|
|
if (element_eq(new_model, read_root())):
|
|
|
return "No conformance relation can be found between these models"!
|
|
return "No conformance relation can be found between these models"!
|
|
|
- output("Success")
|
|
|
|
|
modify(new_model, allow_write(current_user_id, model_id))
|
|
modify(new_model, allow_write(current_user_id, model_id))
|
|
|
if (allow_write(current_user_id, model_id)):
|
|
if (allow_write(current_user_id, model_id)):
|
|
|
// Overwrite the modified model
|
|
// Overwrite the modified model
|
|
@@ -1436,7 +1517,7 @@ String function cmd_model_list_full(location : String):
|
|
|
name = get_filename(read_attribute(core, m, "name")) + "/"
|
|
name = get_filename(read_attribute(core, m, "name")) + "/"
|
|
|
else:
|
|
else:
|
|
|
name = get_filename(read_attribute(core, m, "name"))
|
|
name = get_filename(read_attribute(core, m, "name"))
|
|
|
- result = result + (((((((permissions + " ") + owner) + " ") + group) + " ") + name) + "\n")
|
|
|
|
|
|
|
+ result = result + permissions + " " + owner + " " + group + " " + name + "\n"
|
|
|
return result!
|
|
return result!
|
|
|
else:
|
|
else:
|
|
|
return "Permission denied to folder: " + location!
|
|
return "Permission denied to folder: " + location!
|
|
@@ -1530,7 +1611,9 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
// New location is available, so write
|
|
// New location is available, so write
|
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
|
merged_formalism = model_fuse(formalism_map)
|
|
merged_formalism = model_fuse(formalism_map)
|
|
|
|
|
+ model_create(merged_formalism, "merged/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
|
modify(merged_formalism, True)
|
|
modify(merged_formalism, True)
|
|
|
|
|
+ model_overwrite(merged_formalism, get_entry_id("merged/" + operation_name), get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
|
|
|
|
|
if (operation_type == "manual"):
|
|
if (operation_type == "manual"):
|
|
|
// Finished with all information, now create the model itself!
|
|
// Finished with all information, now create the model itself!
|
|
@@ -1555,7 +1638,6 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
model_id = get_entry_id(operation_name)
|
|
model_id = get_entry_id(operation_name)
|
|
|
|
|
|
|
|
if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
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)
|
|
merged_formalism_id = get_entry_id("merged/" + operation_name)
|
|
|
|
|
|
|
|
// Add tracability links at this level
|
|
// Add tracability links at this level
|
|
@@ -1671,7 +1753,9 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
|
|
|
return "Model not found: " + name!
|
|
return "Model not found: " + name!
|
|
|
|
|
|
|
|
merged_formalism = model_fuse(to_ramify)
|
|
merged_formalism = model_fuse(to_ramify)
|
|
|
|
|
+ model_create(merged_formalism, "merged/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
|
modify(merged_formalism, True)
|
|
modify(merged_formalism, True)
|
|
|
|
|
+ model_overwrite(merged_formalism, get_entry_id("merged/" + operation_name), get_entry_id("formalisms/SimpleClassDiagrams"))
|
|
|
|
|
|
|
|
ramified_metamodel = ramify(merged_formalism)
|
|
ramified_metamodel = ramify(merged_formalism)
|
|
|
model_create(ramified_metamodel, "RAMified/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
model_create(ramified_metamodel, "RAMified/" + operation_name, get_entry_id("formalisms/SimpleClassDiagrams"), "Model")
|
|
@@ -2022,12 +2106,12 @@ String function cmd_transformation_signature(transformation_name : String):
|
|
|
inputs = allOutgoingAssociationInstances(core, model_id, "transformInput")
|
|
inputs = allOutgoingAssociationInstances(core, model_id, "transformInput")
|
|
|
while (set_len(inputs) > 0):
|
|
while (set_len(inputs) > 0):
|
|
|
elem = set_pop(inputs)
|
|
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")
|
|
outputs = allOutgoingAssociationInstances(core, model_id, "transformOutput")
|
|
|
while (set_len(outputs) > 0):
|
|
while (set_len(outputs) > 0):
|
|
|
elem = set_pop(outputs)
|
|
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!
|
|
return result!
|
|
|
else:
|
|
else:
|
|
@@ -2050,33 +2134,12 @@ String function cmd_model_types(model_name : String):
|
|
|
types = allAssociationDestinations(core, model_id, "instanceOf")
|
|
types = allAssociationDestinations(core, model_id, "instanceOf")
|
|
|
while (set_len(types) > 0):
|
|
while (set_len(types) > 0):
|
|
|
type = set_pop(types)
|
|
type = set_pop(types)
|
|
|
- log("Checking type: " + cast_value(type))
|
|
|
|
|
- log("Name attr: " + cast_value(read_attribute(core, type, "name")))
|
|
|
|
|
result = string_join(result, full_name(type) + "\n")
|
|
result = string_join(result, full_name(type) + "\n")
|
|
|
|
|
|
|
|
return result!
|
|
return result!
|
|
|
else:
|
|
else:
|
|
|
return "No such model: " + model_name!
|
|
return "No such model: " + model_name!
|
|
|
|
|
|
|
|
-String function cmd_element_list_nice(model_name : String, metamodel_name : String):
|
|
|
|
|
- if (get_entry_id(model_name) != ""):
|
|
|
|
|
- if (allow_read(current_user_id, get_entry_id(model_name))):
|
|
|
|
|
- if (get_entry_id(metamodel_name) != ""):
|
|
|
|
|
- if (allow_read(current_user_id, get_entry_id(metamodel_name))):
|
|
|
|
|
- Element mm
|
|
|
|
|
- mm = get_full_model(get_entry_id(model_name), get_entry_id(metamodel_name))
|
|
|
|
|
- if (element_eq(mm, read_root())):
|
|
|
|
|
- return "No conformance relation between these models"!
|
|
|
|
|
- return "Success: " + JSON_print(mm)!
|
|
|
|
|
- else:
|
|
|
|
|
- return "Permission denied to model: " + metamodel_name!
|
|
|
|
|
- else:
|
|
|
|
|
- return "No such metamodel: " + metamodel_name!
|
|
|
|
|
- else:
|
|
|
|
|
- return "Permission denied to model: " + model_name!
|
|
|
|
|
- else:
|
|
|
|
|
- return "No such model: " + model_name!
|
|
|
|
|
-
|
|
|
|
|
String function cmd_folder_create(folder_name : String):
|
|
String function cmd_folder_create(folder_name : String):
|
|
|
if (get_entry_id(folder_name) == ""):
|
|
if (get_entry_id(folder_name) == ""):
|
|
|
if (element_neq(create_folders(current_user_id, folder_name), read_root())):
|
|
if (element_neq(create_folders(current_user_id, folder_name), read_root())):
|
|
@@ -2086,6 +2149,12 @@ String function cmd_folder_create(folder_name : String):
|
|
|
else:
|
|
else:
|
|
|
return "Folder alreay exists: " + folder_name!
|
|
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):
|
|
Void function user_function_skip_init(user_id : String):
|
|
|
String cmd
|
|
String cmd
|
|
|
String result
|
|
String result
|
|
@@ -2116,13 +2185,15 @@ Void function user_function_skip_init(user_id : String):
|
|
|
if (cmd == "help"):
|
|
if (cmd == "help"):
|
|
|
output(cmd_help())
|
|
output(cmd_help())
|
|
|
elif (cmd == "model_add"):
|
|
elif (cmd == "model_add"):
|
|
|
- output(cmd_model_add(single_input("Model type?"), single_input("Model name?")))
|
|
|
|
|
|
|
+ output(cmd_model_add(single_input("Model type?"), single_input("Model name?"), single_input("Model textual representation?")))
|
|
|
elif (cmd == "process_execute"):
|
|
elif (cmd == "process_execute"):
|
|
|
output(cmd_process_execute(single_input("Process to execute?"), single_input("Model prefix to use?")))
|
|
output(cmd_process_execute(single_input("Process to execute?"), single_input("Model prefix to use?")))
|
|
|
elif (cmd == "transformation_between"):
|
|
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"):
|
|
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"):
|
|
elif (cmd == "transformation_execute"):
|
|
|
output(cmd_transformation_execute(single_input("Transformation name?"), dict_input("Source models?"), dict_input("Target models?"), single_input("Tracability model?")))
|
|
output(cmd_transformation_execute(single_input("Transformation name?"), dict_input("Source models?"), dict_input("Target models?"), single_input("Tracability model?")))
|
|
|
elif (cmd == "verify"):
|
|
elif (cmd == "verify"):
|
|
@@ -2175,8 +2246,6 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output(cmd_user_password(single_input("User name?"), single_input("New password?")))
|
|
output(cmd_user_password(single_input("User name?"), single_input("New password?")))
|
|
|
elif (cmd == "transformation_read_signature"):
|
|
elif (cmd == "transformation_read_signature"):
|
|
|
output(cmd_transformation_signature(single_input("Transformation name?")))
|
|
output(cmd_transformation_signature(single_input("Transformation name?")))
|
|
|
- elif (cmd == "element_list_nice"):
|
|
|
|
|
- output(cmd_element_list_nice(single_input("Model name?"), single_input("Metamodel name?")))
|
|
|
|
|
elif (cmd == "verbose"):
|
|
elif (cmd == "verbose"):
|
|
|
set_verbose(True)
|
|
set_verbose(True)
|
|
|
elif (cmd == "quiet"):
|
|
elif (cmd == "quiet"):
|
|
@@ -2185,6 +2254,9 @@ Void function user_function_skip_init(user_id : String):
|
|
|
// Delete user from Core Formalism
|
|
// Delete user from Core Formalism
|
|
|
model_delete_element(core, user_id)
|
|
model_delete_element(core, user_id)
|
|
|
return !
|
|
return !
|
|
|
|
|
+ elif (cmd == "user_logout"):
|
|
|
|
|
+ // TODO
|
|
|
|
|
+ cmd = "FAIL"
|
|
|
elif (cmd == "exit"):
|
|
elif (cmd == "exit"):
|
|
|
// Exit by actually removing the user and decoupling it from all of its models
|
|
// Exit by actually removing the user and decoupling it from all of its models
|
|
|
// Restarting with the same user name will NOT grant you access to anything of the previous user with that same name
|
|
// Restarting with the same user name will NOT grant you access to anything of the previous user with that same name
|
|
@@ -2194,7 +2266,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output(cmd_folder_create(single_input("Folder name?")))
|
|
output(cmd_folder_create(single_input("Folder name?")))
|
|
|
elif (cmd == "add_conformance"):
|
|
elif (cmd == "add_conformance"):
|
|
|
// TODO
|
|
// TODO
|
|
|
- cmd = "FAIL"
|
|
|
|
|
|
|
+ output(cmd_conformance_add(single_input("Model name?"), single_input("Metamodel name?")))
|
|
|
elif (cmd == "remove_conformance"):
|
|
elif (cmd == "remove_conformance"):
|
|
|
// TODO
|
|
// TODO
|
|
|
cmd = "FAIL"
|
|
cmd = "FAIL"
|