Metadata-based interface message database maintenance method and device
By configuring the mapping relationship between metamodel fields and interface message fields, the problems of inconsistent data structures and inefficient multi-table inbound in the API method are solved, and support for multiple interface message formats and data integrity and accuracy are achieved, reducing system maintenance costs.
Patent Information
- Application Number
- CN202411643675.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-11
AI Technical Summary
The existing API methods have problems with inconsistent data structures in the main data management platform, and cannot support multiple tables to enter the database simultaneously, resulting in inefficiency.
By configuring the mapping relationship between metamodel fields and interface message fields, analyzing the messages to be incoming and performing database maintenance, it supports synchronous conversion and incoming of various table structures such as main table, extended table, vertical table, etc.
It realizes support for multiple interface message formats, without the need to modify the interface caller, improves the flexibility and scalability of the system, ensures data integrity and accuracy, and reduces system maintenance costs.
Smart Images

Figure CN119597813A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of data exchange, and in particular relates to a metadata-based interface message database maintenance method and device. Background Art
[0002] Currently, in the process of building enterprise master data, it is necessary to unify the management of data in various professional domains. The main management method is to transmit data in JSON / XML and other formats through interface API.
[0003] At present, the API method still has many technical deficiencies. For example, the master data management platform needs to obtain instance master data from various domains. For different master data types, the data structure transmitted by the API is inconsistent. Even for the same type of master data, the data structure transmitted by different callers is inconsistent. In addition, the traditional unified interface processing solution for multiple master data types can only support the warehousing of a single table, and cannot support the simultaneous warehousing of multiple tables including the main table, extended table, vertical table, multi-select relationship table, and associated relationship table, which is inefficient. Summary of the invention
[0004] In view of the above deficiencies in the prior art, an object of the invention is to provide a method and device for maintaining an interface message database based on metadata.
[0005] The present invention provides a metadata-based interface message database maintenance method, comprising:
[0006] S1: configure the mapping relationship between the metamodel fields and the interface message fields;
[0007] S2: receiving a message to be stored in the warehouse, and parsing the message to be stored in the warehouse to obtain message data;
[0008] S3: Based on the metamodel interface, the message data is maintained in a database according to the mapping relationship.
[0009] According to a metadata-based interface message database maintenance method provided by the present invention, the mapping relationship in step S1 includes:
[0010] Database main table mapping relationship, database multi-select relationship table mapping relationship, database slave table mapping relationship.
[0011] According to a metadata-based interface message database maintenance method provided by the present invention, step S2 further includes:
[0012] S21: receiving the message to be stored;
[0013] S22: parsing the data type of the message to be stored;
[0014] S23: According to the data type, the message to be stored is parsed into a data structure by a parser corresponding to a preset data type to obtain message data.
[0015] According to a metadata-based interface message database maintenance method provided by the present invention, the data type in step S22 includes JSON format, XML format and other formats.
[0016] According to a metadata-based interface message database maintenance method provided by the present invention, step S3 further comprises:
[0017] S31: According to the mapping relationship, the message data is converted accordingly to obtain converted data;
[0018] S32: loading the conversion data according to the metamodel table structure corresponding to the mapping relationship to obtain assembly data;
[0019] S33: Call the metadata of the meta-model to maintain the assembly data.
[0020] According to a metadata-based interface message database maintenance method provided by the present invention, in step S31, when the message data is converted, the main table fields, extended table fields, and vertical table fields corresponding to the message data are converted synchronously.
[0021] According to a metadata-based interface message database maintenance method provided by the present invention, the metadata in step S33 includes adding a new interface, modifying an interface, and deleting an interface.
[0022] A second aspect of the present invention provides a metadata-based interface message database maintenance device, comprising:
[0023] Configuration module: used to configure the mapping relationship between metamodel fields and interface message fields;
[0024] Parsing module: used for receiving the message to be stored, parsing the message to be stored to obtain the message data;
[0025] Conversion module: used for performing database maintenance on the message data according to the mapping relationship based on the metamodel interface.
[0026] A third aspect of the present invention provides a metadata-based interface message database maintenance device, comprising:
[0027] A memory and at least one processor, wherein instructions are stored in the memory;
[0028] At least one of the processors calls the instructions in the memory to enable the metadata-based interface message database maintenance device to execute the metadata-based interface message database maintenance method as described in any one of the above items.
[0029] A fourth aspect of the present invention provides a computer-readable storage medium having instructions stored thereon, and when the instructions are executed by a processor, the metadata-based interface message database maintenance method as described in any one of the above items is implemented.
[0030] The present invention provides a metadata-based interface message database maintenance method and device, which mainly realizes data warehousing operation by configuring the mapping relationship between the metamodel field and the interface message field. The present invention supports request messages of any format, and at the same time, there is no need to modify the interface caller, and its existing data structure can be transmitted to the main data platform. It not only supports batch processing capabilities, but also supports multi-layer nested data processing capabilities. Moreover, based on the configuration of metadata, all fields are mapped one by one with all database tables, so that after receiving the request data, the data can be separately stored and processed based on the mapping relationship, and at the same time, the abnormal results of interface processing can be monitored in real time.
[0031] The present invention configures the mapping relationship between the metamodel field and the interface message field, so that the database maintenance no longer depends on hard coding, but can flexibly adjust the mapping rules according to actual needs, so as to adapt to the changes of different interface message formats, thereby greatly improving the scalability and flexibility of the system; secondly, the present invention can automatically parse messages of various formats through the preset data type corresponding parser, and convert them into a unified data structure, simplifying the complexity of message processing and improving the processing efficiency; and based on the metamodel interface and the mapping relationship, the present invention can accurately map the parsed message data to the main table, multi-select relationship table, slave table and other structures of the database, ensuring the integrity and accuracy of the data, avoiding the problem of data omission or redundancy; and in the process of message data conversion, the present invention can synchronously process various data structures such as the main table field, the extension table field, the vertical table field, etc., meeting the data processing requirements under complex business scenarios. In general, the present invention realizes the automatic maintenance of assembly data, reduces manual intervention, improves the efficiency and accuracy of database maintenance, and because the present invention adopts a maintenance method based on metadata, when the system faces changes in the interface message format or adjustments to the database structure, it only needs to adjust the mapping relationship or metadata configuration without modifying the code, thereby reducing the maintenance cost of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0033] Figure 1 A schematic diagram of a method for maintaining an interface message database based on metadata provided by an embodiment of the present invention;
[0034] Figure 2 A schematic structural diagram of a metadata-based interface message database maintenance device provided in an embodiment of the present invention.
[0035] Reference numerals:
[0036] 100, configuration module; 200, parsing module; 300, conversion module. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.
[0038] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.
[0039] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0040] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.
[0041] Combine the following Figure 1 to Figure 2 Embodiments of the present invention are described.
[0042] like Figure 1 As shown, the present invention provides a metadata-based interface message database maintenance method, comprising:
[0043] S1: Configure the mapping relationship between the meta-model fields and the interface message fields.
[0044] The mapping relationship in step S1 includes: a database master table mapping relationship, a database multi-select relationship table mapping relationship, and a database slave table mapping relationship.
[0045] In step S1, first configure the mapping relationship between the metamodel field and the interface message field, and save the structural position of the metamodel field in the interface message. The mapping relationship includes multiple table structures. After the message data is processed and assembled into field data of each database table according to the field mapping relationship, the mapping relationship supports simultaneous data conversion of the main table, extended table, and vertical table.
[0046] S2: receiving a message to be stored in the warehouse, and parsing the message to be stored in the warehouse to obtain message data.
[0047] Wherein, step S2 further comprises:
[0048] S21: Receive the message to be stored.
[0049] S22: Analyze the data type of the message to be stored.
[0050] The data types in step S22 include JSON format, XML format and other formats.
[0051] S23: According to the data type, the message to be stored is parsed into a data structure by a parser corresponding to a preset data type to obtain message data.
[0052] In steps S21 to S23, firstly, a message to be stored is received from the outside or the interface through a communication method (such as HTTP request, FTP transmission, etc.). After receiving the message to be stored, it is necessary to first determine the data type of the message. The reason is that different types of messages require different parsing methods. After determining the data type of the message, the corresponding parser is selected according to the type. The parser will read the original text of the message and parse it into a flat data structure that can be processed according to its format rules.
[0053] S3: Based on the metamodel interface, the message data is maintained in a database according to the mapping relationship.
[0054] Wherein, step S3 further comprises:
[0055] S31: According to the mapping relationship, the message data is converted accordingly to obtain converted data.
[0056] Wherein, in step S31, when the message data is converted, the main table fields, extended table fields, and vertical table fields corresponding to the message data are converted synchronously.
[0057] S32: Load the conversion data according to the metamodel table structure corresponding to the mapping relationship to obtain assembly data.
[0058] S33: Call the metadata of the meta-model to maintain the assembly data.
[0059] The metadata in step S33 includes newly added interface, modified interface, and deleted interface.
[0060] In steps S31 to S33, first obtain the mapping relationship between the interface message fields configured in step S1 and the metamodel table fields, then load the corresponding values of the fields of each table involved according to the obtained mapping relationship, and finally call the metadata standard add, modify, and delete interfaces to realize data storage.
[0061] like Figure 2 As shown, the present invention also provides a metadata-based interface message database maintenance device, which is used to execute the above method, including:
[0062] Configuration module 100: used to configure the mapping relationship between the meta-model field and the interface message field;
[0063] Parsing module 200: used for receiving the message to be stored, parsing the message to be stored to obtain message data;
[0064] The conversion module 300 is used to perform database maintenance on the message data according to the mapping relationship based on the metamodel interface.
[0065] The present invention also provides a metadata-based interface message database maintenance device, comprising:
[0066] A memory and at least one processor, wherein instructions are stored in the memory;
[0067] At least one of the processors calls the instructions in the memory to enable the metadata-based interface message database maintenance device to execute the metadata-based interface message database maintenance method as described in any one of the above items.
[0068] The present invention also provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the metadata-based interface message database maintenance method as described in any one of the above items is implemented.
[0069] Furthermore, a metadata-based interface message database maintenance device provided by the present invention may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU), for example, one or more processors and memories, one or more storage media for storing applications or data, such as one or more mass storage devices, wherein the memories and storage media may be short-term storage or permanent storage, and the program stored in the storage medium may include one or more modules, each module may include a series of instruction operations in the metadata-based interface message database maintenance device, and further, the processor may be configured to communicate with the storage medium to execute a series of instruction operations in the storage medium on the metadata-based interface message database maintenance device.
[0070] It may also include one or more power supplies, one or more wired or wireless network interfaces, one or more input and output interfaces, and one or more operating systems, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that the metadata-based interface message database maintenance device structure provided by the present invention does not constitute a limitation on the device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0071] The present invention provides a metadata-based interface message database maintenance method, device, equipment and storage medium, which can automatically identify the data format (JSON / XML / other) of the request message, convert it into a unified data structure, and provide an SPI-based data message parsing extension point to facilitate and quickly implement the parsing of other types of messages; secondly, the present invention implements an algorithm through a unified message mapping to load message data of any type of format into the metamodel field of the metadata system standard.
[0072] The present invention provides a metadata-based interface message database maintenance method, device, equipment and storage medium. By configuring the mapping relationship between the metamodel field and the interface message field, it can adapt to the changes of different interface message formats and implement the access of new message formats without modifying the code, which greatly improves the flexibility and scalability of the system. Secondly, the present invention unifies the steps of message reception, parsing, conversion and database maintenance to form a standardized processing flow, which not only simplifies the complexity of message processing, but also improves the processing efficiency and ensures the accuracy and integrity of message data. The present invention can simultaneously process message data containing multiple table structures such as main table, extended table, vertical table, etc., realizes the synchronous conversion and loading of data, and meets the requirements of the present invention. Data processing requirements in complex business scenarios; based on the metamodel interface and mapping relationship, the present invention can automatically convert and load message data into the database table, and call the metadata interface to implement data addition, modification and deletion operations, reducing manual intervention and improving the automation level of database maintenance; since the present invention adopts a metadata-based maintenance method, when facing changes in the interface message format or database structure adjustments, the present invention only needs to adjust the mapping relationship or metadata configuration without modifying the code, thereby reducing the maintenance cost of the system; the present invention can quickly and accurately parse messages of various formats through the preset parser corresponding to the data type, and convert them into a unified data structure, thereby improving the speed and efficiency of data processing.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications 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 invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for maintaining an interface message database based on metadata, characterized in that: include: S1: configure the mapping relationship between the metamodel fields and the interface message fields; S2: receiving a message to be stored in the warehouse, and parsing the message to be stored in the warehouse to obtain message data; S3: Based on the metamodel interface, the message data is maintained in a database according to the mapping relationship.
2. The method for maintaining an interface message database based on metadata according to claim 1, characterized in that: The mapping relationship in step S1 includes: Database main table mapping relationship, database multi-select relationship table mapping relationship, database slave table mapping relationship.
3. The method for maintaining an interface message database based on metadata according to claim 1, characterized in that: Step S2 further comprises: S21: receiving the message to be stored; S22: parsing the data type of the message to be stored; S23: According to the data type, the message to be stored is parsed into a data structure by a parser corresponding to a preset data type to obtain message data.
4. The method for maintaining an interface message database based on metadata according to claim 3, characterized in that: The data type in step S22 includes JSON format, XML format and other formats.
5. The method for maintaining an interface message database based on metadata according to claim 1, characterized in that: Step S3 further comprises: S31: According to the mapping relationship, the message data is converted accordingly to obtain converted data; S32: loading the conversion data according to the metamodel table structure corresponding to the mapping relationship to obtain assembly data; S33: Call the metadata of the meta-model to maintain the assembly data.
6. The method for maintaining an interface message database based on metadata according to claim 5, characterized in that: In step S31, when the message data is converted, the main table fields, extended table fields, and vertical table fields corresponding to the message data are converted synchronously.
7. The method for maintaining an interface message database based on metadata according to claim 5, characterized in that: The metadata in step S33 includes newly added interface, modified interface, and deleted interface.
8. A metadata-based interface message database maintenance device, used to execute the method according to any one of claims 1 to 7, characterized in that: include: Configuration module: used to configure the mapping relationship between metamodel fields and interface message fields; Parsing module: used for receiving the message to be stored, parsing the message to be stored to obtain the message data; Conversion module: used for performing database maintenance on the message data according to the mapping relationship based on the metamodel interface.
9. A metadata-based interface message database maintenance device, characterized in that: include: A memory and at least one processor, wherein instructions are stored in the memory; At least one of the processors calls the instructions in the memory to enable the metadata-based interface message database maintenance device to execute the metadata-based interface message database maintenance method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed by the processor, the metadata-based interface message database maintenance method according to any one of claims 1 to 7 is implemented.