Tree Structure Data Merging Processing Method, Device, Equipment and Storage Medium

By processing and merging the tree structure data, the target rendering table data is generated, and the problem of low processing efficiency of tree structure data is solved, and the data volume is reduced and processing efficiency is improved.

CN119025528BActive Publication Date: 2025-05-30HANGZHOU NEWGRAND TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411515549.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-05-30
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

When processing tree structure data, since a single parent node may have multiple child nodes, and the corresponding parent node needs to be set for each child node, the data volume is large and the processing efficiency is low.

Method used

By processing the node data in the tree structure data, a memory object corresponding to the node data is generated, the left and right arrangement order of the table header root and downward data is determined, the corresponding cell data is merged, and the target rendering table data is generated.

Benefits of technology

Integrate the repeated parent node data in the tree structure data into one parent node data to reduce the amount of data and improve processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025528B_ABST
    Figure CN119025528B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of data processing, and particularly to a method, device, equipment and storage medium for merging and processing tree-structured data. The method includes: processing each node data in the tree-structured data to obtain a memory object corresponding to each node data one by one; determining the header root of the tree-structured data and the downward data corresponding to the header root based on the memory object; determining the left-right arrangement order of the header root and the downward data based on the memory object, and processing the header root and the downward data based on the left-right arrangement order to obtain target table data; creating primary rendered table data based on the target table data, and merging the cells in the primary rendered table data based on the memory object to obtain target rendered table data. The present application facilitates improving the processing efficiency of processing tree-structured data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular, to a method, apparatus, device, and storage medium for merging and processing tree-structured data. Background Art

[0002] When performing structured statistics on data in an information system, tree-structured data often occurs. The tree-structured data consists of several levels of data, and the data at adjacent levels has a parent-child relationship. The data at the higher level in adjacent levels is the parent node, and the data at the lower level is the child node.

[0003] Since a single parent node may have multiple child nodes, and in tree-structured data, a corresponding parent node needs to be set for each child node. In the case of a large amount of tree-structured data, there will be many duplicate parent nodes, resulting in a very complex calculation process when processing tree-structured data, and thus the processing efficiency of processing tree-structured data is relatively low. Summary of the Invention

[0004] In order to facilitate improving the processing efficiency of processing tree-structured data, the present application provides a method, apparatus, device, and storage medium for merging and processing tree-structured data.

[0005] In a first aspect, the present application provides a method for merging and processing tree-structured data, including:

[0006] Processing each node data in the tree-structured data to obtain a memory object corresponding to each node data;

[0007] Determining the header root of the tree-structured data and the downward data corresponding to the header root based on the memory object;

[0008] Determining the left-right arrangement order of the header root and the downward data based on the memory object, and processing the header root and the downward data based on the left-right arrangement order to obtain target table data;

[0009] Creating primary rendered table data based on the target table data, and merging the cells in the primary rendered table data based on the memory object to obtain target rendered table data.

[0010] In a second aspect, the present application provides a device for merging and processing tree-structured data, including:

[0011] A memory object generation module, configured to process each node data in the tree-structured data to obtain a memory object corresponding to each node data;

[0012] A root and data determination module, configured to determine a header root of the tree-structured data and downward data corresponding to the header root based on the memory object;

[0013] A target table data generation module, configured to determine a left-right arrangement order of the header root and the downward data based on the memory object, and process the header root and the downward data based on the left-right arrangement order to obtain target table data;

[0014] A target rendered table data generation module, configured to create primary rendered table data based on the target table data, and merge cells in the primary rendered table data based on the memory object to obtain target rendered table data.

[0015] In a third aspect, the present application provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps in the above method are implemented.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method are implemented.

[0017] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0018] For the above tree-structured data merging and processing method, apparatus, device, and storage medium, by processing each node data in the tree-structured data, a memory object corresponding to each node data is obtained; based on the memory object, a header root of the tree-structured data and downward data corresponding to the header root are determined; based on the memory object, a left-right arrangement order of the header root and the downward data is determined, and the header root and the downward data are processed based on the left-right arrangement order to obtain target table data; based on the target table data, primary rendered table data is created, and cells in the primary rendered table data are merged based on the memory object to obtain target rendered table data. Through the above implementation, the tree-structured data can be first exported as primary rendered table data, and then cells corresponding to the same parent node in the primary rendered table data are merged, so that duplicate parent node data in the tree-structured data is integrated into one parent node data, thereby reducing the amount of data in the tree-structured data structure, and further improving the processing efficiency of processing the tree-structured data.

[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0021] Figure 1 It is a flowchart of a method for merging and processing tree-structured data provided in an embodiment of the present application;

[0022] Figure 2 It is a schematic diagram provided in an embodiment of the present application for reflecting the positional relationship between a four-way reference slot and node data;

[0023] Figure 3 It is a schematic diagram of the composition of a memory object provided in an embodiment of the present application;

[0024] Figure 4 It is a schematic diagram of the structure of a device for merging and processing tree-structured data provided in an embodiment of the present application;

[0025] Figure 5 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0026] Figure 6 It is an internal structure diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0027] In order to make the objectives, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.

[0028] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of this article are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or equipment.

[0029] In this article, the term "and / or" is only a relationship describing associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after.

[0030] Embodiment 1

[0031] Figure 1 It is a flowchart of a method for merging and processing tree-structured data provided in Embodiment 1 of this application. Refer to Figure 1 This method can be executed by a device that executes this method. The device can be implemented in software and / or hardware. The method includes:

[0032] S110. Process each node data in the tree-structured data to obtain a memory object corresponding to each node data one by one.

[0033] Among them, the corresponding tree-structured data can be obtained through the data source of the information system. The information system can be various types of information systems for enterprises, such as enterprise data statistics systems, etc.; the data source can be the data interface of the information system or the database set in the information system, etc.; the tree-structured data consists of node data at several levels. The node data in the previous level in adjacent levels is the parent node data of the node data in the next level, and the node data in the next level is the child node data of the node data in the next level. There is a corresponding parent-child relationship between the parent node data and the child node data; each node data has a corresponding display title, and the display title is used to represent the field corresponding to the node data, that is, to represent the type corresponding to the node data. Exemplarily, the display title corresponding to a node data is "group".

[0034] The data of each node in the tree - shaped structure data is stored in the form of a table. Each node data corresponds to a cell in the table. Each cell in the table has four directions, including: the upward direction, simply referred to as the upward; the downward direction, simply referred to as the downward; the left - hand direction, simply referred to as the leftward; and the right - hand direction, simply referred to as the rightward. It is possible that the cells adjacent to each cell in the four directions correspond to other node data. That is, the node data corresponding to each cell may have information about other node data in the four directions (simply referred to as the four - way), and the information about the other node data corresponding to each node data in the four - way is recorded as the four - way data information. Taking one of the node data as an example, encapsulating the node data, the display title corresponding to the node data, and the four - way data information to obtain the memory object corresponding to the node data.

[0035] It should be noted that, to store the tree - shaped structure data obtained from the data source, a raw data container for storing the tree - shaped structure data is preset; to store the memory object corresponding to each generated node data, a pending - association data container for storing the memory object is preset; the data container is embodied as a kind of memory in form.

[0036] Specifically, obtain the tree - shaped structure data from the data source of the information system. The tree - shaped structure data includes multiple node data, and then store the tree - shaped structure data in the preset raw data container; then traverse the display title and the four - way data information corresponding to each node data in the raw data container, and then encapsulate each node data, the display title corresponding to the node data, and the four - way data information, so as to obtain the memory objects corresponding to each node data one by one. Further, store each memory object in the preset pending - association data container.

[0037] S120. Determine the header root of the tree - shaped structure data and the downward data corresponding to the header root based on the memory object.

[0038] Among them, the tree-structured data is stored in the original data container in the form of a table. In the four-way data information of the node data in the first row of the table, there is no upward data. That is, the node data in the first row of the table has no other node data above it. And the node data in the table without upward data is recorded as the header root. Generally, each header root has at least one column of data below it, that is, the downward data of the header root; the four-way data information of each node data can display the existence of data in the four directions of the node data. Exemplarily, assume that a node data has no upward data in the table, but has leftward data, rightward data, and downward data. Then the four-way data in the memory object corresponding to the node data will display the leftward data, rightward data, and downward data corresponding to the node data, and display that the upward data of the node data is empty; Therefore, it can be judged whether a node data is a header root through the memory object corresponding to the node data. Exemplarily, if it is judged through the memory object corresponding to a node data that the node data has leftward data, rightward data, and downward data, but no upward data, then the node data is used as the header root; Since the memory object corresponding to the header root also indicates its adjacent downward data, and the adjacent downward data can also indicate its adjacent downward data through its memory object, and so on, until all the downward data below the header root is indicated.

[0039] It should be noted that, for the convenience of storing the generated header root and all its downward data, a target data container for storing the header root and all its downward data is also preset.

[0040] Specifically, taking a node data as an example, it is judged whether the node data is a header root through the memory object corresponding to the node data. If so, the node data is used as the header root and stored in the preset target data container; further, all the downward data below the header root is determined through the memory object of the header root, and the downward data corresponding to the header root is also stored in the preset target data container.

[0041] S130. Determine the left-right arrangement order of the header root and the downward data based on the memory object, and process the header root and the downward data based on the left-right arrangement order to obtain target table data.

[0042] Among them, the header root stored in the target data container and the downward data of at least one column thereof have an up-and-down arrangement order in the up-and-down direction, but there is no left-and-right arrangement order among the header roots and among the downward data of each column in the target data container. Subsequently, it is necessary to generate target table data based on each header root and the downward data of the header root, and the target table data requires that there is a left-and-right arrangement order among the header roots and among the downward data of each column in the target data container. Therefore, it is necessary to determine the left-and-right arrangement order among the header roots and the left-and-right arrangement order among the downward data of each column. Since the four-way data information in the memory object can also indicate the leftward data and the rightward data of the corresponding node data; for the header root, the other header roots located on its left and right can be determined through the four-way data information in the memory object corresponding to each header root, so as to determine the left-and-right arrangement order among the header roots; for the downward data corresponding to the header root, in the case where the header root corresponds to multiple columns of downward data, the left-and-right arrangement order among the downward data of each layer (each row) in the multiple columns of downward data can also be determined through the memory object corresponding to each downward data; the header roots can be arranged left and right through the left-and-right arrangement order corresponding to the header roots, and the downward data can also be arranged left and right through the left-and-right arrangement order among the downward data of each layer, so that the target table data can be obtained.

[0043] Specifically, the left-and-right arrangement order among the header roots is determined through the memory objects corresponding to the header roots, and the left-and-right arrangement order among the downward data of each layer corresponding to the header root is also determined through the memory objects of the downward data corresponding to the header root; further, the header roots are arranged left and right through the left-and-right arrangement order corresponding to the header roots, and the downward data is arranged left and right through the left-and-right arrangement order among the downward data of each layer, so as to obtain the target table data.

[0044] S140. Create primary rendering table data based on the target table data, and merge the cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0045] Among them, the primary rendering table data is created based on the target table data. The primary rendering table data and the target table data have the same number of table rows and the same number of table columns, but the primary rendering table data has some cells with null values. The reason for the generation of the cells with null values is that during the process of creating the primary rendering table data, multiple repeated parent node data corresponding to sub-node data will be merged into one parent node and displayed at the position of the header root; the cells where the parent node is located in the primary rendering table data and the cells with null values corresponding to the parent node are merged to obtain the target rendering table data.

[0046] Specifically, create primary rendering table data according to the number of rows and columns of the Mubi table data, and then merge all the cells corresponding to the same parent node in the primary rendering table data to obtain the target rendering table data.

[0047] It should be noted that in this embodiment, memory objects corresponding one by one to each of the node data are obtained by processing the node data in the tree structure data; the header root of the tree structure data and the downward data corresponding to the header root are determined based on the memory object; the left - right arrangement order of the header root and the downward data is determined based on the memory object, and the header root and the downward data are processed based on the left - right arrangement order to obtain target table data; primary rendering table data is created based on the target table data, and the cells in the primary rendering table data are merged based on the memory object to obtain the target rendering table data. Through the above implementation, the tree structure data can be first exported as primary rendering table data, and then the cells corresponding to the same parent node in the primary rendering table data are merged, so that the repeated parent node data in the tree structure data is integrated into one parent node data, thereby reducing the amount of data in the tree structure data and improving the processing efficiency of processing the tree structure data.

[0048] Embodiment 2

[0049] A method for merging and processing tree - structure data provided in Embodiment 2 of this application optimizes the step of "processing the node data in the tree - structure data to obtain memory objects corresponding one by one to each of the node data" in Embodiment 1; it should be noted that for parts not detailed in this embodiment, the descriptions in other embodiments can be referred to. The method includes:

[0050] S211. Set four - way reference slots corresponding to the node data according to the presence or absence of four - way data of each node data in the tree - structure data.

[0051] Among them, the tree - structured data original data container is stored in the form of a table. Taking a node data in the table as an example, the node data is in a cell in the table. A cell has four directions in the table, specifically: upward, downward, leftward, and rightward. The adjacent data in the upward direction of the node data is its upward data, the adjacent data in the downward direction of the node data is its downward data, the adjacent data in the leftward direction of the node data is its leftward data, and the adjacent data in the rightward direction of the node data is its rightward data. The four - direction data is the upward data, downward data, leftward data, and rightward data of the node data; it should be noted that the node data does not necessarily have complete four - direction data. Exemplarily, taking a node data in the first row of the table as an example, this node data may only have downward data, leftward data, and rightward data. That is, the existence situation of the four - direction data is also the existence situation of the corresponding four - direction data of the corresponding node data. The four - direction reference slots are set according to the existence situation of the four - direction data. Combining Figure 2 , the four - direction reference slots include four reference slots set along the four directions of the node data, including an upward reference slot 21, a downward reference slot 22, a leftward reference slot 23, and a rightward reference slot 24; the four reference slots correspond one - to - one with the node data in the possible four directions of the node data. If a node data corresponding to a reference slot exists, the information corresponding to the node data is stored in the reference slot. If a node data corresponding to a reference slot does not exist, the reference slot is empty.

[0052] Specifically, taking a node data in the tree - structured data as an example, first determine the existence situation of the four - direction data of the node data, and then set the four - direction reference slots of the node data according to the existence situation of the four - direction data; set the four - direction reference slots of each node data in the tree - structured data in the above - mentioned manner.

[0053] S212. Package based on the node data and the four - direction reference slots to obtain the memory object corresponding to the node data.

[0054] Among them, the node data has corresponding metadata, denoted as node data metadata, which is used to describe the corresponding node data. The node data also has a corresponding display title; in this embodiment, referring to Figure 3 , by packaging the display title, node data metadata, and four - direction reference slots corresponding to a node data, the memory object corresponding to the node data can be obtained.

[0055] Specifically, taking a node data of the tree - structured data as an example, package the display title, node data metadata, and four - direction reference slots corresponding to the node data to obtain the memory object corresponding to the node data; obtain the memory object corresponding to each node data in the tree - structured data through the above steps.

[0056] S220. Determine the header root of the tree - structured data and the downward data corresponding to the header root based on the memory object.

[0057] S230. Determine the left - right arrangement order of the header root and the downward data based on the memory object, and process the header root and the downward data based on the left - right arrangement order to obtain the target table data.

[0058] S240. Create primary rendered table data based on the target table data, and merge the cells in the primary rendered table data based on the memory object to obtain the target rendered table data.

[0059] Embodiment III

[0060] A method for merging and processing tree - structured data provided in Embodiment III of the present application optimizes the step of "determining the header root of the tree - structured data and the downward data corresponding to the header root based on the memory object" in Embodiment I. It should be noted that for parts not detailed in this embodiment, refer to the descriptions in other embodiments. The method includes:

[0061] S310. Process each node data in the tree - structured data to obtain a memory object corresponding to each node data one by one.

[0062] S321. Determine the node data with an empty upward reference slot in the four - way reference slot based on the memory object to obtain the header root.

[0063] Among them, the memory object includes a four - way reference slot for the corresponding node data. If the upward reference slot in the four - way reference slot is empty, the corresponding node data is the header root. The header root is generally the first node data from top to bottom in each column of node data in the table where the node data is located.

[0064] Specifically, taking a node data in the tree - structured data as an example, obtain the memory object of this node data, and then determine whether the upward reference slot in the four - way reference slot of this memory object is empty. If so, use this node data as the header root. Determine all the header roots in the tree - structured data in the above - mentioned manner.

[0065] S322. Determine the downward data corresponding to the header root based on the memory object corresponding to the header root.

[0066] Among them, when there is adjacent node data below a header root, the downward reference slot in the four-way reference slots of the memory object corresponding to the header root will have the data information of the adjacent node data. Through this data information, the downward data of the header root can be determined. Further, if there is still adjacent node data below the downward data, and the downward reference slot of the four-way reference slots of the memory object corresponding to the downward data has the data information of the adjacent node data, through this data information, the downward data of the downward data can be determined, and so on, until all the node data below the header root are determined. All the node data below the header root are also the downward data corresponding to the node data.

[0067] Specifically, determine whether there is data information of node data in the downward reference slot of the four-way reference slots in the memory object corresponding to the header root. If so, determine the corresponding node data through this data information, and use this node data as the downward data of the header root. Further, obtain the memory object corresponding to the downward data, and determine whether there is data information of node data in the downward reference slot of the four-way reference slots in this memory object. If so, determine the corresponding node data through this data information, and use this node data as the downward data of the above downward data, and so on, until the last node data below the header root is determined; use all the node data below the header root determined in the above steps as the downward data corresponding to the header root.

[0068] S330. Determine the left-right arrangement order of the header root and the downward data based on the memory object, and process the header root and the downward data based on the left-right arrangement order to obtain target table data.

[0069] S340. Create primary rendered table data based on the target table data, and merge the cells in the primary rendered table data based on the memory object to obtain target rendered table data.

[0070] Embodiment 4

[0071] A tree structure data merging and processing method provided by Embodiment 4 of this application optimizes the "determining the left-right arrangement order of the header root and the downward data based on the memory object" in Embodiment 1; it should be noted that for parts not detailed in this embodiment, refer to the descriptions of other embodiments. The method includes:

[0072] S410. Process each node data in the tree structure data to obtain memory objects corresponding to each of the node data one by one.

[0073] It should be noted that the memory object includes the hierarchical internal number corresponding to the node data.

[0074] Among them, the node data metadata in the memory object includes the in-level number of the corresponding node data. The node data is stored in the initial data container in the form of a table. Each row of node data in the table corresponds to the node data of one level, and each row of node data has a corresponding number in the corresponding level, that is, the in-level number. The node data with the smallest in-level number is also the first node data from left to right in the corresponding level.

[0075] S420. Determine the header root of the tree structure data and the downward data corresponding to the header root based on the memory object.

[0076] S431. Determine the left-right arrangement order of the header roots based on the in-level numbers in the memory object corresponding to the header roots.

[0077] Among them, each header root is at the same level. The node data metadata in the memory object of the header root includes the in-level number of the header root. The left-right arrangement order of each header root can be determined by the order of the in-level numbers of each header root from small to large.

[0078] Specifically, obtain the memory objects of each header root, then obtain the in-level numbers corresponding to each header root from the memory objects, and further use the order of the in-level numbers from small to large as the left-right arrangement order of each header root.

[0079] S432. Determine whether there are multiple columns of downward data for the header root.

[0080] It should be noted that under normal circumstances, one header root corresponds to one column of downward data. In some special cases, one header root may correspond to multiple columns of downward data. In the case where there are multiple columns of downward data for the header root, it is necessary to arrange the multiple downward data of each level in the left-right direction as well.

[0081] Specifically, obtain the memory object corresponding to the header root, and then determine whether the downward reference slot in the memory object includes the data information of multiple downward data, so as to determine whether there are multiple columns of downward data for the header root.

[0082] S433. If so, determine the left-right arrangement order of the downward data in the same level based on the in-level numbers in the memory object corresponding to the downward data.

[0083] If it is determined that the downward reference slot in the memory object corresponding to the header root includes the data information of multiple downward data, it means that there are multiple columns of downward data for the header root.

[0084] Specifically, if it is determined that there are multiple columns of downward data in the table header root, taking the multiple downward data corresponding to one level in the multiple columns of downward data as an example, obtain the memory objects of each downward data in the multiple downward data, then obtain the in-level numbers of each downward data from the memory objects, and then use the ascending order of the in-level numbers of each downward data as the left-right arrangement order of the multiple downward data at this level.

[0085] S434. Process the table header root and the downward data based on the left-right arrangement order to obtain the target table data.

[0086] S440. Create primary rendered table data based on the target table data, and merge the cells in the primary rendered table data based on the memory object to obtain the target rendered table data.

[0087] Embodiment Five

[0088] A method for merging and processing tree structure data provided in Embodiment Five of the present application optimizes the "creating primary rendered table data based on the target table data" in Embodiment One; it should be noted that for parts not described in detail in this embodiment, reference can be made to the descriptions of other embodiments. The method includes:

[0089] S510. Process each node data in the tree structure data to obtain memory objects corresponding to each node data one by one.

[0090] S520. Determine the table header root of the tree structure data and the downward data corresponding to the table header root based on the memory object.

[0091] S530. Determine the left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain the target table data.

[0092] S541. Determine the corner root in the target table data based on the memory object.

[0093] Among them, the target table data is a table storing node data. The table has four corners, which specifically include the upper left cell, the upper right cell, the lower left cell, and the lower right cell. The corner root is the node data corresponding to the four corners. The corner root can be determined from the memory objects of the node data in the target table data. Exemplarily, obtain the memory object of a node data in the target table data, and then determine whether the upward reference slot and the leftward reference slot in the memory object are empty. If so, use the corresponding node data as a corner root, which is specifically the corner root located at the upper left cell of the target table data. Similarly, the corner roots located at the upper right cell, the lower left cell, and the lower right cell of the target table data can also be determined.

[0094] Specifically, obtain the memory objects corresponding to each node data in the target table data. Taking one node data as an example, determine whether the upward reference slot and the leftward reference slot in the memory object of this node data are empty, or determine whether the upward reference slot and the rightward reference slot in the memory object of this node data are empty, or determine whether the leftward reference slot and the downward reference slot in the memory object of this node data are empty, or determine whether the rightward reference slot and the downward reference slot in the memory object of this node data are empty. If so, use this node data as the corner root. In this embodiment, obtaining one corner root is sufficient.

[0095] S542. Determine the size of the target table data based on the corner root and the memory objects of the node data in the target table data corresponding to the corner root.

[0096] Among them, taking the corner root located at the upper left cell of the target table data as an example, the node data corresponding to this corner root includes all the node data located to the right of its current level and all the node data located below its current column. The size of the target table data includes the number of table columns and the number of table rows.

[0097] Specifically, taking the corner root located at the upper left cell of the target table data as an example, obtain the memory object of this corner root, and then determine whether the rightward reference slot in the memory object contains the data information of the node data. If so, calculate the number of table columns as 2 at this time. Further, taking the node data corresponding to this rightward reference slot as a reference, obtain the memory object of the node data corresponding to this rightward reference slot, and determine whether the rightward reference slot in the memory object contains the data information of the node data. If so, calculate the number of table columns as 3 at this time. And so on, until it is determined that the rightward reference slot does not contain the data information of the node data, thereby calculating the final number of table columns X.

[0098] Then, it is also determined whether the downward reference slot in the memory object of the above corner root contains the data information of the node data. If so, the calculated number of table rows is 2 at this time; further, based on the node data corresponding to the downward reference slot, the memory object of the node data corresponding to the downward reference slot is obtained, and then it is determined whether the downward reference slot in the memory object contains the data information of the node data. If so, the calculated number of table rows is 3 at this time; and so on, until it is determined that the downward reference slot does not contain the data information of the node data, thereby calculating the final number of table rows Y.

[0099] The final number of table columns X and the number of table rows Y are calculated through the above steps, and the number of table columns X and the number of table rows Y are used as the size of the target table data.

[0100] S543. Create a primary rendering table based on the size, and import each node data in the target table data into the primary rendering table based on the index relationship between the primary rendering table and the target table data to obtain primary rendering table data.

[0101] Among them, the number of table columns of the primary rendering table is X and the number of table rows is Y. The created primary rendering table has the same size as the target table data, and each cell in the primary rendering table has a corresponding cell in the position of the target table data. Exemplarily, the cell in the upper left corner of the primary rendering table has a corresponding relationship with the cell in the upper left corner of the target table data, and this corresponding relationship is recorded as the index relationship; it should be noted that there may be several consecutive identical node data in a certain column of node data in the target table data. Such node data may be the parent node data of multiple child node data. When importing this parent node data into the primary rendering table, only one parent node data is imported, and this parent node data is located in the uppermost cell among several cells corresponding to the column where the primary rendering table is located.

[0102] Specifically, according to the calculated size of the target table data, a blank table with the same size as the target table data is created, denoted as the primary rendering table. Further, according to the index relationship between the cells of the primary rendering table and the target table data, the node data in each cell of the target table data is imported into the corresponding cell of the primary rendering table. It should be noted that the node data metadata in the memory object also includes the parent-child relationship of the node data, and the parent-child relationship specifically includes the parent node ID and the child node ID of the node data. During the import process, taking a node data in the target table data as an example, based on the parent-child relationship of the node data, it is determined whether there are multiple corresponding child node data for the node data. If so, the multiple cells in the column direction corresponding to the data node in the primary rendering table are further determined, and then the data node is only imported into the uppermost cell among the multiple cells, and the remaining cells are not imported with node data. Through the above steps, the node data in the target table data is imported into the corresponding cells in the primary rendering table, thereby obtaining the primary rendering table data.

[0103] S544. Merge the cells in the primary rendering table data based on the memory object to obtain the target rendering table data.

[0104] Embodiment Six

[0105] A tree structure data merging and processing method provided in Embodiment Six of the present application optimizes the "merging the cells in the primary rendering table data based on the memory object to obtain the target rendering table data" in Embodiment One. It should be noted that for the parts not detailed in this embodiment, the descriptions in other embodiments can be referred to. The method includes:

[0106] S610. Process each node data in the tree structure data to obtain a memory object corresponding to each node data.

[0107] S620. Based on the memory object, determine the header root of the tree structure data and the downward data corresponding to the header root.

[0108] S630. Determine the left-right arrangement order of the header root and the downward data based on the memory object, and process the header root and the downward data based on the left-right arrangement order to obtain the target table data.

[0109] S641. Create the primary rendering table data based on the target table data.

[0110] S642. Determine the hierarchical root in the primary rendering table data based on the memory object.

[0111] Among them, the primary rendering table data consists of node data at several levels. Taking the node data at one level as an example, there are generally multiple pieces of node data at this level. The first piece of node data in the left-to-right direction among the node data at this level is the level root of the node data at this level; it should be noted that the left reference slot in the four-way reference slots corresponding to the level root is empty.

[0112] Specifically, taking the node data at one level of the primary rendering table data as an example, obtain the memory objects of each piece of node data in the node data at this level, then determine the piece of node data whose left reference slot in the four-way reference slots of the memory object is empty, and mark this node as the level root.

[0113] S643. Judge whether there are adjacent missing value cells in the four directions of the level root in the primary rendering table data. If so, merge the level root and the missing value cell to obtain a merged cell; the four directions include the upward, downward, leftward, and rightward directions.

[0114] Among them, the reason for the generation of the missing value cell is as follows: When the target table data is imported into the primary rendering table, taking a piece of node data in the target table data as an example, based on the parent-child relationship of this piece of node data, judge whether there are multiple child node data corresponding to this piece of node data. If so, further determine the multiple cells in the column direction corresponding to this data node in the primary rendering table, and then only import this data node into the uppermost cell among the multiple cells, and no longer import node data into the remaining cells. The cells in the primary rendering table that do not import node data will form missing value cells.

[0115] Specifically, based on the level root, judge whether there are missing value cells in its four directions. If so, merge the cell where the level root is located and the missing value cell into a merged cell, and display the node data corresponding to the level root in the merged cell.

[0116] S644. Take the merged cell as the new level root, and re-execute the step of obtaining the merged cell until it is judged that there are no adjacent missing value cells in the four directions of the new level root in the primary rendering table data.

[0117] Specifically, after each merged cell is generated, take this merged cell as the new level root, and then judge whether there are adjacent missing value cells in the four directions of this level root. If so, continue to merge the cell of the new level root and the missing value cell to obtain a new merged cell, and so on, until it is judged that there are no adjacent missing value cells in the four directions of the new level root in the primary rendering table data.

[0118] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed 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 executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0119] Embodiment Seven

[0120] Based on the same inventive concept, this embodiment also provides a tree-structured data merging processing device for implementing the tree-structured data merging processing method described above. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the tree-structured data merging processing device provided below can refer to the limitations on the tree-structured data merging processing method in the above text, and will not be repeated here.

[0121] In this embodiment, as Figure 4 shown, a tree-structured data merging processing device is provided, including:

[0122] A memory object generation module, configured to process each node data in the tree-structured data to obtain a memory object corresponding to each of the node data;

[0123] A root and data determination module, configured to determine the header root of the tree-structured data and the downward data corresponding to the header root based on the memory object;

[0124] A target table data generation module, configured to determine the left-right arrangement order of the header root and the downward data based on the memory object, and process the header root and the downward data based on the left-right arrangement order to obtain target table data;

[0125] A target rendering table data generation module, configured to create primary rendering table data based on the target table data, and merge the cells in the primary rendering table data based on the memory object to obtain target rendering table data.

[0126] Each module in the above tree - structured data merging processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.

[0127] It should be noted that in this embodiment, memory objects corresponding one - to - one with each of the node data are obtained by processing the node data in the tree - structured data; the header root of the tree - structured data and the downward data corresponding to the header root are determined based on the memory objects; the left - right arrangement order of the header root and the downward data is determined based on the memory objects, and the header root and the downward data are processed based on the left - right arrangement order to obtain target table data; primary rendering table data is created based on the target table data, and the cells in the primary rendering table data are merged based on the memory objects to obtain target rendering table data. Through the above implementation, the tree - structured data can be first exported as primary rendering table data, and then the cells corresponding to the same parent node in the primary rendering table data are merged, so that the duplicate parent node data in the tree - structured data is integrated into one parent node data, thereby reducing the amount of data in the tree - structured data structure and further improving the processing efficiency of processing the tree - structured data.

[0128] Embodiment Eight

[0129] In this embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 5 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non - volatile storage medium and an internal memory. The non - volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non - volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a method for processing tree - structured data merging.

[0130] Those skilled in the art can understand that Figure 5 the structure shown in

[0131] Embodiment Nine

[0132] In this embodiment, a computer-readable storage medium is provided. As Figure 6 shown, a computer program is stored thereon, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0133] Embodiment Ten

[0134] In this embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0135] 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 for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data that have been authorized by the user or fully authorized by all parties.

[0136] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memories. 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), magnetoresistive 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 be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided by the present disclosure can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided by the present disclosure can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0137] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, 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, it should be considered as the scope recorded in this specification.

[0138] The above-described embodiments merely represent several implementation manners of the present disclosure. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of the present disclosure. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present disclosure, several modifications and improvements can still be made, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the appended claims.

Claims

1. A method for merging and processing tree structure data, characterized in that: include: Processing each node data in the tree structure data to obtain a memory object corresponding to each node data; Determine a header root of the tree structure data and downstream data corresponding to the header root based on the memory object; Determine the left-right arrangement order of the table header root and the downward data based on the memory object, and process the table header root and the downward data based on the left-right arrangement order to obtain target table data; Creating primary rendering table data based on the target table data, and merging cells in the primary rendering table data based on the memory object to obtain target rendering table data; The processing of each node data in the tree structure data to obtain a memory object corresponding to each node data includes: According to the existence of four-way data of each node data in the tree structure data, a four-way reference slot corresponding to the node data is set; Encapsulation is performed based on the node data and the four-way reference slot to obtain a memory object corresponding to the node data; The memory object includes the hierarchical internal number corresponding to the node data, and determining the left-right arrangement order of the header root and the downward data based on the memory object includes: Determine the left-right arrangement order of the header roots based on the hierarchical internal numbers in the memory objects corresponding to the header roots; Determine whether there are multiple columns of the downward data in the table header root; If so, the left-right arrangement order of the downward data in the same level is determined based on the level internal number in the memory object corresponding to the downward data.

2. The method according to claim 1, characterized in that The determining, based on the memory object, a table header root of the tree structure data and downstream data corresponding to the table header root includes: Determine the node data whose upward reference slot is empty in the four-way reference slot based on the memory object to obtain the header root; The downstream data corresponding to the header root is determined based on the memory object corresponding to the header root.

3. The method according to claim 1, characterized in that The creating primary rendering table data based on the target table data includes: Determining corner roots in the target table data based on the memory object; Determine the size of the target table data based on the corner root and the memory object of each node data corresponding to the corner root in the target table data; A primary rendering table is created based on the size, and each node data in the target table data is imported into the primary rendering table based on the index relationship between the primary rendering table and the target table data to obtain primary rendering table data.

4. The method according to claim 1, characterized in that The merging of cells in the primary rendering table data based on the memory object to obtain target rendering table data includes: Determining a hierarchical root in the primary rendering table data based on the memory object; Determine whether there are adjacent missing value cells in four directions of the hierarchical root in the primary rendering table data, and if so, merge the hierarchical root and the missing value cells to obtain a merged cell; the four directions include upward, downward, leftward, and rightward; The merged cell is used as a new hierarchical root, and the step of obtaining the merged cell is re-executed until it is determined that the new hierarchical root has no adjacent missing value cells in four directions in the primary rendering table data.

5. A tree structure data merging and processing device, characterized in that: The device comprises: A memory object generation module, used for processing each node data in the tree structure data to obtain a memory object corresponding to each node data; A root and data determination module, used to determine the header root of the tree structure data and the downstream data corresponding to the header root based on the memory object; A target table data generating module, used for determining a left-right arrangement order of the table header root and the downward data based on the memory object, and processing the table header root and the downward data based on the left-right arrangement order to obtain target table data; A target rendering table data generating module, used for creating primary rendering table data based on the target table data, and merging cells in the primary rendering table data based on the memory object to obtain target rendering table data; The processing of each node data in the tree structure data to obtain a memory object corresponding to each node data includes: According to the existence of four-way data of each node data in the tree structure data, a four-way reference slot corresponding to the node data is set; Encapsulation is performed based on the node data and the four-way reference slot to obtain a memory object corresponding to the node data; The memory object includes the hierarchical internal number corresponding to the node data, and determining the left-right arrangement order of the header root and the downward data based on the memory object includes: Determine the left-right arrangement order of the header roots based on the hierarchical internal numbers in the memory objects corresponding to the header roots; Determine whether there are multiple columns of the downward data in the table header root; If so, the left-right arrangement order of the downward data in the same level is determined based on the level internal number in the memory object corresponding to the downward data.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

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

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Novel display method and device based on tree structure data, equipment and medium

    CN118760806A