Browse Source

Add "name" attribute in SCD

Yentl Van Tendeloo 4 years ago
parent
commit
af69ae1907

+ 43 - 8
bootstrap/90_core_formalism.mvc

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

+ 6 - 2
bootstrap/bottom.mvc

@@ -1,8 +1,12 @@
 import models/SimpleClassDiagrams as SCD
 
 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

+ 22 - 22
bootstrap/conformance_finding.alc

@@ -49,30 +49,30 @@ Boolean function find_type_mapping(model : Element):
 		node_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!
+		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 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, "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_node(location, scd)
 	// 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):
 			attr_name = set_pop(keys)
 			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!
 

+ 29 - 7
bootstrap/pm.mvc

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

+ 5 - 1
bootstrap/tracability.mvc

@@ -4,13 +4,17 @@ include "primitives.alh"
 include "object_operations.alh"
 
 SimpleClassDiagrams Tracability {
-    SimpleAttribute String {}
+    SimpleAttribute String {
+        name = "String"
+    }
 
     Class Reference {
         name : String
+        name = "Reference"
     }
     Association TracabilityLink {
         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 {
+    name = "Place"
     tokens : Natural
     name : String
 }
 Class Transition {
+    name = "Transition"
     name : String
 }
 Association P2T (Place, Transition) {
+    name = "P2T"
     weight : Natural
 }
 Association T2P (Transition, Place) {
+    name = "T2P"
     weight : Natural
 }

+ 20 - 3
models/MM_rendered_graphical.mvc

@@ -1,54 +1,71 @@
 include "primitives.alh"
 
-SimpleAttribute Natural {}
-SimpleAttribute String {}
+SimpleAttribute Natural {
+    name = "Natural"
+}
+SimpleAttribute String {
+    name = "String"
+}
 
 Class GraphicalElement {
+    name = "GraphicalElement"
     x : Natural
     y : Natural
     __asid? : String
 }
 
 Class Group : GraphicalElement {
+    name = "Group"
 }
 
 Class LineElement : GraphicalElement {
+    name = "LineElement"
     lineWidth : Natural
     lineColour : String
 }
 
 Class Text : LineElement {
+    name = "Text"
     text : String
 }
 
 Class Line : LineElement {
+    name = "Line"
     targetX : Natural
     targetY : Natural
 }
 
 Class Shape : LineElement {
+    name = "Shape"
     fillColour : String
     width : Natural
     height : Natural
 }
 
 Class Figure : GraphicalElement {
+    name = "Figure"
     width : Natural
     height : Natural
 }
 
 Class SVG {
+    name = "SVG"
     data : String
 }
 
 Class Rectangle : Shape {
+    name = "Rectangle"
 }
 
 Class Ellipse : Shape {
+    name = "Ellipse"
 }
 
-Association contains (Group, GraphicalElement) {}
+Association contains (Group, GraphicalElement) {
+    name = "contains"
+}
 Association renders (Figure, SVG) {
+    name = "renders"
     source_lower_cardinality = 1
     target_lower_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 {
+    name = "Plot"
     title : String
     legend : Boolean
 }
 
 Class Dataset {
+    name = "Dataset"
     legend : String
     color : String
     linestyle : String
 }
 
 Class Datapoint {
+    name = "Datapoint"
     x : Float
     y : Float
 }
 
 Class Axis {
+    name = "Axis"
     name : String
     unit : String
     lim_low? : 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 "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{
+    name = "Diagram"
     name : String
     author : String
     description : String
@@ -16,6 +25,7 @@ Class Diagram{
 }
 
 Class Class{
+    name = "Class"
     name : String
     constructor_body? : Action
     destructor? : Action
@@ -24,73 +34,100 @@ Class Class{
 }
 
 Association diagram_classes(Diagram, Class){
+    name = "diagram_classes"
     target_lower_cardinality = 1
 }
 
 Class Attribute{
+    name = "Attribute"
     name : String
 }
-Association class_attributes(Class, Attribute){}
+Association class_attributes(Class, Attribute){
+    name = "class_attributes"
+}
 
 Class Method{
+    name = "Method"
     name : String
     body : Action
 }
 
 Association association(Class, Class){
+    name = "association"
     name : String
     source_upper_cardinality = 1
 }
 
 Association inheritance(Class, Class){
+    name = "inheritance"
     priority ?: Natural
     source_upper_cardinality = 1
 }
 
 Class State{
+    name = "State"
     name : String
 }
 
 Class BasicState : State{
+    name = "BasicState"
     isInitial : Boolean
     onEntryScript? : Action
     onExitScript? : Action
 }
 
 Class Raise{
+    name = "Raise"
     event : String
     scope? : String
     target? : String
     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){
+    name = "behaviour"
     target_lower_cardinality = 1
     target_upper_cardinality = 1
 }
 
 Association state_onentry_raises(BasicState, Raise){
+    name = "state_onentry_raises"
     order : Natural
 }
 Association state_onexit_raises(BasicState, Raise){
+    name = "state_onexit_raises"
     order : Natural
 }
 
-Class CompositeState : BasicState{}
+Class CompositeState : BasicState{
+    name = "CompositeState"
+}
+
 Association composite_children(CompositeState, State){
+    name = "composite_children"
     source_upper_cardinality = 1
 }
 
-Class ParallelState : BasicState{}
+Class ParallelState : BasicState{
+    name = "ParallelState"
+}
 Association parallel_children(ParallelState, CompositeState){
+    name = "parallel_children"
     source_upper_cardinality = 1
 }
 
-Class HistoryState : State{}
+Class HistoryState : State{
+    name = "HistoryState"
+}
 
 Association transition(State, State){
+    name = "transition"
     name: String
     cond? : Action
     script? : Action
@@ -99,5 +136,6 @@ Association transition(State, State){
     source_upper_cardinality = 1
 }
 Association transition_raises(transition, Raise){
+    name = "transition_raises"
     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{
+    name = "Event"
     timestamp : Float
     name : String
     parameter : String

+ 9 - 2
models/architecture.mvc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 
 SimpleAttribute String{
+    name = "String"
     constraint = $
         String function main(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
@@ -12,11 +13,17 @@ SimpleAttribute String{
 
 Class Group {
     name : String
+    name = "Group"
 }
 
 Class Port {
     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"
 
-SimpleAttribute Boolean {}
-SimpleAttribute TriState {}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
+SimpleAttribute TriState {
+    name = "TriState"
+}
 SimpleAttribute String{
+    name = "String"
     constraint = $
         String function constraint(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
@@ -13,18 +18,32 @@ SimpleAttribute String{
 }
 
 Class State {
+    name = "State"
     isInitial : Boolean
     isError : Boolean
     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) {
+    name = "Transition"
     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"
 
-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 {
+    name = "Event"
     initial : Boolean
     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"
 
 SimpleAttribute Natural{
+    name = "Natural"
     constraint = $
         String function constraint(model : Element, name : String):
             if (is_physical_int(model["model"][name])):
@@ -11,6 +12,7 @@ SimpleAttribute Natural{
 }
 
 SimpleAttribute String{
+    name = "String"
     constraint = $
         String function constraint(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
@@ -20,18 +22,34 @@ SimpleAttribute String{
         $
 }
 
-SimpleAttribute Boolean {}
+SimpleAttribute Boolean {
+    name = "Boolean"
+}
 
 Class Named {
+    name = "Named"
     name : String
 }
 Class Place : Named {
+    name = "Place"
     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 {}
 
 Class Place {
+    name = "Place"
     tokens : Natural
     name : String
 }
 Class Transition {
+    name = "Transition"
     name : String
 }
 Association P2T (Place, Transition) {
+    name = "P2T"
     weight : Natural
 }
 Association T2P (Transition, Place) {
+    name = "T2P"
     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 {
+    name = "State"
     name : String
     isInitial : Boolean
 }
-Class ErrorState : State {}
-Class NormalState : State {}
+Class ErrorState : State {
+    name = "ErrorState"
+}
+Class NormalState : State {
+    name = "NormalState"
+}
 
 Association Transition (State, State) {
+    name = "Transition"
     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 "modelling.alh"
 
-SimpleAttribute String {}
-SimpleAttribute Natural {}
+SimpleAttribute String {
+    name = "String"
+}
+SimpleAttribute Natural {
+    name = "Natural"
+}
 
 Class Place {
+    name = "Place"
     name : String
     tokens : Natural
     lower_cardinality = 1

+ 16 - 4
models/reachability_graph.mvc

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

+ 2 - 0
models/requirements.mvc

@@ -1,6 +1,7 @@
 include "primitives.alh"
 
 SimpleAttribute String{
+    name = "String"
     constraint = $
         String function constraint_String(model : Element, name : String):
             if (is_physical_string(model["model"][name])):
@@ -11,6 +12,7 @@ SimpleAttribute String{
 }
 
 Class UseCase {
+    name = "UseCase"
     name : String
     scope : 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 {
+    name = "Signal"
     name : String
 }
 
 Class Point {
+    name = "Point"
     x : 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
         instantiate("test/Empty", "Class", ID="A")
+        attr_assign("test/Empty", "A", "name", "A")
         assert verify("test/Empty", "formalisms/SimpleClassDiagrams") == "OK"
 
         # 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")
         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_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': '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': '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}
             ]
         compare_unordered_lists(got, expected)
@@ -416,8 +417,8 @@ class TestModelverse(unittest.TestCase):
             else:
                 assert len(entry) == 4
                 count_edges += 1
-        assert count_nodes == 14
-        assert count_edges == 17
+        assert count_nodes == 20
+        assert count_edges == 23
 
         count_nodes = 0
         count_edges = 0