From: http://sts.zju.edu.cn/software/RJ_CH1-3-1.html
Figure 1.9 shows the physical contact diagram obtained after the Academic Affairs Office is analyzed and investigated in the case of university educational administration. The student archive is a collection of student information, course archives are a collection of courses, and registration records and course selection lists are a collection of student registration and course selection. It uses a simple graphical method to describe the relationship between students, courses, and other data in these teaching activities.
Figure 1.9 Emy-level academic affairs office subject contact list
In the object contact diagram, there are three basic elements: entity, contact, and attribute, as shown in Figure 1.10.
Figure 1.10 basic components of an object contact chart
1) Entity
Entities are objects in reality, specific and abstract; physical and conceptual; for example, students and courses. Their features can be differentiated from each other, otherwise they will be considered as the same object. All things, things, and concepts that can be differentiated and recognized by people can be abstracted as entities. Data storage in a data flow chart is an entity. An entity can be divided into an independent entity and a subordinate entity or a weak entity. An independent entity can exist independently of other entities and links, in 1.9, "student archives" and "course archives" are often referred to as entities directly. A subordinate entity is such an entity that relies on other entities and contacts, in the object contact diagram, it is represented by a rectangle with rounded corners. In example 1.9, the "registration record" is a subordinate entity, and its existence depends on the entity "student profile" and the contact "Registration ", the "Course Selection form" is also a subordinate entity, and its existence depends on the entity "student files", "course Files", and contact "Course Selection ".
For simplicity, the entity "student archives" and "course archives" in Figure 1.9 are directly referred to as "student" and "Course" in the following descriptions ".
2) Contact
There may be various relationships between entities. For example, there is a "Course Selection" relationship between "student" and "course. The relationships between these entities are abstracted as links. In the contact graph, the contact is represented by a diamond box connecting the relevant entities, as shown in Figure 1.9. The contact can be one-to-one (), one-to-many (1: N), or multiple-to-many (M: N). This should also be stated in the physical contact diagram. For example, "Students" and "courses" are many-to-many "Course Selection" contacts.
3) attributes
An entity generally has several characteristics, which are called the attributes of an entity. In example, the entity "student" in section 1.9 Has characteristics such as student ID, name, gender, birth date, and department, these are their attributes.
Connections can also have attributes. For example, if a student chooses a course term, it is neither a student's attribute nor a course attribute, because it depends on a specific student, it depends on a specific course, so it is the attribute of "Course Selection" between students and courses. In Figure 1.9, the attributes of the "Course Selection" contact are summarized in the "course selection list" of the subordinate entity. Association with attributes is very important for understanding the meaning of data.
In the object contact diagram, there are several important concepts about attributes.
(1) primary key
If the value of an attribute or attribute group composed of several attributes of an object uniquely determines the value of all other attributes of the object, that is, the object can be uniquely identified, if any real subset does not have this property, the property or attribute group is called the object key. If an object has multiple entity keys, you can select one of the most commonly used keys as the primary keys of the object. For example, if the primary key of a student is student ID and the student ID is determined, the attributes of the student, such as name, gender, birth date, and Department are also determined. In the object contact diagram, the attribute or attribute group that is often used as the primary key is displayed in the join line of the corresponding object plus a short vertical line.
(2) Foreign key
If the primary key or attribute (Group) value of an object depends on the primary key of another object, the primary key or attribute (group) is called a foreign key. For example, the value of the primary key "student ID" of the subordinate entity "registration record" depends on the primary key "student ID" of the entity "student ", the primary keys "student ID" and "course number" of the "Course Selection form" depend on the primary key "student" of the entity and the primary key "course number" of the entity "course ", these primary keys and attributes are foreign keys.
(3) attribute domain
A property can be a simple attribute of a single domain or a combination attribute of multiple domains. Composite attributes consist of simple attributes and other composite attributes. Other composite attributes can be included in a composite attribute, which means that the attribute can be a hierarchical structure. As shown in Figure 1.11, the communication address is a hierarchical attribute.
Figure 1.11 mailing address attributes
(4) attribute values
The attribute can be single-value or multi-value. For example, a degree may be multi-value. When an attribute is not applicable to an object or the attribute value is unknown, the vacancy character is null.
To make the image clearer and easier to read, you can separate the attributes of the object from the object, as shown in Figures 1.12 and 1.13.
Figure 1.12 entity contact Diagram
Figure 1.13 Object Attributes
Since we usually use the concepts of entities, contacts, and attributes to understand and describe the real problems, the physical contact diagram is very close to the way people think. Because the entity contact diagram uses simple graphs to express people's understanding of the reality, users who are not familiar with computer technology can also accept it, therefore, object contact graphs have become a widely used tool for Conceptual Modeling of database structures.