Updated on 2022-09-23 GMT+08:00

Designing Logical Models

A logical model is an entity relationship diagram that accurately describes business rules based on entities and their relationships. Logical models must ensure the correctness and consistency of the data structure required by services and use a series of standard rules to reflect the features of various objects, and accurately define the relationships between entities.

In addition, logical models provide a reliable reference for constructing physical models and can be converted into physical models. Logical models are key to a successful database design.

The following parts are included in this topic:

Considerations in Logical Model Design

  • You must consider not only the current business status, but also the future business development.
  • Personnel who are familiar with the businesses must participate in the modeling. In this way, the business requirements can be fully integrated into the models.
  • Converting the logical model to the physical model must be efficient.
  • You must consider physical features during physical modeling.
  • Each entity, attribute, and relationship must be consistent with the information in the actual business.

Creating a Logical Model

  1. On the DataArts Studio console, locate an instance and click Access. On the displayed page, locate a workspace and click DataArts Architecture.
    Figure 1 DataArts Architecture
  1. On the DataArts Architecture page, choose Models > ER Modeling in the left navigation pane.
  2. On the ER Modeling page, if no ER model has been created, the system displays a dialog box asking you to create one. If you have created ER models before, click to create models.
    Figure 2 Creating a hierarchical governance model
    Figure 3 ER Modeling page
  3. In the dialog box displayed, set the parameters and click OK.
    Figure 4 Creating a logical model
    Table 1 Parameters for creating a logical model

    Parameter

    Description

    Name

    Only letters, numbers, and underscores (_) are allowed.

    Description

    A description of the logical model.

Creating and Publishing a Logical Entity

A logical entity is a logical table. After creating a logical model, you can create a logical entity in the model.

  1. On the DataArts Architecture page, choose Models > ER Modeling in the left navigation pane.
  2. On the displayed page, click a logical model to access its management page. Then, click Create.
  3. On the displayed page, configure parameters as prompted.

    1. Set the basic parameters.
      Figure 5 Basic Settings
      Table 2 Parameters on the Basic Settings tab page

      Parameter

      Description

      * Subject

      Select a subject from the drop-down list box.

      Logical Entity Code

      You can select Auto Generate or Custom.

      * Table Name

      Logic entity name. It must start with letters. Only letters, digits, and the following special characters are allowed: ()-_

      * Table Code

      Name of the physical table converted from the logical entity. Table codes cannot start with numbers. Only letters, numbers, and the following special characters are allowed: _${}

      Parent Logical Entity

      Set a parent logical entity, which is inherited by child logical entities. Common logical entities and attributes can be logically abstracted as a parent logical entity. After specific attributes are added to the parent logical entity, a child logical entity is generated. The modifications to the attributes in a parent logical entity affect all child logical entities that inherit it.

      Tag

      Tags are custom identifiers that help you classify and search for data assets. After adding a tag, you can search for related data assets in the DataArts Catalog module with ease.

      Click . In the dialog box displayed, select one or more existing tags, or enter a new tag name and press Enter. You can also go to the Tags page of the DataArts Catalog module to add a tag. Then, return to this page and select the newly added tag from the drop-down list box. For details, see Tags.

      Owner

      You can enter an owner name or select an existing owner.

      * Description

      A description of the table to create. It allows 1 to 200 characters.

    2. On the Logical Entity Attributes page, add required attributes. Table 3 lists the parameters for logical entity attributes.
      Figure 6 Adding a logical entity attribute
      Table 3 Parameters for logical entity attributes

      Parameter

      Description

      *Field Name

      It must start with letters. Only letters, digits, and the following special characters are allowed: ()-_

      *Field English Name

      Only letters, numbers, and underscores (_) are allowed. A field code must start with a letter.

      *Code

      Code of the logical attribute. If the logical entity uses a custom code, the code of the logical attribute can be customized or automatically generated.

      Data Type

      Data type of the attribute. If you cannot find a desired data type from the drop-down list box, you can add a data type by referring to Data Types.

      Data Standard

      If you have created data standards, click to select one to associate with the logical entity attribute. If Create Data Quality Jobs is selected for Model Design Process on the Function Settings tab page in Configuration Center and a logical entity attribute is associated with a data standard, a quality job is automatically generated after a logical entity attribute is published. A quality rule is generated for each logical entity attribute associated with the data standard. The quality of the logical entity attribute is monitored based on the data standard. You can access the Quality Job page of DataArts Quality to view the job details.

      If no data standard is available, create one. See Creating Data Standards for details.

      Primary Key

      If this parameter is selected, the attribute is a primary key.

      Partition

      If this parameter is selected, the attribute is a partition field.

      Not Null

      Whether the parameter value can be left empty.

      Tag

      You can click to add a tag for the logical entity attribute.

      • In the dialog box displayed, select one or more existing tags. If no tag has been added, you can go to the Tags page of the DataArts Catalog module to add a tag. For details, see Tags.
      • In the dialog box displayed, enter a new tag name and press Enter. Tag names can contain letters, numbers, and underscores (_), but cannot start with underscores (_).

      Description

      A description of the table to create.

    3. On the Relationships tab page, click Add to create a relationship.

      A relationship refers to the association between a parent and a child entity (also called a primary and a secondary entity). It describes how an entity is associated with another entity, or the impact of an entity's behavior on another entity. Relationships between entities in a data model are particularly important and must be accurately defined. Otherwise, the actual business rules cannot be accurately described in the data model, and data consistency is greatly damaged.

      For example, if the student ID attribute of a score table is the primary key for a student table, the relationship between the two tables designed according to the third normal form (3NF) is as follows:
      • Child logical entity: score table
      • Child logical entity attribute FK: student ID
      • Child to parent:
      • Parent logical entity: student table
      • Parent logical entity attribute PK: student ID
      • Parent to child:
      Figure 7 Adding a relationship
      Table 4 Parameters on the Relationships tab page

      Parameter

      Description

      Name

      Name of the relationship

      Child Logical Entity

      Select a child logical entity from the drop-down list box. Click to set the current logical entity as a child logical entity.

      For example, if the student ID attribute of a score table is the primary key for a student table, the child logical entity is the score table, and the corresponding parent logical entity is the student table.

      Child Logical Entity Attribute FK

      Foreign key of the child logical entity attribute. The attribute of the child logical entity must be the foreign key of the parent logical entity.

      For example, if the student ID attribute of a score table is the primary key for a student table, the foreign key of the child logical entity attribute is the student ID in the score table.

      Child to Table

      indicates that each piece of data in the child logical entity corresponds to only one piece of data in the parent logical entity.

      indicates that each piece of data in the child logical entity corresponds to at most one piece of data in the parent logical entity.

      indicates that one piece of data in the child logical entity corresponds to multiple pieces of data in the parent logical entity.

      indicates that one piece of data in the child logical entity corresponds to one piece of data in the parent logical entity at least.

      Parent to Child

      indicates that the data in the parent logical entity is in one-to-one relationship with the data in the child logical entity.

      indicates that each piece of data in the parent logical entity corresponds to at most one piece of data in the child logical entity.

      indicates that one piece of data in the parent logical entity corresponds to multiple pieces of data in the child logical entity.

      indicates that each piece of data in the parent logical entity corresponds to at least one piece of data in the child logical entity.

      Parent Logical Entity

      Select a logical entity that has a logical relationship with the selected child logical entity.

      For example, if the student ID attribute of a score table is the primary key for a student table, the parent logical entity is the student table, and the corresponding child logical entity is the score table.

      Parent Logical Entity Attribute PK

      Primary key of the parent logical entity attribute. The attribute of the parent logical entity must be the primary key of the parent logical entity.

      For example, if the student ID attribute of a score table is the primary key for a student table, the primary key of the parent logical entity attribute is the student ID in the student table.

      Role

      You can customize a role name to identify the relationship.

      Operation

      Click to delete a relationship. Click to edit the relationship.

    4. On the Mappings page, click Create to create a mapping. Then click Save. Mapping means setting up a mapping relationship between the source and destination logical entity.
      Figure 8 Creating a mapping
      • Mapping is automatically generated when a mapping is created. You can change the value.
      • Source Logical Entity: If data comes from multiple logical entities of a model, you can click next to a logical entity to establish a JOIN relationship between the logical entity and another logical entity.
        Figure 9 Setting the JOIN condition for the source table
        Table 5 JOIN conditions

        Parameter

        Description

        Joined Logical Entity

        Select a logical entity for which you want to establish a JOIN relationship with the source logical entity.

        Joined Mode

        Left JOIN, right JOIN, inner JOIN, and outer JOIN are represented from left to right.

        Joined Attribute

        Generally, the JOIN attribute in the source logical entity is the same as that in the joined logical entity. You can click or to add or delete a JOIN attribute. The relationship between JOIN attributes is AND.

      • Logical Attribute Mapping: Select a source attribute with the same meaning as the current attribute.

  4. Click Publish, select a reviewer, and click Submit.

    Wait for the reviewer to approve the application. After the application is approved, return to the model list and view the created logical entity in the list.

    By default, Synchronize logical assets is selected for Model Design Process on the Functions tab page of the Configuration Center page.

    • For new logical models, you can click Publish to synchronize them to the logical assets of the DataArts Catalog module.
    • For historical logical models, you can click More and select Synchronize from the drop-down list box to synchronize them to the logical assets of the DataArts Catalog module.

Converting a Logical Model to a Physical Model

After a logical model is created, you can convert it to a new physical model or an existing physical model.

  1. On the DataArts Studio console, locate an instance and click Access. On the displayed page, locate a workspace and click DataArts Architecture.
    Figure 10 DataArts Architecture
  1. On the DataArts Architecture page, choose Models > ER Modeling in the left navigation pane.
  2. Find the required logical model and click the conversion button on the model.
    Figure 11 Logical model conversion
  3. In the Convert to Physical Model dialog box, set the parameters and click OK.
    Figure 12 Convert to Physical Model dialog box
    Table 6 Parameters

    Parameter

    Description

    *Model Name

    The name of the physical model to be converted from a logical model. You can enter a new model name, and then the system creates the model. You can also select an existing model name from the drop-down list box.

    Only letters, numbers, and underscores (_) are allowed.

    *Data Connection Type

    Select a data connection type from the drop-down list box. If the required data type does not exist, you can add one by referring to Data Types.

    Data Connection

    The name of the data connection. Select the required data connection. You are advised to use the same data connection for an ER model.

    If no data connection is available, access Management Center to create one. For details, see Creating Data Connections.

    Database

    The name of the database. Select a database from the drop-down list box. If no database is available, access DataArts Factory to create one. For details, see Creating a Database.

    Tables

    • All: Convert all logical entities into physical tables.
    • Partial: Convert the selected logical entities into physical tables.

    Queue

    DLI queue. This parameter is available only for DLI data connections.

    Schema

    Schema of DWS or POSTGRESQL. This parameter is available only for DWS and PostgreSQL data connections.

    Description

    A description of the model. Up to 600 characters are supported.

  4. After the model is converted to a physical model, you can set layers for the physical model. You can select the SDI or DWI layer. As shown in Figure 13, move the cursor to the card of the physical model and click the edit button of the model.
    Figure 13 Setting layers for the physical model

    In the displayed dialog box, select SDI or DWI for Data Warehouse Layer.

    • SDI stands for Source Data Integration and is the source data layer. SDI is a simple implementation of source system data.
    • DWI stands for Data Warehouse Integration, also called the data consolidation layer. DWI integrates and cleans data from multiple source systems, and implements entity relationship modeling based on the three normal forms.
    Figure 14 Editing the physical model