About entity-relationship formalism


Before starting to create the FSA formalism, let's get a look on the language we use in AToM3 to create such formalisms : Entity-Relationship. Please close the current formalism (FSA) and open the file named "EntityRelationship.py" in the ERModels directory:  

 

The interface we have by default when loading AToM3 will appear on your screen:  

 

The entity-relationship formalism contains two distinct constructs that are entities and relationships. An entity may be connected with other entities through the relationships. Now, If we get a closer look on each button of the graphical user interface:

**Note: Those buttons work for any loaded formalism in the same way that they work for Entity-Relationship.  


Entity-Relationship options  

New Entity  

   

This button creates a new entity where the mouse was clicked on the canvas.  Example  

New Relationship  

   

This button creates a new relationship where the mouse was clicked on the canvas.  Example  


Model options  

Edit Entity  

   

After being pressed, this button generates the options window of an object clicked on the canvas.  Example  

Connect  

   

After being pressed, this button connects the two objects on the canvas specified by the user.  Example  

Delete  

   

After being pressed, this button deletes an object on the canvas specified by the user.  

Insert Model  

   

Allow to create composite models where a node of the graph is actually a model itself.
**Note: this is not used frequently**  

Expand Model  

   

Allow to create composite models where a node of the graph is actually a model itself.
**Note: this is not used frequently**  


Visual Options  

Smooth  

   

After being pressed, this button curves an inserted point in a connection.  Example  

Insert point  

   

After being pressed, this button insert a point in a connection, allowing it to avoid other objects.  Example  

Delete point  

   

After being pressed, this button deletes a point from a connection.  

Change connector  

   

After being pressed, this button changes the connector of a connection to another connector selected by the user  


Now, lets explore in details the properties of entities and relationships. If you click on "edit entity" and then on any entity/relationship on the canvas, you should get something like this:  

 

Name  

   

The name that the entity/relationship will have in the generated formalism. For example, "state" was the name of an entity in the meta-model of the formalism we used to create the water FSA.  

Cardinalities  

   

The allowed number of connections the current entity/relationship can have as a source or as a destination with other objects in the generated formalism.  

Attributes  

   

The attributes an entity/relationship will have in the generated formalism. Those attributes must be of ATOM3Type. For example, in the FSA formalism meta-model, the "state" entity had an ATOM3Boolean attribute "isInitial".  

Constraints  

   

A list of constraints (written in python code) related to the current entity/relationship. For example, we may want to prevent the user from giving specific values to some attribute. A violated constraint will issue a warning to the user at the modeling level.  

Appearance  

   

The appearance an entity/relationship will have in the generated formalism. For example, in the FSA formalism meta-model, the appearance of the entity "state" was colored circle.  

There are also properties for the model. If you select "edit model attributes" in the  model tab of the top menu, you will get a properties  screen similar to what we had for the entity/relationship. However, those properties apply to the whole model (so there are no global "appearance" or "cardinalities"). For example, you could have a global constraint affecting many objects on the canvas (like a unique name constraint for the "states").  

You can save your current work by  selecting "save as" in the file tab of the top menu. **Note on naming convention: Nameofyourmodel_ER_mdl.py** <-- start with capital letter
Also, it's always a good idea to save everything in your working directory.  

In short, the Entity-Relationship formalism is used to create new formalisms. We do that by connecting entities with relationships and specifying the names, cardinalities, attributes, constraints and appearance the entities/relationships will have in the generated formalism.