瀏覽代碼

Unified AL, Manual, and Transformations in core algorithm

Yentl Van Tendeloo 8 年之前
父節點
當前提交
5b3f86ba17

+ 36 - 86
core/core_algorithm.alc

@@ -511,15 +511,17 @@ Element function execute_operation(operation_id : String, input_models : Element
 	// 1) Find merged metamodel
 
 	exact_type = read_type(core, operation_id)
-	ramified_metamodel_id = set_pop(followAssociation(core, operation_id, "instanceOf"))
-	trace_links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
 
 	if (exact_type == "ModelTransformation"):
 		linktype = "RAMified"
+		ramified_metamodel_id = set_pop(followAssociation(core, operation_id, "instanceOf"))
+		trace_links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
 	elif (exact_type == "ManualOperation"):
 		linktype = "operatesOn"
+		trace_links = allOutgoingAssociationInstances(core, operation_id, "tracability")
 	elif (exact_type == "ActionLanguage"):
 		linktype = "operatesOn"
+		trace_links = allOutgoingAssociationInstances(core, operation_id, "tracability")
 	else:
 		// Don't know how to execute this operation!
 		return read_root()!
@@ -535,8 +537,8 @@ Element function execute_operation(operation_id : String, input_models : Element
 
 		model_tuples = create_node()
 		while (read_nr_out(input_models) > 0):
-			model_ID = set_pop(input_models)
-			input_model = get_full_model(get_model_id(model_ID))
+			model_ID = get_model_id(set_pop(input_models))
+			input_model = get_full_model(model_ID)
 			metamodel_name = read_attribute(core, set_pop(allAssociationDestinations(core, model_ID, "instanceOf")), "name")
 			set_add(model_tuples, create_tuple(metamodel_name, input_model))
 
@@ -547,23 +549,24 @@ Element function execute_operation(operation_id : String, input_models : Element
 		if (exact_type == "ModelTransformation"):
 			result = transform(merged_model, get_full_model(operation_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))
 			result = func(merged_model)
-
-		output("Transformation executed with result: " + cast_v2s(result))
+		else:
+			log("ERROR")
 
 		// 4) Split in different models depending on type
 
 		if (result):
 			model_tuples = create_node()
 			while (read_nr_out(output_metamodels) > 0):
-				metamodel_ID = set_pop(output_metamodels)
+				metamodel_ID = get_model_id(set_pop(output_metamodels))
 				metamodel_name = read_attribute(core, metamodel_ID, "name")
-				metamodel = get_full_model(get_model_id(metamodel_ID))
+				metamodel = get_full_model(metamodel_ID)
 				set_add(model_tuples, create_tuple(metamodel_name, metamodel))
 			return model_split(merged_model, model_tuples, False)!
 		else:
@@ -617,15 +620,19 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
 		// Something went wrong!
 		return False!
 	else:
+		log("Results: " + dict_to_string(result))
 		keys = dict_keys(result)
 		while (read_nr_out(keys) > 0):
 			key = set_pop(keys)
-			
+			log("Expanding: " + key)
+			log("New name: " + cast_v2s(outputs[key]))
 			if (get_model_id(outputs[key]) == ""):
 				// New model
 				model_create(result[key], outputs[key], user_id, get_model_id(key), "Model")
+				log("New model!")
 			else:
 				model_overwrite(result[key], get_model_id(outputs[key]))
+				log("Overwrite!")
 
 	return result!
 
@@ -1125,9 +1132,8 @@ Void function user_function_skip_init(user_id : String):
 			else:
 				output("No such model")
 
-		elif (cmd == "transformation_add_MANUAL"):
+		elif (bool_or(cmd == "transformation_add_MANUAL", cmd == "transformation_add_AL")):
 			// Add a manual transformation model
-			output("Which metamodels do you want to use as source for the manual operation (empty string to finish)?")
 			String model_id
 			Element models
 			Element source
@@ -1141,13 +1147,15 @@ Void function user_function_skip_init(user_id : String):
 			String type_id
 			String old_type_id
 
-			name = input()
 			source = create_node()
 			target = create_node()
 			all_formalisms = create_node()
 
 			type_id = ""
 			old_type_id = ""
+
+			output("Which metamodels do you want to use as source for the operation (empty string to finish)?")
+			name = input()
 			while (name != ""):
 				model_id = get_model_id(name)
 				if (model_id != ""):
@@ -1170,7 +1178,7 @@ Void function user_function_skip_init(user_id : String):
 				
 				name = input()
 
-			output("Which metamodels do you want to use as target for the manual operation (empty string to finish)?")
+			output("Which metamodels do you want to use as target for the operation (empty string to finish)?")
 			name = input()
 			while (name != ""):
 				model_id = get_model_id(name)
@@ -1194,13 +1202,21 @@ Void function user_function_skip_init(user_id : String):
 				
 				name = input()
 
-			output("Name of Manual operation model?")
+			output("Name of operation model?")
 			name = input()
 
 			if (get_model_id(name) == ""):
-				// Finished with all information, now create the model itself!
-				model_create(instantiate_model(get_full_model(get_model_id("ManualOperation"))), name, user_id, get_model_id("ManualOperation"), "ManualOperation")
-				model_id = get_model_id(name)
+				if (cmd == "transformation_add_MANUAL"):
+					// Finished with all information, now create the model itself!
+					model_create(instantiate_model(get_full_model(get_model_id("ManualOperation"))), name, user_id, get_model_id("ManualOperation"), "ManualOperation")
+					model_id = get_model_id(name)
+
+				elif (cmd == "transformation_add_AL"):
+					// Finished with all information, now create the model itself!
+					output("Waiting for model constructors...")
+					add_code_model(get_full_model(get_model_id("ActionLanguage")), "AL/" + name, construct_function())
+					model_create(import_node("AL/" + name), name, user_id, get_model_id("ActionLanguage"), "ActionLanguage")
+					model_id = get_model_id(name)
 
 				// Write out a merged metamodel containing all these models: this is the MM for the manual operation
 				// New location is available, so write
@@ -1233,71 +1249,6 @@ Void function user_function_skip_init(user_id : String):
 			else:
 				output("Model already exists")
 
-		elif (cmd == "transformation_add_AL"):
-			// Add an action language transformation model
-			output("Which metamodels do you want to use as source for the action code (empty string to finish)?")
-			String model_id
-			Element models
-			Element source
-			Element target
-			String name
-
-			name = input()
-			source = create_node()
-			target = create_node()
-
-			while (name != ""):
-				model_id = get_model_id(name)
-				if (model_id != ""):
-					if (bool_not(set_in(source, model_id))):
-						set_add(source, model_id)
-					else:
-						output("Model already selected as source")
-				else:
-					output("No such model; try again")
-				
-				name = input()
-
-			output("Which metamodels do you want to use as target for the action code (empty string to finish)?")
-			name = input()
-			while (name != ""):
-				model_id = get_model_id(name)
-				if (model_id != ""):
-					if (bool_not(set_in(target, model_id))):
-						set_add(target, model_id)
-					else:
-						output("Model already selected as target")
-				else:
-					output("No such model; try again")
-				
-				name = input()
-
-			output("Name of Action Language model?")
-			name = input()
-
-			if (get_model_id(name) == ""):
-				// Finished with all information, now create the model itself!
-				output("Waiting for model constructors...")
-				add_code_model(get_full_model(get_model_id("ActionLanguage")), "AL/" + name, construct_function())
-				model_create(import_node("AL/" + name), name, user_id, get_model_id("ActionLanguage"), "ActionLanguage")
-				model_id = get_model_id(name)
-
-				// Extend metadata with info on source and target
-				String link
-				String dst
-
-				while (read_nr_out(source) > 0):
-					dst = set_pop(source)
-					link = instantiate_link(core, "transformInput", "", model_id, dst)
-					instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
-
-				while (read_nr_out(target) > 0):
-					dst = set_pop(target)
-					link = instantiate_link(core, "transformOutput", "", model_id, dst)
-					instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
-			else:
-				output("Model already exists")
-
 		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
@@ -1335,8 +1286,7 @@ Void function user_function_skip_init(user_id : String):
 									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)?")
+					output("Which metamodels do you want to use as source for the operation (empty string to finish)?")
 					name = input()
 					while (name != ""):
 						model_id = get_model_id(name)
@@ -1353,7 +1303,7 @@ Void function user_function_skip_init(user_id : String):
 						
 						name = input()
 
-					output("Which ones do you want to use as target (empty string to finish)?")
+					output("Which metamodels do you want to use as target for the operation (empty string to finish)?")
 					name = input()
 					while (name != ""):
 						model_id = get_model_id(name)
@@ -1370,7 +1320,7 @@ Void function user_function_skip_init(user_id : String):
 						
 						name = input()
 
-					output("Name of new transformation?")
+					output("Name of new operation?")
 					name = input()
 
 					if (get_model_id(name) == ""):

+ 3 - 0
core/mini_modify.alc

@@ -77,6 +77,9 @@ Element function modify(model : Element, write : Boolean):
 								else:
 									output("Unknown destination; aborting")
 							else:
+								log("Unknown source!")
+								log("SRC: " + src_name)
+								log("In set: " + set_to_string(dict_keys(model["model"])))
 								output("Unknown source; aborting")
 						else:
 							instantiate_node(model, mm_type_name, element_name)

+ 67 - 90
integration/test_powerwindow.py

@@ -235,18 +235,6 @@ class TestPowerWindow(unittest.TestCase):
                     "",
                     "reachability",
                     ] + get_constructor(open("models/reachability.alc", "r").read()) + [
-                "transformation_add_AL",
-                    "PetriNet",
-                    "",
-                    "",
-                    "pn_print",
-                    ] + get_constructor(open("models/pn_print.alc", "r").read()) + [
-                "transformation_add_AL",
-                    "Encapsulated_PetriNet",
-                    "",
-                    "",
-                    "epn_print",
-                    ] + get_constructor(open("models/epn_print.alc", "r").read()) + [
                 "transformation_add_AL",
                     "ReachabilityGraph",
                     "",
@@ -335,9 +323,9 @@ class TestPowerWindow(unittest.TestCase):
                 "Ready for command...",
                 # transformation_add_MANUAL * 6
                 ] + [
-                    "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
-                    "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
-                    "Name of Manual operation model?",
+                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                    "Name of operation model?",
                     "Ready for command...",
                     ] * 6 + [
                 # transformation_add_MT * 6
@@ -354,19 +342,18 @@ class TestPowerWindow(unittest.TestCase):
                          "  PW_Control",
                          "  ReachabilityGraph",
                         ]),
-                    "",
-                    "Which ones do you want to use as source (empty string to finish)?",
-                    "Which ones do you want to use as target (empty string to finish)?",
-                    "Name of new transformation?",
+                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                    "Name of new operation?",
                     "Waiting for model constructors...",
                     "Ready for command...",
                     ] * 6 + [
-                # transformation_add_AL * 4
-                ] + [   "Which metamodels do you want to use as source for the action code (empty string to finish)?",
-                        "Which metamodels do you want to use as target for the action code (empty string to finish)?",
-                        "Name of Action Language model?",
+                # transformation_add_AL * 2
+                ] + [   "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                        "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                        "Name of operation model?",
                         "Waiting for model constructors...",
-                        "Ready for command...", ] * 4 + [
+                        "Ready for command...", ] * 2 + [
                 # model_list
                 model_list |
                 set([
@@ -384,6 +371,8 @@ class TestPowerWindow(unittest.TestCase):
                      "  revise_environment : ManualOperation",
                      "  revise_query : ManualOperation",
                      "  revise_architecture : ManualOperation",
+                     "  __merged_bfs : SimpleClassDiagrams",
+                     "  __merged_reachability : SimpleClassDiagrams",
                      "  __merged_revise_req : SimpleClassDiagrams",
                      "  __merged_All_RAM : SimpleClassDiagrams",
                      "  __merged_revise_plant : SimpleClassDiagrams",
@@ -391,8 +380,6 @@ class TestPowerWindow(unittest.TestCase):
                      "  __merged_revise_environment : SimpleClassDiagrams",
                      "  __merged_revise_query : SimpleClassDiagrams",
                      "  __merged_revise_architecture : SimpleClassDiagrams",
-                     "  pn_print : ActionLanguage",
-                     "  epn_print : ActionLanguage",
                      "  match : All_RAM",
                      "  All_RAM : SimpleClassDiagrams",
                      "  make_initial_models : All_RAM",
@@ -410,42 +397,42 @@ class TestPowerWindow(unittest.TestCase):
                 "Which process model do you want to execute?",
                 "Model prefix to use?",
                 # Manual transformation revise_req
-                "Please perform manual transformation \"revise_req\"",
+                "Please perform manual operation \"revise_req\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_plant
-                "Please perform manual transformation \"revise_plant\"",
+                "Please perform manual operation \"revise_plant\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_environment
-                "Please perform manual transformation \"revise_environment\"",
+                "Please perform manual operation \"revise_environment\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_control
-                "Please perform manual transformation \"revise_control\"",
+                "Please perform manual operation \"revise_control\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_query
-                "Please perform manual transformation \"revise_query\"",
+                "Please perform manual operation \"revise_query\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_architecture
-                "Please perform manual transformation \"revise_architecture\"",
+                "Please perform manual operation \"revise_architecture\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
@@ -777,9 +764,9 @@ class TestPowerWindow(unittest.TestCase):
                 "Ready for command...",
                 # transformation_add_MANUAL * 6
                 ] + [
-                    "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
-                    "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
-                    "Name of Manual operation model?",
+                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                    "Name of operation model?",
                     "Ready for command...",
                     ] * 6 + [
                 # transformation_add_MT * 6
@@ -796,17 +783,16 @@ class TestPowerWindow(unittest.TestCase):
                          "  PW_Control",
                          "  ReachabilityGraph",
                         ]),
-                    "",
-                    "Which ones do you want to use as source (empty string to finish)?",
-                    "Which ones do you want to use as target (empty string to finish)?",
-                    "Name of new transformation?",
+                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                    "Name of new operation?",
                     "Waiting for model constructors...",
                     "Ready for command...",
                     ] * 6 + [
                 # transformation_add_AL * 4
-                ] + [   "Which metamodels do you want to use as source for the action code (empty string to finish)?",
-                        "Which metamodels do you want to use as target for the action code (empty string to finish)?",
-                        "Name of Action Language model?",
+                ] + [   "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                        "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                        "Name of operation model?",
                         "Waiting for model constructors...",
                         "Ready for command...", ] * 4 + [
                 # model_list
@@ -826,6 +812,7 @@ class TestPowerWindow(unittest.TestCase):
                      "  revise_environment : ManualOperation",
                      "  revise_query : ManualOperation",
                      "  revise_architecture : ManualOperation",
+                     "  __merged_reachability : SimpleClassDiagrams",
                      "  __merged_revise_req : SimpleClassDiagrams",
                      "  __merged_All_RAM : SimpleClassDiagrams",
                      "  __merged_revise_plant : SimpleClassDiagrams",
@@ -833,6 +820,9 @@ class TestPowerWindow(unittest.TestCase):
                      "  __merged_revise_environment : SimpleClassDiagrams",
                      "  __merged_revise_query : SimpleClassDiagrams",
                      "  __merged_revise_architecture : SimpleClassDiagrams",
+                     "  __merged_pn_print : SimpleClassDiagrams",
+                     "  __merged_epn_print : SimpleClassDiagrams",
+                     "  __merged_bfs : SimpleClassDiagrams",
                      "  pn_print : ActionLanguage",
                      "  epn_print : ActionLanguage",
                      "  match : All_RAM",
@@ -852,42 +842,42 @@ class TestPowerWindow(unittest.TestCase):
                 "Which process model do you want to execute?",
                 "Model prefix to use?",
                 # Manual transformation revise_req
-                "Please perform manual transformation \"revise_req\"",
+                "Please perform manual operation \"revise_req\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_plant
-                "Please perform manual transformation \"revise_plant\"",
+                "Please perform manual operation \"revise_plant\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_environment
-                "Please perform manual transformation \"revise_environment\"",
+                "Please perform manual operation \"revise_environment\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_control
-                "Please perform manual transformation \"revise_control\"",
+                "Please perform manual operation \"revise_control\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_query
-                "Please perform manual transformation \"revise_query\"",
+                "Please perform manual operation \"revise_query\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_architecture
-                "Please perform manual transformation \"revise_architecture\"",
+                "Please perform manual operation \"revise_architecture\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
@@ -898,35 +888,35 @@ class TestPowerWindow(unittest.TestCase):
                 "Found error path:",
                 None,
                 # Manual transformation revise_plant
-                "Please perform manual transformation \"revise_plant\"",
+                "Please perform manual operation \"revise_plant\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_environment
-                "Please perform manual transformation \"revise_environment\"",
+                "Please perform manual operation \"revise_environment\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_control
-                "Please perform manual transformation \"revise_control\"",
+                "Please perform manual operation \"revise_control\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_query
-                "Please perform manual transformation \"revise_query\"",
+                "Please perform manual operation \"revise_query\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_architecture
-                "Please perform manual transformation \"revise_architecture\"",
+                "Please perform manual operation \"revise_architecture\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
@@ -1135,18 +1125,6 @@ class TestPowerWindow(unittest.TestCase):
                     "",
                     "reachability",
                     ] + get_constructor(open("models/reachability.alc", "r").read()) + [
-                "transformation_add_AL",
-                    "PetriNet",
-                    "",
-                    "",
-                    "pn_print",
-                    ] + get_constructor(open("models/pn_print.alc", "r").read()) + [
-                "transformation_add_AL",
-                    "Encapsulated_PetriNet",
-                    "",
-                    "",
-                    "epn_print",
-                    ] + get_constructor(open("models/epn_print.alc", "r").read()) + [
                 "transformation_add_AL",
                     "ReachabilityGraph",
                     "",
@@ -1257,9 +1235,9 @@ class TestPowerWindow(unittest.TestCase):
                 "Ready for command...",
                 # transformation_add_MANUAL * 6
                 ] + [
-                    "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
-                    "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
-                    "Name of Manual operation model?",
+                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                    "Name of operation model?",
                     "Ready for command...",
                     ] * 6 + [
                 # transformation_add_MT * 6
@@ -1276,19 +1254,18 @@ class TestPowerWindow(unittest.TestCase):
                          "  PW_Control",
                          "  ReachabilityGraph",
                         ]),
-                    "",
-                    "Which ones do you want to use as source (empty string to finish)?",
-                    "Which ones do you want to use as target (empty string to finish)?",
-                    "Name of new transformation?",
+                    "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                    "Name of new operation?",
                     "Waiting for model constructors...",
                     "Ready for command...",
                     ] * 6 + [
-                # transformation_add_AL * 4
-                ] + [   "Which metamodels do you want to use as source for the action code (empty string to finish)?",
-                        "Which metamodels do you want to use as target for the action code (empty string to finish)?",
-                        "Name of Action Language model?",
+                # transformation_add_AL * 2
+                ] + [   "Which metamodels do you want to use as source for the operation (empty string to finish)?",
+                        "Which metamodels do you want to use as target for the operation (empty string to finish)?",
+                        "Name of operation model?",
                         "Waiting for model constructors...",
-                        "Ready for command...", ] * 4 + [
+                        "Ready for command...", ] * 2 + [
                 # model_list
                 model_list |
                 set([
@@ -1306,6 +1283,8 @@ class TestPowerWindow(unittest.TestCase):
                      "  revise_environment : ManualOperation",
                      "  revise_query : ManualOperation",
                      "  revise_architecture : ManualOperation",
+                     "  __merged_bfs : SimpleClassDiagrams",
+                     "  __merged_reachability : SimpleClassDiagrams",
                      "  __merged_revise_req : SimpleClassDiagrams",
                      "  __merged_All_RAM : SimpleClassDiagrams",
                      "  __merged_revise_plant : SimpleClassDiagrams",
@@ -1313,8 +1292,6 @@ class TestPowerWindow(unittest.TestCase):
                      "  __merged_revise_environment : SimpleClassDiagrams",
                      "  __merged_revise_query : SimpleClassDiagrams",
                      "  __merged_revise_architecture : SimpleClassDiagrams",
-                     "  pn_print : ActionLanguage",
-                     "  epn_print : ActionLanguage",
                      "  match : All_RAM",
                      "  All_RAM : SimpleClassDiagrams",
                      "  make_initial_models : All_RAM",
@@ -1332,42 +1309,42 @@ class TestPowerWindow(unittest.TestCase):
                 "Which process model do you want to execute?",
                 "Model prefix to use?",
                 # Manual transformation revise_req
-                "Please perform manual transformation \"revise_req\"",
+                "Please perform manual operation \"revise_req\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_plant
-                "Please perform manual transformation \"revise_plant\"",
+                "Please perform manual operation \"revise_plant\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_environment
-                "Please perform manual transformation \"revise_environment\"",
+                "Please perform manual operation \"revise_environment\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_control
-                "Please perform manual transformation \"revise_control\"",
+                "Please perform manual operation \"revise_control\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_query
-                "Please perform manual transformation \"revise_query\"",
+                "Please perform manual operation \"revise_query\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_architecture
-                "Please perform manual transformation \"revise_architecture\"",
+                "Please perform manual operation \"revise_architecture\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
@@ -1378,35 +1355,35 @@ class TestPowerWindow(unittest.TestCase):
                 "Found error path:",
                 None,
                 # Manual transformation revise_plant
-                "Please perform manual transformation \"revise_plant\"",
+                "Please perform manual operation \"revise_plant\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_environment
-                "Please perform manual transformation \"revise_environment\"",
+                "Please perform manual operation \"revise_environment\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_control
-                "Please perform manual transformation \"revise_control\"",
+                "Please perform manual operation \"revise_control\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_query
-                "Please perform manual transformation \"revise_query\"",
+                "Please perform manual operation \"revise_query\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",
                 "Waiting for model constructors...",
                 "Please give your command.",
                 # Manual transformation revise_architecture
-                "Please perform manual transformation \"revise_architecture\"",
+                "Please perform manual operation \"revise_architecture\"",
                 "Model loaded, ready for commands!",
                 "Use 'help' command for a list of possible commands",
                 "Please give your command.",

+ 1 - 1
kernel/modelverse_jit/intrinsics.py

@@ -298,7 +298,7 @@ MISC_INTRINSICS = {
     'dict_len' : __read_nr_out,
 
     # Set operations
-    'set_add' : __set_add,
+    #'set_add' : __set_add,
 
     # List operations
     'list_len' : __read_nr_out,

+ 4 - 1
kernel/modelverse_kernel/primitives.py

@@ -440,11 +440,14 @@ def read_root(root, **remainder):
 def set_add(a, b, **remainder):
     #yield [("CE", [a, b])]
     #raise PrimitiveFinished(a)
+
     outgoing, b_value = yield [("RO", [a]), ("RV", [b])]
     if outgoing:
         elements = yield [("RE", [i]) for i in outgoing]
         values = yield [("RV", [i[1]]) for i in elements]
-        if b_value in values:
+        if b_value is not None and b_value in values:
+            raise PrimitiveFinished(a)
+        elif b_value is None and b in elements:
             raise PrimitiveFinished(a)
         else:
             yield [("CE", [a, b])]

+ 5 - 5
models/reachability.alc

@@ -36,12 +36,12 @@ Boolean function reachability_graph(model : Element):
 	// Create a dictionary representation for each transition
 	transition_vectors_produce = create_node()
 	transition_vectors_consume = create_node()
-	all_transitions = allInstances(model, "PetriNets/Transition")
+	all_transitions = allInstances(model, "PetriNet/Transition")
 	while (read_nr_out(all_transitions) > 0):
 		transition = set_pop(all_transitions)
 
 		tv = create_node()
-		links = allIncomingAssociationInstances(model, transition, "PetriNets/P2T")
+		links = allIncomingAssociationInstances(model, transition, "PetriNet/P2T")
 		while (read_nr_out(links) > 0):
 			link = set_pop(links)
 			name = reverseKeyLookup(model["model"], read_edge_src(model["model"][link]))
@@ -50,7 +50,7 @@ Boolean function reachability_graph(model : Element):
 		dict_add_fast(transition_vectors_consume, transition, tv)
 
 		tv = create_node()
-		links = allOutgoingAssociationInstances(model, transition, "PetriNets/T2P")
+		links = allOutgoingAssociationInstances(model, transition, "PetriNet/T2P")
 		while (read_nr_out(links) > 0):
 			link = set_pop(links)
 			name = reverseKeyLookup(model["model"], read_edge_dst(model["model"][link]))
@@ -60,13 +60,13 @@ Boolean function reachability_graph(model : Element):
 
 	workset = create_node()
 
-	all_places = allInstances(model, "PetriNets/Place")
+	all_places = allInstances(model, "PetriNet/Place")
 	dict_repr = create_node()
 	while (read_nr_out(all_places) > 0):
 		place = set_pop(all_places)
 		dict_add_fast(dict_repr, place, read_attribute(model, place, "tokens"))
 
-	all_transitions_original = allInstances(model, "PetriNets/Transition")
+	all_transitions_original = allInstances(model, "PetriNet/Transition")
 
 	mappings = create_node()
 	state_id = 0