Browse Source

Algorithm compiles again

Yentl Van Tendeloo 8 years ago
parent
commit
ba3a8215a3
1 changed files with 21 additions and 1 deletions
  1. 21 1
      core/core_algorithm.alc

+ 21 - 1
core/core_algorithm.alc

@@ -5,6 +5,7 @@ include "constructors.alh"
 include "object_operations.alh"
 include "mini_modify.alh"
 include "model_management.alh"
+include "ramify.alh"
 
 Element core = ?
 
@@ -361,6 +362,7 @@ Void function user_function_skip_init(user_id : String):
 			Element target
 			Element all_formalisms
 			Element merged_formalism
+			Element ramified_formalism
 			String old_type_id
 			String type_id
 			String location
@@ -370,6 +372,7 @@ Void function user_function_skip_init(user_id : String):
 			target = create_node()
 			old_type_id = ""
 
+			// Read source formalisms
 			output("Source formalisms (terminate with empty string)?")
 			name = input()
 			while (name != ""):
@@ -390,6 +393,7 @@ Void function user_function_skip_init(user_id : String):
 				else:
 					output("No such model; try again")
 
+			// Read target formalisms
 			output("Target formalisms (terminate with empty string)?")
 			name = input()
 			while (name != ""):
@@ -411,9 +415,10 @@ Void function user_function_skip_init(user_id : String):
 				else:
 					output("No such model; try again")
 
+			// Merge both into a single metamodel
 			if (read_nr_out(source) > 0):
 				if (read_nr_out(target) > 0):
-					output("Name of the new tranformation?")
+					output("Name of the RAMified tranformation metamodel?")
 					name = input()
 					if (get_model_id(name) == ""):
 						// New location is available, so write
@@ -422,6 +427,20 @@ Void function user_function_skip_init(user_id : String):
 						location = "/models/" + cast_id2s(merged_formalism)
 						export_node(merged_formalism, location)
 
+						// Manage meta-info
+						new_model_id = instantiate_node(core, "Model", "")
+						instantiate_attribute(core, new_model_id, "name", "__merged_" + name)
+						instantiate_attribute(core, new_model_id, "location", location)
+						instantiate_attribute(core, new_model_id, "permissions", "200")
+						instantiate_link(core, "owner", "", new_model_id, user_id)
+						instantiate_link(core, "instanceOf", "", new_model_id, type_id)
+
+						// Merge complete, now RAMify!
+						ramified_formalism = ramify(merged_formalism)
+
+						location = "/models/" + cast_id2s(ramified_formalism)
+						export_node(ramified_formalism, location)
+
 						// Manage meta-info
 						new_model_id = instantiate_node(core, "Model", "")
 						instantiate_attribute(core, new_model_id, "name", name)
@@ -429,6 +448,7 @@ Void function user_function_skip_init(user_id : String):
 						instantiate_attribute(core, new_model_id, "permissions", "200")
 						instantiate_link(core, "owner", "", new_model_id, user_id)
 						instantiate_link(core, "instanceOf", "", new_model_id, type_id)
+
 					else:
 						output("Model already exists!")
 				else: