Objectives:
This document describes the basic concepts of Data Model CDM in powerdesigner.
1. Conceptual Data Model Overview
Data models are the abstraction of data features in the real world. The data model must meet the following requirements:
1) Ability to simulate the real world more realistically
2) easy to understand
3) easy to implement by Computer
The conceptual data model is also called the information model. It is based on the entity-relationship (E-R) theory and expands this theory. It models information from the user's point of view and is mainly used for Conceptual Design of databases.
Generally, people first abstract the real world into a conceptual world, and then convert the conceptual world into a machine world. In other words, objective objects in the real world are first abstracted as entities and relationship. They do not depend on a specific computer system or a DBMS system, this model is what we call CDM, and then converts CDM to the data model supported by a DBMS on the computer. This model is the physical data model, that is, PDM.
CDM is a set of strictly defined model elements that accurately describe the static characteristics, dynamic characteristics, and integrity constraints of the system, it consists of three parts: data structure, data operation, and integrity constraint.
1) Data structures are expressed as entities and attributes;
2) The data operation table is the insert, delete, modify, query, and other operations of records in the entity;
3) integrity constraints are expressed as integrity constraints of data (such as data types, checks, rules, etc.) and integrity constraints of reference between data (such as links and inheritance links );
Ii. Definitions of entities, attributes, and identifiers
Entity, also known as an instance, corresponds to "events" or "things" that can be different from other objects in the real world ". For example, each student in the school and each operation in the hospital.
Each entity can be used to describe a set of properties of entity features, which are called attributes. An entity is described by several attributes. For example, a student entity may consist of attributes such as student ID, name, gender, date of birth, department, and year of admission.
An entity set is a set of entities of the same type and nature. For example, a set of all students in a school can be defined as a "student" entity set, each entity in the "student" entity is subject to a student ID, name, gender, date of birth, department, and year of admission.
Entity type is a set of common properties of each entity in an entity set. For example, the entity type of "patient" is: Patient {outpatient number, name, gender, age, ID card No .............}. An object is an instance of the object type. When the meaning is clear, the object and object types are usually used interchangeably.
Each entity in an object type contains one or more attributes that uniquely identify it. These attributes are called identifiers of an object type. For example, a student ID is an identifier of a student entity type, "name", "Date of Birth", and "email address" form the "Citizen" entity type identifier.
Some object types can have several groups of attributes that act as identifiers. select one of these attributes as the primary identifier of the object type, and others as the secondary identifier.
3. entity, attribute, and identifier expression
1. Create a conceptual data model
1) Select File --> new. In the displayed dialog box, select CDM model (Conceptual Data Model) to create a model.
2) create a conceptual data model. To give a brief introduction to the current workspace. (More details later)
3) Select the newly added CDM model, right-click the model, and select the "properties" attribute in the pop-up menu. the pop-up dialog box is displayed. In the General tab, you can enter the name, code, description, creator, version, and default chart of the created model. Enter the description and description in the "Notes" tab. For more tags, click "More>.
2. Create a new object
1) in the CDM graphic window, click entity tool on the tool option edition, and then click a blank area in the graphic window. An entity symbol is displayed at the clicked position. Click the pointer tool or right-click to release the entitiy tool.
2) double-click the newly created object symbol to open the following icon window. In the "General" tab of the window, you can enter the object name, code, description, and other information.
3. Add Object Attributes
1) You can add attributes to the "attribute" option tag in the preceding window, as shown in.
Note:
The "add attribute" and "reuse existing data items" functions in the data item are related to the unique code of the data item in the model and the allow reuse option.
The P column indicates whether the property is the primary identifier; the D column indicates whether the property is displayed in the graphic window; The m column indicates whether the property is mandatory, that is, whether the column is null.
If an object property is mandatory, it must be assigned a value in each record and cannot be blank.
2) In the displayed window, click the insert attribute button to bring up the attribute dialog box, as shown in.
Note: This involves the concept of a domain, that is, a standard data structure, which can be applied to the attributes of data items or entities. In the following tutorial, we will create additional chapters for detailed description.
I. Define standard inspection constraints for Attributes
The standard check constraint is a set of expressions that ensure the attribute is valid. In the Properties window of object properties, open the check tab.
On this tab, you can define the standard check constraints for attributes. The meanings of parameters in the window are as follows:
Parameters |
Description |
Minimum |
Acceptable minimum number of attributes |
Maximum |
Maximum number of acceptable attributes |
Default |
Default value provided by the system when the attribute is not assigned a value |
Unit |
Units, such as kilometers, tons, and Yuan |
Format |
Attribute data display format |
Lowercase |
All attribute values are lowercase letters. |
Uppercase |
All values assigned to an attribute are uppercase letters. |
Cannot modify |
This attribute cannot be modified once it is assigned a value. |
List of Values |
Attribute Value assignment list. No value exists except the value in the list. |
Label |
Label of attribute List Value |
Ii. Additional inspection of defining attributes
When standard checks or rules cannot meet the requirements of the check, you can go to the server subpage on the additional checks tab, use the variables % MINMAX %, % listval %, % rules %, % upper %, and % lower % in SQL statements to define standard and rule,
% MINMAX %, % listval %, % upper %, % lower %
Minimum and maximum, list values, uppervalues, and lowervalues defined in standard check
% Rules %
Validity rule expression defined on the Expression tab of the Rules Properties window
Objectives:
This document describes how to define the Primary and Secondary identifiers of an object.
1. identifier
An identifier is a set of one or more attributes of an object. It uniquely identifies an instance in an object. It should be emphasized that the identifiers in CDM are equivalent to primary keys or candidate keys in PDM.
Each entity must have at least one identifier. If an object has only one identifier, it is the primary identifier of the object. If an object has multiple identifiers, one of them is specified as the primary identifier, and the other identifiers are secondary identifiers.
2. If the Primary and Secondary identifiers are defined
1) double-click an object to display the object Properties dialog box. You can define object identifiers on the identifiers tab. As shown in
2) Select "primary identifier" in the first line, click the attribute button, or double-click "primary identifier" in the first line. The Properties dialog box is displayed,
3) Select the "attributes" tab and click "add attributes". In the displayed window, select an attribute as the identifier.
Objectives:
This section describes data items, new data items, unique code options for data items, and reuse options.
I. Data items
A data item is the smallest unit of information storage. It can be attached to an object as an attribute of an object.
Note: Data items that are not attached to any entity are allowed in the model.
2. Create a data item
1) use the "model" ---> data items menu to display the list of existing data items in the window that appears. Click "add a row" to create a new data item,
2) Of course, you can continue to set the code, ype, length, and other information for specific data items. This is not detailed here.
Iii. unique code options and reuse options for data items
Use tools ---> model options-> model settings. In the data item group box, define the unique code option (unique code) and reuse option (allow reuse) of the data item ).
Note:
If the unique code check box is selected, each data item has a unique code in the same namespace, and allow reuse is selected, a data item can act as the attribute of multiple entities.
4. Add data items to an object
1) double-click an object symbol to open the object attribute window.
2) Click the attributes tab to open the window as shown in
Note:
The difference between Add a dataitem and reuse a dataitem is that
When you add a dataitem, select an existing data item. The system automatically copies the selected data item. If the uniquecode option is set, the system automatically generates a unique number for the code of the new data item during the replication process. Otherwise, the code is exactly the same as the selected data item.
In the case of reuse a dataitem, only references do not add, that is, references existing data items as new object data items.
Objective: This article describes how to define and use a contact.
1. Contact
Relationship refers to the connection between the entity set and the instances in the entity set.
Entities can be associated by association. It corresponds to an object and an object set. A link can also be divided into a link and a contact set. A contact set is a link between an object set, and a link is a link between entities, which is oriented. A contact and a contact set can be referred to as a contact if the meaning is clear.
There are four types of links according to the number of instances in the entity type, that is, one-to-one (one-to-one) and one-to-many (one-to-many) contact, multi-to-one contact, and multi-to-one contact ).
2. Establish contacts
In addition to public tools, the CDM tool option Board also includes other object generation tools as shown in.
After creating two entities in the graphic window, click the "Create contact between entities" tool, click an entity, drag the cursor to another entity while pressing the left mouse button, and release the left mouse button, in this way, the contact is created between the two entities, right-click the graph window, and release the relationship tool. As shown in
3. Four basic connections
That is, one-to-one connections, one-to-many connections, one-to-one connections, and many-to-many connections ).
4. Other Special contacts
In addition to four basic connections, there are also identify relationship, non-standard relationship, and recursive relationship between the entity set and the entity set ).
Calibration contact:
Each object type has its own identifier. If there is a link between two entity sets, when one entity type identifier enters another entity type and forms its identifier together with the entity type identifier, this kind of contact is called a calibration contact or a dependency contact. The opposite is called non-standard or non-dependent contact.
Note:
In a non-standard relational system, some instances in an entity set depend on instances in another instance set. In this dependency relationship, each entity must have at least one identifier. In the calibration contact, all instances in one entity set depend entirely on instances in another entity set. In this dependency relationship, one entity must have at least one identifier, another entity does not have its own identifier. An entity without an identifier uses its dependent entity identifier as its own identifier.
In other words, in the calibration contact, an entity (Course Selection) depends on one entity (student), then the entity (student) must have at least one identifier, and (Course Selection) an entity may not have its own identifier. An entity without a logo identifier can use the entity (student) identifier as its own identifier.
Recursive contact:
Recursive link is a link between instances in the entity set. It is usually called an anti-link. The link between different entity sets in the same object type is also called recursive link.
For example, there are many employees in the "employees" entity, and there must be a relationship between the leaders and the leaders. Another example is that the entity in the "student" entity contains the "class monitor" and "common student" child body sets. The link between the two child body sets is a recursive link. When creating a recursive link, you only need to click the "Create link between objects" tool to drag a part of the object to another part of the object.
5. define the characteristics of contact
After establishing a contact between the two entities, double-click the contact line to open the contact feature window ,.
6. Define the role name of the contact
There is a grouping box in each of the two directions of the contact. The parameter takes effect only in this direction, and the role name is the role name, which describes the role of the contact in this direction, generally, a verb or a dynamic object group table is used.
For example, in the "student to course" group box, enter "own", and in the "course to student" group box, enter "Belong ". (Here is just an example to illustrate that some words may be inappropriate ).
VII. Define mandatory contact
The mandatory relationship of the mandatory table in this direction. Select this check box to generate a vertical line on the contact line. If this check box is not selected, the contact direction is optional. A small circle is generated on the contact line.
8. Contact Base
The connection is oriented and each direction has a base.
For example,
The relationship between the "department" and "student" entities is one-to-many. In other words, the relationship between "student" and "department" is one-to-one. In addition, a student must belong to only one department and cannot belong to none. Therefore, the base from "student" to "department" is ", in another direction of contact, a department can have multiple students or have no students, that is, zero students. Therefore, the contact base in this direction is "0, N ",