Entity relation model generation method and device
By generating entity relationship diagrams and table building and filtering statements based on the graph, the generation process of entity relationship model is automated, and the problems of low efficiency and poor accuracy in the existing technology are solved, and more efficient and accurate Entity relationship modeling.
Patent Information
- Application Number
- CN202411534755.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-18
AI Technical Summary
The modeling process of entity relationship models in the prior art requires manual comprehensive sorting of business and data flows, high professional capabilities, long development cycles, and prone to errors, resulting in low efficiency and accuracy.
By generating entity relationship diagrams, map the data of the original data table into the image, and intuitively understand the data relationship; generate table building statements and filter statements based on entity relationship diagrams to ensure that the database table structure is consistent with the entity relationship; use table building statements in the database Create a table, and obtain the target data through filter statements to generate an entity relationship model.
It reduces the professional ability requirements for building entity relationship models, saves time and costs, and improves the efficiency, accuracy and applicability of entity relationship modeling.
Smart Images

Figure CN119474092A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis, and in particular to a method and device for generating an entity relationship model. Background Art
[0002] Entity Relationship Modeling (ER model) is an abstract tool for describing data structure. Entity relationship modeling describes the connection between information and data by defining the relationship between entities and entity times. It is usually used to describe information requirements and / or the type of information to be stored in the database during the conceptual structure design phase. By building an entity relationship model, it can help integrate data from different systems, improve data storage and computing efficiency, and reduce database costs.
[0003] However, in the existing technology, the modeling process of the entity relationship model often requires manual and comprehensive sorting of all business and data flows, which places high demands on the professional ability and experience of relevant personnel, and has a long development cycle, consuming a lot of time and labor costs; in addition, manual coding also makes the modeling process prone to errors, reducing the efficiency and accuracy of entity relationship modeling. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide at least one entity relationship model generation method, device, electronic device and storage medium, which can reduce the professional ability requirements for building entity relationships, save the time cost of entity relationship modeling, and improve the efficiency, accuracy and applicability of entity relationship modeling.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for generating an entity relationship model, comprising:
[0006] Generate entity relationship diagrams corresponding to multiple original data tables;
[0007] Based on the entity relationship diagram, generate a table creation statement and a filter statement corresponding to the original data table;
[0008] The table creation statement is used to create a table in a database to obtain a table creation result; the screening statement is used to screen the table creation result to obtain target data to generate an entity relationship model.
[0009] Optionally, before generating the entity relationship diagram corresponding to the multiple original data tables, the method further includes:
[0010] Acquire multiple original data tables, and determine data information corresponding to each of the original data tables; the data information includes structures and fields corresponding to the original data tables and associations between the original data tables;
[0011] The data information is preprocessed to generate the entity relationship diagram.
[0012] Optionally, before generating a table creation statement and a filter statement corresponding to the original data table, the method further includes:
[0013] Based on the preprocessed data information, the output formats of the table creation statement and the filter statement are determined.
[0014] Optionally, after determining the data information corresponding to each of the original data tables, the method further includes:
[0015] Determine whether the data information meets the preset requirements; if not, update the data information based on the original data table until the data information meets the preset requirements.
[0016] Optionally, a pre-trained large model is used to generate an entity relationship diagram, a table creation statement or a screening statement corresponding to the original data table.
[0017] Optionally, before using the pre-trained large model to generate an entity relationship diagram, a table creation statement or a screening statement corresponding to the original data table, the method further includes:
[0018] Determine prompt words for generating the entity relationship diagram, table creation statement or filter statement; the prompt words include output format requirements for the entity relationship diagram, table creation statement or filter statement and data information update requirements corresponding to the entity relationship diagram.
[0019] Optionally, after creating a table in a database using the table creation statement and obtaining a table creation result, the method further includes:
[0020] Insert test data into the table creation result; the test data is used to verify whether the entity relationship model meets the requirements.
[0021] In a second aspect, the present disclosure also provides an entity relationship model generation device, including:
[0022] A relationship diagram generation module, used for generating entity relationship diagrams corresponding to a plurality of original data tables;
[0023] A statement generation module, used to generate a table creation statement and a filter statement corresponding to the original data table based on the entity relationship diagram;
[0024] The model generation module is used to use the table creation statement to create a table in the database to obtain a table creation result; use the screening statement to filter the target data in the table creation result to generate an entity relationship model.
[0025] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps in the above-mentioned first aspect, or any optional implementation of the first aspect are performed.
[0026] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect, or any optional implementation of the first aspect are executed.
[0027] In any of the above aspects or any implementation methods of any of the aspects, by generating an entity relationship diagram and mapping the data in the original data table into an image, the relationship between the data can be understood more intuitively, which is helpful for the efficiency of data understanding and management, and creates a basis for further generating an entity relationship model; then, table creation statements and filter statements corresponding to the original data table are generated according to the entity relationship diagram, which can ensure that the structure of the database table is consistent with the entity relationship, thereby reducing the errors and time cost of manual table creation, and obtaining the target data through the filter statement can improve the efficiency of data query and analysis, thereby improving the efficiency and accuracy of entity relationship modeling; finally, a table is created in the database through the table creation statement, and the target data is determined based on the obtained table creation results and the filter statement, and then the entity relationship model can be obtained, thereby reducing the professional ability requirements for constructing entity relationships, saving the time cost of entity relationship modeling, and improving the efficiency, accuracy and applicability of entity relationship modeling.
[0028] The effects of the above-mentioned entity relationship model generation device, electronic device and storage medium refer to the description of the above-mentioned entity relationship model generation method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0030] Figure 1 A flow chart of a method for generating an entity relationship model provided by an embodiment of the present disclosure is shown;
[0031] Figure 2 A schematic diagram of an entity relationship diagram in the entity relationship model generation method provided by an embodiment of the present disclosure is shown;
[0032] Figure 3 A schematic diagram of a process of generating an entity relationship diagram using a large model in the entity relationship model generation method provided by an embodiment of the present disclosure is shown;
[0033] Figure 4 A schematic diagram of an entity relationship model generation device provided by an embodiment of the present disclosure is shown;
[0034] Figure 5 An exemplary system architecture is shown in which embodiments of the present disclosure may be applied;
[0035] Figure 6 A schematic diagram of the structure of a computer system of a terminal device or a server used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0037] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0038] Research has found that the Entity Relationship Modeling (ER model) is an abstract tool for describing data structures. The ER model describes the connection between information and data by defining the relationship between entities and entity times. It is usually used to describe information requirements and / or the type of information to be stored in the database during the conceptual structure design phase. By building an ER model, it can help integrate data from different systems, improve data storage and computing efficiency, and reduce database costs.
[0039] However, in the process of entity relationship modeling, current technology requires manual and comprehensive sorting of all business and data flows, which requires high professional knowledge and experience of relevant personnel. Some small and medium-sized enterprises or individuals may not have the ability to implement entity relationship modeling, resulting in reduced applicability of entity relationship modeling. In addition, since the modeling process relies on manual labor, the development cycle is long and prone to errors and inconsistencies. While consuming a lot of manpower and time costs, it does not provide relatively accurate modeling results, which in turn reduces the efficiency and accuracy of entity relationship modeling.
[0040] Based on the above research, the embodiment of the present disclosure provides a method for generating an entity relationship model. By generating an entity relationship diagram and mapping the data in the original data table into an image, the relationship between the data can be understood more intuitively, which is helpful for the efficiency of data understanding and management, and creates a basis for further generating an entity relationship model. Then, table creation statements and filter statements corresponding to the original data table are generated according to the entity relationship diagram, which can ensure that the structure of the database table is consistent with the entity relationship, thereby reducing the errors and time cost of manual table creation, and obtaining the target data through the filter statement can improve the efficiency of data query and analysis, thereby improving the efficiency and accuracy of entity relationship modeling. Finally, a table is created in the database through the table creation statement, and the target data is determined based on the obtained table creation results and the filter statement, and then the entity relationship model can be obtained, thereby reducing the professional ability requirements for constructing entity relationships, saving the time cost of entity relationship modeling, and improving the efficiency, accuracy and applicability of entity relationship modeling.
[0041] The raising of the above problems and the solutions are the results obtained by the inventor after practice and careful research. The discovery process of the above problems and the solutions proposed for the above problems should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0042] The technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0043] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0044] To facilitate understanding of the present embodiment, a method for generating an entity relationship model disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the method for generating an entity relationship model provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method for generating an entity relationship model can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0045] See also Figure 1 FIG. 1 is a flowchart of a method for generating an entity relationship model provided by an embodiment of the present disclosure, wherein the method includes S101 to S103, wherein:
[0046] S101: Generate an entity relationship diagram corresponding to multiple original data tables.
[0047] In the disclosed embodiment, an entity-relationship diagram (ER diagram) is a graphical tool for describing a data model, which can represent the relationship between entities. The number of entity-relationship diagrams generated here can be one or more. Specifically, the entity-relationship diagram may include multiple components such as entities, attributes, relationships, connecting lines, primary keys and foreign keys. Among them, an entity refers to an individual, object or concept that can be distinguished and identified; an attribute is information that describes the characteristics or properties of an entity, such as name, age, address, etc., or it can be association information between entities; a relationship represents the connection or connection between different entities, and describes the interaction, connection or dependency between entities; a connecting line is used to connect entities and relationships, indicating the association relationship between entities, and usually there is an arrow pointing to the entity participating in the relationship, and its direction represents the direction of the participating relationship; a primary key is a unique identifier of an entity, which is used to uniquely identify the entity; a foreign key is an attribute of an entity, which references another entity as its value, and is used to help establish an association relationship between entities.
[0048] like Figure 2 As shown, it is a schematic diagram of an entity relationship diagram provided by an embodiment of the present disclosure, wherein a rectangular box represents an entity, an elliptical box represents an attribute corresponding to an entity, and a diamond box represents a relationship between entities. For example, assuming Figure 2The entity relationship diagram is applied in the field of student course management. Entity 1 can be a student, and the attributes corresponding to entity 1 can be student ID, name, gender, department, class, etc.; entity 2 can be a course, and the attributes corresponding to entity 2 can include course number, course name, teacher, credits, etc.; the two entities can be associated through course selection information. It should be noted that Figure 2 The above-mentioned example of application in the field of student course management is only used as an example of a possible implementation of the embodiment of the present disclosure and does not constitute an improper limitation on the present invention. The embodiment of the present disclosure does not specifically limit its application field, number of entities, etc. In actual application, it shall be based on the ability to realize its functions.
[0049] In the embodiment of the present disclosure, each original data table may correspond to an entity, and the entity relationship diagram corresponding to the multiple original data tables may represent the attributes of each entity and the association relationships between entities.
[0050] In a possible implementation, before generating an entity relationship diagram corresponding to multiple original data tables, it also includes: obtaining multiple original data tables and determining data information corresponding to each of the original data tables; the data information includes a structure and fields corresponding to the original data tables and an association relationship between the original data tables; and preprocessing the data information to generate the entity relationship diagram.
[0051] In a specific implementation, before generating an entity relationship diagram, it is necessary to first obtain the data used to generate the entity relationship diagram, that is, the original data table in the embodiment of the present disclosure. Specifically, the ODS (Operational DataStore) model can be obtained from the database. The ODS model is a database used to store real-time or near real-time data, usually used to support the implementation of business operations and decisions. The data table is a structured component that stores specific data in the ODS model. The original data table can be used to store data from different source systems. Therefore, multiple original data tables can be obtained by obtaining the ODS model. After obtaining the original data table, the data information such as the structure, fields, annotations and relationships corresponding to each original data table can be determined, which helps to perform the next step of the data information. In addition, according to the specific needs in the actual application, you can choose to obtain the DWD (Data Warehouse Detail) model from the database to obtain multiple original data tables and data information corresponding to the original data tables.
[0052] In a specific implementation, after obtaining data information corresponding to multiple original data tables, the data information can be preprocessed, for example, character formats, codes, files, etc. can be standardized and dirty data can be filtered out. This helps to ensure the quality and consistency of the data information and improve the availability of the data information in further processing.
[0053] In a possible implementation, after determining the data information corresponding to each of the original data tables, it further includes: judging whether the data information meets preset requirements; if not, updating the data information based on the original data table until the data information meets the preset requirements.
[0054] In a specific implementation, after determining the data information used to generate an entity relationship diagram, it is possible to determine whether the data information meets the requirements for generating an entity relationship diagram, such as whether the data information is complete or whether preprocessing has been completed. In the case of incomplete data information, DDL (Data Definition Language) can be obtained from the database to supplement the incomplete data information. Specifically, it is possible to determine whether the data information is complete by determining whether the data information is in a database and whether there is primary and foreign key information between tables. Incomplete data information can be maintained by adding foreign keys to the database. It should be noted that there is no difference in display between the entity relationship diagram obtained from the complete data information and the entity relationship diagram obtained from the supplemented data information. In a specific implementation, it can be marked whether the corresponding entity relationship diagram is obtained from the complete data information, so that the downstream can better identify and use the corresponding entity relationship diagram.
[0055] S102: Based on the entity relationship diagram, generate a table creation statement and a filter statement corresponding to the original data table.
[0056] In this step, after the entity relationship diagram is generated, the table creation statement and filter statement corresponding to the original data table can be generated based on the entity relationship diagram. The table creation statement here defines the structure of the data table, including information such as table name, field name, data type, and constraint conditions, and determines the database structure and entity relationship. Figure 1 The filter statement is used to filter the target data in the table creation results to meet the query requirements of specific data, thereby simplifying the database table creation and data query process, and further improving the efficiency and accuracy of entity relationship model generation.
[0057] In the embodiments of the present disclosure, the output format of the table creation statement and the filter statement can be determined based on the preprocessed data information. This ensures that the format consistency of the data information and the table creation statement and the filter statement is in place for the next step of processing. In a specific implementation, the output format of the table creation statement and the filter statement can also be determined based on the output specification required by the execution subject of the embodiments of the present disclosure; or the output format of the table creation statement and the filter statement can be determined for a specific business type. In addition, the output format of the entity relationship diagram can also be determined before the entity relationship diagram is generated based on actual needs, such as a file image format, a vector graphics format, a specific modeling format, a code generation format, and the like.
[0058] In the disclosed embodiment, a pre-trained large model can be used to generate an entity relationship diagram, table creation statement, or filter statement corresponding to the original data table. This can further save labor and time costs, thereby improving the efficiency and accuracy of entity relationship modeling. In addition, when using a large model to generate an entity relationship diagram, a table creation statement, or a filter statement, the corresponding output format requirements can be determined in advance and reflected in the prompt words used to generate the entity relationship diagram, the table creation statement, or the filter statement. Specifically, before using a pre-trained large model to generate an entity relationship diagram, a table creation statement, or a filter statement corresponding to the original data table, it also includes: determining the prompt words used to generate the entity relationship diagram, the table creation statement, or the filter statement; the prompt words include the output format requirements for the entity relationship diagram, the table creation statement, or the filter statement and the data information update requirements corresponding to the entity relationship diagram.
[0059] Figure 3 A schematic diagram of generating an entity relationship diagram using a large model is provided in an embodiment of the present disclosure. Figure 3As shown, the corresponding entity relationship diagram can be generated according to the pre-processed data information and the pre-determined prompt words. The prompt words here can include output format constraints, output table constraints and data information update requirements for the entity relationship diagram. Exemplarily, the prompt words for generating the entity relationship diagram can be "design a database entity relationship diagram for company A, the output format should be a PNG image file, and contain the association relationship between entities, where the association relationship should be marked as one-to-one, one-to-many or many-to-many relationship. If the data source is in the same library and has primary and foreign keys, the primary and foreign keys are used to generate entity relationships. If the data source is more than one database, the library name, table name, field name and data are detected, and the primary and foreign keys are improved." Here, A can be used to represent the variables or inputs to be filled corresponding to the company; here, "if the data source is in the same library and has primary and foreign keys, the primary and foreign keys are used to generate entity relationships. If the data source is more than one database, the library name, table name, field name and data are detected, and the primary and foreign keys are improved" is the data information update requirement, that is, in the embodiment of the present disclosure, the prompt words can be used to indicate that the large model associated with the embodiment of the present disclosure automatically improves the data information used to generate the entity relationship diagram.
[0060] In the disclosed embodiment, a corresponding table creation statement can be generated based on the preprocessed data information and the entity relationship diagram, and the table creation statement can include information such as table name, field name, data type, and constraint conditions. It is also possible to generate corresponding filter statements based on the entity relationship diagram using a large model, which may include SELECT statements, JOIN statements, etc. Similarly, the prompt words used to generate table creation statements and filter statements can also be determined according to the format of the prompt words used to generate the entity relationship diagram above, which will not be repeated here.
[0061] S103: Using the table creation statement to create a table in the database to obtain a table creation result; using the screening statement to screen the table creation result to obtain target data to generate an entity relationship model.
[0062] In this step, after obtaining the table creation statement, a table can be created in the database according to the table creation statement, and then a filter statement can be used to filter the target data for generating an entity relationship model from the results obtained by table creation to generate the final entity relationship model.
[0063] In the disclosed embodiment, after creating a table in a database using the table creation statement and obtaining a table creation result, it further includes: inserting test data into the table creation result; the test data is used to verify whether the entity relationship model meets the requirements.
[0064] In a specific implementation, before generating the entity relationship model that is ultimately required, it is possible to verify whether an entity relationship model that meets the requirements can be generated. Specifically, test data can be inserted into the table creation result, and a filter statement corresponding to the test data can be generated. Based on the filter statement, an entity relationship model corresponding to the test data can be generated. At this time, it can be determined whether the entity relationship model corresponding to the test data is accurate to determine whether the execution subject of the embodiment of the present disclosure can generate an entity relationship model that meets the requirements. If the entity relationship model corresponding to the test data meets the requirements, it can be considered that the entity relationship model corresponding to the target data also meets the requirements; if the entity relationship model corresponding to the test data does not meet the requirements, the cause of the exception can be further located and adjusted until the entity relationship model corresponding to the test data meets the requirements.
[0065] According to a second aspect of the embodiment of the present disclosure, Figure 4 As shown, an entity relationship model generation device 400 is provided, comprising:
[0066] A relationship diagram generation module 401 is used to generate an entity relationship diagram corresponding to a plurality of original data tables;
[0067] A statement generation module 402, for generating a table creation statement and a filter statement corresponding to the original data table based on the entity relationship diagram;
[0068] The model generation module 403 is used to use the table creation statement to create a table in the database to obtain a table creation result; use the screening statement to filter the target data in the table creation result to generate an entity relationship model.
[0069] Optionally, the relationship diagram generating module 401 is further used for:
[0070] Acquire multiple original data tables, and determine data information corresponding to each of the original data tables; the data information includes structures and fields corresponding to the original data tables and associations between the original data tables;
[0071] The data information is preprocessed to generate the entity relationship diagram.
[0072] Optionally, the statement generation module 402 is further used to:
[0073] Based on the preprocessed data information, the output formats of the table creation statement and the filter statement are determined.
[0074] Optionally, the relationship diagram generating module 401 is further used for:
[0075] Determine whether the data information meets the preset requirements; if not, update the data information based on the original data table until the data information meets the preset requirements.
[0076] Optionally, the device further comprises a large model generation module 404;
[0077] The large model module 404 is specifically used for:
[0078] The pre-trained large model is used to generate an entity relationship diagram, a table creation statement or a screening statement corresponding to the original data table.
[0079] Optionally, the large model module 404 is further used to:
[0080] Determine prompt words for generating the entity relationship diagram, table creation statement or filter statement; the prompt words include output format requirements for the entity relationship diagram, table creation statement or filter statement and data information update requirements corresponding to the entity relationship diagram.
[0081] Optionally, the model generation module 403 is further used to:
[0082] Insert test data into the table creation result; the test data is used to verify whether the entity relationship model meets the requirements.
[0083] According to the third aspect of an embodiment of the present disclosure, there is provided an electronic device for generating an entity relationship model, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present disclosure.
[0084] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present disclosure is implemented.
[0085] Figure 5 An exemplary system architecture 500 is shown to which the entity relationship model generation method or the entity relationship model generation apparatus implemented by the present disclosure can be applied.
[0086] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0087] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0088] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0089] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may process the received entity relationship model generation request and feed back the processing result (only an example) to the terminal device.
[0090] It should be noted that the method for generating an entity relationship model provided in the embodiment of the present invention is generally executed by the server 505, and accordingly, the entity relationship model generating device is generally set in the server 505. The method for generating an entity relationship model provided in the embodiment of the present invention can also be executed by the terminal devices 501, 502, 503, and accordingly, the entity relationship model generating device can be set in the terminal devices 501, 502, 503.
[0091] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0092] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0093] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0094] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0095] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0096] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0097] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0098] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, a processor includes a relationship diagram generation module, a statement generation module, and a model generation module, wherein the names of these modules do not constitute a limitation on the modules themselves in certain cases. For example, the relationship diagram generation module may also be described as a "module for generating entity relationship diagrams corresponding to multiple original data tables".
[0099] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method:
[0100] Generate an entity relationship diagram corresponding to a plurality of original data tables; based on the entity relationship diagram, generate a table creation statement and a filter statement corresponding to the original data table;
[0101] The table creation statement is used to create a table in a database to obtain a table creation result; the screening statement is used to screen the table creation result to obtain target data to generate an entity relationship model.
[0102] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A method for generating an entity relationship model, characterized in that: include: Generate entity relationship diagrams corresponding to multiple original data tables; Based on the entity relationship diagram, generate a table creation statement and a filter statement corresponding to the original data table; Using the table creation statement to create a table in the database, and obtaining a table creation result; The filter statement is used to filter the target data in the table creation result to generate an entity relationship model.
2. The method according to claim 1, characterized in that Before generating the entity relationship diagram corresponding to multiple original data tables, it also includes: Acquire multiple original data tables, and determine data information corresponding to each of the original data tables; the data information includes structures and fields corresponding to the original data tables and associations between the original data tables; The data information is preprocessed to generate the entity relationship diagram.
3. The method according to claim 2, characterized in that Before generating a table creation statement and a filter statement corresponding to the original data table, the method further includes: Based on the preprocessed data information, the output formats of the table creation statement and the filter statement are determined.
4. The method according to claim 2, characterized in that: After determining the data information corresponding to each of the original data tables, the method further includes: Determine whether the data information meets the preset requirements; if not, update the data information based on the original data table until the data information meets the preset requirements.
5. The method according to claim 1, characterized in that The pre-trained large model is used to generate an entity relationship diagram, a table creation statement or a screening statement corresponding to the original data table.
6. The method according to claim 5, characterized in that Before using the pre-trained large model to generate an entity relationship diagram, a table creation statement or a screening statement corresponding to the original data table, the method further includes: Determine prompt words for generating the entity relationship diagram, table creation statement or filter statement; the prompt words include output format requirements for the entity relationship diagram, table creation statement or filter statement and data information update requirements corresponding to the entity relationship diagram.
7. The method according to claim 1, characterized in that After creating a table in the database using the table creation statement and obtaining the table creation result, the following steps are also included: Insert test data into the table creation result; the test data is used to verify whether the entity relationship model meets the requirements.
8. An entity relationship model generation device, characterized in that: include: A relationship diagram generation module, used to generate entity relationship diagrams corresponding to a plurality of original data tables; wherein each of the original data tables corresponds to an entity; A statement generation module, used to generate a table creation statement and a filter statement corresponding to the original data table based on the entity relationship diagram; The model generation module is used to use the table creation statement to create a table in the database to obtain a table creation result; use the screening statement to filter the target data in the table creation result to generate an entity relationship model.
9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.