|
@@ -2363,25 +2363,39 @@ String function cmd_conformance_delete(model_name : String, metamodel_name : Str
|
|
|
// Remove an existing instanceOf relation
|
|
|
if (get_entry_id(model_name) != ""):
|
|
|
if (get_entry_id(metamodel_name) != ""):
|
|
|
- Element links
|
|
|
- String link
|
|
|
- String found_typing_name
|
|
|
+ if (bool_not(read_type(core, get_entry_id(model_name)) == "Folder")):
|
|
|
+ if (bool_not(read_type(core, get_entry_id(metamodel_name)) == "Folder")):
|
|
|
+ Element links
|
|
|
+ String link
|
|
|
+ String found_typing_name
|
|
|
+ Element typings
|
|
|
+
|
|
|
+ links = get_instanceOf_links(get_entry_id(model_name), get_entry_id(metamodel_name))
|
|
|
+ while (set_len(links) > 0):
|
|
|
+ // Iterate over each link and remove if type mapping matches
|
|
|
+ link = set_pop(links)
|
|
|
+ typings = allAssociationDestinations(core, link, "typing")
|
|
|
+ if (set_len(typings) > 0):
|
|
|
+ found_typing_name = set_pop(typings)
|
|
|
+ else:
|
|
|
+ found_typing_name = ""
|
|
|
|
|
|
- links = get_instanceOf_links(get_entry_id(model_name), get_entry_id(metamodel_name))
|
|
|
- while (set_len(links) > 0):
|
|
|
- // Iterate over each link and remove if type mapping matches
|
|
|
- link = set_pop(links)
|
|
|
- found_typing_name = anAssociationDestination(core, link, "typing")
|
|
|
- if (bool_and(typemapping_name == "", found_typing_name == "")):
|
|
|
- // Remove only the link
|
|
|
- model_delete_element(core, link)
|
|
|
+ if (bool_and(typemapping_name == "", found_typing_name == "")):
|
|
|
+ // Remove only the link
|
|
|
+ model_delete_element(core, link)
|
|
|
+ elif found_typing_name == "":
|
|
|
+ continue!
|
|
|
+ else:
|
|
|
+ found_typing_name = read_attribute(core, found_typing_name, "name")
|
|
|
+ if (found_typing_name == typemapping_name):
|
|
|
+ // Type mappings match, so remove link
|
|
|
+ // Optional: type mapping model can also be removed, but is potentially in use as it is itself a model!
|
|
|
+ model_delete_element(core, link)
|
|
|
+ return "Success"!
|
|
|
else:
|
|
|
- found_typing_name = read_attribute(core, anAssociationDestination(core, link, "typing"), "name")
|
|
|
- if (found_typing_name == typemapping_name):
|
|
|
- // Type mappings match, so remove link
|
|
|
- // Optional: type mapping model can also be removed, but is potentially in use as it is itself a model!
|
|
|
- model_delete_element(core, link)
|
|
|
- return "Success"!
|
|
|
+ return "Not a model: " + metamodel_name!
|
|
|
+ else:
|
|
|
+ return "Not a model: " + model_name!
|
|
|
else:
|
|
|
return "Model not found: " + metamodel_name!
|
|
|
else:
|