|
@@ -21,27 +21,31 @@ Void function initialize_core():
|
|
|
|
|
|
return !
|
|
|
|
|
|
-String function get_instanceOf_link(model_id : String):
|
|
|
+Element function get_instanceOf_links(model_id : String, metamodel_id : String):
|
|
|
+ return set_overlap(allOutgoingAssociationInstances(core, model_id, "instanceOf"), allIncomingAssociationInstances(core, metamodel_id, "instanceOf"))!
|
|
|
+
|
|
|
+String function get_instanceOf_link(model_id : String, metamodel_id : String):
|
|
|
Element all_links
|
|
|
String choice
|
|
|
|
|
|
- all_links = allOutgoingAssociationInstances(core, model_id, "instanceOf")
|
|
|
+ all_links = set_overlap(allOutgoingAssociationInstances(core, model_id, "instanceOf"), allIncomingAssociationInstances(core, metamodel_id, "instanceOf"))
|
|
|
|
|
|
if (read_nr_out(all_links) > 1):
|
|
|
log("WARNING: multiple instanceOf relations were detected for this model; picking one at random!")
|
|
|
elif (read_nr_out(all_links) == 0):
|
|
|
- log("ERROR: untyped model!")
|
|
|
+ log("ERROR: untyped model; crashing")
|
|
|
|
|
|
- choice = set_pop(allOutgoingAssociationInstances(core, model_id, "instanceOf"))
|
|
|
+ choice = set_pop(all_links)
|
|
|
|
|
|
return choice!
|
|
|
|
|
|
-Element function get_full_model(model_id : String):
|
|
|
+Element function get_full_model(model_id : String, metamodel_id : String):
|
|
|
+ // TODO we are restricted to using SimpleClassDiagrams as M3 level, through this code!
|
|
|
Element m
|
|
|
Element all_links
|
|
|
String choice
|
|
|
|
|
|
- choice = get_instanceOf_link(model_id)
|
|
|
+ choice = get_instanceOf_link(model_id, metamodel_id)
|
|
|
|
|
|
m = create_node()
|
|
|
dict_add(m, "model", import_node(read_attribute(core, model_id, "location")))
|
|
@@ -52,7 +56,7 @@ Element function get_full_model(model_id : String):
|
|
|
// Found the meta-circular level, so we can stop!
|
|
|
dict_add(m, "metamodel", m)
|
|
|
else:
|
|
|
- dict_add(m, "metamodel", get_full_model(readAssociationDestination(core, choice)))
|
|
|
+ dict_add(m, "metamodel", get_full_model(readAssociationDestination(core, choice), get_model_id("SimpleClassDiagrams")))
|
|
|
|
|
|
return m!
|
|
|
|
|
@@ -253,7 +257,7 @@ Void function model_create(model : Element, name : String, user_id : String, typ
|
|
|
|
|
|
return!
|
|
|
|
|
|
-Void function model_overwrite(model : Element, model_id : String):
|
|
|
+Void function model_overwrite(model : Element, model_id : String, metamodel_id : String):
|
|
|
// TODO this should be more elegant than just hiding the old elements
|
|
|
|
|
|
String location
|
|
@@ -266,7 +270,9 @@ Void function model_overwrite(model : Element, model_id : String):
|
|
|
unset_attribute(core, model_id, "location")
|
|
|
instantiate_attribute(core, model_id, "location", location)
|
|
|
|
|
|
- instanceOf_link = get_instanceOf_link(model_id)
|
|
|
+ // Update the instanceOf relation of the context in which we are working
|
|
|
+ // TODO This needs to be fixed: all previous connections should be cleared probably
|
|
|
+ instanceOf_link = get_instanceOf_link(model_id, metamodel_id)
|
|
|
unset_attribute(core, instanceOf_link, "typing_location")
|
|
|
location = "models/" + cast_id2s(model["type_mapping"])
|
|
|
export_node(location, model["type_mapping"])
|
|
@@ -321,7 +327,6 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
Boolean result
|
|
|
String exact_type
|
|
|
Element trace_links
|
|
|
- String linktype
|
|
|
String model_ID
|
|
|
String key
|
|
|
Element keys
|
|
@@ -333,17 +338,31 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
String metamodel_ID
|
|
|
Boolean tracability
|
|
|
|
|
|
+ // 0) Find the signature of the operation
|
|
|
+ Element input_metamodels
|
|
|
+ Element output_metamodels
|
|
|
+ Element iter
|
|
|
+ String edge
|
|
|
+ input_metamodels = create_node()
|
|
|
+ iter = allOutgoingAssociationInstances(core, operation_id, "transformInput")
|
|
|
+ while (read_nr_out(iter) > 0):
|
|
|
+ edge = set_pop(iter)
|
|
|
+ dict_add(input_metamodels, read_attribute(core, edge, "name"), read_attribute(core, readAssociationDestination(core, edge), "name"))
|
|
|
+
|
|
|
+ output_metamodels = create_node()
|
|
|
+ iter = allOutgoingAssociationInstances(core, operation_id, "transformOutput")
|
|
|
+ while (read_nr_out(iter) > 0):
|
|
|
+ edge = set_pop(iter)
|
|
|
+ dict_add(output_metamodels, read_attribute(core, edge, "name"), read_attribute(core, readAssociationDestination(core, edge), "name"))
|
|
|
+
|
|
|
// 1) Find merged metamodel
|
|
|
|
|
|
exact_type = read_type(core, operation_id)
|
|
|
-
|
|
|
trace_links = allOutgoingAssociationInstances(core, operation_id, "tracability")
|
|
|
- linktype = "operatesOn"
|
|
|
-
|
|
|
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"), linktype)):
|
|
|
+ if (value_eq(read_attribute(core, trace_link_id, "type"), "operatesOn")):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
|
|
|
// 2) Merge source models
|
|
@@ -353,13 +372,13 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
keys = dict_keys(input_models)
|
|
|
while (read_nr_out(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
- set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(input_models[key]))))
|
|
|
+ set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(input_models[key]), get_model_id(input_metamodels[key]))))
|
|
|
|
|
|
- merged_model = model_join(model_tuples, get_full_model(merged_metamodel_id), tracability_model)
|
|
|
+ merged_model = model_join(model_tuples, get_full_model(merged_metamodel_id, get_model_id("SimpleClassDiagrams")), tracability_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)))))
|
|
|
+ merged_model = model_copy(get_full_model(get_model_id(set_read(input_models)), get_model_id(set_read(input_metamodels))))
|
|
|
elif (bool_and(read_nr_out(input_models) == 0, read_nr_out(output_models) == 0)):
|
|
|
merged_model = read_root()
|
|
|
else:
|
|
@@ -370,14 +389,14 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
// 3) Transform
|
|
|
|
|
|
if (exact_type == "ModelTransformation"):
|
|
|
- result = transform(merged_model, get_full_model(operation_id))
|
|
|
+ result = transform(merged_model, get_full_model(operation_id, merged_metamodel_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))
|
|
|
+ func = get_func_AL_model(get_full_model(operation_id, get_model_id("ActionLanguage")))
|
|
|
result = func(merged_model)
|
|
|
else:
|
|
|
log("Unknown type of operation: " + exact_type)
|
|
@@ -396,7 +415,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
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]))))
|
|
|
+ set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(output_models[key]), get_model_id(output_metamodels[key]))))
|
|
|
|
|
|
result = model_split(merged_model, model_tuples, tracability)
|
|
|
|
|
@@ -487,7 +506,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
// New model
|
|
|
model_create(result[key], output_map[key], user_id, get_model_id(key), "Model")
|
|
|
else:
|
|
|
- model_overwrite(result[key], get_model_id(output_map[key]))
|
|
|
+ model_overwrite(result[key], get_model_id(output_map[key]), get_model_id(outputs[key]))
|
|
|
return True!
|
|
|
|
|
|
Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
@@ -648,7 +667,7 @@ String function cmd_model_add(user_id : String, type : String, name : String):
|
|
|
if (get_model_id(name) == ""):
|
|
|
// Model doesn't exist yet
|
|
|
output("Waiting for model constructors...")
|
|
|
- new_model = construct_model_raw(get_full_model(type_id))
|
|
|
+ new_model = construct_model_raw(get_full_model(type_id, get_model_id("SimpleClassDiagrams")))
|
|
|
model_create(new_model, name, user_id, type_id, "Model")
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -665,7 +684,7 @@ String function cmd_process_execute(user_id : String, process : String, prefix :
|
|
|
process_id = get_model_id(process)
|
|
|
if (process_id != ""):
|
|
|
if (allow_read(user_id, process_id)):
|
|
|
- enact_PM(get_full_model(process_id), prefix, user_id)
|
|
|
+ enact_PM(get_full_model(process_id, get_model_id("ProcessModel")), prefix, user_id)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
return "Permission denied to model: " + process!
|
|
@@ -742,30 +761,30 @@ String function cmd_model_render(user_id : String, model_name : String, mapper_n
|
|
|
|
|
|
if (get_model_id(rendered_name) == ""):
|
|
|
// Instantiate
|
|
|
- rendered_model = instantiate_model(get_full_model(get_model_id(output_map["rendered"])))
|
|
|
+ rendered_model = instantiate_model(get_full_model(get_model_id(output_map["rendered"]), get_model_id("SimpleClassDiagrams")))
|
|
|
model_create(rendered_model, rendered_name, user_id, get_model_id(output_map["rendered"]), "Model")
|
|
|
|
|
|
// Tracability model won't exist either
|
|
|
- tracability_model = instantiate_model(get_full_model(get_model_id("Tracability")))
|
|
|
+ tracability_model = instantiate_model(get_full_model(get_model_id("Tracability"), get_model_id("SimpleClassDiagrams")))
|
|
|
model_create(tracability_model, tracability_name, user_id, get_model_id("Tracability"), "Model")
|
|
|
|
|
|
else:
|
|
|
// Read out tracability model
|
|
|
- tracability_model = get_full_model(get_model_id(tracability_name))
|
|
|
+ tracability_model = get_full_model(get_model_id(tracability_name), get_model_id("TracabilityModel"))
|
|
|
|
|
|
// Do the operation itself!
|
|
|
result = execute_operation(mapper_ID, inputs, output_map, tracability_model)
|
|
|
|
|
|
// Overwrite the previous rendered model
|
|
|
- model_overwrite(result["rendered"], get_model_id(rendered_name))
|
|
|
- model_overwrite(result["abstract"], get_model_id(model_name))
|
|
|
+ model_overwrite(result["rendered"], get_model_id(rendered_name), get_model_id(output_map["rendered"]))
|
|
|
+ model_overwrite(result["abstract"], get_model_id(model_name), get_model_id(output_map["abstract"]))
|
|
|
|
|
|
// Tracability updated in-place
|
|
|
- model_overwrite(tracability_model, get_model_id(tracability_name))
|
|
|
- tracability_model = get_full_model(get_model_id(tracability_name))
|
|
|
+ model_overwrite(tracability_model, get_model_id(tracability_name), get_model_id("TracabilityModel"))
|
|
|
+ tracability_model = get_full_model(get_model_id(tracability_name), get_model_id("TracabilityModel"))
|
|
|
|
|
|
// Also output the resulting model
|
|
|
- return "Success: " + JSON_print(get_full_model(get_model_id(rendered_name)))!
|
|
|
+ return "Success: " + JSON_print(get_full_model(get_model_id(rendered_name), get_model_id(output_map["rendered"])))!
|
|
|
else:
|
|
|
return "Permission denied to model: " + mapper_name!
|
|
|
else:
|
|
@@ -875,7 +894,7 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
// New model
|
|
|
model_create(result[key], outputs[key], user_id, get_model_id(key), "Model")
|
|
|
else:
|
|
|
- model_overwrite(result[key], get_model_id(outputs[key]))
|
|
|
+ model_overwrite(result[key], get_model_id(outputs[key]), get_model_id(output_map[key]))
|
|
|
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -885,7 +904,22 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
else:
|
|
|
return "Model not found: " + transformation_name!
|
|
|
|
|
|
-String function cmd_verify(user_id : String, model_name : String):
|
|
|
+String function cmd_verify(user_id : String, model_name : String, metamodel_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)):
|
|
|
+ return conformance_scd(get_full_model(get_model_id(model_name), get_model_id(metamodel_name)))!
|
|
|
+ else:
|
|
|
+ return "Permission denied to model: " + model_name!
|
|
|
+ else:
|
|
|
+ return "Model not found: " + model_name!
|
|
|
+
|
|
|
+String function cmd_new_verify(user_id : String, model_name : String, metamodel_name : String):
|
|
|
// Check whether a model conforms to its specification (with the selected type mapping)
|
|
|
String model_id
|
|
|
String result
|
|
@@ -897,7 +931,7 @@ String function cmd_verify(user_id : String, model_name : String):
|
|
|
String conformance_operation
|
|
|
Element conformance
|
|
|
|
|
|
- conformance_operation = set_pop(allAssociationDestinations(core, get_instanceOf_link(model_id), "semantics"))
|
|
|
+ conformance_operation = set_pop(allAssociationDestinations(core, get_instanceOf_link(model_id, get_model_id(metamodel_name)), "semantics"))
|
|
|
inputs = create_node()
|
|
|
dict_add(inputs, "SimpleClassDiagrams", model_name)
|
|
|
result = execute_operation(conformance_operation, inputs, create_node(), read_root())
|
|
@@ -907,7 +941,7 @@ String function cmd_verify(user_id : String, model_name : String):
|
|
|
else:
|
|
|
return "Model not found: " + model_name!
|
|
|
|
|
|
-String function cmd_model_overwrite(user_id : String, model_name : String):
|
|
|
+String function cmd_model_overwrite(user_id : String, model_name : String, metamodel_name : String):
|
|
|
// Overwrites an existing model without changing any metadata
|
|
|
String model_id
|
|
|
String type_id
|
|
@@ -919,8 +953,8 @@ String function cmd_model_overwrite(user_id : String, model_name : String):
|
|
|
type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
if (allow_read(user_id, type_id)):
|
|
|
output("Waiting for model constructors...")
|
|
|
- new_model = construct_model_raw(get_full_model(set_pop(allAssociationDestinations(core, model_id, "instanceOf"))))
|
|
|
- model_overwrite(new_model, model_id)
|
|
|
+ new_model = construct_model_raw(get_full_model(get_model_id(metamodel_name), get_model_id("SimpleClassDiagrams")))
|
|
|
+ model_overwrite(new_model, model_id, metamodel_name)
|
|
|
return "Success"!
|
|
|
else:
|
|
|
return string_join("Permission denied to model: ", read_attribute(core, type_id, "name"))!
|
|
@@ -929,7 +963,7 @@ String function cmd_model_overwrite(user_id : String, model_name : String):
|
|
|
else:
|
|
|
return "Model not found: " + model_name!
|
|
|
|
|
|
-String function cmd_model_modify(user_id : String, model_name : String):
|
|
|
+String function cmd_model_modify(user_id : String, model_name : String, metamodel_name : String):
|
|
|
// Model modify operation, which uses the mini_modify.alc operations, though with extensions for access control
|
|
|
String model_id
|
|
|
String type_id
|
|
@@ -941,7 +975,7 @@ String function cmd_model_modify(user_id : String, model_name : String):
|
|
|
type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
if (allow_read(user_id, type_id)):
|
|
|
output("Success")
|
|
|
- modify(get_full_model(model_id), allow_write(user_id, model_id))
|
|
|
+ modify(get_full_model(model_id, get_model_id(metamodel_name)), allow_write(user_id, model_id))
|
|
|
return "Success"!
|
|
|
else:
|
|
|
return string_join("Permission denied to model: ", read_attribute(core, type_id, "name"))!
|
|
@@ -1019,8 +1053,6 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
String merged_formalism_id
|
|
|
String source_formalism_id
|
|
|
String tracability_link
|
|
|
- String type_id
|
|
|
- String old_type_id
|
|
|
Element keys
|
|
|
String key
|
|
|
|
|
@@ -1029,9 +1061,6 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
all_formalisms = create_node()
|
|
|
formalism_map = create_node()
|
|
|
|
|
|
- type_id = ""
|
|
|
- old_type_id = ""
|
|
|
-
|
|
|
keys = dict_keys(source_models)
|
|
|
while (read_nr_out(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
@@ -1040,16 +1069,10 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
if (bool_not(dict_in(source, key))):
|
|
|
- type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
- if (bool_or(old_type_id == "", type_id == old_type_id)):
|
|
|
- old_type_id = type_id
|
|
|
- dict_add(source, key, model_id)
|
|
|
- set_add(formalism_map, create_tuple(key, get_full_model(model_id)))
|
|
|
- if (bool_not(set_in(all_formalisms, model_id))):
|
|
|
- set_add(all_formalisms, model_id)
|
|
|
- elif (old_type_id != type_id):
|
|
|
- // Already have a previous type_id and now another: CLASH
|
|
|
- return "Cannot add model as type not compatible with previous models: " + key!
|
|
|
+ dict_add(source, key, model_id)
|
|
|
+ set_add(formalism_map, create_tuple(key, get_full_model(model_id, get_model_id("SimpleClassDiagrams"))))
|
|
|
+ if (bool_not(set_in(all_formalisms, model_id))):
|
|
|
+ set_add(all_formalisms, model_id)
|
|
|
else:
|
|
|
return "Name already selected for source: " + key!
|
|
|
else:
|
|
@@ -1065,16 +1088,10 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, model_id)):
|
|
|
if (bool_not(dict_in(target, key))):
|
|
|
- type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
|
|
|
- if (bool_or(old_type_id == "", type_id == old_type_id)):
|
|
|
- old_type_id = type_id
|
|
|
- dict_add(target, key, model_id)
|
|
|
- set_add(formalism_map, create_tuple(key, get_full_model(model_id)))
|
|
|
- if (bool_not(set_in(all_formalisms, model_id))):
|
|
|
- set_add(all_formalisms, model_id)
|
|
|
- elif (old_type_id != type_id):
|
|
|
- // Already have a previous type_id and now another: CLASH
|
|
|
- return "Cannot add model as type not compatible with previous models: " + key!
|
|
|
+ dict_add(target, key, model_id)
|
|
|
+ set_add(formalism_map, create_tuple(key, get_full_model(model_id, get_model_id("SimpleClassDiagrams"))))
|
|
|
+ if (bool_not(set_in(all_formalisms, model_id))):
|
|
|
+ set_add(all_formalisms, model_id)
|
|
|
else:
|
|
|
return "Name already selected for target: " + key!
|
|
|
else:
|
|
@@ -1091,18 +1108,18 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
|
|
|
if (operation_type == "manual"):
|
|
|
// Finished with all information, now create the model itself!
|
|
|
- model_create(instantiate_model(get_full_model(get_model_id("ManualOperation"))), operation_name, user_id, get_model_id("ManualOperation"), "ManualOperation")
|
|
|
+ model_create(instantiate_model(get_full_model(get_model_id("ManualOperation"), get_model_id("SimpleClassDiagrams"))), operation_name, user_id, get_model_id("ManualOperation"), "ManualOperation")
|
|
|
model_id = get_model_id(operation_name)
|
|
|
|
|
|
elif (operation_type == "actionlanguage"):
|
|
|
// Finished with all information, now create the model itself!
|
|
|
output("Waiting for code constructors...")
|
|
|
- add_code_model(get_full_model(get_model_id("ActionLanguage")), "AL/" + operation_name, construct_function())
|
|
|
+ add_code_model(get_full_model(get_model_id("ActionLanguage"), get_model_id("SimpleClassDiagrams")), "AL/" + operation_name, construct_function())
|
|
|
model_create(import_node("AL/" + operation_name), operation_name, user_id, get_model_id("ActionLanguage"), "ActionLanguage")
|
|
|
model_id = get_model_id(operation_name)
|
|
|
|
|
|
if (bool_not(bool_and(read_nr_out(source_models) == 0, read_nr_out(target_models) == 0))):
|
|
|
- model_create(merged_formalism, "__merged_" + operation_name, user_id, type_id, "Model")
|
|
|
+ model_create(merged_formalism, "__merged_" + operation_name, user_id, get_model_id("SimpleClassDiagrams"), "Model")
|
|
|
merged_formalism_id = get_model_id("__merged_" + operation_name)
|
|
|
|
|
|
// Add tracability links at this level
|
|
@@ -1171,11 +1188,10 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, name)):
|
|
|
// Check whether or not it is SimpleClassDiagrams
|
|
|
- mm = read_attribute(core, readAssociationDestination(core, get_instanceOf_link(model_id)), "name")
|
|
|
- if (mm == "SimpleClassDiagrams"):
|
|
|
+ if (read_nr_out(get_instanceOf_links(model_id, get_model_id("SimpleClassDiagrams"))) > 0):
|
|
|
if (bool_not(dict_in(source, key))):
|
|
|
dict_add(source, key, model_id)
|
|
|
- set_add(to_ramify, create_tuple(key, get_full_model(model_id)))
|
|
|
+ set_add(to_ramify, create_tuple(key, get_full_model(model_id, get_model_id("SimpleClassDiagrams"))))
|
|
|
else:
|
|
|
return "Name was already assigned a metamodel: " + key!
|
|
|
else:
|
|
@@ -1192,8 +1208,7 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
model_id = get_model_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, name)):
|
|
|
- mm = read_attribute(core, readAssociationDestination(core, get_instanceOf_link(model_id)), "name")
|
|
|
- if (mm == "SimpleClassDiagrams"):
|
|
|
+ if (read_nr_out(get_instanceOf_links(model_id, get_model_id("SimpleClassDiagrams"))) > 0):
|
|
|
if (bool_not(dict_in(target, key))):
|
|
|
if (dict_in(source, key)):
|
|
|
if (value_eq(model_id, source[key])):
|
|
@@ -1203,7 +1218,7 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
return "Name in output cannot have different type than input: " + key!
|
|
|
else:
|
|
|
dict_add(target, key, model_id)
|
|
|
- set_add(to_ramify, create_tuple(key, get_full_model(model_id)))
|
|
|
+ set_add(to_ramify, create_tuple(key, get_full_model(model_id, get_model_id("SimpleClassDiagrams"))))
|
|
|
else:
|
|
|
return "Name was already assigned a metamodel: " + key!
|
|
|
else:
|
|
@@ -1225,7 +1240,7 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
String new_model
|
|
|
// Finished with all information, now create the model itself!
|
|
|
output("Waiting for model constructors...")
|
|
|
- new_model = construct_model_raw(get_full_model(ramified_metamodel_id))
|
|
|
+ new_model = construct_model_raw(get_full_model(ramified_metamodel_id, get_model_id("SimpleClassDiagrams")))
|
|
|
model_create(new_model, operation_name, user_id, ramified_metamodel_id, "ModelTransformation")
|
|
|
model_id = get_model_id(operation_name)
|
|
|
|
|
@@ -1626,10 +1641,10 @@ String function cmd_transformation_signature(user_id : String, transformation_na
|
|
|
else:
|
|
|
return "No such transformation: " + transformation_name!
|
|
|
|
|
|
-String function cmd_element_list_nice(user_id : String, model_name : String):
|
|
|
+String function cmd_element_list_nice(user_id : String, model_name : String, metamodel_name : String):
|
|
|
if (get_model_id(model_name) != ""):
|
|
|
if (allow_read(user_id, get_model_id(model_name))):
|
|
|
- return "Success: " + JSON_print(get_full_model(get_model_id(model_name)))!
|
|
|
+ return "Success: " + JSON_print(get_full_model(get_model_id(model_name), get_model_id(metamodel_name)))!
|
|
|
else:
|
|
|
return "Permission denied to model: " + model_name!
|
|
|
else:
|
|
@@ -1657,13 +1672,13 @@ 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"):
|
|
|
- result = cmd_verify(user_id, single_input("Model name?"))
|
|
|
+ result = cmd_verify(user_id, single_input("Model name?"), single_input("Metamodel name?"))
|
|
|
if (result != ""):
|
|
|
output(result)
|
|
|
elif (cmd == "model_overwrite"):
|
|
|
- output(cmd_model_overwrite(user_id, single_input("Model name?")))
|
|
|
+ output(cmd_model_overwrite(user_id, single_input("Model name?"), single_input("Metamodel name?")))
|
|
|
elif (cmd == "model_modify"):
|
|
|
- output(cmd_model_modify(user_id, single_input("Model name?")))
|
|
|
+ output(cmd_model_modify(user_id, single_input("Model name?"), single_input("Metamodel name?")))
|
|
|
elif (cmd == "model_delete"):
|
|
|
output(cmd_model_delete(user_id, single_input("Model name?")))
|
|
|
elif (cmd == "model_list"):
|
|
@@ -1711,7 +1726,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
elif (cmd == "transformation_read_signature"):
|
|
|
output(cmd_transformation_signature(user_id, single_input("Transformation name?")))
|
|
|
elif (cmd == "element_list_nice"):
|
|
|
- output(cmd_element_list_nice(user_id, single_input("Model name?")))
|
|
|
+ output(cmd_element_list_nice(user_id, single_input("Model name?"), single_input("Metamodel name?")))
|
|
|
elif (cmd == "verbose"):
|
|
|
set_verbose(True)
|
|
|
elif (cmd == "quiet"):
|