Browse Source

Add "name" attribute in SCD

Yentl Van Tendeloo 6 years ago
parent
commit
af69ae1907

+ 43 - 8
bootstrap/90_core_formalism.mvc

@@ -3,6 +3,7 @@ include "primitives.alh"
 
 
 SimpleClassDiagrams CoreFormalism {
 SimpleClassDiagrams CoreFormalism {
     SimpleAttribute String {
     SimpleAttribute String {
+        name = "String"
         constraint = $
         constraint = $
             String function constraint(model : Element, name : String):
             String function constraint(model : Element, name : String):
                 if (bool_not(is_physical_string(model["model"][name]))):
                 if (bool_not(is_physical_string(model["model"][name]))):
@@ -13,6 +14,7 @@ SimpleClassDiagrams CoreFormalism {
     }
     }
 
 
     SimpleAttribute Permissions {
     SimpleAttribute Permissions {
+        name = "Permissions"
         constraint = $
         constraint = $
             String function constraint(model : Element, name : String):
             String function constraint(model : Element, name : String):
                 Element self
                 Element self
@@ -32,6 +34,7 @@ SimpleClassDiagrams CoreFormalism {
     }
     }
 
 
     SimpleAttribute Boolean {
     SimpleAttribute Boolean {
+        name = "Boolean"
         constraint = $
         constraint = $
             String function constraint(model : Element, name : String):
             String function constraint(model : Element, name : String):
                 if (bool_not(is_physical_boolean(model["model"][name]))):
                 if (bool_not(is_physical_boolean(model["model"][name]))):
@@ -42,6 +45,7 @@ SimpleClassDiagrams CoreFormalism {
     }
     }
 
 
     SimpleAttribute Natural {
     SimpleAttribute Natural {
+        name = "Natural"
         constraint = $
         constraint = $
             String function constraint(model : Element, name : String):
             String function constraint(model : Element, name : String):
                 if (bool_not(is_physical_int(model["model"][name]))):
                 if (bool_not(is_physical_int(model["model"][name]))):
@@ -54,76 +58,107 @@ SimpleClassDiagrams CoreFormalism {
     }
     }
 
 
     Class User {
     Class User {
+        name = "User"
         name : String
         name : String
         password : String
         password : String
         admin : Boolean
         admin : Boolean
     }
     }
 
 
     Class Group {
     Class Group {
+        name = "Group"
         name : String
         name : String
     }
     }
 
 
-    Association ownedBy (Group, User) {}
-    Association belongsTo (User, Group) {}
+    Association ownedBy (Group, User) {
+        name = "ownedBy"
+    }
+    Association belongsTo (User, Group) {
+        name = "belongsTo"
+    }
 
 
     Class Entry {
     Class Entry {
+        name = "Entry"
         name : String
         name : String
         permissions : Permissions
         permissions : Permissions
     }
     }
 
 
     Class Folder : Entry {
     Class Folder : Entry {
+        name = "Folder"
     }
     }
 
 
-    Association contains (Folder, Entry) {}
+    Association contains (Folder, Entry) {
+        name = "contains"
+    }
 
 
     Class Model : Entry {
     Class Model : Entry {
+        name = "Model"
         location : String
         location : String
     }
     }
 
 
-    Class TypeMapping : Model {}
+    Class TypeMapping : Model {
+        name = "TypeMapping"
+    }
 
 
     Association instanceOf (Model, Model) {
     Association instanceOf (Model, Model) {
+        name = "instanceOf"
     }
     }
 
 
     Association owner (Model, User) {
     Association owner (Model, User) {
+        name = "owner"
         target_lower_cardinality = 1
         target_lower_cardinality = 1
         target_upper_cardinality = 1
         target_upper_cardinality = 1
     }
     }
 
 
     Association group (Model, Group) {
     Association group (Model, Group) {
+        name = "group"
         target_lower_cardinality = 1
         target_lower_cardinality = 1
         target_upper_cardinality = 1
         target_upper_cardinality = 1
     }
     }
 
 
-    Class Transformation : Model {}
+    Class Transformation : Model {
+        name = "Transformation"
+    }
 
 
-    Class ModelTransformation : Transformation {}
+    Class ModelTransformation : Transformation {
+        name = "ModelTransformation"
+    }
 
 
-    Class ActionLanguage : Transformation {}
+    Class ActionLanguage : Transformation {
+        name = "ActionLanguage"
+    }
 
 
-    Class ManualOperation : Transformation {}
+    Class ManualOperation : Transformation {
+        name = "ManualOperation"
+    }
 
 
     Association transformInput (Model, Transformation) {
     Association transformInput (Model, Transformation) {
+        name = "transformInput"
         name : String
         name : String
     }
     }
+
     Association transformOutput (Transformation, Model) {
     Association transformOutput (Transformation, Model) {
+        name = "transformOutput"
         name : String
         name : String
     }
     }
 
 
     Association tracability (Model, Model) {
     Association tracability (Model, Model) {
+        name = "tracability"
         type : String
         type : String
     }
     }
 
 
     Association semantics (instanceOf, ActionLanguage) {
     Association semantics (instanceOf, ActionLanguage) {
+        name = "semantics"
         target_lower_cardinality = 1
         target_lower_cardinality = 1
         target_upper_cardinality = 1
         target_upper_cardinality = 1
     }
     }
     Association typing (instanceOf, TypeMapping) {
     Association typing (instanceOf, TypeMapping) {
+        name = "typing"
         target_lower_cardinality = 1
         target_lower_cardinality = 1
         target_upper_cardinality = 1
         target_upper_cardinality = 1
     }
     }
 
 
     Class Service {
     Class Service {
+        name = "Service"
         name : String
         name : String
         port : String
         port : String
     }
     }

+ 6 - 2
bootstrap/bottom.mvc

@@ -1,8 +1,12 @@
 import models/SimpleClassDiagrams as SCD
 import models/SimpleClassDiagrams as SCD
 
 
 SCD Bottom{
 SCD Bottom{
-    Class Node {}
-    Association Edge : Node (Node, Node) {}
+    Class Node {
+        name = "Node"
+    }
+    Association Edge : Node (Node, Node) {
+        name = "Edge"
+    }
 }
 }
 
 
 export Bottom to models/Bottom
 export Bottom to models/Bottom

+ 22 - 22
bootstrap/conformance_finding.alc

@@ -49,30 +49,30 @@ Boolean function find_type_mapping(model : Element):
 		node_element = read_root()
 		node_element = read_root()
 		edge_element = read_root()
 		edge_element = read_root()
 
 
-		elems = dict_keys(model["metamodel"]["model"])
-		log("Elements in metamodel: " + set_to_string(elems))
-		while (set_len(elems) > 0):
-			elem = set_pop(elems)
-			// log("Check " + elem)
-
-			if (bool_not(is_edge(model["metamodel"]["model"][elem]))):
-				if (element_neq(node_element, read_root())):
-					log("Multiple nodes detected!")
-					return False!
-				node_element = elem
-			else:
-				// Is an edge, but might be the inheritance link...
-				log("type: " + read_type(model["metamodel"], elem))
-				if (read_type(model["metamodel"], elem) != "Inheritance"):
-					// Is not the inheritance link
-					if (element_neq(edge_element, read_root())):
-						log("Multiple edges detected")
-						return False!
-					edge_element = elem
+		Element nodes
+		Element edges
+		nodes = allInstances(model["metamodel"], "Class")
+		edges = allInstances(model["metamodel"], "Association")
 
 
-		if (bool_or(element_eq(node_element, read_root()), element_eq(edge_element, read_root()))):
-			log("Not both node and edge detected")
+		if (set_len(nodes) > 1):
+			log("Got nodes: " + set_to_string(nodes))
+			log("Multiple nodes detected!")
 			return False!
 			return False!
+		elif (set_len(edges) > 1):
+			log("Got edges: " + set_to_string(edges))
+			log("Multiple edges detected!")
+			return False!
+		elif (set_len(nodes) != 1):
+			log("No node found!")
+			return False!
+		elif (set_len(edges) != 1):
+			log("No edge found!")
+			return False!
+		else:
+			node_element = set_pop(nodes)
+			edge_element = set_pop(edges)
+			log("Found node: " + node_element)
+			log("Found edge: " + edge_element)
 
 
 		// Now we have bot an edge_element and node_element of the metamodel
 		// Now we have bot an edge_element and node_element of the metamodel
 		// Now just trivially bind all elements!
 		// Now just trivially bind all elements!

+ 11 - 0
bootstrap/metamodels.alt

@@ -120,6 +120,17 @@ Element function initialize_SCD(location : String):
 	model_define_attribute(scd, "Association", "target_upper_cardinality", True, "Natural")
 	model_define_attribute(scd, "Association", "target_upper_cardinality", True, "Natural")
 	model_define_attribute(scd, "ComplexAttribute", "type", False, "Location")
 	model_define_attribute(scd, "ComplexAttribute", "type", False, "Location")
 
 
+	model_define_attribute(scd, "Class", "name", False, "String")
+	model_define_attribute(scd, "SimpleAttribute", "name", False, "String")
+	model_define_attribute(scd, "Association", "name", False, "String")
+	instantiate_attribute(scd, "Class", "name", "Class")
+	instantiate_attribute(scd, "Association", "name", "Association")
+	instantiate_attribute(scd, "SimpleAttribute", "name", "SimpleAttribute")
+	instantiate_attribute(scd, "Location", "name", "Location")
+	instantiate_attribute(scd, "Natural", "name", "Natural")
+	instantiate_attribute(scd, "Boolean", "name", "Boolean")
+	instantiate_attribute(scd, "Inheritance", "name", "Inheritance")
+
 	// Export already, to allow AL to pick it up
 	// Export already, to allow AL to pick it up
 	export_node(location, scd)
 	export_node(location, scd)
 	// Add in the Action Language metamodel
 	// Add in the Action Language metamodel

+ 4 - 3
bootstrap/object_operations.alc

@@ -130,9 +130,10 @@ Element function getAttributeList(model : Element, element : String):
 		while (set_len(keys) > 0):
 		while (set_len(keys) > 0):
 			attr_name = set_pop(keys)
 			attr_name = set_pop(keys)
 			if (is_physical_string(attr_name)):
 			if (is_physical_string(attr_name)):
-				attr_type = reverseKeyLookup(mm, mm[type][attr_name])
-				// WARNING: do not change this to dict_add_fast, as this crashes random code...
-				dict_add(result, attr_name, attr_type)
+				if (read_type(model["metamodel"], reverseKeyLookup(mm, dict_read_edge(mm[type], attr_name))) == "AttributeLink"):
+					attr_type = reverseKeyLookup(mm, mm[type][attr_name])
+					// WARNING: do not change this to dict_add_fast, as this crashes random code...
+					dict_add(result, attr_name, attr_type)
 
 
 	return result!
 	return result!
 
 

+ 29 - 7
bootstrap/pm.mvc

@@ -3,8 +3,11 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
 SimpleClassDiagrams ProcessModel {
 SimpleClassDiagrams ProcessModel {
-    SimpleAttribute String {}
+    SimpleAttribute String {
+        name = "String"
+    }
     SimpleAttribute MvCName {
     SimpleAttribute MvCName {
+        name = "MvCName"
         constraint = $
         constraint = $
             String function constraint(model : Element, name : String):
             String function constraint(model : Element, name : String):
                 if (bool_not(is_physical_string(model["model"][name]))):
                 if (bool_not(is_physical_string(model["model"][name]))):
@@ -14,17 +17,26 @@ SimpleClassDiagrams ProcessModel {
             $
             $
     }
     }
 
 
-    Class Activity {}
+    Class Activity {
+        name = "Activity"
+    }
     Class Start : Activity {
     Class Start : Activity {
+        name = "Start"
         lower_cardinality = 1
         lower_cardinality = 1
         upper_cardinality = 1
         upper_cardinality = 1
     }
     }
     Class Finish : Activity {
     Class Finish : Activity {
+        name = "Finish"
         lower_cardinality = 1
         lower_cardinality = 1
     }
     }
-    Class Fork : Activity {}
-    Class Join : Activity {}
+    Class Fork : Activity {
+        name = "Fork"
+    }
+    Class Join : Activity {
+        name = "Join"
+    }
     Class Decision : Activity {
     Class Decision : Activity {
+        name = "Decision"
         constraint = $
         constraint = $
             String function constraint(model : Element, name : String):
             String function constraint(model : Element, name : String):
                 if (read_nr_out(allOutgoingAssociationInstances(model, name, "Next")) == 0):
                 if (read_nr_out(allOutgoingAssociationInstances(model, name, "Next")) == 0):
@@ -35,23 +47,33 @@ SimpleClassDiagrams ProcessModel {
     }
     }
 
 
     Class Exec : Activity {
     Class Exec : Activity {
+        name = "Exec"
         name : MvCName
         name : MvCName
     }
     }
 
 
     Class Data {
     Class Data {
+        name = "Data"
         name : MvCName
         name : MvCName
         type : MvCName
         type : MvCName
     }
     }
 
 
     Association Produces (Exec, Data) {
     Association Produces (Exec, Data) {
         name : String
         name : String
+        name = "Produces"
     }
     }
     Association Consumes (Exec, Data) {
     Association Consumes (Exec, Data) {
         name : String
         name : String
+        name = "Consumes"
+    }
+    Association Then (Decision, Activity) {
+        name = "Then"
+    }
+    Association Else (Decision, Activity) {
+        name = "Else"
+    }
+    Association Next (Activity, Activity) {
+        name = "Next"
     }
     }
-    Association Then (Decision, Activity) {}
-    Association Else (Decision, Activity) {}
-    Association Next (Activity, Activity) {}
 }
 }
 
 
 export ProcessModel to models/ProcessModel
 export ProcessModel to models/ProcessModel

+ 5 - 1
bootstrap/tracability.mvc

@@ -4,13 +4,17 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
 SimpleClassDiagrams Tracability {
 SimpleClassDiagrams Tracability {
-    SimpleAttribute String {}
+    SimpleAttribute String {
+        name = "String"
+    }
 
 
     Class Reference {
     Class Reference {
         name : String
         name : String
+        name = "Reference"
     }
     }
     Association TracabilityLink {
     Association TracabilityLink {
         type : String
         type : String
+        name = "TracabilityLink"
     }
     }
 }
 }
 
 

+ 10 - 2
integration/code/pn_design.mvc

@@ -1,16 +1,24 @@
-SimpleAttribute Natural {}
-SimpleAttribute String {}
+SimpleAttribute Natural {
+    name = "Natural"
+}
+SimpleAttribute String {
+    name = "String"
+}
 
 
 Class Place {
 Class Place {
+    name = "Place"
     tokens : Natural
     tokens : Natural
     name : String
     name : String
 }
 }
 Class Transition {
 Class Transition {
+    name = "Transition"
     name : String
     name : String
 }
 }
 Association P2T (Place, Transition) {
 Association P2T (Place, Transition) {
+    name = "P2T"
     weight : Natural
     weight : Natural
 }
 }
 Association T2P (Transition, Place) {
 Association T2P (Transition, Place) {
+    name = "T2P"
     weight : Natural
     weight : Natural
 }
 }

+ 20 - 3
models/MM_rendered_graphical.mvc

@@ -1,54 +1,71 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleAttribute Natural {}
-SimpleAttribute String {}
+SimpleAttribute Natural {
+    name = "Natural"
+}
+SimpleAttribute String {
+    name = "String"
+}
 
 
 Class GraphicalElement {
 Class GraphicalElement {
+    name = "GraphicalElement"
     x : Natural
     x : Natural
     y : Natural
     y : Natural
     __asid? : String
     __asid? : String
 }
 }
 
 
 Class Group : GraphicalElement {
 Class Group : GraphicalElement {
+    name = "Group"
 }
 }
 
 
 Class LineElement : GraphicalElement {
 Class LineElement : GraphicalElement {
+    name = "LineElement"
     lineWidth : Natural
     lineWidth : Natural
     lineColour : String
     lineColour : String
 }
 }
 
 
 Class Text : LineElement {
 Class Text : LineElement {
+    name = "Text"
     text : String
     text : String
 }
 }
 
 
 Class Line : LineElement {
 Class Line : LineElement {
+    name = "Line"
     targetX : Natural
     targetX : Natural
     targetY : Natural
     targetY : Natural
 }
 }
 
 
 Class Shape : LineElement {
 Class Shape : LineElement {
+    name = "Shape"
     fillColour : String
     fillColour : String
     width : Natural
     width : Natural
     height : Natural
     height : Natural
 }
 }
 
 
 Class Figure : GraphicalElement {
 Class Figure : GraphicalElement {
+    name = "Figure"
     width : Natural
     width : Natural
     height : Natural
     height : Natural
 }
 }
 
 
 Class SVG {
 Class SVG {
+    name = "SVG"
     data : String
     data : String
 }
 }
 
 
 Class Rectangle : Shape {
 Class Rectangle : Shape {
+    name = "Rectangle"
 }
 }
 
 
 Class Ellipse : Shape {
 Class Ellipse : Shape {
+    name = "Ellipse"
 }
 }
 
 
-Association contains (Group, GraphicalElement) {}
+Association contains (Group, GraphicalElement) {
+    name = "contains"
+}
 Association renders (Figure, SVG) {
 Association renders (Figure, SVG) {
+    name = "renders"
     source_lower_cardinality = 1
     source_lower_cardinality = 1
     target_lower_cardinality = 1
     target_lower_cardinality = 1
     target_upper_cardinality = 1
     target_upper_cardinality = 1

+ 31 - 9
models/MM_rendered_plot.mvc

@@ -1,34 +1,56 @@
-SimpleAttribute String {}
-SimpleAttribute Boolean {}
-SimpleAttribute Float {}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
+SimpleAttribute Float {
+    name = "Float"
+}
 
 
 Class Plot {
 Class Plot {
+    name = "Plot"
     title : String
     title : String
     legend : Boolean
     legend : Boolean
 }
 }
 
 
 Class Dataset {
 Class Dataset {
+    name = "Dataset"
     legend : String
     legend : String
     color : String
     color : String
     linestyle : String
     linestyle : String
 }
 }
 
 
 Class Datapoint {
 Class Datapoint {
+    name = "Datapoint"
     x : Float
     x : Float
     y : Float
     y : Float
 }
 }
 
 
 Class Axis {
 Class Axis {
+    name = "Axis"
     name : String
     name : String
     unit : String
     unit : String
     lim_low? : Float
     lim_low? : Float
     lim_high? : Float
     lim_high? : Float
 }
 }
 
 
-Class XAxis : Axis {}
-Class YAxis : Axis {}
+Class XAxis : Axis {
+    name = "XAxis"
+}
+Class YAxis : Axis {
+    name = "YAxis"
+}
 
 
-Association x (Plot, XAxis) {}
-Association y (Plot, YAxis) {}
-Association data (Plot, Dataset) {}
-Association point (Dataset, Datapoint) {}
+Association x (Plot, XAxis) {
+    name = "x"
+}
+Association y (Plot, YAxis) {
+    name = "y"
+}
+Association data (Plot, Dataset) {
+    name = "data"
+}
+Association point (Dataset, Datapoint) {
+    name = "point"
+}

+ 48 - 10
models/SCCD.mvc

@@ -2,12 +2,21 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 include "modelling.alh"
 include "modelling.alh"
 
 
-SimpleAttribute Action {}
-SimpleAttribute Boolean {}
-SimpleAttribute String {}
-SimpleAttribute Natural {}
+SimpleAttribute Action {
+    name = "Action"
+}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Natural {
+    name = "Natural"
+}
 
 
 Class Diagram{
 Class Diagram{
+    name = "Diagram"
     name : String
     name : String
     author : String
     author : String
     description : String
     description : String
@@ -16,6 +25,7 @@ Class Diagram{
 }
 }
 
 
 Class Class{
 Class Class{
+    name = "Class"
     name : String
     name : String
     constructor_body? : Action
     constructor_body? : Action
     destructor? : Action
     destructor? : Action
@@ -24,73 +34,100 @@ Class Class{
 }
 }
 
 
 Association diagram_classes(Diagram, Class){
 Association diagram_classes(Diagram, Class){
+    name = "diagram_classes"
     target_lower_cardinality = 1
     target_lower_cardinality = 1
 }
 }
 
 
 Class Attribute{
 Class Attribute{
+    name = "Attribute"
     name : String
     name : String
 }
 }
-Association class_attributes(Class, Attribute){}
+Association class_attributes(Class, Attribute){
+    name = "class_attributes"
+}
 
 
 Class Method{
 Class Method{
+    name = "Method"
     name : String
     name : String
     body : Action
     body : Action
 }
 }
 
 
 Association association(Class, Class){
 Association association(Class, Class){
+    name = "association"
     name : String
     name : String
     source_upper_cardinality = 1
     source_upper_cardinality = 1
 }
 }
 
 
 Association inheritance(Class, Class){
 Association inheritance(Class, Class){
+    name = "inheritance"
     priority ?: Natural
     priority ?: Natural
     source_upper_cardinality = 1
     source_upper_cardinality = 1
 }
 }
 
 
 Class State{
 Class State{
+    name = "State"
     name : String
     name : String
 }
 }
 
 
 Class BasicState : State{
 Class BasicState : State{
+    name = "BasicState"
     isInitial : Boolean
     isInitial : Boolean
     onEntryScript? : Action
     onEntryScript? : Action
     onExitScript? : Action
     onExitScript? : Action
 }
 }
 
 
 Class Raise{
 Class Raise{
+    name = "Raise"
     event : String
     event : String
     scope? : String
     scope? : String
     target? : String
     target? : String
     parameter? : Action
     parameter? : Action
 }
 }
-Association onEntryRaise (BasicState, Raise) {}
-Association onExitRaise (BasicState, Raise) {}
+Association onEntryRaise (BasicState, Raise) {
+    name = "onEntryRaise"
+}
+Association onExitRaise (BasicState, Raise) {
+    name = "onExitRaise"
+}
 
 
 Association behaviour(Class, BasicState){
 Association behaviour(Class, BasicState){
+    name = "behaviour"
     target_lower_cardinality = 1
     target_lower_cardinality = 1
     target_upper_cardinality = 1
     target_upper_cardinality = 1
 }
 }
 
 
 Association state_onentry_raises(BasicState, Raise){
 Association state_onentry_raises(BasicState, Raise){
+    name = "state_onentry_raises"
     order : Natural
     order : Natural
 }
 }
 Association state_onexit_raises(BasicState, Raise){
 Association state_onexit_raises(BasicState, Raise){
+    name = "state_onexit_raises"
     order : Natural
     order : Natural
 }
 }
 
 
-Class CompositeState : BasicState{}
+Class CompositeState : BasicState{
+    name = "CompositeState"
+}
+
 Association composite_children(CompositeState, State){
 Association composite_children(CompositeState, State){
+    name = "composite_children"
     source_upper_cardinality = 1
     source_upper_cardinality = 1
 }
 }
 
 
-Class ParallelState : BasicState{}
+Class ParallelState : BasicState{
+    name = "ParallelState"
+}
 Association parallel_children(ParallelState, CompositeState){
 Association parallel_children(ParallelState, CompositeState){
+    name = "parallel_children"
     source_upper_cardinality = 1
     source_upper_cardinality = 1
 }
 }
 
 
-Class HistoryState : State{}
+Class HistoryState : State{
+    name = "HistoryState"
+}
 
 
 Association transition(State, State){
 Association transition(State, State){
+    name = "transition"
     name: String
     name: String
     cond? : Action
     cond? : Action
     script? : Action
     script? : Action
@@ -99,5 +136,6 @@ Association transition(State, State){
     source_upper_cardinality = 1
     source_upper_cardinality = 1
 }
 }
 Association transition_raises(transition, Raise){
 Association transition_raises(transition, Raise){
+    name = "transition_raises"
     order : Natural
     order : Natural
 }
 }

+ 7 - 2
models/SCCD_Trace.mvc

@@ -1,7 +1,12 @@
-SimpleAttribute Float {}
-SimpleAttribute String {}
+SimpleAttribute Float {
+    name = "Float"
+}
+SimpleAttribute String {
+    name = "String"
+}
 
 
 Class Event{
 Class Event{
+    name = "Event"
     timestamp : Float
     timestamp : Float
     name : String
     name : String
     parameter : String
     parameter : String

+ 9 - 2
models/architecture.mvc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
 SimpleAttribute String{
 SimpleAttribute String{
+    name = "String"
     constraint = $
     constraint = $
         String function main(model : Element, name : String):
         String function main(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
             if (is_physical_string(model["model"][name])):
@@ -12,11 +13,17 @@ SimpleAttribute String{
 
 
 Class Group {
 Class Group {
     name : String
     name : String
+    name = "Group"
 }
 }
 
 
 Class Port {
 Class Port {
     name : String
     name : String
+    name = "Port"
 }
 }
 
 
-Association Connects (Port, Port) {}
-Association Contains (Group, Port) {}
+Association Connects (Port, Port) {
+    name = "Connects"
+}
+Association Contains (Group, Port) {
+    name = "Contains"
+}

+ 27 - 8
models/control_PW.mvc

@@ -1,8 +1,13 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleAttribute Boolean {}
-SimpleAttribute TriState {}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
+SimpleAttribute TriState {
+    name = "TriState"
+}
 SimpleAttribute String{
 SimpleAttribute String{
+    name = "String"
     constraint = $
     constraint = $
         String function constraint(model : Element, name : String):
         String function constraint(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
             if (is_physical_string(model["model"][name])):
@@ -13,18 +18,32 @@ SimpleAttribute String{
 }
 }
 
 
 Class State {
 Class State {
+    name = "State"
     isInitial : Boolean
     isInitial : Boolean
     isError : Boolean
     isError : Boolean
     name : String
     name : String
 }
 }
 
 
-Class Up : State {}
-Class Down : State {}
-Class Neutral : State {}
+Class Up : State {
+    name = "Up"
+}
+Class Down : State {
+    name = "Down"
+}
+Class Neutral : State {
+    name = "Neutral"
+}
 
 
 Association Transition (State, State) {
 Association Transition (State, State) {
+    name = "Transition"
     objDetected : TriState
     objDetected : TriState
 }
 }
-Association UpPressed : Transition (State, State) {}
-Association NonePressed : Transition (State, State) {}
-Association DownPressed : Transition (State, State) {}
+Association UpPressed : Transition (State, State) {
+    name = "UpPressed"
+}
+Association NonePressed : Transition (State, State) {
+    name = "NonePressed"
+}
+Association DownPressed : Transition (State, State) {
+    name = "DownPressed"
+}

+ 16 - 5
models/environment_PW.mvc

@@ -1,13 +1,24 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleAttribute Boolean {}
-SimpleAttribute Natural{}
-SimpleAttribute String{}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
+SimpleAttribute Natural{
+    name = "Natural"
+}
+SimpleAttribute String{
+    name = "String"
+}
 
 
-Class Group {}
+Class Group {
+    name = "Group"
+}
 Class Event {
 Class Event {
+    name = "Event"
     initial : Boolean
     initial : Boolean
     name : String
     name : String
 }
 }
 
 
-Association Contains (Group, Event) {}
+Association Contains (Group, Event) {
+    name = "Contains"
+}

+ 25 - 7
models/petrinet_ports.mvc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
 SimpleAttribute Natural{
 SimpleAttribute Natural{
+    name = "Natural"
     constraint = $
     constraint = $
         String function constraint(model : Element, name : String):
         String function constraint(model : Element, name : String):
             if (is_physical_int(model["model"][name])):
             if (is_physical_int(model["model"][name])):
@@ -11,6 +12,7 @@ SimpleAttribute Natural{
 }
 }
 
 
 SimpleAttribute String{
 SimpleAttribute String{
+    name = "String"
     constraint = $
     constraint = $
         String function constraint(model : Element, name : String):
         String function constraint(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
             if (is_physical_string(model["model"][name])):
@@ -20,18 +22,34 @@ SimpleAttribute String{
         $
         $
 }
 }
 
 
-SimpleAttribute Boolean {}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
 
 
 Class Named {
 Class Named {
+    name = "Named"
     name : String
     name : String
 }
 }
 Class Place : Named {
 Class Place : Named {
+    name = "Place"
     tokens : Natural
     tokens : Natural
 }
 }
-Class Transition : Named {}
-Class Port : Named {}
+Class Transition : Named {
+    name = "Transition"
+}
+Class Port : Named {
+    name = "Port"
+}
 
 
-Association P2T (Place, Transition) {}
-Association T2P (Transition, Place) {}
-Association PortPlace (Port, Place) {}
-Association Related (Port, Port) {}
+Association P2T (Place, Transition) {
+    name = "P2T"
+}
+Association T2P (Transition, Place) {
+    name = "T2P"
+}
+Association PortPlace (Port, Place) {
+    name = "PortPlace"
+}
+Association Related (Port, Port) {
+    name = "Related"
+}

+ 4 - 0
models/petrinets.mvc

@@ -2,15 +2,19 @@ SimpleAttribute Natural {}
 SimpleAttribute String {}
 SimpleAttribute String {}
 
 
 Class Place {
 Class Place {
+    name = "Place"
     tokens : Natural
     tokens : Natural
     name : String
     name : String
 }
 }
 Class Transition {
 Class Transition {
+    name = "Transition"
     name : String
     name : String
 }
 }
 Association P2T (Place, Transition) {
 Association P2T (Place, Transition) {
+    name = "P2T"
     weight : Natural
     weight : Natural
 }
 }
 Association T2P (Transition, Place) {
 Association T2P (Transition, Place) {
+    name = "T2P"
     weight : Natural
     weight : Natural
 }
 }

+ 26 - 8
models/plant_PW.mvc

@@ -1,17 +1,35 @@
-SimpleAttribute TriState {}
-SimpleAttribute String {}
-SimpleAttribute Boolean {}
+SimpleAttribute TriState {
+    name = "TriState"
+}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
 
 
 Class State {
 Class State {
+    name = "State"
     name : String
     name : String
     isInitial : Boolean
     isInitial : Boolean
 }
 }
-Class ErrorState : State {}
-Class NormalState : State {}
+Class ErrorState : State {
+    name = "ErrorState"
+}
+Class NormalState : State {
+    name = "NormalState"
+}
 
 
 Association Transition (State, State) {
 Association Transition (State, State) {
+    name = "Transition"
     objPresent : TriState
     objPresent : TriState
 }
 }
-Association OnUp : Transition (State, State) {}
-Association OnDown : Transition (State, State) {}
-Association OnNeutral : Transition (State, State) {}
+Association OnUp : Transition (State, State) {
+    name = "OnUp"
+}
+Association OnDown : Transition (State, State) {
+    name = "OnDown"
+}
+Association OnNeutral : Transition (State, State) {
+    name = "OnNeutral"
+}

+ 7 - 2
models/query.mvc

@@ -2,10 +2,15 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 include "modelling.alh"
 include "modelling.alh"
 
 
-SimpleAttribute String {}
-SimpleAttribute Natural {}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Natural {
+    name = "Natural"
+}
 
 
 Class Place {
 Class Place {
+    name = "Place"
     name : String
     name : String
     tokens : Natural
     tokens : Natural
     lower_cardinality = 1
     lower_cardinality = 1

+ 16 - 4
models/reachability_graph.mvc

@@ -2,27 +2,39 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 include "modelling.alh"
 include "modelling.alh"
 
 
-SimpleAttribute String {}
-SimpleAttribute Natural {}
-SimpleAttribute Boolean {}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Natural {
+    name = "Natural"
+}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
 
 
 Class State {
 Class State {
+    name = "State"
     name : String
     name : String
     error : Boolean
     error : Boolean
 }
 }
 Class InitialState : State {
 Class InitialState : State {
+    name = "InitialState"
     lower_cardinality = 1
     lower_cardinality = 1
     upper_cardinality = 1
     upper_cardinality = 1
 }
 }
 
 
 Class Place {
 Class Place {
+    name = "Place"
     name : String
     name : String
     tokens : Natural
     tokens : Natural
 }
 }
 Association Transition (State, State) {
 Association Transition (State, State) {
+    name = "Transition"
     name : String
     name : String
 }
 }
-Association Contains (State, Place) {}
+Association Contains (State, Place) {
+    name = "Contains"
+}
 
 
 GlobalConstraint {
 GlobalConstraint {
     global_constraint = $
     global_constraint = $

+ 2 - 0
models/requirements.mvc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
 SimpleAttribute String{
 SimpleAttribute String{
+    name = "String"
     constraint = $
     constraint = $
         String function constraint_String(model : Element, name : String):
         String function constraint_String(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
             if (is_physical_string(model["model"][name])):
@@ -11,6 +12,7 @@ SimpleAttribute String{
 }
 }
 
 
 Class UseCase {
 Class UseCase {
+    name = "UseCase"
     name : String
     name : String
     scope : String
     scope : String
     level : String
     level : String

+ 11 - 3
models/trace.mvc

@@ -1,13 +1,21 @@
-SimpleAttribute String {}
-SimpleAttribute Float {}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Float {
+    name = "Float"
+}
 
 
 Class Signal {
 Class Signal {
+    name = "Signal"
     name : String
     name : String
 }
 }
 
 
 Class Point {
 Class Point {
+    name = "Point"
     x : Float
     x : Float
     y : Float
     y : Float
 }
 }
 
 
-Association contains (Signal, Point) {}
+Association contains (Signal, Point) {
+    name = "contains"
+}

+ 9 - 8
unit/test_all.py

@@ -145,6 +145,7 @@ class TestModelverse(unittest.TestCase):
 
 
         # Create something in the formalism
         # Create something in the formalism
         instantiate("test/Empty", "Class", ID="A")
         instantiate("test/Empty", "Class", ID="A")
+        attr_assign("test/Empty", "A", "name", "A")
         assert verify("test/Empty", "formalisms/SimpleClassDiagrams") == "OK"
         assert verify("test/Empty", "formalisms/SimpleClassDiagrams") == "OK"
 
 
         # Now instantiate that in the model as well, which now works
         # Now instantiate that in the model as well, which now works
@@ -377,16 +378,16 @@ class TestModelverse(unittest.TestCase):
         
         
         got = element_list_nice("test/PetriNet")
         got = element_list_nice("test/PetriNet")
         expected = \
         expected = \
-            [{'id': 'Natural', 'type': 'SimpleAttribute', 'constraint': None},
-             {'id': 'String', 'type': 'SimpleAttribute', 'constraint': None},
-             {'id': 'Place', 'type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': None},
+            [{'id': 'Natural', 'type': 'SimpleAttribute', 'constraint': None, 'name': 'Natural'},
+             {'id': 'String', 'type': 'SimpleAttribute', 'constraint': None, 'name': 'String'},
+             {'id': 'Place', 'type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': None, 'name': 'Place'},
              {'id': 'Place_tokens', 'type': 'AttributeLink', '__source': 'Place', '__target': 'Natural', 'name': 'tokens', 'optional': False, 'constraint': None},
              {'id': 'Place_tokens', 'type': 'AttributeLink', '__source': 'Place', '__target': 'Natural', 'name': 'tokens', 'optional': False, 'constraint': None},
              {'id': 'Place_name', 'type': 'AttributeLink', '__source': 'Place', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': None},
              {'id': 'Place_name', 'type': 'AttributeLink', '__source': 'Place', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': None},
-             {'id': 'Transition', 'type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': None},
+             {'id': 'Transition', 'type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': None, 'name': 'Transition'},
              {'id': 'Transition_name', 'type': 'AttributeLink', '__source': 'Transition', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': None},
              {'id': 'Transition_name', 'type': 'AttributeLink', '__source': 'Transition', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': None},
-             {'id': 'P2T', 'type': 'Association', '__source': 'Place', '__target': 'Transition', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': None},
+             {'id': 'P2T', 'type': 'Association', '__source': 'Place', '__target': 'Transition', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': None, 'name': 'P2T'},
              {'id': 'P2T_weight', 'type': 'AttributeLink', '__source': 'P2T', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': None},
              {'id': 'P2T_weight', 'type': 'AttributeLink', '__source': 'P2T', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': None},
-             {'id': 'T2P', 'type': 'Association', '__source': 'Transition', '__target': 'Place', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': None},
+             {'id': 'T2P', 'type': 'Association', '__source': 'Transition', '__target': 'Place', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': None, 'name': 'T2P'},
              {'id': 'T2P_weight', 'type': 'AttributeLink', '__source': 'T2P', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': None}
              {'id': 'T2P_weight', 'type': 'AttributeLink', '__source': 'T2P', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': None}
             ]
             ]
         compare_unordered_lists(got, expected)
         compare_unordered_lists(got, expected)
@@ -416,8 +417,8 @@ class TestModelverse(unittest.TestCase):
             else:
             else:
                 assert len(entry) == 4
                 assert len(entry) == 4
                 count_edges += 1
                 count_edges += 1
-        assert count_nodes == 14
-        assert count_edges == 17
+        assert count_nodes == 20
+        assert count_edges == 23
 
 
         count_nodes = 0
         count_nodes = 0
         count_edges = 0
         count_edges = 0