Browse Source

Updated AToMPM conformance algorithm test example

Yentl Van Tendeloo 7 years ago
parent
commit
f2be24ac46
2 changed files with 14 additions and 6 deletions
  1. 13 5
      models/Conformance/AToMPM.alc
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 13 - 5
models/Conformance/AToMPM.alc

@@ -23,10 +23,18 @@ Boolean function main(model : Element):
 
 
 	Element instances
 	Element instances
 	String instance
 	String instance
-	instances = allInstances(model, "type_mapping/Instance")
-	while (set_len(instances) > 0):
-		instance = set_pop(instances)
-		dict_add(type_mapping, "model/" + string_replace(instance, "type_mapping/instance_", ""), "metamodel/" + string_replace(set_pop(allAssociationDestinations(model, instance, "type_mapping/TypeLink")), "type_mapping/type_", ""))
+	type_mapping = model["model"][set_pop(allInstances(model, "type_mapping/Root"))]
+
+	Element new_type_mapping
+	Element keys
+	String key
+	new_type_mapping = dict_create()
+	keys = dict_keys(type_mapping)
+	while (set_len(keys) > 0):
+		key = set_pop(keys)
+		dict_add(new_type_mapping, "model/" + key, "metamodel/" + cast_string(type_mapping[key]))
+
+	type_mapping = new_type_mapping
 	
 	
 	// Check if each attribute is there, and satisfies the constraints
 	// Check if each attribute is there, and satisfies the constraints
 	instances = dict_keys(type_mapping)
 	instances = dict_keys(type_mapping)
@@ -36,7 +44,7 @@ Boolean function main(model : Element):
 			// Got an instance of a Class
 			// Got an instance of a Class
 			String type
 			String type
 			Element inherits_from
 			Element inherits_from
-			type = type_mapping[instance]
+			type = cast_string(type_mapping[instance])
 
 
 			Element outgoing_links
 			Element outgoing_links
 			String outgoing_link
 			String outgoing_link

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Wed May 30 15:01:47 2018
+Date:   Thu May 31 08:03:22 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server