ソースを参照

Added changes to remove reRAMify

Yentl Van Tendeloo 8 年 前
コミット
1564f28b8d
4 ファイル変更66 行追加35 行削除
  1. BIN
      bootstrap/bootstrap.m.gz
  2. 1 0
      bootstrap/ramify.alc
  3. 1 35
      core/core_algorithm.alc
  4. 64 0
      integration/test_mvc.py

BIN
bootstrap/bootstrap.m.gz


+ 1 - 0
bootstrap/ramify.alc

@@ -137,6 +137,7 @@ Element function ramify(model : Element):
 
 		type_name = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], entry))
 		if (type_name == "Class"):
+			log("Added Pre_" + key)
 			instantiate_node(new_model, type_name, "Pre_" + key)
 			instantiate_node(new_model, type_name, "Post_" + key)
 

+ 1 - 35
core/core_algorithm.alc

@@ -306,7 +306,6 @@ Void function user_function_skip_init(user_id : String):
 			output("")
 			output("Transformation-specific operations")
 			output("    transformation_add_MT_language  -- Create a RAMified metamodel")
-			output("    transformation_reRAMify         -- RAMify a merged metamodel again")
 			output("    transformation_add_MT           -- Initialize a new model transformation")
 			output("    transformation_add_AL           -- [TODO] Initialize a new action language transformation")
 			output("    transformation_add_EXT          -- [TODO] Initialize a new external tool transformation")
@@ -608,7 +607,7 @@ Void function user_function_skip_init(user_id : String):
 					if (allow_read(user_id, model_id)):
 						type_id = set_pop(allAssociationDestinations(core, model_id, "instanceOf"))
 						if (bool_or(old_type_id == "", type_id == old_type_id)):
-							set_add(all_formalisms, create_tuple(name, import_node(read_attribute(core, model_id, "location"))))
+							set_add(all_formalisms, create_tuple(name + "/", import_node(read_attribute(core, model_id, "location"))))
 							old_type_id = type_id
 						elif (old_type_id != type_id):
 							// Already have a previous type_id and now another: CLASH
@@ -655,39 +654,6 @@ Void function user_function_skip_init(user_id : String):
 			else:
 				output("At least one formalism is required")
 
-		elif (cmd == "transformation_reRAMify"):
-			String model_id
-			String source_id
-			Element trace_links
-			String trace_link
-			String merged_model_id
-			Element new_model
-			String location
-
-			output("Merged metamodel to RAMify again?")
-			model_id = get_model_id(input())
-
-			if (model_id != ""):
-				if (allow_write(user_id, model_id)):
-					// We must be able to write the RAMification model, as we will update it in-place
-					trace_links = allOutgoingAssociationInstances(core, model_id, "tracability")
-					merged_model_id = ""
-					while (read_nr_out(trace_links) > 0):
-						trace_link = set_pop(trace_links)
-						if (value_eq(read_attribute(core, trace_link, "type"), "RAMified")):
-							// Found a RAMification link, so redo it on the original model
-							merged_model_id = readAssociationDestination(core, trace_link)
-
-					if (merged_model_id != ""):
-						new_model = ramify(core["model"][merged_model_id])
-						model_overwrite(new_model, model_id)
-					else:
-						output("Could not determine original model of RAMified metamodel!")
-				else:
-					output("Permission denied")
-			else:
-				output("No such model")
-
 		elif (cmd == "transformation_add_MT"):
 			// Add a model transformation model
 			// Just a usual model instantiation, but need to add the source and target links based on user info

+ 64 - 0
integration/test_mvc.py

@@ -276,3 +276,67 @@ class TestModelverseCore(unittest.TestCase):
                 "Ready for command...",
             ],
             mode))
+
+    def test_po_transform_add_MT_instance(self):
+        self.transform_add_MT_instance("PO")
+
+    def transform_add_MT_instance(self, mode):
+        self.assertTrue(run_file(all_files,
+            [ "root",
+                "model_add",
+                "SimpleClassDiagrams",
+                "PetriNets",
+                ] + get_raw_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
+                "model_list_full",
+                "transformation_add_MT_language",
+                "PetriNets",
+                "",
+                "PetriNets_RAM",
+                "model_list_full",
+                "transformation_add_MT",
+                "PetriNets_RAM",
+                "PetriNets",
+            ],
+            [   "Desired username for admin user?",
+                "Welcome to the Model Management Interface v2.0!",
+                "Use the 'help' command for a list of possible commands",
+                "Ready for command...",
+                "Creating new model!",
+                "Model type?",
+                "Model name?",
+                "Waiting for model constructors...",
+                "Model upload success!",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root admin    53   core : CoreFormalism"]),
+                "Ready for command...",
+                "Formalisms to include (terminate with empty string)?",
+                "Name of the RAMified transformation metamodel?",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root nobody    14   __merged_PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root nobody    328   PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root admin    76   core : CoreFormalism"]),
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root nobody    14   __merged_PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root nobody    328   PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root admin    76   core : CoreFormalism"]),
+                "Ready for command...",
+                "Merged metamodel to RAMify again?",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root nobody    14   __merged_PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root nobody    328   PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root admin    76   core : CoreFormalism"]),
+                "Ready for command...",
+            ],
+            mode))