What Is a Logical Data Model?
Logical Data Model (LogicDataModel, LDM) is a graphical display method. Generally, an object-oriented design method is used to effectively organize a variety of business data from various sources and use a unified logical language to describe the business.
Logical data model
Right!
- Hierarchical data model
- Mesh data model
- Relational data model
- Object-oriented model
- Logical Data Model (LogicDataModel, LDM) is a graphical display method, generally used
- With a relatively abstract, logically unified, and robust structure, achieving the data storage goals required by the data warehouse system and supporting a large number of analytical applications is an important foundation for achieving business intelligence. It is also an effective tool for data management analysis and communication.
- For enterprises, the logical data model (LDM for short) is a part of the basic data of the enterprise. It is a comprehensive and accurate description of enterprise data assets, and it is the core or purpose of data integration. Data integration is the integration of data from different sources into a unified definition and unified form of LDM.
1. Logical data model 1. Hierarchical model
- Hierarchical Model is the earliest data model. It is a data model that uses hierarchical data structure to organize data. Hierarchical models can simply and intuitively represent entities, their attributes, and one-to-many relationships between entities in the information world. It uses record types to describe entities; fields to describe attributes; and lines between nodes to represent connections between entities.
- (1) Concept of hierarchical model
- Hierarchical data structure is also called tree structure, and each node in the tree represents a record type. A data model that meets the following two conditions is called a hierarchical model:
- 1) Only one node has no parent node (parent node is also called parent node), and this node is called root node. 2) Nodes other than the root node have one and only one parent node. Hierarchical models can naturally represent family structure, administrative organization structure, and so on. (2) Three elements of the hierarchical model 1) Data structure: Use record types to represent entities, and use lines between nodes to represent one-to-many connections. 2) Data operations: Including node query and node update (such as insert, delete and modify) operations. 3) Integrity constraint: a model has only one root node; other nodes can only have one parent node; there is a one-to-many connection between nodes. (3) Advantages and disadvantages of the hierarchical model The advantages of the hierarchical model are simple and clear structure, easy to understand, simple connection between nodes, and high query efficiency. The main disadvantages are the following: 1) It cannot indicate that a node has multiple parents. 2) Many-to-many relationships cannot be directly expressed. Many-to-many relationships need to be broken down into multiple one-to-many relationships. Common decomposition methods are redundant node method and virtual node method. 3) There are many restrictions on inserting and deleting. For example, when a parent node is deleted, the corresponding child node is also deleted at the same time. For details, refer to the related operations of the tree in the course of "Data Structure". 4) You must pass through the parent node to query the child nodes. Because in the hierarchical model, no record value of a child node can exist independently of the record value of a parent node.
2. Logical data model 2. Mesh model
- The network model uses a network structure, which can directly describe the situation where a node has multiple parent nodes and there are many-to-many connections between nodes. (1) Concept of mesh model A mesh model is a collection of basic hierarchical connections that satisfy the following two conditions: 1) More than one node is allowed without parent nodes. 2) A node can have more than one parent node. In fact, the hierarchical model is a special case of the mesh model. The mesh model removes the restrictions in the hierarchical model, allowing multiple nodes to have no parent nodes, allowing nodes to have multiple parent nodes, and allowing many-to-many connections between nodes. A mesh model can be used to represent many-to-many relationships. For example, as shown in Figure 1-8, a graded connection record is introduced to represent the many-to-many connection between students and courses. The connection between the neutron node and the parent node in the mesh model may not be unique, but each connection needs to be named. The score node in Figure 1-8 has two parent nodes: the course and the student. The relationship between course and grade is named "course-grade", and the relationship between student and grade is named "student-grade". (2) Three elements of the mesh model 1) Data structure: Use record types to represent entities, and use fields to describe the attributes of entities. Each record type can contain several fields, and the connection between nodes is used to represent one-to-many Connection. 2) Data operation: Including node query and node update operation. 3) Integrity Constraint: The concept of support codes is used to uniquely identify the collection of data items in a record; to ensure that there is a one-to-many relationship between a parent node and a child node in a connection; support for parent-child records and child records Certain constraints, such as deleting only parent nodes. (3) Advantages and disadvantages of the mesh model The mesh model has good performance and high access efficiency. Compared with the hierarchical model, the relationships between nodes in the mesh model are flexible, can represent complex relationships between things, and are more suitable for describing the objective world. Although the mesh model effectively overcomes the shortcomings of the hierarchical model that is inconvenient to express many-to-many relationships, it is difficult to implement a mesh database management system because of its complex structure. And the DDL language provided by it is complicated, which is not easy to learn and master. In addition, because the relationship between entities is essentially represented by access paths, applications need to specify access paths when accessing data.
3. Logical data model 3. Relational model
- The common shortcoming of the hierarchical model and the mesh model is to achieve the connection between the records through the access path. The application must choose the appropriate access path when accessing the data, and the user must understand the details of the system structure. burden. In addition, aggregate processing is not supported, that is, no function is provided to process multiple records at a time. The Relational Model was first proposed by IBM's EFCodd in 1970. The relationship model can describe one-to-one, one-to-many, and many-to-many connections, and hide the access path from the user, which greatly improves the independence of the data and the programmer's work efficiency. In addition, the relational model is based on strict mathematical concepts and mathematical theories, and supports set operations. The relational model consists of three parts: relational data structure, relational operation, and integrity constraints. In the relational model, the relationships between entities and entities are represented by relationships. (1) Definition of relationship : The relationship model is a simple two-dimensional table structure. Each two-dimensional table is called a relationship. The head of a two-dimensional table, that is, the title of all columns is called a tuple, and each column The data is called an attribute, and the column heading is called the attribute name. Duplicate tuples and attributes with the same attribute name are not allowed in the same relationship. (2) Database architecture External mode: or sub-mode, application mode, local mode, etc. It is a description of the logical structure and characteristics of the data involved in the local application of the database in a certain aspect. It is an end user and an application programmer Seen database. Mode: Or conceptual mode, logical mode, global mode, etc. It is a description of the logical structure and characteristics of the entire database. The user is based on the logical data model supported by the DBMS. Internal mode: or storage mode, physical mode, etc. It is a description of the storage structure and characteristics of the entire database. (3) The main functions of the DBMS , data definition and manipulation , database management control , database auxiliary services , providing the use of database tools , establishing and maintaining data dictionary (4) relational operations relational data structure domain: domain is A collection of data with the same characteristics. Cartesian product: A Cartesian product is a set defined on a set of domains. Assuming a set of domains is represented by D1, D2, ..., Dn, their Cartesian products are expressed as: D1 * D2 * ... * Dn. Relations: A subset of the Cartesian product. If the Cartesian product has n domains, the relationship on the Cartesian product is called an n-element relationship. Code: Code is also called key, keyword, etc. Candidate code: The smallest attribute or attribute group that uniquely identifies each tuple in a relationship is called the candidate code for the relationship. Master code: Select one of the candidate codes as the master code of the relationship, and the database system will identify and sort each tuple by the master code. Relationship Integrity l Entity Integrity Entity Integrity Rules: The primary code of a relationship cannot take a null value, or the primary code of each tuple in any relationship cannot be empty. l Referential integrity Referential integrity rules: In two referential and referenced relationships, the outer code of each tuple in the reference relationship is either empty or equal to the master code of a tuple in the referenced relationship. Relational operations (5) Traditional set operations include four operations: union , intersection, difference, and Cartesian product.
4 Logical data model 4, object-oriented model
- The object-oriented model is an emerging data model and the most important model idea at present. It uses an object-oriented approach to designing the database. Object-oriented database storage objects are based on objects. Each object contains the properties and methods of the object, and has the characteristics of class and inheritance.
- In the design of object-oriented databases, we abstract entities in the objective world into objects. A basic tenet of the object-oriented approach is "everything is an object". An object can be defined as a description of a set of information and its operations. Interoperation between objects must be completed by sending messages and executing messages. Messages are the interface between objects. Strictly speaking, in an object-oriented model, any attribute of an entity must be represented as a variable and a pair of messages in the corresponding object. Variables are used to hold attribute values, one message is used to read the attribute value, and another message is used to update the value.
- There are usually many similar objects in the database. "Similar" means that they respond to the same message using the same method, and have variables of the same name and type. Defining each such object separately is wasteful, so we group similar objects into a "class". A class is a collection of similar objects. Each object in a class is also called an instance of the class. All objects in a class share a common definition, even though they assign different values to variables. The concept of classes in the object-oriented data model is equivalent to the concept of entity sets in the ER model.
- Inheritance allows objects of different classes to share the structure and characteristics of their common parts. Inheritance can be achieved using a hierarchical connection between superclasses and subclasses. A subclass can inherit the structure and characteristics of a superclass, which is called "single inheritance"; a subclass can also inherit the structure and characteristics of multiple superclasses, which is called "multi-inheritance". Inheritance is a generalization / refinement relationship between data, which is an "is a" connection.
- Object-oriented systems provide a concept of "object identifiers" to identify objects. OID has nothing to do with the physical storage location of the object, and it has nothing to do with the way the data is described and its value. OID is unique. At the moment the object is created, it is assigned to the object by the system. It is unique in the system. During the life of the object, the identity cannot be changed. If the data is to be transferred to a different database system, the identifier must be transformed.
- Objects may contain objects of different classes. Objects that contain other objects are called composite objects. The containment relationship can have multiple layers to form a class containment hierarchy. Inclusion is a kind of "is part of" connection, so contains and inheritance are two different data relationships.
- Currently, a database that combines relational and object-oriented features provides a shortcut for users who want to use a relational database with object-oriented features. This kind of database system is called "object relational database". It is based on the traditional relational data model. It provides rich data types such as tuples, arrays, and collections, as well as the ability to handle new data types. It has inheritance and objects. Object-oriented features such as logos.