How to Create a Chen Entity-Relationship Diagram

This tutorial guides you through creating a Chen Entity-Relationship Diagram (ERD) for a simple Content Management System (CMS) using Software Ideas Modeler. You will learn not only the mechanics of drawing the ERD but also the theoretical underpinnings of using entities like weak entities, weak relationships, derived attributes, and more.

Step 1: Setting Up the Diagram

  • Create a New Diagram: Navigate to the 'Project' tab in the ribbon and click on 'Add New Diagram'. In the dialog that appears, select the 'Entity Relationship' category on the left and choose 'Chen Entity-Relationship Diagram' from the options on the right.
  • Name Your Diagram: Enter 'Simple CMS' in the Name box and click 'OK'. An empty canvas will appear, ready for you to start adding elements.

Step 2: Adding Entities

  • Add Primary Entities: Use the 'Entity' tool from the toolbox to drag onto the canvas. This way create the following entities: 'Page', 'Category', and 'Author'.
  • Add Weak Entity: Use the 'Weak Entity' tool for the 'Chapter' entity. Drag the Weak Entity tool from the toolbox to the diagram editor. Then enter the name - 'Chapter'.
    • Why Use a Weak Entity? It does not have a primary key that can identify it independently and relies on another entity ('Page') for its identity.

Step 3: Establishing Relationships

  • Create Weak Relationship: Select the 'Weak Relationship' tool. Drag from 'Page' to 'Chapter'. Name this relationship 'Contains'.
    • Why Use a Weak Relationship? A weak relationship is used because 'Chapter' cannot exist without 'Page'. This reflects the database rule that every 'Chapter' must be associated with a 'Page', showing dependency.
  • Set Participation Connectors:
    • From 'Page' to 'Contains', use the 'Participation' tool to indicate that a 'Page' might not necessarily have a 'Chapter' (optional participation).
    • From 'Contains' to 'Chapter', use the 'Total Participation' tool to show that every 'Chapter' must be linked to a 'Page' (mandatory participation).

Step 4: Defining Attributes

  • Add Attributes to Entities:
    • For 'Page', right-click and choose 'Add Multiple Attributes'. Type 'Page ID', 'Title', 'Creation Date', and 'Days Since Published'. Connect these using the 'Attribute Connector' - select all attributes and drag the Attribute Connector tool from the toolbox to the Page entity on the diagram canvas.
    • For 'Chapter', add attributes like 'Order Index', 'Title', and 'Content'. Select the 'Chapter' entity and use the 'Add Attribute' button in the context bar for simplicity.
  • Specify Attribute Types:
    • Key Attribute: Right-click 'Page ID' and select 'Key' from the context menu to define it as the primary key.
    • Derived Attribute: Mark 'Days Since Published' as derived since its value can be calculated from 'Creation Date', reducing data redundancy.
    • Weak Key: Mark 'Order Index' in 'Chapter' as a weak key. A weak key is used when an attribute cannot uniquely identify an entity record on its own but can do so in combination with another attribute (here, in combination with the primary key of 'Page').

Step 5: Adding Associative Entity

  • Create Associative Entity Between 'Category' and 'Page': Select both 'Page' and 'Category', then click 'Create Associative Entity'. Name it 'Page Category'.
    • Why Use an Associative Entity? This is used instead of a simple relationship to allow for the inclusion of additional attributes that pertain to the association itself, like 'Priority'.
  • Add Attributes to 'PageCategory': Add an attribute 'Priority' to indicate the importance or ranking of pages within categories.

Step 6: Adding and Connecting a Multivalue Attribute

  • Select the Multivalue Attribute Tool:
    • In the toolbox, find and select the 'Multivalue Attribute' tool. This tool is specifically designated for attributes that can hold several values under a single attribute name, which is ideal for situations where an entity might be associated with multiple data points, such as tags for a category.
  • Add the Multivalue Attribute to the Diagram:
    • With the 'Multivalue Attribute' tool selected, click and drag on the canvas near the 'Category' entity where you want to place the attribute. Once you release the mouse button, an edit box will appear where you can enter you the attribute name.
  • Name the Attribute:
    • Type 'Tags' as the name of the attribute. This name reflects the attribute’s purpose — to store multiple tags that can be associated with each category in the CMS.
  • Connect the Attribute to the 'Category' Entity:
    • To visually and functionally link the 'Tags' attribute to the 'Category' entity, you will need to use the 'Attribute Connector' tool from the toolbox. Select the 'Attribute Connector' tool.
    • Click on the 'Tags' attribute you just created, and drag towards the 'Category' entity. Release the mouse when you hover over the 'Category' entity to establish a connection.

New Comment

Comment