Data model creation method, device, electronic device and storage medium

By generating and sending the model generation language to the database, the problem that the data model cannot be determined during the application development stage and cannot be flexibly changed during the application process is solved, and dynamic creation and flexible adjustment of the data model are realized.

CN119440515BActive Publication Date: 2025-04-22YUNJIN SMART TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510025599.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-04-22
Estimated Expiration
2045-01-08

AI Technical Summary

Technical Problem

In the prior art, data models need to be solidified in the code in advance, and cannot adapt to scenarios that data models cannot be determined in the application development stage, and cannot meet the needs of flexible changes in the data models during the application process.

Method used

By obtaining the model parameters input by the user, model configuration information is generated and stored in the database, model analysis information is generated based on the preset model definition information and model configuration information, and the model generation language is further generated and sent to the database, so that the database can create a data model based on the model generation language and associate the data model with the model configuration information.

Benefits of technology

The data model is implemented without the need to be solidified in the code in advance. Users can create a new data model according to actual needs after the application development is completed, adapt to scenarios that the data model cannot be determined during the application development stage, and realize flexible changes in the data model during the application process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440515B_ABST
    Figure CN119440515B_ABST
Patent Text Reader

Abstract

The embodiments of the present application propose a data model creation method, device, electronic device and storage medium, which relate to the field of database technology. The electronic device obtains the model parameters input by the user based on the model processing application; generates model configuration information according to the model parameters, and stores the model configuration information in the database; generates model parsing information according to the preset model definition information and model configuration information; generates a model generation language according to the model parsing information and the database type of the database, and sends the model generation language to the database, so that the database creates a data model according to the model generation language and associates the data model with the model configuration information. The data model does not need to be solidified in the code of the model processing application in advance, and can adapt to scenarios where the data model cannot be determined in the application development stage. At the same time, the data model can also be flexibly changed during the application process of the model processing application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a data model creation method, device, electronic device and storage medium. Background Art

[0002] At present, when developing an application, it is necessary to use a data model to predefine each part of the business scenario, and use it as a carrier of business data to transmit during the data processing process. In the prior art, when developing an application, the demand personnel must first perform demand analysis and prototype production, and then the developers must perform demand decomposition and business sorting based on the prototype, define the data model according to the objects involved in the business, and finally perform business development and logical connection based on the data model.

[0003] Among them, when defining the data model, it is often necessary to write fixed code and package it and store it in the server. That is to say, the data model needs to be solidified in the code in advance. Therefore, this method cannot adapt to the scenario where the data model cannot be determined during the application development stage. In addition, this method cannot add a new data model after the application development is completed, so it cannot meet the needs of flexible changes in the data model during the application process. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a data model creation method, device, electronic device and storage medium to solve the problems in the prior art that the data model needs to be solidified in the code in advance, cannot adapt to scenarios where the data model cannot be determined during the application development stage, and cannot meet the needs of flexible changes in the data model during the application process.

[0005] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0006] In a first aspect, the present invention provides a data model creation method, which is applied to an electronic device, wherein a model processing application is provided in the electronic device, and the method comprises:

[0007] Obtaining model parameters input by a user based on the model processing application;

[0008] Generate model configuration information according to the model parameters, and store the model configuration information in a database;

[0009] Generate model analysis information according to the preset model definition information and the model configuration information;

[0010] A model generation language is generated according to the model parsing information and the database type of the database, and the model generation language is sent to the database so that the database creates a data model according to the model generation language and associates the data model with the model configuration information.

[0011] In an optional implementation, the model parameters include model attribute parameters and at least one field parameter, and the model configuration information includes first configuration information and second configuration information;

[0012] The generating model configuration information according to the model parameters comprises:

[0013] generating a model identifier for the model attribute parameters, and generating first configuration information according to the model identifier and the model attribute parameters;

[0014] A field identifier is generated for each of the field parameters, and second configuration information is generated according to the model identifier, each of the field parameters, and the field identifier corresponding to the field parameter.

[0015] In an optional implementation manner, generating model parsing information according to preset model definition information and the model configuration information includes:

[0016] Convert the model configuration information into model description information according to a preset model conversion format;

[0017] The model description information is model parsed according to the model definition information to obtain the model parsing information.

[0018] In an optional embodiment, the method further comprises:

[0019] Acquire a data update instruction input by a user based on the model processing application; the data update instruction includes a model identifier of a first data model to be updated;

[0020] According to the model identifier of the first data model, the first data model is obtained from the database, and a data update interface corresponding to the first data model is generated;

[0021] Acquire update data input by the user based on the data update interface, and generate data update information according to the update data, the target field targeted by the update data, and the model configuration information of the first data model;

[0022] The data update information is parsed according to the model definition information to obtain update parsing information, and a data update language for the first data model is generated according to the update parsing information and the database type of the database, and the data update language is sent to the database so that the database updates the data of the first data model according to the data update language.

[0023] In an optional implementation manner, generating data update information according to the update data, the target field targeted by the update data, and the model configuration information of the first data model includes:

[0024] If the data update instruction is a data adding instruction, a data identifier is generated for the updated data, and data update information is generated according to the updated data, the data identifier, the target field targeted by the updated data, and the model configuration information of the first data model;

[0025] If the data update instruction is a data modification instruction, the data identifier of the data to be modified targeted by the update data is obtained, and data update information is generated according to the update data, the data identifier, the target field targeted by the update data and the model configuration information of the first data model.

[0026] In an optional embodiment, the method further comprises:

[0027] Obtaining a data deletion instruction input by a user based on the model processing application; the data deletion instruction includes a model identifier of a second data model to be deleted and a data identifier corresponding to the data to be deleted;

[0028] Generate data deletion information according to the model identifier of the second data model and the data identifier corresponding to the data to be deleted, and parse the data deletion information according to the model definition information to generate deletion parsing information;

[0029] A data deletion language for the second data model is generated according to the deletion parsing information and the database type of the database, and the data deletion language is sent to the database so that the database deletes the data to be deleted in the second data model according to the data deletion language.

[0030] In an optional embodiment, the method further comprises:

[0031] Obtaining a data query instruction from a user; the data query instruction including a model identifier of a third data model to be queried;

[0032] According to the model identifier of the third data model, the third data model is obtained from the database, and a data query interface corresponding to the third data model is generated;

[0033] Acquire a query condition input by a user based on the data query interface, and generate data query information according to the query condition, the target field targeted by the query condition, and the model configuration information of the third data model;

[0034] Parsing the data query information according to the model definition information to obtain first query parsing information, and constructing a query condition binary tree according to the first query parsing information;

[0035] Generate second query parsing information according to the query condition binary tree, and generate a data query language for the third data model according to the second query parsing information and the database type of the database, and send the data query language to the database so that the database performs data query in the third data model according to the data query language.

[0036] In a second aspect, the present invention provides a data model creation device, which is applied to an electronic device, wherein a model processing application is provided in the electronic device, and the device comprises:

[0037] An acquisition module, used for acquiring model parameters input by a user based on the model processing application;

[0038] A configuration module, used to generate model configuration information according to the model parameters, and store the model configuration information in a database;

[0039] A processing module, used to generate model parsing information according to preset model definition information and the model configuration information;

[0040] The processing module is also used to generate a model generation language according to the model parsing information and the database type of the database, and send the model generation language to the database so that the database creates a data model according to the model generation language and associates the data model with the model configuration information.

[0041] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement any of the methods described in the aforementioned embodiments.

[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in any one of the aforementioned embodiments.

[0043] The data model creation method, device, electronic device and storage medium provided in the embodiment of the present application, the electronic device is provided with a model processing application, the electronic device can obtain the model parameters input by the user based on the model processing application, generate model configuration information according to the model parameters, and store the model configuration information in a database, and then generate model parsing information according to the preset model definition information and model configuration information, generate a model generation language according to the model parsing information and the database type of the database, and send the model generation language to the database, then the database can create a data model according to the model generation language, and associate the data model with the model configuration information. Through this method, the data model does not need to be solidified in the code of the model processing application in advance, and the user can create a new data model according to actual needs after the model processing application is developed, so it can adapt to the scenario where the data model cannot be determined in the application development stage, and it can also realize flexible changes of the data model in the application process of the model processing application.

[0044] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 A schematic diagram of the native JDBC execution process is shown;

[0047] Figure 2 A block diagram of an electronic device provided by an embodiment of the present application is shown;

[0048] Figure 3 A schematic diagram of a process of creating a data model provided by an embodiment of the present application is shown;

[0049] Figure 4 An example diagram of model parameters is shown;

[0050] Figure 5 An example diagram of first configuration information is shown;

[0051] Figure 6 An example diagram of second configuration information is shown;

[0052] Figure 7An example diagram of model description information is shown;

[0053] Figure 8 An example diagram of model definition information is shown;

[0054] Fig. 9 An example diagram of data update information is shown;

[0055] Fig.10 Another example diagram of data update information is shown;

[0056] Fig.11 An example diagram of data deletion information is shown;

[0057] Fig.12 An example diagram of data query information is shown;

[0058] Fig.13 An example diagram of a query condition binary tree is shown;

[0059] Fig.14 An example diagram of a preset binary tree format is shown;

[0060] Fig.15 A functional module diagram of a data model creation device provided in an embodiment of the present application is shown.

[0061] Icon: 10 - electronic device; 100 - memory; 110 - processor; 120 - communication module; 200 - acquisition module; 210 - configuration module; 220 - processing module. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0063] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0064] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0065] At present, in the field of application development, Java is widely used in the Internet field as a common development technology for interactive applications. As an object-oriented programming language, when describing business scenarios, it is necessary to use data models to predefine various parts of the business scenarios and use them as data carriers to transmit during data processing.

[0066] Among them, the data model refers to a combination of a group of attributes used to describe the characteristics of an object. For example, the task name, task type, task creation time, etc. combined together can be the data model of the task object, while the task execution time, task executor, etc. can be used as the data model of the task execution object.

[0067] At the same time, the application development process is often accompanied by database-related operations, and the processes of defining necessary information for database connection, obtaining database connection, releasing resources, etc., require repeated coding every time the database is operated.

[0068] It can be seen that when developing an application with the existing technology, the requirements personnel can first conduct requirements analysis and prototype production, and then the developers can decompose the requirements and sort out the business according to the prototype, and define the data model according to the objects involved in the business, and finally carry out business development and logical connection based on the data model.

[0069] Among them, when defining the data model, it is often necessary to write fixed code and package it and store it in the server. That is to say, the data model needs to be solidified in the code in advance. Therefore, this method cannot adapt to the scenario where the data model cannot be determined during the application development stage. In addition, this method cannot add a new data model after the application development is completed, so it cannot meet the needs of flexible changes in the data model during the application process.

[0070] Although in some scenarios, the data model can be configured by splicing SQL, this method is often only applicable to a certain type or a certain database, and its applicability is poor. At present, when implementing the logical connection of databases based on the splicing SQL method, most of them use the native JDBC (Java Database Connectivity) method for operation. The execution process is as follows: Figure 1 As shown, this method also has the problem of complex process and difficult maintenance.

[0071] Based on this, embodiments of the present application provide a data model creation method, device, electronic device and storage medium to solve the above problems.

[0072] Specifically, Figure 2 For a block diagram of an electronic device 10 provided in an embodiment of the present application, see Figure 2 The electronic device 10 includes a memory 100, a processor 110 and a communication module 120. The memory 100, the processor 110 and the communication module 120 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0073] The memory 100 is used to store computer programs or data that can be executed by the processor. The memory 100 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.

[0074] The processor 110 is used to read / write data or computer programs stored in the memory, and execute the computer program to implement the data model creation method provided in the embodiment of the present application.

[0075] The communication module 120 is used to establish a communication connection between the electronic device and other communication terminals through a network, and to send and receive data through the network.

[0076] Optionally, a model processing application is provided in the electronic device, and the electronic device is also communicatively connected to a database.

[0077] It can be understood that the database can be a database set on the electronic device, or a database set on other devices, and this application does not limit this.

[0078] Optionally, in order to simplify the operation steps of the database, the following steps are omitted: Figure 1 The model processing application can be built using an ORM (Object Relational Mapping) framework, such as the Mybatis framework, which avoids JDBC code and manual parameter setting and result set acquisition, thereby simplifying the operation process and facilitating maintenance.

[0079] It should be understood that Figure 2 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown. Figure 2 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0080] Next, the above Figure 2 The electronic device in the example is the execution subject, and the data model creation method provided in the embodiment of the present application is exemplarily introduced in combination with the flow chart.

[0081] Specifically, Figure 3 A flow chart of a data model creation method provided in an embodiment of the present application is shown in Figure 3 , the method comprises the following steps.

[0082] Step S20, obtaining model parameters input by the user based on the model processing application.

[0083] Step S21, generating model configuration information according to the model parameters, and storing the model configuration information in a database.

[0084] Step S22, generating model analysis information according to preset model definition information and model configuration information.

[0085] Optionally, the model definition information may be in a general form of model parsing.

[0086] In an example, the model definition information may divide the data model into three parts: basic information, field information, and data information.

[0087] It can be understood that, on this basis, the model parsing information can also include three parts, namely basic information, field information and data information.

[0088] Step S23, generating a model generation language according to the model parsing information and the database type of the database, and sending the model generation language to the database, so that the database creates a data model according to the model generation language and associates the data model with the model configuration information.

[0089] Optionally, after parsing the model configuration information, the electronic device may generate a model generation language according to the model parsing information and the database type of the database.

[0090] It is understandable that the model generation language refers to a language that can be recognized by the database. For example, DDL (Data Definition Language, database model definition language) statements can be generated for a relational database.

[0091] Optionally, the electronic device may store model language generation logic corresponding to each database type, and the electronic device may determine in advance the database type of the target database for which the data model should be created, thereby generating a model generation language based on the model language generation logic corresponding to the database type and the model parsing information.

[0092] Optionally, the database may create a data model according to the model generation language, and associate the data model with the model configuration information, so as to subsequently operate the data model according to the model configuration information.

[0093] The data model creation method provided by the embodiment of the present application is that the electronic device is provided with a model processing application, the electronic device can obtain the model parameters input by the user based on the model processing application, generate model configuration information according to the model parameters, and store the model configuration information in the database, and then generate model parsing information according to the preset model definition information and model configuration information, generate a model generation language according to the model parsing information and the database type of the database, and send the model generation language to the database, then the database can create a data model according to the model generation language, and associate the data model with the model configuration information. Through this method, the data model does not need to be solidified in the code of the model processing application in advance, and the user can create a new data model according to actual needs after the model processing application is developed, so it can adapt to the scenario where the data model cannot be determined in the application development stage, and it can also realize the flexible change of the data model in the application process of the model processing application.

[0094] In addition, since the method can be used by the electronic device to generate model parsing information based on preset model definition information and model configuration information, and thus generate a model generation language based on the model parsing information and the database type of the database, the model can be parsed by abstractly defining the relevant configuration of the data model, and a language recognizable by the database can be generated based on the parsing results and the database type of the corresponding database. Therefore, corresponding operations can be implemented for each database, thereby improving applicability.

[0095] Optionally, when inputting model parameters, the user needs to input the basic parameters of the model itself and the fields contained therein, that is, the model parameters may include model attribute parameters and at least one field parameter.

[0096] Optionally, the model attribute parameters may include a model name, a model type, a model description, etc., and the field parameters may include a field name, component information, a field configuration parameter, etc.

[0097] In an example, if the data model to be created is a personnel management data model and the field parameter is name, the corresponding model parameter can be as follows: Figure 4 shown.

[0098] Based on this, the model configuration information may include first configuration information and second configuration information.

[0099] It can be understood that the first configuration information is configuration information for model attribute parameters, and the second configuration information is configuration information for field parameters.

[0100] In this embodiment, the electronic device can generate a model identifier for the model attribute parameters, and generate first configuration information based on the model identifier and the model attribute parameters, and generate a field identifier for each field parameter, and generate second configuration information based on the model identifier, each field parameter and the field identifier corresponding to the field parameter.

[0101] Optionally, the model identifier may include a model ID and a model code, and the field identifier may include a field ID and a field code.

[0102] Optionally, the model identifier and the field identifier may be generated according to a predetermined identifier generation logic, such as sequentially generated in a generation order, or randomly generated, etc., which is not limited in the present application.

[0103] It can be understood that a model identifier can uniquely identify a data model, and a field identifier can uniquely identify a field parameter.

[0104] Optionally, the first configuration information may include a model ID, a model code, and model attribute parameters; the second configuration information may include a model ID, a field ID and a field code of each field, and each field parameter.

[0105] Optionally, in order to further refine the configuration information of the model, the first configuration information may also include the annotation information of the model, and the second configuration information may also include policy configuration information, field encryption and decryption configuration information, field search configuration information, field length configuration information, data type, etc.

[0106] Please continue to refer to the above example. If the data model to be created is a personnel management data model, and the field parameters are name and age, the first configuration information can be as follows: Figure 5 As shown, the second configuration information can be Figure 6 shown.

[0107] Optionally, considering that the model parameters input by the user may be in various formats and difficult for electronic devices to parse, the model configuration information can first be converted into model description information in a standard format according to a preset model conversion format, and then the model description information can be parsed according to the model definition information to obtain model parsing information.

[0108] Optionally, the model conversion format can be set by the developer in advance according to actual application conditions.

[0109] In one possible implementation, the model conversion format also includes model attribute parameters and field parameters, and the model attribute parameters may include model encoding, character set, engine type, model description, etc., and the field parameters include field name, field length, default value, whether it is a primary key, whether it is empty, etc.

[0110] Optionally, the character set and engine type can be added by the electronic device according to actual application conditions, and the field length, default value, and whether it is a primary key can be determined according to user settings. If the user has not set it, the electronic device can add it according to a predetermined format.

[0111] Please continue to refer to the above example. If the data model to be created is a personnel management data model and the field parameter is name, the model description information can be as follows: Figure 7 shown.

[0112] Optionally, after obtaining the model description information, the electronic device may perform model parsing on the model description information according to the model definition information. In a possible implementation, the model definition information may be as follows: Figure 8 shown.

[0113] It can be understood that, in this embodiment, the electronic device can perform model analysis on the model description information by making the model description information correspond to each definition in the model definition information.

[0114] In this embodiment, after obtaining the model parsing information, the electronic device may generate a model generation language according to the model parsing information and the database type of the database, so that the database creates a data model according to the model generation language.

[0115] Optionally, after the data model is generated, the user can add corresponding business data to the data model through the model processing application, and update, delete or query the business data.

[0116] In this embodiment, the electronic device can obtain a data update instruction input by the user based on the model processing application.

[0117] Optionally, the data update instruction includes a model identifier of the first data model to be updated.

[0118] Optionally, the user may select the first data model that needs to be updated through the model processing application, thereby sending a data update instruction for the first data model to the electronic device.

[0119] It can be understood that data updating may include adding new data as well as modifying data.

[0120] In this embodiment, the electronic device can obtain the first data model from the database according to the model identifier of the first data model, and generate a data update interface corresponding to the first data model.

[0121] Optionally, the electronic device can obtain model configuration information corresponding to the first data model and data stored in the first data model according to the model identifier, and on this basis, the electronic device can generate a data update interface for the first data model according to the obtained information.

[0122] It can be understood that the data update interface may include model configuration information corresponding to the first data model and data already stored in the first data model, and the user may update the data on the data update interface based on this information.

[0123] In this embodiment, the electronic device can obtain update data input by the user based on the data update interface, generate data update information according to the update data, the target field targeted by the update data, and the model configuration information of the first data model, and then parse the data update information according to the model definition information to obtain update parsing information, and generate a data update language for the first data model based on the update parsing information and the database type of the database, and send the data update language to the database so that the database can update the data of the first data model according to the data update language.

[0124] Optionally, the data update language is a language recognizable by the database. Optionally, the data update information may include a model ID, a data ID, a field ID, a field code, a field name, and a specific update value.

[0125] Optionally, since data updating includes adding new data and modifying data, the process of the electronic device generating data updating information may be different for different update scenarios.

[0126] Specifically, when the data update instruction is a data adding instruction, the electronic device may generate a data identifier for the updated data, and generate data update information according to the updated data, the data identifier, the target field targeted by the updated data, and the model configuration information of the first data model.

[0127] Optionally, the electronic device may generate the data identifier according to a preset data identifier generation logic, for example, according to the order in which the data is newly added or randomly generated, etc.

[0128] Optionally, a data identifier can uniquely identify a row of data.

[0129] In an example, if the data model is a personnel management data model, and the field parameters are name and age, each row of data can represent information about a person, including the person's name and age.

[0130] It can be understood that when the data update instruction is a data addition instruction, the electronic device can first generate a corresponding data identifier for the newly added row of data, for example, the newly added data of person A, including A's name and age, then the data identifier can represent this newly added data.

[0131] In this example, the data update information can be as follows Fig. 9 shown.

[0132] In this embodiment, when the data update instruction is a data modification instruction, the data identifier of the data to be modified targeted by the update data is obtained, and data update information is generated based on the update data, the data identifier, the target field targeted by the update data, and the model configuration information of the first data model.

[0133] Optionally, the data identifier of the data to be modified may indicate in which row the data to be modified is located.

[0134] In one example, in Fig. 9 Based on this, if the user wants to modify the age of person A to 2, the data update information can be as follows Fig.10 shown.

[0135] In this embodiment, the electronic device may also obtain a data deletion instruction input by the user based on the model processing application.

[0136] In this embodiment, the data deletion instruction is used to instruct the electronic device to delete a row of data, so the data deletion instruction may include the model identifier of the second data model to be deleted and the data identifier corresponding to the data to be deleted.

[0137] Optionally, the electronic device may generate data deletion information according to the model identifier of the second data model and the data identifier corresponding to the data to be deleted, and parse the data deletion information according to the model definition information to generate deletion parsing information.

[0138] In one example, if the data model is a personnel management data model, and the user wants to delete the relevant information of person A, then Fig.11 As shown, the data deletion information may include the model ID of the data model and the data ID corresponding to person A.

[0139] Optionally, the electronic device may generate a data deletion language for the second data model according to the deletion parsing information and the database type of the database, and send the data deletion language to the database so that the database deletes the data to be deleted in the second data model according to the data deletion language.

[0140] Optionally, the data deletion language is a language recognizable by the database.

[0141] In this embodiment, the electronic device can also obtain a data query instruction from the user.

[0142] Optionally, considering that the query requirements of users are diverse, the subsequent operation may be determined according to the specific query method.

[0143] In one possible implementation, the query method may include query based on data ID, paging query, conditional query, full query, etc.

[0144] For example, if the query method is data ID query, the data query instruction should include the model identifier of the third data model and the data ID to be queried, and the electronic device can directly perform data ID query based on the model identifier and data ID.

[0145] In another possible implementation, if the query method is conditional query, the data query instruction includes a model identifier of the third data model to be queried. Optionally, the electronic device can obtain the third data model from the database according to the model identifier of the third data model, and generate a data query interface corresponding to the third data model.

[0146] Optionally, the electronic device can obtain model configuration information corresponding to the third data model and data stored in the third data model according to the model identifier, and on this basis, the electronic device can generate a data query interface for the third data model according to the obtained information.

[0147] It is understandable that the data query interface may include model configuration information corresponding to the third data model and data already stored in the third data model, and the user may enter query conditions on the data query interface based on this information. In this embodiment, the electronic device may obtain the query conditions entered by the user based on the data query interface, and generate data query information according to the query conditions, the target field targeted by the query conditions, and the model configuration information of the third data model.

[0148] Optionally, the data query information may include a model code of the third data model, a code of a target field, a query method, and a specific query value.

[0149] In one example, if the data model is a personnel management data model, the data query information can be as follows: Fig.12 shown.

[0150] In this embodiment, the electronic device may parse the data query information according to the model definition information to obtain first query parsing information, and construct a query condition binary tree according to the first query parsing information.

[0151] Optionally, the query condition binary tree consists of a query method, a target field, and a specific query value.

[0152] In an example, if a user wants to query the information of people between the ages of 16 and 60 and with a bachelor's degree or college degree in a personnel management data model, the query condition can be represented as: ((age>16) and (age<60)) and ((education=bachelor's degree) or (education=college)).

[0153] On this basis, the electronic device may first generate data query information according to the above query conditions, and parse the data query information according to the model definition information to obtain first query parsing information, thereby constructing a query condition binary tree according to the first query parsing information.

[0154] In this example, the query condition binary tree can be as follows Fig.13 shown.

[0155] In this example, the electronic device can generate second query parsing information based on the query condition binary tree, and generate a data query language for the third data model based on the second query parsing information and the database type of the database, and send the data query language to the database so that the database can perform data query in the third data model according to the data query language.

[0156] Optionally, the query condition binary tree includes operators and expressions, and the electronic device can parse the query condition binary tree according to the relationship between the operators, the expressions and the left and right trees.

[0157] In a possible implementation manner, the electronic device may perform query parsing on the query condition binary tree according to a preset binary tree format, thereby obtaining the second query parsing condition.

[0158] Optionally, the preset binary tree format can be as follows Fig.14 shown.

[0159] Continuing with the above example, Fig.13 As shown, the query condition binary tree includes a left tree, a right tree, and a node relationship between the left and right trees, so the query condition binary tree can be parsed according to a preset binary tree format.

[0160] Optionally, the data query language is a language that can be recognized by the database.

[0161] Optionally, in order to ensure data security, the electronic device may also perform some processing on the data when generating the database language.

[0162] In this embodiment, the electronic device may perform one or more processing operations on the data, such as desensitizing, encrypting, converting types, generating mapping values, etc., which can be specifically set by the developer according to actual needs.

[0163] In one possible implementation, at least one data processing device may be provided in the electronic device, and each data processing device is used to perform a process on the data. For example, an encryption processing device, a desensitization processing device, a conversion processing device, etc. may be provided, and each processing device may process the data respectively to finally obtain the processed data.

[0164] It can be understood that the database can store the processed data according to the database language.

[0165] It is understandable that when a user performs a data query on a data model, the electronic device also needs to perform inverse processing on the queried data to obtain real data and feed it back to the user.

[0166] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a data model creation device is given below. Fig.15 , Fig.15 A functional module diagram of a data model creation device provided in an embodiment of the present application. It should be noted that the basic principle and technical effects of the data model creation device provided in this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The data model creation device includes: an acquisition module 200, a configuration module 210, and a processing module 220.

[0167] The acquisition module 200 is used to acquire model parameters input by the user based on the model processing application.

[0168] It can be understood that the acquisition module 200 can also be used to execute the above step S20.

[0169] The configuration module 210 is used to generate model configuration information according to model parameters and store the model configuration information in a database.

[0170] It can be understood that the configuration module 210 can also be used to execute the above step S21.

[0171] The processing module 220 is used to generate model parsing information according to preset model definition information and model configuration information.

[0172] It can be understood that the processing module 220 can also be used to execute the above step S22.

[0173] The processing module 220 is also used to generate a model generation language according to the model parsing information and the database type of the database, and send the model generation language to the database so that the database creates a data model according to the model generation language and associates the data model with the model configuration information.

[0174] It can be understood that the processing module 220 can also be used to execute the above step S23.

[0175] Optionally, the configuration module 210 is also used to generate a model identifier for the model attribute parameters, and generate first configuration information based on the model identifier and the model attribute parameters; generate a field identifier for each field parameter, and generate second configuration information based on the model identifier, each field parameter and the field identifier corresponding to the field parameter.

[0176] Optionally, the processing module 220 is further configured to convert the model configuration information into model description information according to a preset model conversion format; and perform model parsing on the model description information according to the model definition information to obtain model parsing information.

[0177] Optionally, the processing module 220 is also used to obtain data update instructions input by the user based on the model processing application; the data update instructions include a model identifier of the first data model to be updated; according to the model identifier of the first data model, the first data model is obtained from the database, and a data update interface corresponding to the first data model is generated; the update data input by the user based on the data update interface is obtained, and data update information is generated according to the update data, the target field targeted by the update data, and the model configuration information of the first data model; the data update information is parsed according to the model definition information to obtain update parsing information, and a data update language for the first data model is generated according to the update parsing information and the database type of the database, and the data update language is sent to the database so that the database updates the data of the first data model according to the data update language.

[0178] Optionally, the processing module 220 is also used to generate a data identifier for the updated data if the data update instruction is a data addition instruction, and generate data update information based on the updated data, the data identifier, the target field targeted by the updated data, and the model configuration information of the first data model; if the data update instruction is a data modification instruction, obtain the data identifier of the data to be modified targeted by the updated data, and generate data update information based on the updated data, the data identifier, the target field targeted by the updated data, and the model configuration information of the first data model.

[0179] Optionally, the processing module 220 is also used to obtain a data deletion instruction input by a user based on a model processing application; the data deletion instruction includes a model identifier of a second data model for data deletion and a data identifier corresponding to the data to be deleted; data deletion information is generated based on the model identifier of the second data model and the data identifier corresponding to the data to be deleted, and the data deletion information is parsed based on the model definition information to generate deletion parsing information; a data deletion language for the second data model is generated based on the deletion parsing information and the database type of the database, and the data deletion language is sent to the database so that the database deletes the data to be deleted in the second data model according to the data deletion language.

[0180] Optionally, the processing module 220 is also used to obtain the user's data query instruction; the data query instruction includes the model identifier of the third data model to be queried; according to the model identifier of the third data model, the third data model is obtained from the database, and a data query interface corresponding to the third data model is generated; the query conditions input by the user based on the data query interface are obtained, and data query information is generated according to the query conditions, the target fields targeted by the query conditions, and the model configuration information of the third data model; the data query information is parsed according to the model definition information to obtain the first query parsing information, and a query condition binary tree is constructed according to the first query parsing information; second query parsing information is generated according to the query condition binary tree, and a data query language for the third data model is generated according to the second query parsing information and the database type of the database, and the data query language is sent to the database so that the database performs data query in the third data model according to the data query language. Optionally, the above modules can be stored in the form of software or firmware. Figure 2 The memory shown in the figure or solidified in the operating system (OS) of the electronic device, and can be Figure 2 Meanwhile, the data and program codes required for executing the above modules can be stored in the memory.

[0181] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the data model creation method provided in the embodiment of the present application can be implemented.

[0182] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing 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 consecutive boxes 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 and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0183] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0184] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0185] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for creating a data model, characterized in that: Applied to an electronic device, wherein a model processing application is provided in the electronic device, the method comprises: Obtaining model parameters input by a user based on the model processing application; Generate model configuration information according to the model parameters, and store the model configuration information in a database; Generate model analysis information according to the preset model definition information and the model configuration information; Generate a model generation language according to the model parsing information and the database type of the database, and send the model generation language to the database, so that the database creates a data model according to the model generation language and associates the data model with the model configuration information; The data model is a combination of a set of attributes used to describe object features; the model parameters include model attribute parameters and at least one field parameter; the model configuration information includes first configuration information and second configuration information, wherein the first configuration information is configuration information for the model attribute parameters, and the second configuration information is configuration information for the field parameters; the model definition information is a general form of model parsing, including basic information, field information and data information; the model parsing information includes basic information, field information and data information; the model generation language is a language that can be recognized by the database; Obtaining a data update instruction input by a user based on the model processing application; the data update instruction includes a model identifier of a first data model to be updated; obtaining the first data model from the database according to the model identifier of the first data model, and generating a data update interface corresponding to the first data model; obtaining update data input by the user based on the data update interface, and generating data update information according to the update data, the target field targeted by the update data, and the model configuration information of the first data model; parsing the data update information according to the model definition information to obtain update parsing information, and generating a data update language for the first data model according to the update parsing information and the database type of the database, and sending the data update language to the database so that the database updates the data of the first data model according to the data update language; Acquire a data deletion instruction input by a user based on the model processing application; the data deletion instruction includes a model identifier of a second data model to be deleted and a data identifier corresponding to the data to be deleted; generate data deletion information according to the model identifier of the second data model and the data identifier corresponding to the data to be deleted, and parse the data deletion information according to the model definition information to generate deletion parsing information; generate a data deletion language for the second data model according to the deletion parsing information and the database type of the database, and send the data deletion language to the database, so that the database deletes the data to be deleted in the second data model according to the data deletion language; Obtain a data query instruction from a user; the data query instruction includes a model identifier of a third data model to be queried; according to the model identifier of the third data model, obtain the third data model from the database, and generate a data query interface corresponding to the third data model; obtain a query condition input by the user based on the data query interface, and generate data query information according to the query condition, the target field targeted by the query condition, and the model configuration information of the third data model; parse the data query information according to the model definition information to obtain first query parsing information, and construct a query condition binary tree according to the first query parsing information; generate second query parsing information according to the query condition binary tree, and generate a data query language for the third data model according to the second query parsing information and the database type of the database, and send the data query language to the database so that the database performs data query in the third data model according to the data query language.

2. The method according to claim 1, characterized in that The generating model configuration information according to the model parameters comprises: generating a model identifier for the model attribute parameters, and generating first configuration information according to the model identifier and the model attribute parameters; A field identifier is generated for each of the field parameters, and second configuration information is generated according to the model identifier, each of the field parameters, and the field identifier corresponding to the field parameter.

3. The method according to claim 1, characterized in that The generating model parsing information according to the preset model definition information and the model configuration information includes: Convert the model configuration information into model description information according to a preset model conversion format; The model description information is model parsed according to the model definition information to obtain the model parsing information.

4. The method according to claim 1, characterized in that: The generating data update information according to the update data, the target field targeted by the update data, and the model configuration information of the first data model includes: If the data update instruction is a data adding instruction, a data identifier is generated for the updated data, and data update information is generated according to the updated data, the data identifier, the target field targeted by the updated data, and the model configuration information of the first data model; If the data update instruction is a data modification instruction, the data identifier of the data to be modified targeted by the update data is obtained, and data update information is generated according to the update data, the data identifier, the target field targeted by the update data and the model configuration information of the first data model.

5. A data model creation device, characterized in that: Applied to an electronic device, wherein the electronic device is provided with a model processing application program, the device comprises: An acquisition module, used for acquiring model parameters input by a user based on the model processing application; A configuration module, used to generate model configuration information according to the model parameters, and store the model configuration information in a database; A processing module, used to generate model parsing information according to preset model definition information and the model configuration information; The processing module is further used to generate a model generation language according to the model parsing information and the database type of the database, and send the model generation language to the database, so that the database creates a data model according to the model generation language and associates the data model with the model configuration information; the data model is a combination of a group of attributes used to describe object characteristics; the model parameters include model attribute parameters and at least one field parameter; the model configuration information includes first configuration information and second configuration information, wherein the first configuration information is configuration information for the model attribute parameters, and the second configuration information is configuration information for the field parameters; the model definition information is a general form of model parsing, including basic information, field information and data information; the model parsing information includes basic information, field information and data information; the model generation language is a language that can be recognized by the database; The processing module is further used to obtain a data update instruction input by a user based on the model processing application; the data update instruction includes a model identifier of a first data model to be updated; according to the model identifier of the first data model, the first data model is obtained from the database, and a data update interface corresponding to the first data model is generated; the update data input by the user based on the data update interface is obtained, and data update information is generated according to the update data, the target field targeted by the update data, and the model configuration information of the first data model; the data update information is parsed according to the model definition information to obtain update parsing information, and a data update language for the first data model is generated according to the update parsing information and the database type of the database, and the data update language is sent to the database, so that the database updates the data of the first data model according to the data update language; The processing module is further used to obtain a data deletion instruction input by a user based on the model processing application; the data deletion instruction includes a model identifier of a second data model to be deleted and a data identifier corresponding to the data to be deleted; data deletion information is generated according to the model identifier of the second data model and the data identifier corresponding to the data to be deleted, and the data deletion information is parsed according to the model definition information to generate deletion parsing information; a data deletion language for the second data model is generated according to the deletion parsing information and a database type of the database, and the data deletion language is sent to the database so that the database deletes the data to be deleted in the second data model according to the data deletion language; The processing module is also used to obtain a data query instruction from a user; the data query instruction includes a model identifier of a third data model to be queried; according to the model identifier of the third data model, the third data model is obtained from the database, and a data query interface corresponding to the third data model is generated; the query condition input by the user based on the data query interface is obtained, and data query information is generated according to the query condition, the target field targeted by the query condition, and the model configuration information of the third data model; the data query information is parsed according to the model definition information to obtain first query parsing information, and a query condition binary tree is constructed according to the first query parsing information; second query parsing information is generated according to the query condition binary tree, and a data query language for the third data model is generated according to the second query parsing information and the database type of the database, and the data query language is sent to the database so that the database performs data query in the third data model according to the data query language.

6. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • A computer implemented and IoT based method for increasing crop production using machine learning model

    AU2021105327A4

  • Data processing method, device and equipment and computer readable storage medium

    CN116821103A