Browse Source

Add some new operations in the Python wrapper that were already in the SCCD model

Yentl Van Tendeloo 7 years ago
parent
commit
3f1a98bab0
2 changed files with 15 additions and 2 deletions
  1. 7 2
      bootstrap/core_algorithm.alc
  2. 8 0
      wrappers/modelverse.py

+ 7 - 2
bootstrap/core_algorithm.alc

@@ -2411,8 +2411,13 @@ String function cmd_folder_create(folder_name : String):
 
 
 String function cmd_conformance_add(model_name : String, metamodel_name : String):
 String function cmd_conformance_add(model_name : String, metamodel_name : String):
 	// Create a new instanceOf relation now
 	// Create a new instanceOf relation now
-	String instance_of
-	instance_of = instantiate_link(core, "instanceOf", "", get_entry_id(model_name), get_entry_id(metamodel_name))
+	if (get_entry_id(model_name) != ""):
+		if (get_entry_id(metamodel_name) != ""):
+			instantiate_link(core, "instanceOf", "", get_entry_id(model_name), get_entry_id(metamodel_name))
+		else:
+			return "Model not found: " + metamodel_name!
+	else:
+		return "Model not found: " + model_name!
 	return "Success"!
 	return "Success"!
 
 
 Void function user_function_skip_init(user_id : String):
 Void function user_function_skip_init(user_id : String):

+ 8 - 0
wrappers/modelverse.py

@@ -483,6 +483,14 @@ def define_attribute(model_name, node, attr_name, attr_type):
     INPUT("define_attribute", [model_name, node, attr_name, attr_type])
     INPUT("define_attribute", [model_name, node, attr_name, attr_type])
     return OUTPUT()
     return OUTPUT()
 
 
+def undefine_attribute(model_name, node, attr_name):
+    INPUT("undefine_attribute", [model_name, node, attr_name])
+    return OUTPUT()
+
+def read_defined_attrs(model_name, node):
+    INPUT("read_defined_attrs", [model_name, node])
+    return OUTPUT()
+
 def all_instances(model_name, type_name):
 def all_instances(model_name, type_name):
     INPUT("all_instances", [model_name, type_name])
     INPUT("all_instances", [model_name, type_name])
     return OUTPUT()
     return OUTPUT()