Browse Source

Some more code to write and part about source/target MT fixed

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

+ 20 - 25
core/core_algorithm.alc

@@ -213,6 +213,7 @@ Void function user_function_skip_init(user_id : String):
 			output("    model_delete					-- [TODO] Delete a model and all related transformations")
 			output("    model_list						-- List all models")
 			output("    model_list_full					-- List all models with full info")
+			output("    model_overwrite					-- Overwrites a model with an uploaded model, leaving all metadata")
 			output("")
 			output("Transformation-specific operations")
 			output("    transformation_add_MT_language	-- Create a RAMified metamodel")
@@ -373,8 +374,8 @@ 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)?")
+			// Read involved formalisms
+			output("Formalisms to include (terminate with empty string)?")
 			name = input()
 			while (name != ""):
 				model_id = get_model_id(name)
@@ -382,7 +383,6 @@ 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(source, model_id)
 							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):
@@ -394,28 +394,6 @@ 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 != ""):
-				model_id = get_model_id(name)
-				if (model_id != ""):
-					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(target, model_id)
-							if (bool_not(set_in(source, model_id))):
-								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
-							output("Cannot add model as types not compatible with previous models; try again")
-					else:
-						output("Model not readable; try again")
-					name = input()
-				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):
@@ -512,6 +490,23 @@ Void function user_function_skip_init(user_id : String):
 			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
+			String ramified_metamodel_id
+
+			output("RAMified metamodel to use?")
+			ramified_metamodel_id = get_model_id(input())
+			if (ramified_metamodel_id != ""):
+				if (allow_read(user_id, ramified_metamodel_id)):
+					// TODO follow chain of RAMified and merged tracability links to find possible source and target
+					// TODO instantiate a new model of this metamodel and allow for an upload or whatever
+					output("TODO")
+				else:
+					output("Permission denied")
+			else:
+				output("No such model")
+
 		elif (cmd == "permission_modify"):
 			String permissions
 			Integer permission