Browse Source

Nicer name for MMCL links

Yentl Van Tendeloo 9 years ago
parent
commit
e6d458bcef
3 changed files with 49 additions and 49 deletions
  1. 25 25
      bootstrap/metamodels.alc
  2. 23 23
      integration/test_constructors_models.py
  3. 1 1
      integration/test_pn_interface.py

+ 25 - 25
bootstrap/metamodels.alc

@@ -15,18 +15,18 @@ Element function create_metamodels():
 		model_add_value(scd, "inheritance", "inheritance")
 		model_add_value(scd, "link", "link")
 		model_add_value(scd, "name", "name")
-		model_add_edge(scd, "l1", "Class", "Any")
-		model_add_edge(scd, "l2", "Type", "Any")
-		model_add_edge(scd, "l3", "Any", "Any")
-		model_add_edge(scd, "l4", "l3", "inheritance")
-		model_add_edge(scd, "l5", "Any", "Any")
-		model_add_edge(scd, "l6", "l5", "Any")
-		model_add_edge(scd, "l7", "l5", "link")
-		model_add_edge(scd, "l8", "l5", "String")
-		model_add_edge(scd, "l9", "l8", "name")
+		model_add_edge(scd, "class_inherits_any", "Class", "Any")
+		model_add_edge(scd, "type_inherits_any", "Type", "Any")
+		model_add_edge(scd, "Inheritance", "Any", "Any")
+		model_add_edge(scd, "inheritance_name", "Inheritance", "inheritance")
+		model_add_edge(scd, "Association", "Any", "Any")
+		model_add_edge(scd, "assoc_inherits_any", "Association", "Any")
+		model_add_edge(scd, "association_name", "Association", "link")
+		model_add_edge(scd, "association_attr", "Association", "String")
+		model_add_edge(scd, "attr_name", "association_attr", "name")
 
 		retype_model(scd, scd)
-		define_inheritance(scd, "l3")
+		define_inheritance(scd, "Inheritance")
 		retype(scd, "Class", "Class")
 		retype(scd, "Type", "Class")
 		retype(scd, "Any", "Class")
@@ -34,29 +34,29 @@ Element function create_metamodels():
 		retype(scd, "inheritance", "String")
 		retype(scd, "link", "String")
 		retype(scd, "name", "String")
-		retype(scd, "l1", "l3")
-		retype(scd, "l2", "l3")
-		retype(scd, "l3", "l5")
-		retype(scd, "l4", "l8")
-		retype(scd, "l5", "l5")
-		retype(scd, "l6", "l3")
-		retype(scd, "l7", "l8")
-		retype(scd, "l8", "l5")
-		retype(scd, "l9", "l8")
+		retype(scd, "class_inherits_any", "Inheritance")
+		retype(scd, "type_inherits_any", "Inheritance")
+		retype(scd, "Inheritance", "Association")
+		retype(scd, "inheritance_name", "association_attr")
+		retype(scd, "Association", "Association")
+		retype(scd, "assoc_inherits_any", "Inheritance")
+		retype(scd, "association_name", "association_attr")
+		retype(scd, "association_attr", "Association")
+		retype(scd, "attr_name", "association_attr")
 
 		export_node("models/SimpleClassDiagrams", scd)
 
 		Element pn
 		pn = instantiate_model(scd)
-		define_inheritance(pn, "l3")
+		define_inheritance(pn, "Inheritance")
 		instantiate_node(pn, "Class", "Place")
 		instantiate_node(pn, "Class", "Transition")
 		instantiate_node(pn, "Type", "Integer")
-		instantiate_link(pn, "l5", "P2T", "Place", "Transition")
-		instantiate_link(pn, "l5", "T2P", "Transition", "Place")
-		instantiate_named(pn, "l5", "tokens", "Place", "Integer")
-		instantiate_named(pn, "l5", "weight", "P2T", "Integer")
-		instantiate_named(pn, "l5", "weight", "T2P", "Integer")
+		instantiate_link(pn, "Association", "P2T", "Place", "Transition")
+		instantiate_link(pn, "Association", "T2P", "Transition", "Place")
+		instantiate_named(pn, "Association", "tokens", "Place", "Integer")
+		instantiate_named(pn, "Association", "weight", "P2T", "Integer")
+		instantiate_named(pn, "Association", "weight", "T2P", "Integer")
 
 		set_model_constraints(pn, petrinet_constraints)
 		export_node("models/PetriNets", pn)

+ 23 - 23
integration/test_constructors_models.py

@@ -25,12 +25,12 @@ bottom = [
         '"add_value"', 1, '"name"', '"name"',
         '"add_edge"', 1, '"l1"', '"Class"', '"Any"',
         '"add_edge"', 1, '"l2"', '"Type"', '"Any"',
-        '"add_edge"', 1, '"l3"', '"Any"', '"Any"',
-        '"add_edge"', 1, '"l4"', '"l3"', '"inheritance"',
-        '"add_edge"', 1, '"l5"', '"Any"', '"Any"',
-        '"add_edge"', 1, '"l6"', '"l5"', '"Any"',
-        '"add_edge"', 1, '"l7"', '"l5"', '"link"',
-        '"add_edge"', 1, '"l8"', '"l5"', '"String"',
+        '"add_edge"', 1, '"Inheritance"', '"Any"', '"Any"',
+        '"add_edge"', 1, '"l4"', '"Inheritance"', '"inheritance"',
+        '"add_edge"', 1, '"Association"', '"Any"', '"Any"',
+        '"add_edge"', 1, '"l6"', '"Association"', '"Any"',
+        '"add_edge"', 1, '"l7"', '"Association"', '"link"',
+        '"add_edge"', 1, '"l8"', '"Association"', '"String"',
         '"add_edge"', 1, '"l9"', '"l8"', '"name"',
         '"exit"',
     ]
@@ -38,7 +38,7 @@ bottom = [
 retype = [
         '"model"', 
         '"retype_model"', 1, 1,
-        '"define_inheritance"', 1, '"l3"',
+        '"define_inheritance"', 1, '"Inheritance"',
         '"retype"', 1, '"Class"', '"Class"',
         '"retype"', 1, '"Type"', '"Class"',
         '"retype"', 1, '"Any"', '"Class"',
@@ -46,14 +46,14 @@ retype = [
         '"retype"', 1, '"inheritance"', '"String"',
         '"retype"', 1, '"link"', '"String"',
         '"retype"', 1, '"name"', '"String"',
-        '"retype"', 1, '"l1"', '"l3"',
-        '"retype"', 1, '"l2"', '"l3"',
-        '"retype"', 1, '"l3"', '"l5"',
+        '"retype"', 1, '"l1"', '"Inheritance"',
+        '"retype"', 1, '"l2"', '"Inheritance"',
+        '"retype"', 1, '"Inheritance"', '"Association"',
         '"retype"', 1, '"l4"', '"l8"',
-        '"retype"', 1, '"l5"', '"l5"',
-        '"retype"', 1, '"l6"', '"l3"',
+        '"retype"', 1, '"Association"', '"Association"',
+        '"retype"', 1, '"l6"', '"Inheritance"',
         '"retype"', 1, '"l7"', '"l8"',
-        '"retype"', 1, '"l8"', '"l5"',
+        '"retype"', 1, '"l8"', '"Association"',
         '"retype"', 1, '"l9"', '"l8"',
         '"exit"',
     ]
@@ -61,15 +61,15 @@ retype = [
 instantiate_scd = [
         '"model"',
         '"instantiate_model"', 1, 2,
-        '"define_inheritance"', 2, '"l3"',
+        '"define_inheritance"', 2, '"Inheritance"',
         '"instantiate_node"', 2, '"Class"', '"Place"',
         '"instantiate_node"', 2, '"Class"', '"Transition"',
         '"instantiate_node"', 2, '"Type"', '"Integer"',
-        '"instantiate_link"', 2, '"l5"', '"P2T"', '"Place"', '"Transition"',
-        '"instantiate_link"', 2, '"l5"', '"T2P"', '"Transition"', '"Place"',
-        '"instantiate_named"', 2, '"l5"', '"tokens"', '"Place"', '"Integer"',
-        '"instantiate_named"', 2, '"l5"', '"weight"', '"P2T"', '"Integer"',
-        '"instantiate_named"', 2, '"l5"', '"weight"', '"T2P"', '"Integer"',
+        '"instantiate_link"', 2, '"Association"', '"P2T"', '"Place"', '"Transition"',
+        '"instantiate_link"', 2, '"Association"', '"T2P"', '"Transition"', '"Place"',
+        '"instantiate_named"', 2, '"Association"', '"tokens"', '"Place"', '"Integer"',
+        '"instantiate_named"', 2, '"Association"', '"weight"', '"P2T"', '"Integer"',
+        '"instantiate_named"', 2, '"Association"', '"weight"', '"T2P"', '"Integer"',
         '"exit"',
     ]
 
@@ -96,13 +96,13 @@ instantiate_pn = [
 instantiate_example = [
         '"model"',
         '"instantiate_model"', 1, 2,
-        '"define_inheritance"', 2, '"l3"',
+        '"define_inheritance"', 2, '"Inheritance"',
         '"instantiate_node"', 2, '"Class"', '"A"',
         '"instantiate_node"', 2, '"Class"', '"B"',
         '"instantiate_node"', 2, '"Class"', '"C"',
-        '"instantiate_link"', 2, '"l3"', '"b_inherits_a"', '"B"', '"A"',
-        '"instantiate_named"', 2, '"l5"', '"tokens"', '"A"', '"B"',
-        '"instantiate_named"', 2, '"l5"', '"tokens"', '"C"', '"B"',
+        '"instantiate_link"', 2, '"Inheritance"', '"b_inherits_a"', '"B"', '"A"',
+        '"instantiate_named"', 2, '"Association"', '"tokens"', '"A"', '"B"',
+        '"instantiate_named"', 2, '"Association"', '"tokens"', '"C"', '"B"',
         '"exit"',
         '"model"',
         '"instantiate_model"', 2, 3,

+ 1 - 1
integration/test_pn_interface.py

@@ -311,7 +311,7 @@ class TestPetrinetInterface(unittest.TestCase):
     def pn_interface_types(self, mode):
         self.assertTrue(run_file(all_files,
             ["new", "PetriNets", "abc", "types"],
-            init + new + loaded + list_types([("Place", "Class"), ("Transition", "Class"), ("P2T", "l5"), ("T2P", "l5"), ("Integer", "Type")]),
+            init + new + loaded + list_types([("Place", "Class"), ("Transition", "Class"), ("P2T", "Association"), ("T2P", "Association"), ("Integer", "Type")]),
             mode))
 
     def test_po_pn_interface_modify_place(self):