Data processing method and device, electronic device, and computer readable medium

By building a matching tree and determining a data conversion strategy, the problem of difficulty in converting data models in the existing technology is solved, and higher development convenience and maintainability are achieved.

CN114327493BActive Publication Date: 2025-03-04CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111576032.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2025-03-04
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The conversion of different data models in the prior art requires the design of a large number of customized codes, which leads to large development volume and maintenance difficulties, increasing the difficulty of data model conversion.

Method used

By obtaining the source data model and transformation requirement information, building a matching tree, and parsing the leaf nodes to determine the data conversion strategy, and then obtaining the target data model, reducing the difficulty of data model conversion.

Benefits of technology

This method reduces the amount of encoding developers need to design, reduces the difficulty of data model conversion, and improves development convenience and maintainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114327493B_ABST
    Figure CN114327493B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data processing method and device, an electronic device, and a computer-readable medium, the method comprising: obtaining a source data model and conversion requirement information of the source data model, then constructing a matching tree based on the source data model and the conversion requirement information, then parsing the leaf nodes contained in the matching tree, and determining the data conversion strategy corresponding to the leaf nodes based on the parsing results, then obtaining the target data matched by the leaf nodes based on the data conversion strategy, and obtaining the target data model based on the target data. The technical solution of the embodiment of the present application greatly optimizes the data model conversion solution and reduces the difficulty of data model conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer communication technology, and in particular to a data processing method, a data processing device, an electronic device, and a computer-readable medium. Background Art

[0002] At present, the conversion of different data models is involved between various systems. However, the conversion of different data models in related technologies all involves corresponding coding designed for each data model conversion, that is, customized code development, which has a large amount of development and is difficult to maintain, causing certain troubles for relevant development staff.

[0003] Therefore, how to reduce the difficulty of data model conversion is an urgent problem to be solved. Summary of the invention

[0004] To solve the above technical problems, the embodiments of the present application provide a data processing method and device, an electronic device, and a computer-readable medium, thereby reducing the difficulty of converting the data model at least to a certain extent.

[0005] According to one aspect of an embodiment of the present application, a data processing method is provided, the method comprising: obtaining a source data model and conversion requirement information of the source data model; constructing a matching tree based on the source data model and the conversion requirement information; parsing leaf nodes contained in the matching tree, and determining a data conversion strategy corresponding to the leaf node based on the parsing result; obtaining target data matching the leaf node based on the data conversion strategy, and obtaining a target data model based on the target data.

[0006] According to one aspect of an embodiment of the present application, a data processing device is provided, comprising: an acquisition module, configured to acquire a source data model and conversion requirement information of the source data model; a construction module, configured to construct a matching tree based on the source data model and the conversion requirement information; a parsing and determination module, configured to parse the leaf nodes contained in the matching tree, and determine the data conversion strategy corresponding to the leaf nodes based on the parsing results; an acquisition and obtaining module, configured to acquire target data matching the leaf nodes based on the data conversion strategy, and obtain a target data model based on the target data.

[0007] In one embodiment of the present application, based on the aforementioned scheme, the construction module includes: a parsing unit, configured to parse the source data model to obtain multiple element items; a first acquisition unit, configured to obtain multiple target conversion logic components based on the multiple element items and the conversion requirement information; a generation unit, configured to combine the multiple target conversion logic components to generate a conversion data template; and a construction unit, configured to construct the matching tree based on the conversion data template.

[0008] In one embodiment of the present application, based on the aforementioned scheme, the conversion requirement information includes type information of the target data model to which the source data model is to be converted; the acquisition unit is specifically configured to: obtain multiple conversion logic components that match the type information from a preset conversion logic library; determine the conversion logic components that match each element item from the multiple conversion logic components, and use the conversion logic components that match each element item as the target conversion logic component.

[0009] In one embodiment of the present application, based on the aforementioned scheme, the construction unit is specifically configured as follows: parsing the conversion data template to obtain the level to which each element item belongs and the association relationship between each element item; based on the level to which each element item belongs and the association relationship between each element item, constructing the matching tree.

[0010] In one embodiment of the present application, based on the aforementioned scheme, the data conversion strategy includes a meta-service call strategy, a mapping processing strategy and a regular processing strategy; the acquisition and obtaining module includes: a second acquisition unit, configured to obtain the meta-service component matching the leaf node from a preset meta-service library if it is determined based on the parsing result that the data conversion strategy corresponding to the leaf node is a meta-service call strategy; a third acquisition unit, configured to obtain the target data matching the leaf node based on the meta-service component.

[0011] In one embodiment of the present application, based on the aforementioned solution, the device further includes: a receiving module configured to generate multiple meta-service components based on the received input operation; and a storage module configured to store the multiple meta-service components in the preset meta-service library.

[0012] In one embodiment of the present application, based on the aforementioned scheme, the parsing and determination module includes: a traversal unit, configured to traverse all nodes contained in the matching tree; a parsing unit, configured to determine leaf nodes from all nodes and parse the leaf nodes.

[0013] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the data processing method as described above.

[0014] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor of a computer, the data processing method as described above is implemented.

[0015] According to one aspect of an embodiment of the present application, a computer program product is provided, including computer instructions, which implement the data processing method as described above when executed by a processor.

[0016] In the technical solutions provided in the embodiments of the present application:

[0017] On the one hand, by constructing a matching tree based on the source data model and the conversion requirement information of the source data model, the relevant development staff does not need to design a large amount of repetitive coding, for example, there is no need to design a large number of judgment statements. In the related technology, a large number of judgment statements are designed, and for the relevant development staff, it is necessary to build a more complex conversion logic, which greatly increases the development difficulty. Therefore, the technical solution in the embodiment of the present application can reduce the difficulty of data model conversion and improve the development convenience of the relevant development staff to a certain extent. At the same time, by constructing a matching tree based on the source data model and the conversion requirement information of the source data model, the conversion logic can be viewed more intuitively and clearly, which is convenient for later maintenance, improves maintainability, and further improves the development convenience of the relevant development staff.

[0018] On the other hand, by parsing the leaf nodes contained in the matching tree and determining the data conversion strategy corresponding to the leaf nodes based on the parsing results, the target data matching the leaf nodes is obtained based on the determined data conversion strategy. In this way, the corresponding target data can be obtained according to different data conversion strategies, which is more flexible and applicable to a wider range of scenarios.

[0019] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0021] Figure 1 is a schematic diagram of an exemplary implementation environment to which the technical solution of the embodiments of the present application can be applied;

[0022] Figure 2 is a flow chart of a data processing method shown in an exemplary embodiment of the present application;

[0023] Figure 3 yes Figure 2 A flowchart of step S202 in the illustrated embodiment in an exemplary embodiment;

[0024] Figure 4 yes Figure 3 A flowchart of step S302 in the illustrated embodiment in an exemplary embodiment;

[0025] Figure 5 yes Figure 3 A flowchart of step S304 in the illustrated embodiment in an exemplary embodiment;

[0026] Figure 6 yes Figure 2 A flowchart of step S203 in the illustrated embodiment in an exemplary embodiment;

[0027] Figure 7 yes Figure 2 A flowchart of step S204 in the illustrated embodiment in an exemplary embodiment;

[0028] Figure 8 is a flow chart of a data processing method shown in an exemplary embodiment of the present application;

[0029] Fig. 9 is a flow chart of a data processing method shown in an exemplary embodiment of the present application;

[0030] Fig.10 is a schematic diagram of a data processing method shown in an exemplary embodiment of the present application;

[0031] Fig.11 is a structural schematic diagram of a data processing device shown in an exemplary embodiment of the present application;

[0032] Fig.12 It is a structural diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application. DETAILED DESCRIPTION

[0033] Here, exemplary embodiments will be described in detail, 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 implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0035] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0036] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.

[0037] At present, the conversion of different data models will be involved between various systems. For example, for the product service center, it will involve the conversion between a large number of different data models. However, the conversion of different data models in the relevant technology is designed for the corresponding coding of each data model conversion. For example, a large number of judgment statements need to be designed for each data model conversion. Since a large number of judgment statements need to be designed, it is necessary for the relevant development staff to build a more complex conversion logic, which greatly increases the difficulty of development, thereby greatly increasing the difficulty of data model conversion; and the later maintenance is also more difficult, which brings certain troubles to the relevant development staff.

[0038] Based on this, the embodiment of the present application proposes a data processing method, which not only reduces the difficulty of converting the data model, but also facilitates subsequent maintenance and has strong maintainability, bringing many conveniences to the development of relevant development staff.

[0039] See also Figure 1 , Figure 1 1 is a schematic diagram of an exemplary implementation environment of the present application, wherein the implementation environment includes a terminal device 101 and a server 102, and the terminal device 101 and the server 102 communicate with each other via a wired or wireless network.

[0040] It should be understood that Figure 1 The number of terminal devices 101 and servers 102 in the embodiment is only for illustration. Any number of terminal devices 101 and servers 102 may be provided according to actual needs.

[0041] Among them, the terminal device 101 corresponds to the client, which can be any electronic device with a user input interface, including but not limited to smart phones, tablets, laptops, computers, etc., wherein the user input interface includes but is not limited to touch screens, keyboards, physical buttons, audio pickup devices, etc.

[0042] Among them, server 102 corresponds to the service end, which can be a server that provides various services. It can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network) and basic cloud computing services such as big data and artificial intelligence platforms. This is not restricted here.

[0043] In some embodiments of the present application, the data processing method may be executed by the server 102, and accordingly, the data processing device is configured in the server 102. Optionally, the server 102 may obtain the source data model and the conversion requirement information of the source data model sent by the terminal device 101, and then build a matching tree based on the source data model and the conversion requirement information, and then parse the leaf nodes contained in the matching tree, and determine the data conversion strategy corresponding to the leaf nodes based on the parsing results, and then obtain the target data matching the leaf nodes based on the data conversion strategy, and obtain the target data model based on the target data.

[0044] In some embodiments of the present application, the data processing method can be executed by the terminal device 101, and accordingly, the data processing device is configured in the terminal device 101. Optionally, the terminal device 101 can obtain the uploaded source data model and the conversion requirement information of the source data model, and then build a matching tree based on the source data model and the conversion requirement information, and then parse the leaf nodes contained in the matching tree, and determine the data conversion strategy corresponding to the leaf node based on the parsing result, and then obtain the target data matched by the leaf node based on the data conversion strategy, and obtain the target data model based on the target data, and the target data model can be sent to the server 102.

[0045] The following is a detailed description of various implementation details of the technical solution of the embodiment of the present application:

[0046] See also Figure 2 , Figure 2 is a flow chart of a data processing method shown in an embodiment of the present application. The method can be applied to Figure 1 In the implementation environment shown, and by Figure 1 The terminal device 101 or the server 102 in the implementation environment shown is executed. Figure 2 As shown, the data processing method at least includes steps S201 to S204, which are described in detail as follows:

[0047] Step S201, obtaining a source data model and conversion requirement information of the source data model.

[0048] In the embodiment of the present application, the source data model refers to an unconverted data model, that is, a data model to be converted; wherein the source data model can be a source data model in any form, for example, it can be an Excel file format, a Word file format, a Notepad file format, etc.

[0049] In the embodiment of the present application, the conversion requirement information refers to the information of the target data model to which the source data model is to be converted, that is, the information of which type / target data model the source data model needs to be converted.

[0050] Optionally, the conversion requirement information includes, but is not limited to, type information, identification information, name information, etc. of the target data model to which the source data model is to be converted. The type information refers to the type of the target data model; the identification information refers to the identification of the target data model, such as an identification number, which may correspond to the type one-to-one; the name information refers to the name of the target data model, which may correspond to the type and the identification number one-to-one.

[0051] Step S202: construct a matching tree based on the source data model and the conversion requirement information.

[0052] In the embodiment of the present application, a source data model and conversion requirement information of the source data model are obtained, and then a matching tree can be constructed based on the source data model and the conversion requirement information.

[0053] In the embodiment of the present application, a matching tree refers to a tree-shaped data structure, which has the characteristics that each node has zero or more child nodes, a node without a parent node is called a root node, and each non-root node has only one parent node. Among them, a matching tree is a data structure dedicated to processing matching related.

[0054] In one embodiment of the present application, see Figure 3 The process of constructing a matching tree based on the source data model and the conversion requirement information in step S202 may include steps S301 to S304, which are described in detail as follows:

[0055] Step S301, parsing the source data model to obtain multiple element items;

[0056] Step S302, based on the multiple element items and the conversion requirement information, obtaining multiple target conversion logic components;

[0057] Step S303, combining multiple target conversion logic components to generate a conversion data template;

[0058] Step S304: construct a matching tree based on the converted data template.

[0059] That is, in an optional embodiment, building a matching tree based on the source data model and the conversion requirement information can be specifically implemented by parsing the source data model to obtain multiple element items, then obtaining multiple target conversion logic components based on the multiple element items and the conversion requirement information, then combining the multiple target conversion logic components to generate a conversion data template, and then building a matching tree based on the conversion data module.

[0060] Among them, in the optional embodiment, the element item refers to the name item corresponding to the source data contained in the source data model; for example, the source data contained in the source data model are a1, a2 and a3, then the element items include a1 element item corresponding to a1, a2 element item corresponding to a2, and a3 element item corresponding to a3.

[0061] Among them, in the optional embodiment, the target conversion logic component refers to a set of codes related to the target conversion logic.

[0062] Among them, in the optional embodiment, the conversion data template refers to a data template obtained by combining one or more target conversion logic components, which is used to construct a matching tree, that is, the construction of the matching tree is based on the conversion data template.

[0063] In one embodiment of the present application, the conversion requirement information includes type information of the target data model to which the source data model is to be converted; see Figure 4 The process of obtaining multiple target conversion logic components based on multiple element items and conversion requirement information in step S302 may include steps S401 to S402, which are described in detail as follows:

[0064] Step S401, acquiring multiple conversion logic components matching the type information from a preset conversion logic library;

[0065] Step S402: determining a conversion logic component that matches each element item from a plurality of conversion logic components, and taking the conversion logic component that matches each element item as a target conversion logic component.

[0066] That is, in an optional embodiment, based on multiple element items and conversion requirement information, obtaining multiple target conversion logic components can be specifically implemented by obtaining multiple conversion logic components that match the type information from a preset conversion logic library, and then determining the conversion logic component that matches each element item from the multiple conversion logic components, and using the conversion logic component that matches each element item as the target conversion logic component.

[0067] Among them, in an optional embodiment, a preset conversion logic library is preset with multiple type information and multiple conversion logic components corresponding to each type information; for example, please refer to Table 1 below, which is an example of a preset conversion logic library.

[0068] Type Information Conversion Logic Component A t1, t2, t3, t4, t5, t6, t7, t8 B t3, t6, t7, t8, t9, t10, t11, t12 …… ……

[0069] Table 1

[0070] As shown in Table 1, type A information corresponds to multiple conversion logic components t1, t2, t3, t4, t5, t6, t7, and t8, and type B information corresponds to multiple conversion logic components t3, t6, t7, t8, t9, t10, t11, and t12; the multiple conversion logic components corresponding to different types of information may be the same or different, and in actual applications, they can be flexibly set according to specific application scenarios.

[0071] For example, if the type information of the target data model to be converted from the source data model included in the conversion requirement information is A, then multiple conversion logic components t1, t2, t3, t4, t5, t6, t7, t8 that match the A type information can be obtained from the preset conversion logic library shown in Table 1; at the same time, if the conversion logic components matching the element items are t1, t2, t3, t4, then at this time, t1, t2, t3, t4 are determined from the multiple conversion logic components t1, t2, t3, t4, t5, t6, t7, t8, that is, t1, t2, t3, t4 are used as target conversion logic components.

[0072] It can be understood that by implementing the optional embodiment, the relevant development staff only need to set up the conversion logic components corresponding to each type of information in the preset conversion logic library. In this way, as long as the source data model and the conversion requirement information of the source data model are obtained, the target conversion logic components can be matched from the preset conversion logic library, thereby generating a conversion data template to provide support for the construction of a matching tree. In the later stage, it is only necessary to maintain the conversion logic components corresponding to each type of information in the preset conversion logic library, without having to design corresponding codes for each data model conversion separately, which greatly reduces the development difficulty.

[0073] In one embodiment of the present application, see Figure 5 The process of constructing a matching tree based on the conversion data template in step S304 may include steps S501 to S502, which are described in detail as follows:

[0074] Step S501, parsing the conversion data template to obtain the level to which each element item belongs and the association relationship between each element item;

[0075] Step S502: construct a matching tree based on the levels to which the elements belong and the associations between the elements.

[0076] That is, in an optional embodiment, building a matching tree based on a conversion data template may be specifically implemented by parsing the conversion data template to obtain the level to which each element item belongs and the association relationship between each element item, and then building a matching tree based on the level to which each element item belongs and the association relationship between each element item.

[0077] Among them, the level to which the element item belongs in the optional embodiment refers to the level in the source data template where the element item is located, which is determined by the characteristics of the element item's own data; for example, the source data model includes a1 element item, a2 element item, and a3 element item, where a1 element item and a2 element item are both at the second level, and a3 element item is at the third level. It can be understood that the levels in the matching tree are counted from top to bottom, and the root node is the first level; at the same time, the elements at the same level are in a parallel relationship, and the elements at different levels may have no relationship, or may be in a containing relationship, or may be in a contained relationship.

[0078] Among them, the association relationship between each element item in the optional embodiment refers to the association relationship that may exist between each element item, wherein the association relationship includes but is not limited to no relationship, a containing relationship, a contained relationship, etc.

[0079] For example, suppose that the conversion data template is parsed, and the levels to which each element belongs are: the a1 element and the a2 element are both the second level, the a3 element is the third level, and the associations between the elements are: the a1 element contains the a3 element (it can also be understood that the a3 element is contained by the a1 element), and the a2 element has no relationship with the a1 element and the a3 element. Therefore, a matching tree can be constructed based on the levels to which each element belongs and the associations between each element obtained by parsing; specifically, the a1 element and the a2 element can be used as nodes of the second level, and the a3 element can be used as a node of the third level, and it is a child node of the a1 element node.

[0080] It can be understood that by implementing the optional embodiment, the conversion data template is parsed, and an accurate matching tree can be quickly constructed based on the levels to which each element item belongs and the association relationship between each element item obtained by the analysis. The construction process is simple and easy to implement.

[0081] Step S203, parsing the leaf nodes contained in the matching tree, and determining the data conversion strategy corresponding to the leaf nodes based on the parsing result.

[0082] In the embodiment of the present application, a matching tree is constructed based on the source data model and the conversion requirement information, and then the leaf nodes contained in the matching tree can be parsed, and the data conversion strategy corresponding to the leaf nodes can be determined based on the parsing results.

[0083] In the embodiment of the present application, a leaf node refers to a node without child nodes in the matching tree, that is, the bottom node in the matching tree.

[0084] The data conversion strategy in the embodiment of the present application refers to the conversion strategy of the source data corresponding to the leaf node into the target data. It is understandable that the data conversion strategy includes but is not limited to the meta-service call strategy, the mapping processing strategy and the regular processing strategy. Among them, the meta-service call strategy refers to the strategy of obtaining the target data by calling a set of logically related codes, which is applicable to the leaf nodes of complex data conversion; the mapping processing strategy refers to the strategy of obtaining the target data by encoding a simple mapping relationship, which is applicable to the leaf nodes of simple data conversion; the regular processing strategy refers to the strategy of obtaining the target data by processing regular expressions.

[0085] In one embodiment of the present application, see Figure 6 The process of parsing the leaf nodes contained in the matching tree in step S203 may include steps S601 to S602, which are described in detail as follows:

[0086] Step S601, traverse all nodes contained in the matching tree;

[0087] Step S602, determining leaf nodes from all nodes and parsing the leaf nodes.

[0088] That is, in an optional embodiment, parsing the leaf nodes contained in the matching tree may be specifically implemented by traversing all nodes contained in the matching tree, then determining the leaf nodes from all the nodes, and parsing the leaf nodes.

[0089] Among them, in an optional embodiment, the nodes in the matching tree can be traversed from the root node from top to bottom and from left to right until all the nodes contained in the matching tree are traversed. When the traversed node has no child node, it can be determined that the node without child node is a leaf node, and then the leaf node can be parsed.

[0090] Step S204, obtaining target data matching the leaf node based on the data conversion strategy, and obtaining a target data model based on the target data.

[0091] In an embodiment of the present application, the leaf nodes contained in the matching tree are parsed, and the data conversion strategy corresponding to the leaf nodes is determined based on the parsing results. Thereafter, the target data matching the leaf nodes can be obtained based on the data conversion strategy, and the target data model can be obtained based on the target data.

[0092] In one embodiment of the present application, see Figure 7The process of obtaining the target data matching the leaf node based on the data conversion strategy in step S204 may include steps S701 to S702, which are described in detail as follows:

[0093] Step S701: if it is determined based on the analysis result that the data conversion strategy corresponding to the leaf node is a meta-service calling strategy, then a meta-service component matching the leaf node is obtained from a preset meta-service library;

[0094] Step S702: Acquire target data matching the leaf node based on the meta-service component.

[0095] That is, in an optional embodiment, if the data conversion strategy corresponding to the leaf node is determined to be a meta-service call strategy based on the analysis results, the meta-service component matching the leaf node can be obtained from the preset meta-service library, and then the target data matching the leaf node can be obtained based on the meta-service component.

[0096] Among them, in an optional embodiment, a plurality of meta-service components are pre-set in the preset meta-service library, wherein the meta-service component refers to a set of codes related to the meta-service; for example, please refer to Table 2 below, which is an example of a preset meta-service library.

[0097] Meta-service components name Meta Service Component 1 Get UUID Service Meta Service Component 2 Get related foreign key service Meta Service Component 3 String concatenation service Meta Service Component 4 Data type conversion service …… ……

[0098] Table 2

[0099] In one embodiment of the present application, see Figure 8 Before the process of obtaining the meta-service component matching the leaf node from the preset meta-service library in step S204, steps S801 to S802 may also be included, which are described in detail as follows:

[0100] Step S801, generating multiple meta-service components based on the received input operation;

[0101] Step S802: storing multiple meta-service components in a preset meta-service library.

[0102] That is, in an optional embodiment, multiple meta-service components may be generated based on the received input operation, and then the multiple meta-service components may be stored in a preset meta-service library.

[0103] Among them, in the optional embodiment, the input operation can be any form of input operation, for example, it can be a keyboard input operation, a mouse input operation, a voice input operation, etc.

[0104] It is understandable that by implementing the optional embodiment, the relevant development staff only needs to set up the various meta-service components in the preset meta-service library, so that the leaf nodes for more complex data conversion can quickly and accurately obtain the target data to be converted from the source data corresponding to the leaf node through the meta-service component corresponding to the leaf node, without having to write a large amount of code for the leaf node each time to obtain the target data. This not only improves the efficiency of obtaining the target data, but also reduces the repeated writing of a large amount of code, greatly reducing the difficulty of development.

[0105] In one embodiment of the present application, the process of obtaining target data matching a leaf node based on a data conversion strategy in step S204 may include the following steps:

[0106] If it is determined based on the analysis result that the data conversion strategy corresponding to the leaf node is a mapping processing strategy, the source data corresponding to the leaf node is processed according to the mapping relationship contained in the mapping processing strategy to obtain the target data matching the leaf node.

[0107] That is, in an optional embodiment, if the data conversion strategy corresponding to the leaf node is determined to be a mapping processing strategy based on the analysis results, then the source data corresponding to the leaf node can be mapped accordingly based on the mapping relationship contained in the mapping processing strategy to obtain the target data matching the leaf node.

[0108] Among them, in an optional embodiment, the mapping processing strategy may contain a mapping relationship, or the mapping relationship may be stored in a preset mapping library, in which multiple mapping relationships are preset, so the mapping relationship matching the leaf node can be found by searching the preset mapping library.

[0109] In one embodiment of the present application, the process of obtaining target data matching a leaf node based on a data conversion strategy in step S204 may include the following steps:

[0110] If it is determined based on the parsing result that the data conversion strategy corresponding to the leaf node is a regular processing strategy, the source data corresponding to the leaf node is processed using the regular expression contained in the regular processing strategy to obtain the target data matching the leaf node.

[0111] That is, in an optional embodiment, if the data conversion strategy corresponding to the leaf node is determined to be a regular processing strategy based on the parsing results, then the regular expression contained in the regular processing strategy is used to calculate the regular expression of the source data corresponding to the leaf node, thereby obtaining the target data matching the leaf node.

[0112] Among them, in an optional embodiment, the regular processing strategy may contain a regular expression, or the regular expression may be stored in a preset regular expression library, in which multiple regular expressions are preset, so the mapping relationship matching the leaf node can be found by searching the preset regular expression library.

[0113] In the embodiment of the present application, a matching tree is constructed based on the source data model and the conversion requirement information of the source data model, so that the relevant development staff does not need to design a large amount of repetitive coding, which reduces the difficulty of data model conversion, and the conversion logic can be viewed more intuitively and clearly through the matching tree, which is convenient for later maintenance and has strong maintainability, thereby greatly improving the development convenience of the relevant development staff; at the same time, when the data conversion strategy corresponding to the leaf node is determined to be the meta-service call strategy based on the parsing results, the meta-service component matching the leaf node can be obtained from the preset meta-service library, and then the target data matching the leaf node can be quickly and accurately obtained based on the meta-service component, thereby greatly improving the conversion efficiency of the data model.

[0114] The specific application scenarios of the embodiments of the present application are described in detail below:

[0115] See also Fig. 9 , Fig. 9 FIG. 1 is a flow chart of a data processing method according to an embodiment of the present application. Fig. 9 As shown, the data processing method at least includes steps S901 to S910, which are described in detail as follows:

[0116] Step S901: Acquire a source data model and conversion requirement information of the source data model.

[0117] Step S902: parse the source data model to obtain multiple element items.

[0118] Step S903: acquiring multiple target conversion logic components based on multiple element items and conversion requirement information.

[0119] Optionally, the conversion requirement information includes type information of the target data model to be converted to; based on multiple element items and the conversion requirement information, obtaining multiple target conversion logic components can specifically be obtaining multiple conversion logic components that match the type information from a preset conversion logic library, and then determining the conversion logic component that matches each element item from the multiple conversion logic components, and using the conversion logic component that matches each element item as the target conversion logic component.

[0120] Optionally, the preset conversion logic library is preset with multiple type information and multiple conversion logic components corresponding to each type information; wherein, the content stored in the preset conversion logic library can be specifically generated by the received input operation, and then stored in the preset meta-service library.

[0121] Step S904: combine multiple target conversion logic components to generate a conversion data template.

[0122] Optionally, the conversion data template may be in a file format such as YAML / Json.

[0123] Step S905: construct a matching tree based on the conversion data template.

[0124] Optionally, constructing a matching tree based on a conversion data template may specifically be to parse the conversion data template to obtain the level to which each element item belongs and the association relationship between each element item, and then construct a matching tree based on the level to which each element item belongs and the association relationship between each element item.

[0125] Step S906, parsing the leaf nodes contained in the matching tree, and determining the data conversion strategy corresponding to the leaf nodes based on the parsing result.

[0126] Optionally, parsing the leaf nodes contained in the matching tree may specifically include traversing all nodes contained in the matching tree, then determining the leaf nodes from all the nodes, and parsing the leaf nodes.

[0127] Step S907, if it is determined based on the analysis result that the data conversion strategy corresponding to the leaf node is a meta-service calling strategy, the meta-service component matching the leaf node is obtained from the preset meta-service library, and the target data matching the leaf node is obtained based on the meta-service component.

[0128] Optionally, a plurality of meta-service components are pre-set in the preset meta-service library; wherein the content stored in the preset meta-service library may be specifically generated by the received input operation, and then stored in the preset meta-service library.

[0129] Step S908, if it is determined based on the analysis result that the data conversion strategy corresponding to the leaf node is a mapping processing strategy, the source data corresponding to the leaf node is processed according to the mapping relationship contained in the mapping processing strategy to obtain the target data matching the leaf node.

[0130] Step S909, if it is determined based on the analysis result that the data conversion strategy corresponding to the leaf node is a regular processing strategy, the source data corresponding to the leaf node is processed according to the regular expression contained in the regular processing strategy to obtain the target data matching the leaf node.

[0131] Step S910, obtaining a target data model based on the target data.

[0132] Optionally, the specific implementation process of step S901 to step S910 may refer to the technical solution of the aforementioned embodiment.

[0133] Optionally, see Fig.10 , is a schematic diagram of an exemplary data processing method. Fig.10 As shown, the source data model can be a data model in the excel file format, in which a workbook corresponding to an element item such as "stage information" includes multiple element items such as "use area", "process name", "stage name", "API name", etc. Among them, Fig.10 Only part of the source data is shown as an example.

[0134] Afterwards, multiple target conversion logic components are obtained according to the source data model and the conversion requirement information of the source data model, and then the multiple target conversion logic components are combined to generate a conversion data template.

[0135] After that, a matching tree is constructed based on the conversion data template. The constructed matching tree includes a root node (ROOT), a second-level node (TacheTable, APITable), a third-level node (Id, Name, APIId, UsedRegion...) (Id...), and a fourth-level node (RegionCode, StatusId...). It can be understood that each node is the element item mentioned above, and the relationship between each element item is as follows: Fig.10 As shown in the matching tree, no further details are given here. At the same time, for the third-level node (Id), its corresponding meta-service call strategy, specifically, obtains the corresponding Get UUID service from the preset meta-service library. For the third-level node (APIId), its corresponding meta-service call strategy, specifically, obtains the corresponding Get Associated Foreign Key service from the preset meta-service library. Optionally, the preset meta-service library also has preset string concatenation services, data type conversion services, etc. For other nodes, the corresponding target data can be obtained through their corresponding data conversion strategies such as mapping processing strategies or regular processing strategies.

[0136] Afterwards, the target data model is obtained based on the target data matched by each node. Fig.10 Only part of the target data is shown as an example.

[0137] in, Fig.10 The source data template shown may be as follows (only part of the content is shown as an example):

[0138]

[0139]

[0140] In the embodiment of the present application, a matching tree is constructed based on the source data model and the conversion requirement information of the source data model, so that the relevant development staff does not need to design a large amount of repetitive coding, which reduces the difficulty of data model conversion, and the conversion logic can be viewed more intuitively and clearly through the matching tree, which is convenient for later maintenance and has strong maintainability, thereby greatly improving the development convenience of the relevant development staff; at the same time, when the data conversion strategy corresponding to the leaf node is determined to be the meta-service call strategy based on the parsing results, the meta-service component matching the leaf node can be obtained from the preset meta-service library, and then the target data matching the leaf node can be quickly and accurately obtained based on the meta-service component, thereby greatly improving the conversion efficiency of the data model.

[0141] Fig.11 FIG. 1 is a block diagram of a data processing device according to an embodiment of the present application. Fig.11 As shown, the data processing device may include:

[0142] An acquisition module 1101 is configured to acquire a source data model and conversion requirement information of the source data model;

[0143] A construction module 1102 is configured to construct a matching tree based on the source data model and the conversion requirement information;

[0144] The parsing and determining module 1103 is configured to parse the leaf nodes contained in the matching tree and determine the data conversion strategy corresponding to the leaf nodes based on the parsing result;

[0145] The acquisition and obtaining module 1104 is configured to obtain target data matching the leaf node based on the data conversion strategy, and obtain a target data model based on the target data.

[0146] In one embodiment of the present application, the construction module 1102 may include:

[0147] A parsing unit, configured to parse the source data model to obtain a plurality of element items;

[0148] A first acquisition unit is configured to acquire multiple target conversion logic components based on multiple element items and conversion requirement information;

[0149] A generating unit, configured to combine a plurality of target conversion logic components to generate a conversion data template;

[0150] The building unit is configured to build a matching tree based on the conversion data template.

[0151] In one embodiment of the present application, the conversion requirement information includes type information of the target data model to which the source data model is to be converted; the acquisition unit is specifically configured as follows:

[0152] Acquire multiple conversion logic components matching the type information from a preset conversion logic library;

[0153] A conversion logic component matching each element item is determined from multiple conversion logic components, and the conversion logic component matching each element item is used as a target conversion logic component.

[0154] In one embodiment of the present application, the construction unit is specifically configured as follows:

[0155] Parse the conversion data template to obtain the level to which each element item belongs and the relationship between each element item;

[0156] A matching tree is constructed based on the level to which each element item belongs and the association relationship between each element item.

[0157] In one embodiment of the present application, the data conversion strategy includes a meta-service call strategy, a mapping processing strategy, and a regularization processing strategy; the acquisition and obtaining module 1104 may include:

[0158] A second acquisition unit is configured to acquire a meta-service component matching the leaf node from a preset meta-service library if it is determined based on the parsing result that the data conversion strategy corresponding to the leaf node is a meta-service call strategy;

[0159] The third acquisition unit is configured to acquire target data matching the leaf node based on the meta-service component.

[0160] In one embodiment of the present application, the data processing device may further include:

[0161] A receiving module configured to generate a plurality of meta-service components based on received input operations;

[0162] The storage module is configured to store multiple meta-service components in a preset meta-service library.

[0163] In one embodiment of the present application, the parsing and determining module 1103 may include:

[0164] A traversal unit, configured to traverse all nodes contained in the matching tree;

[0165] The parsing unit is configured to determine a leaf node from all nodes and parse the leaf node.

[0166] It should be noted that the data processing device provided in the above embodiment and the data processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.

[0167] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the data processing method provided in the aforementioned embodiments.

[0168] Fig.12 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0169] It should be noted that Fig.12 The computer system 1200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0170] like Fig.12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203, such as executing the method in the above embodiment. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202 and the RAM 1203 are connected to each other through the bus 1204. The input / output (I / O) interface 1205 is also connected to the bus 1204.

[0171] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0172] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.

[0173] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0174] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0175] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0176] Another aspect of the present application also provides a computer readable medium having a computer program stored thereon, which implements the above data processing method when the computer program is executed by a processor. The computer readable medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0177] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable medium. A processor of a computer device reads the computer instruction from the computer-readable medium, and the processor executes the computer instruction, so that the computer device executes the data processing method provided in each of the above embodiments.

[0178] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A data processing method, characterized in that: The method comprises: Acquire a source data model and conversion requirement information of the source data model; Building a matching tree based on the source data model and the conversion requirement information; Parsing the leaf nodes contained in the matching tree, and determining the data conversion strategy corresponding to the leaf nodes based on the parsing result; Acquire target data matching the leaf node based on the data conversion strategy, and obtain a target data model based on the target data; The conversion requirement information includes type information of a target data model to be converted from a source data model; and constructing a matching tree based on the source data model and the conversion requirement information includes: Parsing the source data model to obtain multiple element items; Acquire multiple conversion logic components matching the type information from a preset conversion logic library; Determine a conversion logic component that matches each element item from the multiple conversion logic components, and use the conversion logic component that matches each element item as a target conversion logic component; Combining the multiple target conversion logic components to generate a conversion data template; The matching tree is constructed based on the conversion data template.

2. The method according to claim 1, characterized in that The step of constructing a matching tree based on the conversion data template includes: Parsing the conversion data template to obtain the level to which each element item belongs and the association relationship between each element item; The matching tree is constructed based on the levels to which the various element items belong and the association relationships between the various element items.

3. The method according to claim 1 or 2, characterized in that The data conversion strategy includes a meta-service calling strategy, a mapping processing strategy and a regularization processing strategy; The acquiring target data matched by the leaf node based on the data conversion strategy includes: If it is determined based on the parsing result that the data conversion strategy corresponding to the leaf node is a meta-service calling strategy, then obtaining a meta-service component matching the leaf node from a preset meta-service library; The target data matching the leaf node is obtained based on the meta-service component.

4. The method according to claim 3, characterized in that Before acquiring the meta-service component matching the leaf node from the preset meta-service library, the method further includes: generating a plurality of meta-service components based on the received input operations; The plurality of meta-service components are stored in the preset meta-service library.

5. The method according to claim 1 or 2, characterized in that: The parsing of the leaf nodes contained in the matching tree includes: Traversing all nodes contained in the matching tree; A leaf node is determined from all the nodes, and the leaf node is parsed.

6. A data processing device, characterized in that: The device comprises: An acquisition module configured to acquire a source data model and conversion requirement information of the source data model; A construction module, configured to construct a matching tree based on the source data model and the conversion requirement information; A parsing and determining module, configured to parse the leaf nodes contained in the matching tree, and determine the data conversion strategy corresponding to the leaf nodes based on the parsing results; An acquisition and obtaining module, configured to acquire the target data matched by the leaf node based on the data conversion strategy, and obtain a target data model based on the target data; The conversion requirement information includes type information of the target data model to be converted from the source data model; the construction module includes: A parsing unit, configured to parse the source data model to obtain a plurality of element items; A first acquisition unit is configured to acquire a plurality of conversion logic components matching the type information from a preset conversion logic library; determine a conversion logic component matching each element item from the plurality of conversion logic components, and use the conversion logic component matching each element item as a target conversion logic component; a generating unit, configured to combine the plurality of target conversion logic components to generate a conversion data template; A construction unit is configured to construct a matching tree based on the conversion data template.

7. The device according to claim 6, characterized in that The data conversion strategy includes a meta-service calling strategy, a mapping processing strategy and a regularization processing strategy; The analysis and determination module includes: A second acquisition unit is configured to acquire a meta-service component matching the leaf node from a preset meta-service library if it is determined based on the parsing result that the data conversion strategy corresponding to the leaf node is a meta-service call strategy; The third acquisition unit is configured to acquire the target data matched by the leaf node based on the meta-service component.

8. The device according to claim 6, characterized in that The analysis and determination module includes: A traversal unit, configured to traverse all nodes contained in the matching tree; The parsing unit is configured to determine a leaf node from all the nodes and parse the leaf node.

9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the data processing method as described in any one of claims 1 to 5.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method and system for storing interface data on demand

    CN111913963A

  • Page construction method and device

    CN112100550A