Ver código fonte

Fixed manual transformations

Yentl Van Tendeloo 8 anos atrás
pai
commit
6fe7b7aca6
3 arquivos alterados com 106 adições e 15 exclusões
  1. 0 3
      core/core_algorithm.alc
  2. 5 0
      core/mini_modify.alc
  3. 101 12
      integration/test_mvc.py

+ 0 - 3
core/core_algorithm.alc

@@ -716,13 +716,10 @@ Void function user_function_skip_init(user_id : String):
 
 							trace_links = allOutgoingAssociationInstances(core, transformation_id, "tracability")
 							merged_metamodel_id = ""
-							log("Tracability links: " + cast_v2s(read_nr_out(trace_links)))
 							while (read_nr_out(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)
-								else:
-									output("Unknown tracability link: " + cast_v2s(read_attribute(core, trace_link_id, "type")))
 
 							if (merged_metamodel_id != ""):
 								merged_model = instantiate_model(get_full_model(merged_metamodel_id))

+ 5 - 0
core/mini_modify.alc

@@ -219,8 +219,10 @@ Element function modify(model : Element, write : Boolean):
 
 				if (bool_or(type == "Class", type == "Association")):
 					output((("  " + v_m) + " : ") + read_type(model, v_m))
+					log((("  " + v_m) + " : ") + read_type(model, v_m))
 					if (type == "Association"):
 						output((("    " + reverseKeyLookup(model["model"], read_edge_src(model["model"][v_m]))) + " --> ") + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m])))
+						log((("    " + reverseKeyLookup(model["model"], read_edge_src(model["model"][v_m]))) + " --> ") + reverseKeyLookup(model["model"], read_edge_dst(model["model"][v_m])))
 
 					// Defines attributes
 					attr_list = getInstantiatableAttributes(model, v_m)
@@ -228,6 +230,7 @@ Element function modify(model : Element, write : Boolean):
 					while (0 < read_nr_out(attr_keys)):
 						attr_key = set_pop(attr_keys)
 						output(((("      " + attr_key) + " : ") + cast_v2s(attr_list[attr_key])))
+						log(((("      " + attr_key) + " : ") + cast_v2s(attr_list[attr_key])))
 
 					// Has attributes
 					attr_list = getAttributeList(model, v_m)
@@ -236,8 +239,10 @@ Element function modify(model : Element, write : Boolean):
 						attr_key = set_pop(attr_keys)
 						if (element_eq(read_attribute(model, v_m, attr_key), read_root())):
 							output(((("      " + cast_v2s(attr_key)) + " : ") + cast_v2s(attr_list[attr_key])) + " = (undefined)")
+							log(((("      " + cast_v2s(attr_key)) + " : ") + cast_v2s(attr_list[attr_key])) + " = (undefined)")
 						else:
 							output((((("      " + cast_v2s(attr_key)) + " : ") + cast_v2s(attr_list[attr_key])) + " = ") + cast_v2s(read_attribute(model, v_m, attr_key)))
+							log((((("      " + cast_v2s(attr_key)) + " : ") + cast_v2s(attr_list[attr_key])) + " = ") + cast_v2s(read_attribute(model, v_m, attr_key)))
 
 		elif (cmd == "list"):
 			Element keys_m

+ 101 - 12
integration/test_mvc.py

@@ -1554,25 +1554,23 @@ class TestModelverseCore(unittest.TestCase):
                 "pn_design_to_runtime",
                 "my_pn",
                 "my_pn_runtime",
-                "nice_list",
                 "instantiate", "PetriNets_Runtime/Place", "p1",
-                "add_attr", "p1", "tokens", 1,
-                "add_attr", "p1", "name", "p1",
+                "attr_add", "p1", "tokens", 1,
+                "attr_add", "p1", "name", "p1",
                 "instantiate", "PetriNets_Runtime/Place", "p2",
-                "add_attr", "p2", "tokens", 2,
-                "add_attr", "p2", "name", "p2",
+                "attr_add", "p2", "tokens", 2,
+                "attr_add", "p2", "name", "p2",
                 "instantiate", "PetriNets_Runtime/Place", "p3",
-                "add_attr", "p3", "tokens", 3,
-                "add_attr", "p3", "name", "p3",
+                "attr_add", "p3", "tokens", 3,
+                "attr_add", "p3", "name", "p3",
                 "instantiate", "PetriNets_Runtime/Transition", "t1",
-                "add_attr", "t1", "name", "t1",
+                "attr_add", "t1", "name", "t1",
                 "instantiate", "PetriNets_Runtime/P2T", "p2t1", "p1", "t1",
-                "add_attr", "p2t1", "weight", 1,
+                "attr_add", "p2t1", "weight", 1,
                 "instantiate", "PetriNets_Runtime/P2T", "p2t2", "p2", "t1",
-                "add_attr", "p2t2", "weight", 1,
+                "attr_add", "p2t2", "weight", 1,
                 "instantiate", "PetriNets_Runtime/T2P", "t2p", "t1", "p3",
-                "add_attr", "t2p", "weight", 2,
-                "nice_list",
+                "attr_add", "t2p", "weight", 2,
                 "exit",
                 "transformation_execute",
                 "pn_step",
@@ -1767,6 +1765,97 @@ class TestModelverseCore(unittest.TestCase):
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
+                # instantiate p1
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                # instantiate p2
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                # instantiate p3
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                # instantiate t1
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                # instantiate p2t1
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Source name?",
+                    "Destination name?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                # instantiate p2t2
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Source name?",
+                    "Destination name?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
+                # instantiate t2p1
+                    "Type to instantiate?",
+                    "Name of new element?",
+                    "Source name?",
+                    "Destination name?",
+                    "Instantiation successful!",
+                    "Please give your command.",
+                    "Which model do you want to assign an attribute to?",
+                    "Which attribute do you wish to assign?",
+                    "Value of attribute?",
+                    "Added attribute!",
+                    "Please give your command.",
                 "Ready for command...",
                 # transformation_execute (pn_step)
                 "Which transformation do you want to execute?",