Преглед изворни кода

More bugfixes when defining MT_language and MT_instances

Yentl Van Tendeloo пре 8 година
родитељ
комит
ec77f1b11f
3 измењених фајлова са 36 додато и 10 уклоњено
  1. 1 1
      bootstrap/model_management.alc
  2. 21 6
      core/core_algorithm.alc
  3. 14 3
      integration/test_mvc.py

+ 1 - 1
bootstrap/model_management.alc

@@ -24,7 +24,7 @@ Element function model_fuse(models : Element):
 	// Do the iteration
 	while (read_nr_out(models)):
 		tagged_model = set_pop(models)
-		model_name = list_read(tagged_model, 0)
+		model_name = string_join(list_read(tagged_model, 0), "/")
 		model = list_read(tagged_model, 1)
 
 		// Add all elements from 'model', but prepend it with the 'model_name'

+ 21 - 6
core/core_algorithm.alc

@@ -607,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
@@ -630,13 +630,14 @@ Void function user_function_skip_init(user_id : String):
 					String tracability_link
 
 					// New location is available, so write
-					merged_formalism = model_fuse(all_formalisms)
+					merged_formalism = model_fuse(set_copy(all_formalisms))
 					model_create(merged_formalism, "__merged_" + name, user_id, type_id)
 					merged_formalism_id = get_model_id("__merged_" + name)
 
 					// Add tracability links at this level
 					while (read_nr_out(all_formalisms) > 0):
-						source_formalism_id = list_read(set_pop(all_formalisms), 1)
+						source_formalism_id = get_model_id(list_read(set_pop(all_formalisms), 0))
+						log("ADD tracability link to " + source_formalism_id)
 						tracability_link = instantiate_link(core, "tracability", "", merged_formalism_id, source_formalism_id)
 						instantiate_attribute(core, tracability_link, "type", "merged")
 
@@ -667,6 +668,9 @@ Void function user_function_skip_init(user_id : String):
 			Element target
 			String name
 			String new_model_id
+			String merged_link_id
+			Element links_merged
+			String merged_metamodel_id
 
 			source = create_node()
 			target = create_node()
@@ -677,11 +681,22 @@ Void function user_function_skip_init(user_id : String):
 				if (allow_read(user_id, ramified_metamodel_id)):
 					output("Supported metamodels:")
 					links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
+					log(set_to_string(links))
 					while (read_nr_out(links) > 0):
 						link_id = set_pop(links)
-						if (value_eq(read_attribute(core, link_id, "type"), "merged")):
-							output(string_join("  ", read_attribute(core, readAssociationDestination(core, link_id), "name")))
-							set_add(supported, readAssociationDestination(core, link_id))
+						log("CHECK " + link_id)
+						merged_metamodel_id = readAssociationDestination(core, link_id)
+						log("Merged: " + merged_metamodel_id)
+						if (value_eq(read_attribute(core, link_id, "type"), "RAMified")):
+							links_merged = allOutgoingAssociationInstances(core, merged_metamodel_id, "tracability")
+							log(set_to_string(links_merged))
+							while (read_nr_out(links_merged) > 0):
+								merged_link_id = set_pop(links_merged)
+								log("CHECK2 " + merged_link_id)
+								if (value_eq(read_attribute(core, merged_link_id, "type"), "merged")):
+									log("Found match!")
+									output(string_join("  ", read_attribute(core, readAssociationDestination(core, merged_link_id), "name")))
+									set_add(supported, readAssociationDestination(core, merged_link_id))
 
 					output("")
 					output("Which ones do you want to use as source (empty string to finish)?")

+ 14 - 3
integration/test_mvc.py

@@ -320,14 +320,25 @@ class TestModelverseCore(unittest.TestCase):
                      "  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"]),
+                     "  200  root admin    79   core : CoreFormalism"]),
                 "Ready for command...",
+                "RAMified metamodel to use?",
+                "Supported metamodels:",
+                set(["  PetriNets",
+                    ]),
+                "",
+                "Which ones do you want to use as source (empty string to finish)?",
+                "Model added as source",
+                "Which ones do you want to use as target (empty string to finish)?",
+                "Model added as target",
+                "Name of new transformation?",
+                "Met-info correctly set!",
                 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"]),
+                     "  200  root admin    79   core : CoreFormalism"]),
                 "Ready for command...",
                 "Merged metamodel to RAMify again?",
                 "Ready for command...",
@@ -336,7 +347,7 @@ class TestModelverseCore(unittest.TestCase):
                      "  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"]),
+                     "  200  root admin    79   core : CoreFormalism"]),
                 "Ready for command...",
             ],
             mode))