Database principles-Several data models

Source: Internet
Author: User

Three different data models in the database application system

Conceptual model (E-R model): In order to achieve the user's requirements defined model, mainly to initially express user needs

Logical model: The data is modeled according to the user's viewpoint, which is mainly used for database design.

The logical model includes: hierarchical model, mesh model, relational model, object-oriented data model, object relational data model, semi-structured model, etc.

Physical Model: Represents the representation and access method of the data inside the system, and realizes the physical storage of the data. This includes storage location of data, index location, storage details such as file location and storage policy.

Components of the data model: structure, data manipulation, data integrity constraints
    • Data

The data structure index is a description of the static characteristics of the system, including two aspects, according to the relation between object and object:
(1) The data itself: type, content, nature. For example, domains, attributes, relationships, and so on in a relational model.

(2) The relationship between the data: how the data is interconnected, such as the main code in the relational model, external code and other links.

    • Data manipulation

The set of operations allowed for an instance (value) of an object (type) in a database, primarily to retrieve and update (INSERT, delete, modify) two types of operations. The data model must define the exact meaning of these operations, the action symbols, the action rules (such as priority), and the language in which the operation is implemented. Data manipulation is a description of the dynamic characteristics of the system.

    • Integrity constraint conditions

Data integrity constraint is a set of integrity rules, which specifies the conditions that should be met in order to ensure the correctness, validity and compatibility of the data.

The primary logical data model in the database
    • Hierarchical model (formatted model)

Define and Restrict conditions:

    1. There is only one node, no parent node, this node is the root of the tree;
    2. Other nodes have and have only one parent node;

Advantages:

    1. The data structure is simple and clear;
    2. Using pointer to record edge to contact, query efficiency is high;
    3. Good and complete new support;

Disadvantages:

    1. Can only represent 1:n's contact. Although there are many auxiliary means to achieve m:n contact, but more complex, difficult to grasp.
    2. The tree of the hierarchical model is an ordered tree (hierarchical order). The precedence is set for all subtrees of any node, which implies control over the access path to the database.
    3. There is only one connection between parent and child nodes in a tree, so there is only one self-root node that reaches its path to any node in the tree.
    • Mesh model (formatted model)
The data structure of the mesh model mainly has the following two characteristics:
    1. Allow more than one node to have no parents;
    2. A node can have more than one parent;

Advantages:

    1. Can express the reality more clearly, accord with the real data relation;
    2. Operations can be accessed quickly;

Disadvantages:

    1. Complex structure;
    2. Difficult to grasp, the network model of DDL,DDM complex, and to embed a high-level language (COBOL,C), users are not easy to grasp;
    3. The application is complex, the connection between records is realized through access path, the application must choose the appropriate access path when accessing the data, so the user must understand the details of the system structure and aggravate the burden of writing the application;
    • Relational model
A single data structure--the relationship between real-world entities and entities is represented by relationships, and the logical structure of the data in the relational model is a two-dimensional table from the user's point of view. Advantages:
    1. The data structure is single, the relation model, whether entity or entity, is represented by the relationship, and the relationship corresponds to a two-dimensional data table, the data structure is simple and clear.
    2. Relationship normalization, and based on the strict theoretical basis, the basic norms of the relationship between the requirements of each attribute can not be re-segmentation, and the relationship is based on a solid theoretical basis of strict mathematical concepts.
    3. Simple concept, easy to operate, the biggest advantage of the relationship model is simple, user easy to understand and master, a relationship is a two-dimensional table, the user can only use simple query language to operate the database.
Disadvantages:
    1. The query efficiency is inferior to the formatted data model;
    2. In order to improve the performance, the database management system needs to optimize the user query, increase the database management system development difficulty;
    • Object-oriented data model

Object-oriented data models represent entities as classes, and a class describes object properties and entity behavior.

Object-oriented data model four core technologies:

    • Classification

Is the process of generalizing or mapping a group of objects with the same attribute structure and action method to a common class. such as urban buildings can be divided into administrative districts, business districts, residential areas, cultural areas and other categories.

    • Generalization (inheritance)

The process of abstracting classes of the same characteristics and operations into a higher-level, more general-class superclass. Subclasses are a special case of super class. A class may be a subclass of a superclass, but also a superclass of several subclasses. Therefore, generalizations may have any number of layers. The generalization technique avoids a large amount of redundancy on the description and storage. This requires a mechanism that automatically gets the properties and operations of the subclass object from the properties and operations of the superclass, that is, the inheritance mechanism.

    • Aggregation (aggregation)

Aggregation is the process of combining objects of several different nature classes into a more advanced compound object.

    • Union (Combination)

A similar object abstraction is combined as a collection object. Its operation is a collection of operations for the member object.

Advantages:

    1. Suitable for handling a wide variety of data types: Unlike traditional databases such as hierarchies, meshes, or relationships, an object-oriented database is suitable for storing different types of data, such as pictures, sounds, and videos, including text, numbers, and so on.
    2. Object-oriented programming is combined with database technology: Object-oriented data model combines object-oriented programming and database technology, thus provides an integrated application development system.
    3. Improved development efficiency: the object-oriented data model provides powerful features, such as inheritance, polymorphism, and dynamic binding, which allows users to compose objects and provide solutions without the need to write code for a particular object. These features can effectively improve the development efficiency of database application developers.
    4. Improved data access: the object-oriented data model explicitly represents the contact, supporting both navigation and correlation information access. It can improve data access performance more than relationships based on relational values.

Disadvantages:

    1. There is no precise definition: different products and prototypes of the object is not the same, so the object can not be accurately defined;
    2. Maintenance difficulties: As the organization's information needs change, the definition of the object requires changes and the existing database needs to be ported to complete the definition of the new object. When you change the definition of an object and migrate a database, it can face real challenges.
    3. Not suitable for all applications: the object-oriented data model is used for applications that need to manage the complex relationships that exist between data objects, which are particularly suitable for specific applications, such as engineering, e-commerce, medical, etc., but not for all applications. When used in general applications, its performance degrades and requires a high level of processing power.
    • Object Relational Data Model
That's called an Object relational database mapping. The principle of Hibernate. The core part.
Object Relational Mapping (ORM) provides conceptual, easy-to-understand methods for modeling data.
The ORM methodology is based on three core principles:
Simple: Model data in the most basic form.

Accuracy: Create a properly standardized structure based on the data model. Typically, modelers develop information models by collecting information from people who are familiar with the application but are not proficient in data modelers. Modelers must be able to communicate with the data structure at the conceptual level using terminology that non-technical enterprise experts can understand. The modeler must also be able to process the sample data with simple unit analysis information. ORM is specifically designed to improve this connection. Object-relational database mapping rule expression, ORM represents the application world as a set of objects (entities or values) that have a role (part of a relationship).
Advantages:
    1. The ORM also provides flexibility. Models created using ORM are more capable of adapting to changes in the system than models created using other methods.
    2. ORM allows non-technical enterprise experts to talk about models by sample data, so they can use real-world data validation models. Because ORM allows objects to be reused, the data model is automatically mapped to a properly normalized database structure.
    3. The simplicity of the ORM model simplifies the database query process. Using the ORM Query tool, users can access the desired data without having to understand the underlying structure of the database.
    • Semi-structured model

Some of the data are completely unstructured data, such as sound files, image files, etc., some have rigorous structure, such as relational database data, there is a structure state between the two data, the data has a certain structure, but the structure is irregular, incomplete, or structure is implicit, For example, HTML documents, we refer to this kind of data as semi-structured data. There is no uniform definition of semi-structured data.

Semi-structured models are divided into tree-based models, graph-based models, logic-based models, relationship-based models, and object-based models;

Characteristics of semi-structured models

    1. The semi-structured data model is a database model, but differs from the traditional relational model or object-oriented data model, in which the pattern is contained in the data, and unlike the relational model, the pattern is strictly differentiated from the data, and in this model, the pattern is derived from the data, which is the first data, then the pattern, This is just the opposite of the traditional database model.
    2. The structure of semi-structured data model is not invariable, its complexity depends on the actual application, can be customized according to needs, its pattern is not accurate, does not enforce the data structure constraints, only describes the data structure information, may only describe a part of the structure of the data, may also vary depending on the angle of view of the data processing at different stages.
    3. Due to the dynamic variability of the structure of the semi-structured data model, it can provide flexible data formats based on the data interaction of the different structure of the database.
    4. Semi-structured data models can help users view semi-structured data as structural data for browsing purposes.
    5. The data transfer format can be ported to each other in different structure database.
    6. Due to the variability of the structure of semi-structured data model, the difficulty of data processing is increased.

Database principles-Several data models

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.