Tree structure data conversion method and device, computer device and storage medium

By performing node path matching and weighted data merging on tree-structured data, the problem of low efficiency in manual processing in existing technologies is solved, and efficient and accurate data conversion is achieved.

CN116150245BActive Publication Date: 2026-03-17CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310150647.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-13
Publication Date
2026-03-17
Estimated Expiration
2043-02-13

AI Technical Summary

Technical Problem

In existing technologies, the conversion of tree-structured data relies on manual processing, which is inefficient and makes it difficult to achieve an efficient and unified format.

Method used

By matching the node paths of the data to be converted with the node order of the preset tree structure, path standardization is performed, and conversion weight data is determined. Finally, the data is merged into the internal baseline data to achieve data format unification.

Benefits of technology

It improves the efficiency of tree-structured data conversion, reduces errors, and increases the accuracy of data conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116150245B_ABST
    Figure CN116150245B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of big data data processing, and specifically discloses a tree structure data conversion method and device, computer equipment, storage medium and computer program product. The method comprises: obtaining to-be-converted data, the to-be-converted data being tree structure data, performing path standardization processing on the to-be-converted data to unify the to-be-converted data and internal reference data formats, then determining conversion weight data of each node in the to-be-converted data after the path standardization processing, and then merging the to-be-converted data and the internal reference data according to the conversion weight data of each node in the to-be-converted data. Compared with a tree structure conversion method relying on manual processing, the tree structure data conversion processing efficiency is greatly improved, errors are reduced, and the accuracy of tree structure data conversion is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data processing technology, and in particular to a method, apparatus, computer equipment, storage medium and computer program product for converting tree-structured data. Background Technology

[0002] With the development of computer application technology, various industries are gradually implementing digital services, resulting in a massive amount of data that needs to be analyzed to meet business needs. However, the same business may receive multiple types of data; therefore, data must be formatted uniformly for subsequent processing. The unified processing of tree-structured data is a challenging aspect of data analysis.

[0003] Currently, the conversion of tree-structured data mainly involves staff manually processing the external and internal data formats. Then, a large amount of tree-structured data needs to be standardized manually before subsequent data analysis can be performed.

[0004] However, current methods for converting tree structures using manual processing are inefficient. Summary of the Invention

[0005] Therefore, it is necessary to provide an efficient method, apparatus, computer device, computer-readable storage medium, and computer program product for converting tree-structured data in order to address the aforementioned technical problems.

[0006] Firstly, this application provides a method for converting tree-structured data. The method includes:

[0007] Obtain the data to be converted, which is a tree-structured data;

[0008] The node paths of the data to be converted are matched with the node order of a preset tree structure. Based on the matching results, the path of each node path is standardized to obtain the data to be converted after path standardization.

[0009] The transformation weight data of each node in the data to be transformed after the path standardization process is determined, and the data to be transformed with the transformation weight data of each node determined is merged into the internal reference data, which is a tree structure data.

[0010] In one embodiment, obtaining the data to be converted includes:

[0011] Standardize the node names of each node in the acquired data to be transformed;

[0012] Based on a preset tree structure storage format, the data to be converted after the node names have been standardized is subjected to format standardization processing to obtain the node path of the data to be converted.

[0013] In one embodiment, the step of matching the node paths of the data to be converted with the node order of a preset tree structure, and performing path standardization processing on each node path based on the matching result to obtain the path-standardized data to be converted includes:

[0014] The node paths of the data to be converted are matched with the node order of a preset tree structure to determine the path adjustment type;

[0015] Based on the path adjustment type, the node path is adjusted to obtain the data to be converted after path standardization.

[0016] In one embodiment, matching the node path of the data to be converted with the node order of a preset tree structure to determine the path adjustment type includes:

[0017] If the node path of the data to be converted is the same as the node order of the matching preset tree structure, the path adjustment type is determined to be no adjustment.

[0018] If the length of the node path of the data to be converted is greater than the length of the node sequence of the matching preset tree structure, the path adjustment type is determined to be the reduction type.

[0019] If the length of the node path of the data to be converted is less than the length of the node sequence of the matching preset tree structure, the path adjustment type is determined to be the stretching type.

[0020] In one embodiment, the step of adjusting the node path according to the path adjustment type to obtain the data to be converted after path standardization includes:

[0021] Based on the path adjustment type, determine the order of atomic operations for adjusting the node path;

[0022] Atomic operations are performed on the node path based on the atomic operation sequence to adjust the node path and obtain the data to be converted after path standardization.

[0023] In one embodiment, determining the order of atomic operations for adjusting the node path based on the path adjustment type includes:

[0024] When the path adjustment type is a reduction type, the order of atomic operations for adjusting the node path is determined to include deletion and addition operations;

[0025] When the path adjustment type is an extension type, the order of atomic operations for adjusting the node path includes replacement operation, addition operation, and hierarchy adjustment operation.

[0026] In one embodiment, performing atomic operations on the node path based on the atomic operation sequence to adjust the node path and obtain the data to be transformed after path standardization includes:

[0027] When the path adjustment type is reduced, the nodes to be deleted in the node path of the data to be converted are determined, the deletion operation is performed on the nodes to be deleted, and the addition operation is performed to add new nodes, so as to obtain the data to be converted after path standardization processing.

[0028] In one embodiment, performing atomic operations on the node path based on the atomic operation sequence to adjust the node path and obtain the data to be transformed after path standardization includes:

[0029] When the path adjustment type is the extension type, the node to be replaced in the node path of the data to be converted is determined, the replacement operation is performed to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure, and the addition operation is performed to add a new node to obtain the data to be converted after path standardization.

[0030] or

[0031] When the path adjustment type is the elongation type, the node to be replaced in the node path of the data to be converted is determined, and a replacement operation is performed to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure. An addition operation is performed to add a new node, and a hierarchy adjustment operation is performed on the data to be converted after adding the new node to obtain the data to be converted after path standardization.

[0032] In one embodiment, the process of adding a new node includes:

[0033] Determine the target node to be added in the preset tree structure, as well as the parent node and child nodes of the target node to be added;

[0034] Based on the parent and child nodes of the target added node, determine the parent and child nodes of the target added node in the node path of the data to be converted;

[0035] Based on the parent and child nodes of the target node in the node path of the data to be converted, the target node is added to the node path of the data to be converted.

[0036] In one embodiment, determining the transformation weight data of each node in the path-normalized data to be transformed includes:

[0037] Identify the target data node in the internal benchmark data;

[0038] The conversion coefficients are determined based on the initial weight data of each leaf node in the data to be converted after path standardization and the weight data of the target data node.

[0039] Based on the transformation coefficients, the transformation weight data of each leaf node in the path-standardized data to be transformed is determined.

[0040] In one embodiment, the transformation coefficient is the ratio of the weight data of the target data node to the sum of the initial weight data of each of the leaf nodes.

[0041] In one embodiment, determining the leaf weight data of each node in the path-normalized data to be transformed based on the transformation coefficients includes:

[0042] Based on the transformation coefficient, the initial weight data of each leaf node in the path-standardized data to be transformed is transformed to obtain the transformed weight data of each leaf node in the path-standardized data to be transformed.

[0043] In one embodiment, merging the data to be transformed, for which the transformation weights of each node have been determined, into internal baseline data includes:

[0044] The node paths of the data to be converted after path standardization are merged into the internal baseline data, and the conversion weight data of each leaf node in the data to be converted after path standardization are superimposed with the weight data of the leaf nodes of the internal baseline data to obtain the merged internal baseline data.

[0045] In one embodiment, the method further includes: calculating the difference between the initial total weight and the merged total weight when the initial total weight is inconsistent with the merged total weight, wherein the initial total weight is the sum of the weight data of each leaf node in the internal benchmark data, and the merged total weight is the sum of the weight data of each leaf node in the merged internal benchmark data;

[0046] The difference is added to the leaf node with the largest weight in the merged internal benchmark data, where the leaf node with the largest weight is the leaf node with the largest weight in the merged internal benchmark data.

[0047] Secondly, this application also provides a tree-structured data conversion device. The device includes:

[0048] The acquisition module is used to acquire the data to be converted, which is a tree-structured data.

[0049] The standardization processing module is used to match the node paths of the data to be converted with the node order of a preset tree structure, and perform path standardization processing on each node path according to the matching result to obtain the data to be converted after path standardization.

[0050] The conversion module is used to determine the conversion weight data of each node in the data to be converted after the path standardization process, and to merge the data to be converted with the determined conversion weight data of each node into the internal reference data, which is a tree structure data.

[0051] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0052] Obtain the data to be converted, which is a tree-structured data;

[0053] The node paths of the data to be converted are matched with the node order of a preset tree structure. Based on the matching results, the path of each node path is standardized to obtain the data to be converted after path standardization.

[0054] The transformation weight data of each node in the data to be transformed after the path standardization process is determined, and the data to be transformed with the transformation weight data of each node determined is merged into the internal reference data, which is a tree structure data.

[0055] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0056] Obtain the data to be converted, which is a tree-structured data;

[0057] The node paths of the data to be converted are matched with the node order of a preset tree structure. Based on the matching results, the path of each node path is standardized to obtain the data to be converted after path standardization.

[0058] The transformation weight data of each node in the data to be transformed after the path standardization process is determined, and the data to be transformed with the transformation weight data of each node determined is merged into the internal reference data, which is a tree structure data.

[0059] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0060] Obtain the data to be converted, which is a tree-structured data;

[0061] The node paths of the data to be converted are matched with the node order of a preset tree structure. Based on the matching results, the path of each node path is standardized to obtain the data to be converted after path standardization.

[0062] The transformation weight data of each node in the data to be transformed after the path standardization process is determined, and the data to be transformed with the transformation weight data of each node determined is merged into the internal reference data, which is a tree structure data.

[0063] The aforementioned tree-structure data conversion method, apparatus, computer equipment, storage medium, and computer program product acquire data to be converted, which is tree-structured data; match the node paths of the data to be converted with the node order of a preset tree structure; perform path standardization processing on each node path based on the matching results to obtain path-standardized data to be converted; determine the conversion weight data of each node in the path-standardized data to be converted; and merge the data to be converted with the determined conversion weight data of each node into internal reference data, which is also tree-structured data. The entire scheme, by performing path standardization processing on the data to be converted to unify the format with the internal reference data, then determining the conversion weight data of each node in the path-standardized data to be converted, and finally merging the data to be converted with the internal reference data based on the conversion weight data of each node, significantly improves the efficiency of tree-structured data conversion processing compared to tree-structured data conversion methods that rely on manual processing, while reducing errors and improving the accuracy of tree-structured data conversion. Attached Figure Description

[0064] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0065] Figure 1 This is a diagram illustrating the application environment of a tree-structured data conversion method in one embodiment.

[0066] Figure 2 This is a flowchart illustrating a tree-structured data conversion method in one embodiment;

[0067] Figure 3 This is a schematic diagram of a tree structure in one embodiment;

[0068] Figure 4 This is a flowchart illustrating the tree structure data conversion method in another embodiment;

[0069] Figure 5 This is a flowchart illustrating the tree structure data conversion method in yet another embodiment;

[0070] Figure 6 This is a flowchart illustrating the tree structure data conversion method in yet another embodiment;

[0071] Figure 7 This is a schematic diagram illustrating the deletion of nodes in the node path of the data to be converted in one embodiment;

[0072] Figure 8 This is a schematic diagram of replacing nodes in the node path of the data to be converted in one embodiment;

[0073] Figure 9 This is a schematic diagram illustrating the adjustment of node hierarchy in the node path of the data to be converted in one embodiment;

[0074] Figure 10 This is a schematic diagram illustrating that the node paths of the data to be converted do not need to be adjusted in one embodiment;

[0075] Figure 11 A schematic diagram illustrating the addition of a new node to the node path of the data to be converted in one embodiment;

[0076] Figure 12 This is a schematic diagram of the node path of the data to be converted in one embodiment;

[0077] Figure 13 This is a schematic diagram illustrating that the node paths of the data to be converted do not need to be adjusted in yet another embodiment;

[0078] Figure 14 This is a schematic diagram illustrating the replacement and deletion of nodes in the node path of the data to be converted in one embodiment;

[0079] Figure 15 This is a schematic diagram illustrating the replacement of node paths and the addition of new nodes for the data to be converted in one embodiment.

[0080] Figure 16 This is a schematic diagram of the node paths of the data to be converted after path standardization processing in one embodiment.

[0081] Figure 17This is a schematic diagram of the merged internal reference data in one embodiment;

[0082] Figure 18 This is a flowchart illustrating the tree structure data conversion method in yet another embodiment;

[0083] Figure 19 This is a structural block diagram of a tree-structured data conversion device in one embodiment;

[0084] Figure 20 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0085] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0086] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0087] The tree structure data conversion method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server.

[0088] In one possible implementation, the user triggers a tree-structured data conversion on terminal 102. Terminal 102 responds to the tree-structured data conversion instruction and retrieves the data to be converted from a local or remote server 104 according to the instruction. The data to be converted is tree-structured data. The data to be converted retrieved locally by terminal 102 can be data uploaded to terminal 102 in real time, data pre-stored on terminal 102, or data from a third-party storage device connected to terminal 102. Terminal 102 matches the node paths of the data to be converted with the node order of a preset tree structure. Based on the matching results, it performs path standardization processing on each node path to obtain path-standardized data to be converted. It then determines the conversion weight data of each node in the path-standardized data and merges the data with determined conversion weight data into internal baseline data, which is also tree-structured data.

[0089] In another possible implementation, the user identifies the data to be converted on terminal 102 and triggers a tree-structured data conversion. Terminal 102 receives the tree-structured data conversion instruction and sends it to server 104. Server 104 responds to the tree-structured data conversion instruction, obtains the data to be converted (which is tree-structured data), matches the node paths of the data to be converted with the node order of a preset tree structure, performs path standardization processing on each node path based on the matching results, and obtains the path-standardized data to be converted. It then determines the conversion weight data for each node in the path-standardized data and merges the data with the determined conversion weight data into internal baseline data, which is also tree-structured data. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0090] In one embodiment, such as Figure 2 As shown, a method for converting tree-structured data is provided, which can be applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps:

[0091] Step 200: Obtain the data to be converted.

[0092] The data to be converted is tree-structured data. A tree structure is a hierarchical nested structure. The outer and inner layers of a tree structure have similar structures, so this structure can often be represented recursively.

[0093] Tree-structured data storage uses the current node, parent nodes, and attribute values ​​as its storage structure, often referred to as a two-dimensional table structure. Tree-structured data storage formats include the current-parent level pattern and the node path pattern. Figure 3 The tree structure shown can be stored in a file in two ways, as shown in the table below. There is no essential difference between the two modes, and both can completely restore the tree structure.

[0094] Table 1 Local-Higher Level Model

[0095] This node Parent node Attribute value A none B A C A D A E B F B G B H C I D J D

[0096] Table 2 Node Path Patterns

[0097]

[0098]

[0099] Specifically, the user uploads data to be converted on the terminal, triggering a tree-structured data conversion operation. The terminal responds to the tree-structured data conversion operation and retrieves the data to be converted. The user can also select data to be converted on the terminal, triggering the tree-structured data conversion operation, which the terminal also responds to and retrieves. The logical structure of the data to be converted is a tree structure, stored in a file as a two-dimensional table, with the tree-like relationships represented by a current-to-parent node pattern. When the terminal reads the data to be converted, it parses the two-dimensional table data into system memory; the data storage format changes from file to machine memory storage. Furthermore, after retrieving the data to be converted, the terminal determines the node path of the data to be converted.

[0100] Step 400: Match the node paths of the data to be converted with the node order of the preset tree structure, and perform path standardization processing on each node path according to the matching results to obtain the data to be converted after path standardization.

[0101] The preset tree structure is a standard tree structure stored locally on the terminal that corresponds to the node path of the data to be converted, and it is set according to business requirements.

[0102] Specifically, the terminal can determine the data type based on the data to be converted and obtain a preset tree structure based on the data type. Further, the data type can be the file topic of the data to be converted; different file topics have corresponding preset tree structures stored locally on the terminal. Then, the terminal matches the node paths of the data to be converted with the node order of the preset tree structure, using the node order as a standard, to obtain a matching structure. Finally, based on the matching results, path standardization processing is performed on each node path to ensure that the node paths of the data to be converted are consistent with the node paths of the internal baseline data, thus obtaining the path-standardized data to be converted.

[0103] Step 600: Determine the transformation weight data of each node in the data to be transformed after path standardization, and merge the data to be transformed with the determined transformation weight data of each node into the internal baseline data.

[0104] The internal baseline data is a tree-structured data.

[0105] Specifically, after the terminal performs path standardization on the data to be converted, it determines the conversion weight data of each node in the path-standardized data based on the value relationship between each node in the data to be converted and the nodes in the internal benchmark data. Based on the conversion weight data of each node, the terminal performs weight transformation on each node in the path-standardized data to be converted. The weight-transformed data to be converted is then merged with the internal benchmark data to obtain the target data, thus completing the transformation and merging of the data to be converted for subsequent data analysis.

[0106] In the above-described tree-structured data conversion method, the data to be converted is obtained, which is a tree-structured data. The node paths of the data to be converted are matched with the node order of a preset tree structure. Based on the matching results, path standardization processing is performed on each node path to obtain the path-standardized data to be converted. The conversion weight data of each node in the path-standardized data to be converted is determined, and the data to be converted with determined conversion weight data is merged into internal benchmark data, which is also a tree-structured data. This entire scheme, by standardizing the path of the data to be converted to ensure a unified format with the internal benchmark data, and then determining the conversion weight data of each node in the path-standardized data to be converted, merges the data to be converted with the internal benchmark data based on the conversion weight data of each node. Compared to tree-structured data conversion methods that rely on manual processing, this method significantly improves the efficiency of tree-structured data conversion while reducing errors and increasing the accuracy of tree-structured data conversion.

[0107] In one embodiment, such as Figure 4 As shown, the data to be converted is obtained, including:

[0108] Step 220: Standardize the node names of each node in the acquired data to be transformed;

[0109] Step 240: Based on the preset tree structure storage format, perform format standardization processing on the data to be converted after the node names have been standardized to obtain the node path of the data to be converted.

[0110] The preset tree structure storage format is the standard format for storing tree structure data locally on the terminal. For example, it can be a node path mode. Staff can also set it to other storage formats according to storage needs, such as the current level-parent level mode. The specific storage format is not limited in this embodiment.

[0111] Since the data to be converted may be of different file types and may contain multiple rows and columns, the system needs to define a parsing rule for each type of file. The parsing rule includes information such as file name, file path, file start line number, file end marker, and file start column number. The parser reads the values ​​of each row and each column of the file in sequence according to the above configuration and converts them into standard names or labels on the terminal, such as "A0", "D1", "M2" and other labels.

[0112] Specifically, after acquiring the data to be converted, the terminal determines the data format and, according to the parser corresponding to the data format, extracts the attribute information of each node in the data to be converted sequentially. The terminal then performs name standardization processing on each node according to its local standardized naming rules for attribute information, obtaining the data to be converted with standardized node names. Next, based on a preset tree structure storage format, the data to be converted with standardized node names undergoes format standardization processing to obtain the node path of each node in the data to be converted. The preset tree structure storage format also includes fixed-length mode and delimiter mode. For example, customer data may have a fixed-length node mode such as ABC; and a delimiter mode such as ABC, A / B / C, A*B*C, etc. The terminal can internally specify the preset tree structure as the delimiter mode.

[0113] Furthermore, after standardizing the names of the data to be converted, the terminal can also standardize the attributes of the data. Attributes refer to the meaning of the data. For example, if data A represents "number of copies," while the terminal's internal standard attribute is "quantity," then attribute standardization is required to ensure that the meaning of the data to be converted is the same. Similarly, if the standard attribute names are "quantity" or "amount," but the data to be converted does not perfectly match, such as "number of copies," "number of shares," or "price," then attribute standardization is necessary to convert the node names defined in the data to be converted into the terminal's internal standard data node names, facilitating subsequent data analysis.

[0114] In this embodiment, by standardizing the names and formats of the data to be converted, the format of the data to be converted is consistent with that of the tree structure data stored locally on the terminal, thereby improving the efficiency of subsequent data conversion and merging.

[0115] In one embodiment, such as Figure 5 As shown, the node paths of the data to be converted are matched with the node order of a preset tree structure. Based on the matching results, the path of each node is standardized to obtain the standardized data to be converted, including:

[0116] Step 420: Match the node path of the data to be converted with the node order of the preset tree structure to determine the path adjustment type.

[0117] Step 440: Adjust the node paths according to the path adjustment type to obtain the data to be converted after path standardization.

[0118] The path adjustment types include no adjustment, reduction, and extension.

[0119] Specifically, the terminal obtains the node path of each leaf node from the node paths of the data to be converted, and also obtains the standard node path of each leaf node in the preset tree structure. Then, it sequentially matches the node path of each leaf node with the node order of the standard node path of that leaf node in the preset tree structure to obtain a matching result. Next, based on the matching result, it determines the path adjustment type of the data to be converted, and adjusts the node paths of the leaf nodes of the data to be converted according to the path adjustment type, resulting in the path-standardized data to be converted.

[0120] In this embodiment, by determining the path adjustment type of the data to be converted, and then performing path standardization processing on the data to be converted according to the corresponding path adjustment type, path conversion can be performed accurately and efficiently, thereby improving data conversion efficiency.

[0121] In one embodiment, such as Figure 6 As shown, the node paths of the data to be converted are matched with the node order of the preset tree structure to determine the path adjustment type, including:

[0122] Step 422: If the node path of the data to be converted is the same as the node order of the matching preset tree structure, determine the path adjustment type as no adjustment.

[0123] Step 424: If the length of the node path of the data to be converted is greater than the length of the node order of the matching preset tree structure, determine the path adjustment type as the reduction type.

[0124] Step 426: If the length of the node path of the data to be converted is less than the length of the node sequence of the matching preset tree structure, determine the path adjustment type as the stretching type.

[0125] Specifically, when determining the path adjustment type of the data to be converted, the terminal can first compare the length of the node path of the leaf node of the data to be converted with the length of the standard node path of the leaf node in the preset tree structure. If the node path lengths are the same, then the terminal can sequentially compare the order of the nodes in the node path of the leaf node of the data to be converted with the order of the nodes in the standard node path of the leaf node in the preset tree structure. If the order of the nodes is the same, then the path adjustment type is no adjustment, and the path of the leaf node does not need to be adjusted.

[0126] If the node path lengths are inconsistent, it is further determined whether the node path of the leaf node to be converted is longer than the standard node path length of that leaf node in the preset tree structure. If the node path of the leaf node to be converted is longer than the standard node path length of that leaf node in the preset tree structure, the path adjustment type is reduction. Otherwise, if the node path of the leaf node to be converted is shorter than or equal to the standard node path length of that leaf node in the preset tree structure, the path adjustment type is extension.

[0127] In one embodiment, the node path is adjusted according to the path adjustment type to obtain the data to be converted after path standardization, including:

[0128] Determine the order of atomic operations for adjusting the node path based on the path adjustment type;

[0129] Atomic operations are performed on node paths based on the order of atomic operations to adjust the node paths and obtain the data to be transformed after path standardization.

[0130] Among them, the atomic operation sequence ensures that during the path adjustment of the data to be transformed, other threads cannot make adjustments, and it will not be interfered with by other tasks, thus guaranteeing the accuracy of path adjustment.

[0131] Specifically, after determining the path adjustment type of each leaf node path in the data to be converted, the terminal needs to determine the atomic operation sequence of the path adjustment corresponding to the path adjustment type; then, it performs atomic operations on the node paths according to the atomic operation sequence to adjust the node paths and obtain the data to be converted after path standardization.

[0132] In one embodiment, the order of atomic operations for adjusting a node path is determined based on the path adjustment type, including:

[0133] When the path adjustment type is reduction, the order of atomic operations for adjusting the node path is determined to include deletion and addition operations;

[0134] When the path adjustment type is the elongation type, the order of atomic operations for adjusting the node path is determined to include replacement operation, addition operation, and level adjustment operation.

[0135] Specifically, when the path adjustment type of the leaf node of the data to be transformed is reduced, such as Figure 7As shown, if the node path of the data to be converted only contains nodes that need to be deleted and no new nodes need to be added, then the atomic operation order for adjusting the node path is the deletion operation. If the node path of the data to be converted contains nodes that need to be deleted and new nodes need to be added, then the atomic operation order for adjusting the node path is the deletion operation followed by the addition operation.

[0136] If the path adjustment type of the leaf node of the data to be transformed is the stretch type, and if a new node needs to be added to the node path of the data to be transformed, and there are nodes in the node path that need to have their level adjusted, then the atomic operation order for adjusting the node path is determined to be the add operation followed by the level adjustment operation. For example... Figure 8 As shown, if a node in the path of the data to be converted needs to be directly replaced, then the atomic operations for adjusting the node path are determined to be replacement operations. For example... Figure 9 As shown, if a new node needs to be added to the node path of the data to be transformed, and there are nodes in the node path that need to have their hierarchy adjusted, then the atomic operation order for adjusting the node path is determined to be the hierarchy adjustment operation. If a node in the node path of the data to be transformed needs to be directly replaced, and a new node needs to be added, as well as a hierarchy adjustment operation, then the atomic operation order for adjusting the node path is determined to be the replacement operation, the addition operation, and the hierarchy adjustment operation. Figure 10 As shown, an example of a path adjustment type of no adjustment is also given. Figure 11 As shown, if only new nodes need to be added to the node path of the data to be transformed, then the atomic operation order for adjusting the node path is determined to be the add operation.

[0137] In one embodiment, atomic operations are performed on the node path based on the atomic operation sequence to adjust the node path and obtain the data to be transformed after path standardization, including:

[0138] When the path adjustment type is reduced, determine the nodes to be deleted in the node path of the data to be converted, perform the deletion operation on the nodes to be deleted, and perform the addition operation to add new nodes to obtain the data to be converted after path standardization.

[0139] Specifically, when the path adjustment type is reduction, if nodes need to be deleted and new nodes added in the node path of the data to be converted, the nodes to be deleted in the node path of the data to be converted are determined by matching the node path of the data to be converted with the node order of the preset tree structure. The nodes to be deleted are then deleted, and new nodes are added, resulting in the data to be converted after path standardization. For example, ... Figure 12 The image shows the path diagram for each leaf node of the data to be transformed. Figure 13The path graph for node C is consistent with the path of node C in the preset tree structure and requires no processing. Figure 14 Given the path graph of node F, the node path of the data to be converted is ABF, and the node path of the preset tree structure is AM. Then, nodes B and F need to be deleted, and node M is a newly added node. First, the deletion operation is performed to delete nodes B and F. Then, the addition operation is performed to add the new node M, and the data to be converted after path standardization is obtained.

[0140] In one embodiment, atomic operations are performed on the node path based on the atomic operation sequence to adjust the node path and obtain the data to be transformed after path standardization, including:

[0141] When the path adjustment type is the stretching type, determine the node to be replaced in the node path of the data to be converted, perform the replacement operation to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure, and perform the add operation to add a new node to obtain the data to be converted after path standardization.

[0142] or

[0143] When the path adjustment type is the elongation type, the node to be replaced in the node path of the data to be converted is determined, the replacement operation is performed to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure, the addition operation is performed to add a new node, and the hierarchy adjustment operation is performed on the data to be converted after adding the new node to obtain the data to be converted after path standardization.

[0144] Specifically, when the path adjustment type is "extension," if the node path of the data to be converted needs to replace a node and add a new node, the nodes to be replaced in the node path of the data to be converted are determined. A replacement operation is performed to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure. Then, an add operation is performed to add a new node, resulting in the data to be converted after path standardization. For example, if the node path of the data to be converted is AMN, and the node path of the preset tree structure is A-M1-NW, then node M needs to be replaced with M1, and node W is a new node. First, a replacement operation is performed to replace node M with M1, and then an add operation is performed to add a new node W, resulting in the data to be converted after path standardization.

[0145] When the path adjustment type is "extension," if the node path of the data to be converted requires replacing nodes, adding new nodes, and adjusting the node hierarchy, the process involves: identifying the nodes to be replaced in the path; performing a replacement operation to replace the target replacement node in the preset tree structure with the node to be replaced in the data to be converted; performing an add operation to add new nodes; determining the original and target levels of the nodes to be adjusted; and performing a hierarchy adjustment operation on the data to be converted after adding new nodes, based on the original and target levels of the nodes to be adjusted, to obtain the data to be converted after path standardization. For example, Figure 15 Given the path graph of node L, and the node path of the data to be transformed as ADL, with the preset tree structure node path as AG-L1-D, then node L needs to be replaced with L1. Node G is a newly added node; therefore, a replacement operation is first performed to replace node D with D1. Then, an add operation is performed to add a new node G, resulting in the path AD-L1-G. Finally, a level adjustment operation is performed, moving D to the fourth level and G to the second level, yielding the path-standardized data to be transformed as follows: Figure 16 As shown.

[0146] In one embodiment, performing an add operation to add a new node includes:

[0147] Determine the target node to be added, as well as its parent and child nodes, in the preset tree structure;

[0148] Based on the parent and child nodes of the target node, determine the parent and child nodes of the target node in the node path of the data to be transformed;

[0149] Based on the parent and child nodes of the target node in the node path of the data to be transformed, add the target node to the node path of the data to be transformed.

[0150] Specifically, when adding a new node to a node path, the target node, its parent node, and child nodes are first determined from the preset tree structure. The parent and child nodes of the target node in the preset tree structure are then added to the node path of the data to be converted. For example, if the node path of the data to be converted is ABC, and the node path of the preset tree structure is ABCD, then node D is the new node. The parent node of node D in the preset tree structure is C, and it has no child nodes. Therefore, the parent node of node D is found in the node path of the data to be converted, and C is added to the node path of the data to be converted.

[0151] In one embodiment, the transformation weight data of each node in the path-normalized data to be transformed is determined, including:

[0152] Identify the target data node in the internal benchmark data;

[0153] The conversion coefficients are determined based on the initial weight data of each leaf node in the data to be converted after path standardization, and the weight data of the target data node.

[0154] Based on the transformation coefficients, determine the transformation weight data of each leaf node in the data to be transformed after path standardization.

[0155] In this context, the attribute values ​​of the target data node and all leaf nodes of the data to be transformed are equal, and the weights of all leaf nodes of the data to be transformed are the path weights of all leaf nodes of the data to be transformed.

[0156] Specifically, the terminal determines target data nodes from internal benchmark data whose attribute values ​​are equal to those of all leaf nodes in the data to be converted, based on the relationship between all leaf nodes and preset attribute values ​​in the data to be converted. Then, a conversion coefficient is calculated by comparing the initial weight data of each leaf node in the path-standardized data to be converted with the weight data of the target data node. In an optional embodiment, the conversion coefficient is the ratio of the weight data of the target data node to the sum of the initial weight data of each leaf node; that is, the conversion coefficient is obtained by comparing the weight data of the target data node with the sum of the initial weight data of each leaf node in the path-standardized data to be converted. Afterwards, the conversion weight data of each leaf node in the path-standardized data to be converted is determined by comparing the conversion coefficient with the initial weight data of each leaf node in the path-standardized data to be converted.

[0157] In one embodiment, the leaf weight data of each node in the path-normalized data to be transformed is determined based on the transformation coefficients, including:

[0158] Based on the transformation coefficients, the initial weight data of each leaf node in the path-standardized data to be transformed is transformed to obtain the transformed weight data of each leaf node in the path-standardized data to be transformed.

[0159] Specifically, the transformation coefficients are multiplied by the initial weight data of each leaf node in the path-standardized data to obtain the transformation weight data of each leaf node in the path-standardized data to be transformed.

[0160] In one embodiment, the data to be transformed, for which the transformation weights of each node have been determined, is merged into internal baseline data, including:

[0161] The node paths of the data to be transformed after path standardization are merged into the internal baseline data. The transformation weight data of each leaf node in the path-standardized data to be transformed is superimposed with the weight data of the leaf nodes in the internal baseline data to obtain the merged internal baseline data.

[0162] Specifically, the terminal retrieves internal reference data with the same root node from its local machine based on the root node of the data to be converted. It then deletes the target data node from the internal reference data, merges the node paths of the data to be converted (after path standardization) into the internal reference data, and superimposes the conversion weight data of each leaf node in the path-standardized data of the data to be converted with the weight data of the leaf nodes in the internal reference data to obtain the merged internal reference data. That is, the superimposed leaf node weight is equal to the product of the conversion coefficient and the initial weight data of each leaf node in the path-standardized data of the data to be converted, plus the weight data of the leaf nodes in the internal reference data.

[0163] like Figure 17 As shown in a specific example, the left side represents the data to be transformed after path standardization, the right side represents the internal baseline data, and the bottom side represents the merged internal baseline data. Node H is the target data node, and the attribute values ​​of nodes C, M, and D are equal to those of node H. The weight value of node H is W1 = 3. The total weight of all leaf nodes (C, M, D) in the data to be transformed is W2 = 1 + 2 + 3 = 6, and the transformation coefficient Q = W1 / W2 = 3 / 6 = 0.5. Then, the leaf node paths of each data to be transformed are processed sequentially. If a path overlaps with the internal baseline data, the weight of the superimposed leaf node is calculated as: weight of the leaf node in the data to be transformed * transformation coefficient + weight of the leaf node in the internal baseline data.

[0164] For node path ABC with weight 1, it exists in the internal benchmark data, with an internal weight of 5, and the transformed weight is 5.5.

[0165] For node path AM weight 2, it exists in the internal benchmark data, with an internal weight of 1, and the weight after transformation is 2.

[0166] For a node path AG-L1-D with a weight of 3, there is an internal weight of 5, and the transformed weight is 6.5.

[0167] In one embodiment, the method further includes: calculating the difference between the initial total weight and the merged total weight when the initial total weight is inconsistent with the merged total weight;

[0168] The difference is added to the leaf node with the highest weight in the merged internal benchmark data.

[0169] The initial total weight is the sum of the weights of all leaf nodes in the internal benchmark data, and the merged total weight is the sum of the weights of all leaf nodes in the merged internal benchmark data. The leaf node with the largest weight is the leaf node with the largest weight in the merged internal benchmark data.

[0170] Specifically, the initial total weight is obtained by summing the weight data of each leaf node in the internal benchmark data. The merged total weight is then obtained by summing the weight data of each leaf node in the merged internal benchmark data. The initial total weight and the merged total weight are then compared. If they match, the merging is complete. If they do not match, the difference between the initial total weight and the merged total weight is calculated. The leaf node with the highest weight in the merged internal benchmark data is then determined, and the difference is added to the leaf node with the highest weight in the merged internal benchmark data.

[0171] In this embodiment, by adjusting the tail difference, it can be ensured that the total weight of all leaf nodes of the internal benchmark data is equal before and after merging, thus satisfying the weight equality rule.

[0172] To facilitate understanding of the technical solutions provided in the embodiments of this application, such as Figure 18 As shown, the tree structure data conversion method provided in this application embodiment will be briefly described using the complete tree structure data conversion process:

[0173] Step 1801: Obtain the data to be transformed and standardize the node names of each node in the data to be transformed.

[0174] Step 1802: Based on the preset tree structure storage format, perform format standardization processing on the data to be converted after the node names have been standardized to obtain the node path of the data to be converted.

[0175] Step 1803: Match the node path of the data to be converted with the node order of the preset tree structure to determine the path adjustment type.

[0176] Step 1804: Determine the order of atomic operations for adjusting the node paths according to the path adjustment type; perform atomic operations on the node paths based on the order of atomic operations to adjust the node paths and obtain the data to be converted after path standardization.

[0177] Step 1805: Determine the target data node in the internal benchmark data; determine the conversion coefficient based on the initial weight data of each leaf node in the data to be converted after path standardization and the weight data of the target data node.

[0178] Step 1806: Based on the transformation coefficient, perform weight transformation on the initial weight data of each leaf node in the path-standardized data to obtain the transformed weight data of each leaf node in the path-standardized data to be transformed.

[0179] Step 1807: Merge the node paths of the data to be converted after path standardization into the internal baseline data, and superimpose the conversion weight data of each leaf node in the data to be converted after path standardization with the weight data of the leaf nodes in the internal baseline data to obtain the merged internal baseline data.

[0180] Step 1808: Calculate the sum of the weight data of each leaf node in the internal benchmark data to obtain the initial total weight. Calculate the sum of the weight data of each leaf node in the merged internal benchmark data to obtain the merged total weight. If the initial total weight and the merged total weight are inconsistent, calculate the difference between the initial total weight and the merged total weight.

[0181] Step 1809: Add the difference to the leaf node with the highest weight in the merged internal benchmark data.

[0182] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0183] Based on the same inventive concept, this application also provides a tree structure data conversion device for implementing the tree structure data conversion method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more tree structure data conversion device embodiments provided below can be found in the limitations of the tree structure data conversion method described above, and will not be repeated here.

[0184] In one embodiment, such as Figure 19 As shown, a tree-structured data conversion device is provided, including: an acquisition module 1902, a standardization processing module 1904, and a conversion module 1906, wherein:

[0185] The acquisition module 1902 is used to acquire the data to be converted, which is a tree-structured data.

[0186] The standardization processing module 1904 is used to match the node paths of the data to be converted with the node order of the preset tree structure, and perform path standardization processing on each node path according to the matching results to obtain the data to be converted after path standardization.

[0187] The transformation module 1906 is used to determine the transformation weight data of each node in the data to be transformed after path standardization, and to merge the data to be transformed with the transformation weight data of each node determined into the internal baseline data, which is a tree structure data.

[0188] The acquisition module 1902 is used to standardize the node names of each node in the acquired data to be converted; based on the preset tree structure storage format, the data to be converted after the node names are standardized is subjected to format standardization processing to obtain the node path of the data to be converted.

[0189] In one embodiment, the standardization processing module 1904 is further configured to match the node path of the data to be converted with the node order of a preset tree structure to determine the path adjustment type; and adjust the node path according to the path adjustment type to obtain the data to be converted after path standardization processing.

[0190] In one embodiment, the standardization processing module 1904 is further configured to determine that the path adjustment type is no adjustment when the node path of the data to be converted is the same as the node order of the matching preset tree structure; determine that the path adjustment type is a reduction type when the length of the node path of the data to be converted is greater than the length of the node order of the matching preset tree structure; and determine that the path adjustment type is an extension type when the length of the node path of the data to be converted is less than the length of the node order of the matching preset tree structure.

[0191] In one embodiment, the standardization processing module 1904 is further configured to determine the order of atomic operations for adjusting the node path according to the path adjustment type; perform atomic operations on the node path based on the order of atomic operations to adjust the node path and obtain the data to be converted after path standardization processing.

[0192] In one embodiment, the standardization processing module 1904 is further configured to determine, when the path adjustment type is a reduction type, the atomic operation sequence for adjusting the node path includes deletion and addition operations; and when the path adjustment type is an extension type, the atomic operation sequence for adjusting the node path includes replacement, addition, and hierarchy adjustment operations.

[0193] In one embodiment, the standardization processing module 1904 is further configured to, when the path adjustment type is reduction type, determine the nodes to be deleted in the node path of the data to be converted, perform a deletion operation on the nodes to be deleted, and perform an addition operation to add new nodes, thereby obtaining the data to be converted after path standardization processing.

[0194] In one embodiment, the standardization processing module 1904 is further configured to, when the path adjustment type is the extension type, determine the node to be replaced in the node path of the data to be converted, perform a replacement operation to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure, and perform an add operation to add a new node, thereby obtaining the data to be converted after path standardization processing.

[0195] or

[0196] The standardization processing module 1904 is also used to determine the node to be replaced in the node path of the data to be converted when the path adjustment type is the extension type, perform a replacement operation to replace the node to be replaced in the data to be converted with the target replacement node in the preset tree structure, perform an add operation to add a new node, and perform a hierarchy adjustment operation on the data to be converted after adding the new node to obtain the data to be converted after path standardization processing.

[0197] In one embodiment, the standardization processing module 1904 is further configured to determine the target added node and the parent node and child node of the target added node in the preset tree structure; determine the parent node and child node of the target added node in the node path of the data to be converted based on the parent node and child node of the target added node; and add the target added node to the node path of the data to be converted based on the parent node and child node of the target added node in the node path of the data to be converted.

[0198] In one embodiment, the conversion module 1906 is further configured to determine the target data node in the internal baseline data; the initial weight data of each leaf node in the path-standardized data to be converted, and the weight data of the target data node, to determine the conversion coefficient; and, based on the conversion coefficient, to determine the conversion weight data of each leaf node in the path-standardized data to be converted.

[0199] In one embodiment, the transformation coefficient is the ratio of the weight data of the target data node to the sum of the initial weight data of each leaf node.

[0200] In one embodiment, the conversion module 1906 is further configured to perform weight conversion on the initial weight data of each leaf node of the path-standardized data to be converted according to the conversion coefficient, so as to obtain the conversion weight data of each leaf node in the path-standardized data to be converted.

[0201] In one embodiment, the conversion module 1906 is further configured to merge the node paths of the path-standardized data to be converted into the internal reference data, and to superimpose the conversion weight data of each leaf node in the path-standardized data to be converted with the weight data of the leaf nodes in the internal reference data to obtain the merged internal reference data.

[0202] In one embodiment, the conversion module 1906 is further configured to calculate the difference between the initial total weight and the merged total weight when the initial total weight is inconsistent with the merged total weight, and to add the difference to the leaf node with the largest weight in the merged internal benchmark data; wherein the initial total weight is the sum of the weight data of each leaf node in the internal benchmark data, the merged total weight is the sum of the weight data of each leaf node in the merged internal benchmark data, and the leaf node with the largest weight is the leaf node with the largest weight data in the merged internal benchmark data.

[0203] Each module in the aforementioned tree-structured data conversion device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0204] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 20 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a tree-structured data conversion method. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0205] Those skilled in the art will understand that Figure 20The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0206] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0207] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0208] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0209] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0210] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0211] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A tree structure data conversion method, characterized by, The method comprises: acquiring to-be-converted data, the to-be-converted data being tree structure data; determining a path adjustment type by comparing a path length of a node path of the to-be-converted data and a length of a node sequence of a preset tree structure; the path adjustment type comprises no adjustment, a shortening type and an elongation type; determining an atomic operation sequence for path adjustment of the node path according to the path adjustment type; performing atomic operations on the node path based on the atomic operation sequence to adjust the path of the node path, and obtaining to-be-converted data after path normalization processing; determining conversion weight data by finding a target data node and calculating a conversion coefficient; determining a target data node in internal reference data based on a rule that an attribute value of a leaf node in the to-be-converted data is equal to an attribute value of a node in the internal reference data; determining a conversion coefficient according to initial weight data of each leaf node in the to-be-converted data after path normalization processing and weight data of the target data node; determining conversion weight data of each leaf node in the to-be-converted data after path normalization processing according to the conversion coefficient, merging a node path of the to-be-converted data after path normalization processing into the internal reference data, and superimposing the conversion weight data of each leaf node in the to-be-converted data after path normalization processing and weight data of leaf nodes in the internal reference data to obtain merged internal reference data, the internal reference data being tree structure data; in a case where an initial total weight and a merged total weight are inconsistent, calculating a difference between the initial total weight and the merged total weight, the initial total weight being a sum of weight data of each leaf node in the internal reference data, and the merged total weight being a sum of weight data of each leaf node in the merged internal reference data; superimposing the difference into a maximum weight leaf node in the merged internal reference data, the maximum weight leaf node being a leaf node with the maximum weight data in the merged internal reference data.

2. The method of claim 1, wherein, The acquiring to-be-converted data comprises: performing node name normalization on each node in the acquired to-be-converted data; performing format standardization processing on the to-be-converted data after node name normalization based on a preset tree structure storage format to obtain a node path of the to-be-converted data.

3. The method of claim 1, wherein, The determining a path adjustment type by comparing a path length of a node path of the to-be-converted data and a length of a node sequence of a preset tree structure comprises: in a case where the node path of the to-be-converted data is the same as a matching node sequence of the preset tree structure, determining that the path adjustment type is no adjustment; in a case where the length of the node path of the to-be-converted data is greater than the length of the matching node sequence of the preset tree structure, determining that the path adjustment type is a shortening type; in a case where the length of the node path of the to-be-converted data is less than the length of the matching node sequence of the preset tree structure, determining that the path adjustment type is an elongation type.

4. The method of claim 1, wherein, The method comprises the following steps: In the case of the path adjustment type being the shortening type, determining the atomic operation sequence for path adjustment of the node path comprises a deletion operation and an addition operation; In the case of the path adjustment type being the lengthening type, determining the atomic operation sequence for path adjustment of the node path comprises a replacement operation, an addition operation, and a hierarchy adjustment operation.

5. The method of claim 4, wherein, The method comprises the following steps: In the case of the path adjustment type being the shortening type, determining the node to be deleted in the node path of the to-be-converted data, performing a deletion operation on the node to be deleted, and performing an addition operation to add a new node to obtain the path-standardized to-be-converted data.

6. The method of claim 4, wherein, The method comprises the following steps: In the case of the path adjustment type being the lengthening type, determining the node to be replaced in the node path of the to-be-converted data, performing a replacement operation to replace the target replacement node in the preset tree structure with the node to be replaced in the to-be-converted data, and performing an addition operation to add a new node to obtain the path-standardized to-be-converted data. Or In the case of the path adjustment type being the lengthening type, determining the node to be replaced in the node path of the to-be-converted data, performing a replacement operation to replace the target replacement node in the preset tree structure with the node to be replaced in the to-be-converted data, performing an addition operation to add a new node, and performing a hierarchy adjustment operation on the to-be-converted data after the new node is added to obtain the path-standardized to-be-converted data.

7. The method according to claim 5 or 6, characterized in that, The method comprises the following steps: Determining a target addition node in the preset tree structure, a parent node of the target addition node, and a child node of the target addition node; Determining the parent node and the child node of the target addition node in the node path of the to-be-converted data according to the parent node and the child node of the target addition node; According to the parent node and the child node of the target addition node in the node path of the to-be-converted data, the target addition node is added to the node path of the to-be-converted data.

8. The method of claim 1, wherein: The conversion coefficient is a ratio of weight data of the target data node to a sum of initial weight data of each leaf node.

9. A tree structure data conversion apparatus characterized by comprising: The device comprises: An acquisition module configured to acquire to-be-converted data, wherein the to-be-converted data is tree structure data. The standardization processing module is configured to determine a path adjustment type by comparing a path length of a node path of the to-be-converted data and a length of a node sequence of a preset tree structure; the path adjustment type includes no adjustment, a shortening type, and a lengthening type; determine an atomic operation sequence for adjusting the node path according to the path adjustment type; and perform atomic operations on the node path based on the atomic operation sequence to adjust the node path, and obtain the to-be-converted data after path standardization processing. The conversion module is configured to determine conversion weight data by finding a target data node and calculating a conversion coefficient; determine the target data node in the internal reference data based on a rule that an attribute value of a leaf node in the to-be-converted data is equal to an attribute value of a node in the internal reference data; determine the conversion coefficient based on initial weight data of each leaf node in the to-be-converted data after path standardization processing and weight data of the target data node; determine conversion weight data of each leaf node in the to-be-converted data after path standardization processing based on the conversion coefficient, and merge the node path of the to-be-converted data after path standardization processing into the internal reference data, and superimpose the conversion weight data of each leaf node in the to-be-converted data after path standardization processing on weight data of leaf nodes in the internal reference data, to obtain merged internal reference data, wherein the internal reference data is tree structure data; in a case where an initial total weight and a merged total weight are inconsistent, calculate a difference value between the initial total weight and the merged total weight, wherein the initial total weight is a sum of weight data of each leaf node in the internal reference data, and the merged total weight is a sum of weight data of each leaf node in the merged internal reference data; and superimpose the difference value into a maximum weight leaf node in the merged internal reference data, wherein the maximum weight leaf node is a leaf node with the maximum weight data in the merged internal reference data.

10. The apparatus of claim 9, wherein: The acquisition module is configured to perform node name standardization on each node in the acquired to-be-converted data, and perform format standardization processing on the to-be-converted data after node name standardization based on a preset tree structure storage format, to obtain a node path of the to-be-converted data.

11. The apparatus of claim 9, wherein: The standardization processing module is further configured to determine that the path adjustment type is no adjustment in a case where the node path of the to-be-converted data is the same as a matched node sequence of the preset tree structure; determine that the path adjustment type is the shortening type in a case where a length of the node path of the to-be-converted data is greater than a length of the matched node sequence of the preset tree structure; and determine that the path adjustment type is the lengthening type in a case where the length of the node path of the to-be-converted data is less than the length of the matched node sequence of the preset tree structure.

12. The apparatus of claim 9, wherein: ​ The standardization processing module is further configured to determine that the order of atomic operations for adjusting the node path of the to-be-converted data includes a deletion operation and an addition operation when the path adjustment type is a reduction type; and determine that the order of atomic operations for adjusting the node path of the to-be-converted data includes a replacement operation, an addition operation, and a hierarchy adjustment operation when the path adjustment type is an extension type.

13. The apparatus of claim 12, wherein: The standardization processing module is further configured to determine a node to be deleted in the node path of the to-be-converted data, perform a deletion operation on the node to be deleted, and perform an addition operation to add a new node, to obtain the to-be-converted data after path standardization processing, when the path adjustment type is a reduction type.

14. The apparatus of claim 12, wherein: The standardization processing module is further configured to determine a node to be replaced in the node path of the to-be-converted data, perform a replacement operation to replace the node to be replaced in the to-be-converted data with a target replacement node in the preset tree structure, and perform an addition operation to add a new node, to obtain the to-be-converted data after path standardization processing, when the path adjustment type is an extension type. Or The standardization processing module is further configured to determine a node to be replaced in the node path of the to-be-converted data, perform a replacement operation to replace the node to be replaced in the to-be-converted data with a target replacement node in the preset tree structure, perform an addition operation to add a new node, and perform a hierarchy adjustment operation on the to-be-converted data after adding the new node, to obtain the to-be-converted data after path standardization processing, when the path adjustment type is an extension type.

15. The apparatus of claim 13 or 14, wherein: The standardization processing module is further configured to determine a target addition node in the preset tree structure, a parent node and a child node of the target addition node, determine a parent node and a child node of the target addition node in the node path of the to-be-converted data according to the parent node and the child node of the target addition node, and add the target addition node to the node path of the to-be-converted data according to the parent node and the child node of the target addition node in the node path of the to-be-converted data.

16. The apparatus of claim 13, wherein, The conversion coefficient is a ratio of weight data of the target data node to a sum of initial weight data of each leaf node. 17.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-16. The processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 8.

18. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method of any one of claims 1 to 8.

19. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method of any one of claims 1 to 8. The computer program, when executed by the processor, implements the steps of the method of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Cross-system tree structure data synchronization method and related equipment thereof

    CN115630123A

  • Data storage method and apparatus, and storage medium and server

    WO2022127114A1