CN107092659B - Universal tree structure storage and analysis method - Google Patents

Universal tree structure storage and analysis method Download PDF

Info

Publication number
CN107092659B
CN107092659B CN201710191450.7A CN201710191450A CN107092659B CN 107092659 B CN107092659 B CN 107092659B CN 201710191450 A CN201710191450 A CN 201710191450A CN 107092659 B CN107092659 B CN 107092659B
Authority
CN
China
Prior art keywords
tree
data
node
temporary
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710191450.7A
Other languages
Chinese (zh)
Other versions
CN107092659A (en
Inventor
傅玉生
杨毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Youe Data Co ltd
Original Assignee
Chengdu Youe Data Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Youe Data Co ltd filed Critical Chengdu Youe Data Co ltd
Priority to CN201710191450.7A priority Critical patent/CN107092659B/en
Publication of CN107092659A publication Critical patent/CN107092659A/en
Application granted granted Critical
Publication of CN107092659B publication Critical patent/CN107092659B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees

Abstract

The invention discloses a universal tree structure storage and analysis method, relates to the field of computer application, and solves the technical problems of huge calculation amount, complex storage codes, complex logic, insufficient intuition of a tree structure of data and the like in the prior art due to the fact that a recursion mode is used for analyzing tree structure data. The method mainly comprises the steps of circularly traversing a data list generated by hierarchical associated data through temporary variables, reading root data of the data list, constructing a threshold condition by using characteristics of tree nodes in the data list and combining a temporary data set, gradually setting tree codes in sequence for the tree nodes meeting the threshold condition, storing the tree codes corresponding to the current tree nodes in the data list into the temporary data set, and obtaining a complete tree-shaped temporary data set relative to the data list when circulation is finished; and searching the temporary data set corresponding to the root data to obtain the root tree nodes and all sub-tree nodes of the tree structure. The invention has the characteristics of simplicity, easy use, maintainability and strong operability.

Description

Universal tree structure storage and analysis method
Technical Field
The invention relates to the field of computer application, in particular to a general tree structure storage and analysis method.
Background
In the field of application software, a tree structure is often used to represent the association relationship of some data, such as upper and lower departments of an enterprise, commodity classification, region information, navigation column structure information, role authority information, resource relationship information, and the like. The storage, analysis and maintenance of these data are very complicated.
At present, the storage of tree structure data is mainly based on the storage of a database. Two implementation methods are mainly adopted.
The first implementation method stores the tree structure in a parent node id association manner.
Tree structure based data fig. 1 (illustrated with partial region information):
the mode of storing the tree structure of the upper graph adopts an inheritance mode among nodes, a two-dimensional relation table can be established by describing a father node of a certain node in a display mode, and the table structure of the scheme is usually designed to be { id, name, parent _ id }. Storing the data of fig. 1 in an actual database is shown in table 1 below.
id name parent_id
1 Beijing City
2 Towards the sun district 1
3 Manor 2
4 Within three rings 2
5 Sea lake area 1
6 West three flags 5
7 Sichuan province
8 Adult city 7
9 Wu-hou district 8
10 Sheep area 8
11 Chinese area 8
12 Jinjiang district 8
13 Taurus district 8
14 Deyang city 7
15 Guanghan city 14
16 Mianyang city 7
17 Oil market of river 16
18 Three cities 16
TABLE 1 database stores partial region information
The storage implementation mainly has the following problems:
1. the maintenance of the relationship between id and parent _ id is complex;
2. the user can hardly and intuitively see the tree-shaped relation among the data;
3. the adding, deleting and modifying costs of the nodes are high, and the change of data in various aspects in the table can be involved;
4. in order to obtain a tree structure result, recursive query is required, recursive traversal writing is complex, and maintenance cost is high.
The second implementation method adopts a mode of coding based on left and right values to store a tree structure.
The method adopts a brand-new non-recursion query, utilizes left and right value coding, can code the infinite tree, realizes infinite classification on the premise of eliminating recursion, and has high efficiency because the query condition is based on shaping digital comparison. As shown in fig. 2, there are two fields of left and right in each node, and it is seen that a line is drawn on the graph from the root node along the child nodes, and one is added for each layer of left, and after the end, right is left +1, and then backtrack along the node, and right is added one step by step until going back to the root node. If a node and its children, such as Beijing City node, are to be queried, the condition is where left between 2and 13. The table structure for left and right value encoding is usually designed as { id, name, lft, rgt }. The data stored in the actual database with fig. 1 is shown in table 2 below.
Figure GDA0002796346510000021
TABLE 2 left and right value coding storage part area information
The storage implementation mainly has the following problems:
1. the left and right value coding mode is different from the common direct sorting of Arabic numerals, and the sequence is not displayed directly by adding the hierarchy of nodes in a tree, but is obtained by calculation through a simple formula, so that a mathematical model of the tree needs to be understood deeply within a certain time;
2. the user can hardly and intuitively see the tree-shaped relation among the data;
3. by adopting the scheme to compile the related storage process, the nodes are newly added and deleted, and the translation nodes on the same layer need to query and modify the whole tree, so that the code complexity, the coupling degree and the modification and maintenance risk are high.
No matter which scheme is adopted to store the data of the tree structure, users are difficult to visually see the tree relationship among the data, a large amount of calculation needs to be carried out in the process of writing the data into the database in order to obtain the related tree relationship, and the complicated storage process needs to be compiled or the logic needs to be called recursively and complicatedly. Therefore, a scheme that a user can visually see the relationship between data, can embody a tree structure through a fast coding scheme, and can rapidly reproduce the tree structure between data is urgently needed to be provided.
Disclosure of Invention
In view of the foregoing prior art, an object of the present invention is to provide a universal tree structure storage and analysis method, which solves the technical problems of huge computation amount, complex storage codes, complex logic, and insufficiently intuitive tree structure of data in the prior art due to the recursive analysis of tree structure data.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a universal tree structure storage and analysis method comprises
Step 1, circularly traversing a data list generated by the hierarchy associated data through a temporary variable, reading root data of the data list, constructing a threshold condition by using characteristics of tree nodes in the data list and combining a temporary data set, gradually setting tree codes in sequence for the tree nodes meeting the threshold condition, storing the tree codes corresponding to the current tree nodes in the data list into the temporary data set, and obtaining a complete tree-shaped temporary data set relative to the data list when the circulation is finished;
and 2, searching the temporary data set corresponding to the root data to obtain root tree nodes and all sub-tree nodes of the tree structure.
In the above method, the step 1 includes the following steps:
step 1.1, defining the attribute corresponding to each tree node data in each level as a unique sequence number and a unique tree code;
step 1.2, presetting and reading a data list generated by the hierarchy associated data;
step 1.3, creating a result list, a temporary data set with data of which the tree codes are key values and the tree nodes are values, and temporary variables for the cyclic traversal of the sequence numbers corresponding to each tree node;
step 1.4, judging whether the current temporary variable is smaller than the sequence length of the data list, if the current temporary variable is smaller than the sequence length of the data list, performing step 1.5, and if the current temporary variable is larger than or equal to the sequence length of the data list, returning the data of the current tree node to the result list and ending;
step 1.5, obtaining a current tree node in a data list corresponding to a current temporary variable, judging whether a temporary data set comprises a value of the tree node corresponding to a tree coding key value of the current tree node, if the temporary data set comprises the value of the tree node, taking out the value of the tree node of the temporary data set, setting the value of the current tree node as the value of the tree node of the temporary data set, adding a unit amount to the current temporary variable, returning the updated temporary variable to step 1.4, and if the temporary variable does not comprise the value of the tree node, performing step 1.6;
step 1.6, adding the current tree node into the temporary data set, judging whether the tree coding length of the current tree node is equal to a level threshold, if so, adding the current tree node into a result list, and if not, performing the step 1.7;
step 1.7, judging whether the tree coding length of the current tree node is larger than a level threshold, if the tree coding length is smaller than the level threshold, adding a unit amount to the current temporary variable, returning the updated temporary variable to the step 1.4, and if the tree coding length is larger than the level threshold, performing the step 1.8;
step 1.8, updating the tree code of the current tree node into the tree node with the length reduced level threshold value, taking out a sub-node list of the tree node corresponding to the updated tree code from the temporary data set, adding the current tree node into the sub-node list, adding a unit amount to the current temporary variable, returning the updated temporary variable to step 1.4, and if the value of the tree node corresponding to the updated tree code is empty, performing step 1.9;
step 1.9, creating a new tree node and setting a tree code of the new tree node as the tree code updated in step 1.8, updating the current tree node as the new tree node and using the new tree node as the new current tree node, storing the data of which the updated tree code is a key value and the new tree node is a value into a temporary data set, judging whether the length of the updated tree code is equal to a level threshold value or not, if the length of the updated tree code is equal to the level threshold value, adding the data of the new tree node into a result list, adding a unit amount to the current temporary variable, returning the updated temporary variable to step 1.4, and if the length of the updated temporary variable is not equal to the level threshold value, performing step 1.7.
In the above method, the step 1 further includes deleting data in the result list, specifically, deleting tree nodes corresponding to the data and all tree nodes using tree codes of the tree nodes as prefix tree codes.
In the above method, in step 2, a read operation is performed by using a LIKE statement.
Compared with the prior art, the invention has the beneficial effects that:
1. the coding scheme of the tree code is provided, each node in a tree structure has a unique tree code, the tree code embodies the parent-child relationship among data nodes, and complex tree structure relationship data can be stored in a two-dimensional table form through the form of the tree code;
2. the two-dimensional table stored in the form of tree codes can be used for theoretically storing tree-structured data with infinite depth, and the tree codes of the current node can be obtained only by paying attention to the tree codes of the father node of the current node and the number of all brother nodes in the storage process as long as the data are strictly in the form agreed by the tree codes;
3. under the condition of ensuring that all data are coded according to a tree coding form, the CRUD process performed on tree-structured data is very simple, information of any other node is not concerned on the premise of ensuring that the tree coding is correct in the creation process, only a simple LIKE statement is needed to be used in the process of reading related data, only simple tree coding attribute modification is needed in the process of modifying data, and only a corresponding node and all nodes using the node tree coding as prefix tree coding are needed to be deleted in the process of deleting data;
4. according to the characteristics of tree coding, a general tree structure reading process is provided, the process provides a general tree structure reading scheme based on the tree coding, the traditional mode that the tree structure can be formed only by a recursion mode is abandoned, the tree structure can be formed only by performing simple traversal processing on all relevant data in the whole reading process, and the method is simple and easy to use, and high in maintainability and operability.
Drawings
FIG. 1 is a schematic diagram of a tree structure of a part of a region;
FIG. 2 is a schematic diagram of a left-right value encoding tree structure;
FIG. 3 is a schematic view of the operation of the analyzing step of the present invention;
FIG. 4 is a schematic view of the main process of the present invention.
Detailed Description
All of the features disclosed in this specification, or all of the steps in any method or process so disclosed, may be combined in any combination, except combinations of features and/or steps that are mutually exclusive.
The invention is further described below with reference to the accompanying drawings:
the invention also provides a solution for reading tree-structured data by using the characteristics of tree coding without a recursive mode.
In order to achieve the above purpose, the implementation of the invention is realized by the following steps:
a universal tree structure storage resolution system, the method comprising: tree coding, a solution for a generic read tree.
The tree coding is a coding mode, the coding mode uses 2 bits to code each layer of tree structure, each bit takes on numbers and letters, the letters include capital and small cases, the numbers and letters are sequentially increased in a 0-9a-zA-Z mode, each bit in the coding mode can have 62 optional characters, the two-bit coding can have 3843 different modes, the possibility of 3843 nodes on a common tree structure single layer is very low, so the two-bit tree coding is performed theoretically, if the number of nodes on a single layer is expected to be very large, the number of the tree coding bits on each layer can be increased, and later related descriptions are coded by default 2 bits. The tree coding can accommodate 56755918107 nodes for a three-level tree structure. The coding sequence of the child node corresponding to each layer of data is in a mode of 01, 02 to ZZ, and only two-bit coding needs to be added on the basis of the tree coding of the father node to code the node. The table structure of the tree code is usually designed as { id, name, treeCode }, and the table name is tree.
The solution of the general read tree is a process of directly reflecting the tree-shaped relation of data by using the characteristics of tree coding through a program internal processing mode without a recursion mode. In the reading process, a tree structure with a certain node as a root needs to be reproduced, and only a list of all nodes related to the corresponding node needs to be used as parameter parameters, and then analysis is performed, wherein the specific analysis process is shown in fig. 3.
The solution of the general read tree, as shown in fig. 3, mainly includes the following steps:
determining the highest level of the nodes to be read and all data related to the level, and obtaining a corresponding result by simple sql query in the mode;
creating a temporary data set map of a temporary storage node, conveniently and quickly determining that data corresponding to tree codes are processed, and creating a return result list;
traversing and processing the node data in the relevant list;
taking out tree nodes treeNode of node data corresponding to treeCode from the map of the temporary storage node, and if the parent node is already established in the process of processing the child node before non-empty representation, only setting parent node information;
if the treeNode node is empty, sequentially constructing father nodes according to the rule of tree coding, adding the father nodes into the map, and completing the data construction of the tree structure in the mode;
in the whole process, if the treeCode of a node is equal to the hierarchy 2, the node is added into the returned result list.
Example 1
The table structure of the invention is designed as { id, name, treeCode }. The data in fig. 1 is first sorted, and the storage format is shown in table 3.
Figure GDA0002796346510000071
TABLE 3 Tree code storage partial region information
In the table structure, CRUD is performed as follows:
and adding a node, namely adding a new node in the table, and when the new node is added to a new metropolitan area under the metropolitan area in Sichuan province, only observing the maximum number of the child nodes under the metropolitan area, wherein the maximum number in the table 3 is a golden cow area 020105, so that the new metropolitan area tree is coded as 020106. The insert statement is executed as follows:
INSERT INTO tree (name, treeCode) VALUES ('New metropolitan', '020106').
The inserted data is table 4, the relationship between the data is automatically formed after the data is inserted by the tree coding mode, and the newly inserted data has no influence on other data.
Figure GDA0002796346510000072
Figure GDA0002796346510000081
Table 4 area data after inserting new metropolitan area
And modifying the node, wherein the node can be directly operated under the condition of ensuring that the hierarchy relation of the node treeCode is not changed, if the whole structure moves, the parent-child nodes need to be simultaneously modified, and if the urbanized treeCode is modified to 0204. The modified statement is as follows: UPDATE 'tree' SET tree code ═ CONCAT ("0204", RIGHT (tree code, ("tree code") -4)) WHERE tree code LIKE '0201%'.
The database data after executing the modification statement is shown in table 5. If not, the node owning the child node is recommended not to be modified by treeCode.
Figure GDA0002796346510000082
Figure GDA0002796346510000091
TABLE 5 area data after modification to DutreeCode
Deleting a node, wherein for the deletion operation of a certain node, only treeCode of the node needs to be matched, and if Deyang city needs to be deleted, treeCode of Deyang city is 0202. The delete statement is executed as follows:
delete from`tree`WHERE treeCode LIKE'0202%'。
the database data after executing the delete statement is shown in table 6.
Figure GDA0002796346510000092
TABLE 6 regional data after Deyang City deleted
And inquiring the node, wherein for the inquiry operation of a certain node, only treeCode of the node needs to be matched, and if the node needs to be inquired, treeCode of Sichuan province is 02. The delete statement is executed as follows:
select*from`tree`WHERE treeCode LIKE'02%'
the database data after the query statement is executed is shown in table 7.
Figure GDA0002796346510000093
Figure GDA0002796346510000101
TABLE 7 Inquiry data of regions after Sichuan province
The tree structure reading process of the data of the table is as follows:
assuming that the read data is Sichuan province and the level of Sichuan province is 1, in order to better describe the solution of the general read tree, the table of the results of reading the relevant data of Sichuan province is simply adjusted, and the adjusted structure is shown in Table 8.
According to the flow chart of the general tree structure data reading flow chart provided in fig. 3, a data list of relevant areas in sichuan province needs to be stored, and the specific steps are as follows:
step 301, assigning the read area data list related to Sichuan province to a dList, observing and determining that the level of Sichuan is 1, so that the level is assigned to 1, and entering step 302;
step 302, creating a return result tList for storing a final return result list, creating a map for temporarily storing data and a temporary variable i, assigning the value of i to 0, and entering step 303;
step 303, judging whether i is smaller than the length of the dList, if so, jumping to step 319, and if not, entering 304;
step 304, reading the ith element in the dList, wherein the data read for the first time is data with a row number of 1 and id of 13, the name of the data is a golden cow region, treeCode is 020105, the data processing in the following steps is performed aiming at the flow of the golden cow region, and the step 305 is entered;
step 305, judging whether the map contains data with key 020105, and entering step 308 because the data recorded in the map for the first time is empty;
step 308, setting the nodes of the golden ox area to map, and entering step 309;
step 309, judging whether the treeCode length is 2 (because the level is equal to 1, the judgment condition is level x 2), and the treeCode of the treeNode in the golden ox area is 6, and entering step 311;
step 311, judging whether the treeCode length is greater than 2, if the treeCode is 020105, entering step 312; if the length is not greater than 2, go to step 307;
step 312, updating the treeCode to be the string of which the treeCode length is reduced by 2, wherein the updated treeCode is 0201, taking out the corresponding value of the treeCode from the map, and entering step 313;
step 313, only 020105 is the key value in the map, so when finding the 0201 key value in the map, the data is null, and step 314 is entered;
step 314, creating a newTreeNode node, setting treeCode of the newTreeNode node as 0201, and placing the Jinniu district node into a child node of the newTreeNode; assigning the previous treeNode as a newTreeNode; storing data with key of 0201 value of treeNode in map, and entering step 315;
step 315, judging whether the length of the current treeCode is 2, if so, performing step 311 if the length of the current treeCode is 0201 and not 2, and performing step 316 if the length of the current treeCode is 2;
step 316, adding the treeNode into the result list tList, and entering step 311;
since the current treeCode is 0201 and the length is greater than 2 through the above processing, a round of flow from 311 to 316 needs to be executed. After the node of the golden ox area is added, the map for temporarily storing the data has data corresponding to three keys of 02, 0201 and 020105, and the tList of the final result has node data with treeCode of 02.
The way of entering other nodes is strictly performed according to the flow chart of fig. 3, and in order to better illustrate the whole flow chart, the entering flow of the data node in the state of sichuan province with the row number of 7 in table 8 is described below:
line number id name treeCode
1 9 Wu-hou district 020101
2 10 Sheep area 020102
3 11 Chinese area 020103
4 16 Mianyang city 0203
5 12 Jinjiang district 020104
6 13 Taurus district 020105
7 7 Sichuan province 02
8 17 Oil market of river 020301
9 18 Three cities 020302
10 8 Adult city 0201
11 19 New metropolitan area 020106
TABLE 8 Inquiry data of regions after Sichuan province
Step 304, taking out the element when i is 6, wherein the row number of the element is 7, treeCode is 02, and name is Sichuan province, and entering step 305;
step 305, taking data with treeCode 02 from the map, putting the data into the map when the Taurus area is recorded for the first time, taking out a corresponding node treeNode, and entering step 306;
step 306, setting the name of treeNode as Sichuan province, and entering step 307;
step 307, i is increased by 1, and the step 303 is entered;
through the traversal of the dList data list, each node data is processed through steps 304 to 318, so that a complete tree structure can be formed. Only one node of tList in the whole structure is data of Sichuan province, and the corresponding treeCode is 02; the child nodes of the system are Mianyang city with treeCode 0203 and Chengdu city with treeCode 0201; the child nodes of Mianyang city are Jiang oil city with treeCode 020301 and three cities with treeCode 020302; the subnodes of the metropolis are a Wu-Hou district with treeCode of 020101, a blue-green sheep district with treeCode of 020102, a Chenghuan district with treeCode of 020103, a Jinjiang district with treeCode of 020104, a Taurus district with treeCode of 020105 and a Xindu district with treeCode of 020106.
According to the scheme provided by the invention, the tree coding provided in the general tree structure storage and analysis scheme enables the representation of the relationship of the tree structure data to be simple and clear, the process logic of CRUD on the related data is simple through the coding mode, and a user only needs to carry out node coding in a mode of complying with the tree coding and can keep the tree structure relationship among the data after CUD operation is carried out on the data. The general tree structure reading scheme based on the tree coding is provided by the general tree structure reading process, the traditional mode that the tree structure can be formed only by a recursion mode is abandoned, the tree structure can be formed only by performing simple traversal processing on all relevant data in the whole reading process, and the general tree structure reading scheme is simple and easy to use in an implementation mode and strong in maintainability and operability.
The above description is only an embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention.

Claims (3)

1. A universal tree structure storage analysis method is characterized by comprising
Step 1, circularly traversing a data list generated by the hierarchy associated data through a temporary variable, reading root data of the data list, constructing a threshold condition by using characteristics of tree nodes in the data list and combining a temporary data set, gradually setting tree codes in sequence for the tree nodes meeting the threshold condition, storing the tree codes corresponding to the current tree nodes in the data list into the temporary data set, and obtaining a complete tree-shaped temporary data set of the data list when the circulation is finished;
step 2, searching a temporary data set corresponding to the root data to obtain root tree nodes and all sub-tree nodes of a tree structure;
wherein, the step 1 comprises the following steps:
step 1.1, defining the attribute corresponding to each tree node data in each level as a unique sequence number and a unique tree code;
step 1.2, presetting and reading a data list generated by the hierarchy associated data;
step 1.3, creating a result list, a temporary data set with data of which the tree codes are key values and the tree nodes are values, and temporary variables for the cyclic traversal of the sequence numbers corresponding to each tree node;
step 1.4, judging whether the current temporary variable is smaller than the sequence length of the data list, if the current temporary variable is smaller than the sequence length of the data list, performing step 1.5, and if the current temporary variable is larger than or equal to the sequence length of the data list, returning the data of the current tree node to the result list and ending;
step 1.5, obtaining a current tree node in a data list corresponding to a current temporary variable, judging whether a temporary data set comprises a value of the tree node corresponding to a tree coding key value of the current tree node, if the temporary data set comprises the value of the tree node, taking out the value of the tree node of the temporary data set, setting the value of the current tree node as the value of the tree node of the temporary data set, adding a unit amount to the current temporary variable, returning the updated temporary variable to step 1.4, and if the temporary variable does not comprise the value of the tree node, performing step 1.6;
step 1.6, adding the current tree node into the temporary data set, judging whether the tree coding length of the current tree node is equal to a level threshold, if so, adding the current tree node into a result list, and if not, performing the step 1.7;
step 1.7, judging whether the tree coding length of the current tree node is larger than a level threshold, if the tree coding length is smaller than the level threshold, adding a unit amount to the current temporary variable, returning the updated temporary variable to the step 1.4, and if the tree coding length is larger than the level threshold, performing the step 1.8;
step 1.8, updating the tree code of the current tree node into the tree node with the length reduced level threshold value, taking out a sub-node list of the tree node corresponding to the updated tree code from the temporary data set, adding the current tree node into the sub-node list, adding a unit amount to the current temporary variable, returning the updated temporary variable to step 1.4, and if the value of the tree node corresponding to the updated tree code is empty, performing step 1.9;
step 1.9, creating a new tree node and setting a tree code of the new tree node as the tree code updated in step 1.8, updating the current tree node as the new tree node and using the new tree node as the new current tree node, storing the data of which the updated tree code is a key value and the new tree node is a value into a temporary data set, judging whether the length of the updated tree code is equal to a level threshold value or not, if the length of the updated tree code is equal to the level threshold value, adding the data of the new tree node into a result list, adding a unit amount to the current temporary variable, returning the updated temporary variable to step 1.4, and if the length of the updated temporary variable is not equal to the level threshold value, performing step 1.7.
2. The method according to claim 1, wherein the step 1 further includes deleting data from the result list, specifically deleting tree nodes corresponding to the data and all tree nodes encoded by using tree codes of the tree nodes as prefix tree codes.
3. The method as claimed in claim 1, wherein step 2 is performed by using a LIKE statement.
CN201710191450.7A 2017-03-28 2017-03-28 Universal tree structure storage and analysis method Active CN107092659B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710191450.7A CN107092659B (en) 2017-03-28 2017-03-28 Universal tree structure storage and analysis method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710191450.7A CN107092659B (en) 2017-03-28 2017-03-28 Universal tree structure storage and analysis method

Publications (2)

Publication Number Publication Date
CN107092659A CN107092659A (en) 2017-08-25
CN107092659B true CN107092659B (en) 2021-05-28

Family

ID=59649011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710191450.7A Active CN107092659B (en) 2017-03-28 2017-03-28 Universal tree structure storage and analysis method

Country Status (1)

Country Link
CN (1) CN107092659B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110019006B (en) * 2017-10-16 2022-03-04 航天信息股份有限公司 Method and system for infinite classification and sorting
CN108924215B (en) * 2018-06-28 2021-03-19 北京顺丰同城科技有限公司 Service discovery processing method and device based on tree structure
CN110889022A (en) * 2018-08-17 2020-03-17 迈普通信技术股份有限公司 Data query method and device and electronic equipment
US10915546B2 (en) * 2018-10-10 2021-02-09 Micron Technology, Inc. Counter-based compaction of key-value store tree data block
CN109766337B (en) * 2018-11-28 2023-05-09 杭州云为科技有限公司 Tree structure data storage method, electronic device, storage medium and system
CN110704450B (en) * 2019-10-14 2023-02-17 北京和利时系统集成有限公司 Method and device for realizing data processing, computer storage medium and terminal
CN111475482B (en) * 2020-04-03 2023-09-05 北京东方金信科技股份有限公司 HDFS data display method and device
CN113676437B (en) * 2020-05-14 2023-08-18 中国移动通信集团云南有限公司 Parameter acquisition method, parameter setting method and device
CN112000667B (en) * 2020-08-10 2024-04-12 多点(深圳)数字科技有限公司 Method, apparatus, server and medium for retrieving tree data
CN112446594B (en) * 2020-11-12 2023-07-21 书丸子科技(云南)有限公司 Multi-level quantifiable calculation method for analysis of comprehensive capacity of preschool children
CN113095719B (en) * 2021-04-29 2022-05-06 中国科学院水生生物研究所 Lake ecosystem health evaluation and restoration method
CN113628038A (en) * 2021-08-30 2021-11-09 中国银行股份有限公司 Bank invoice tax number change processing method and system based on block chain
CN113961713A (en) * 2021-09-29 2022-01-21 中国科学院计算机网络信息中心 Graph data structure representing, storing and inquiring method and device based on hierarchical coding
CN115407942B (en) * 2022-08-29 2023-07-14 深圳市锦锐科技股份有限公司 Data processing method suitable for single chip microcomputer chip

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102867059A (en) * 2012-09-19 2013-01-09 浪潮(北京)电子信息产业有限公司 Method and system for processing data in treelike structures
US20130151565A1 (en) * 2011-12-08 2013-06-13 Xerox Corporation Arithmetic node encoding for tree structures
CN106339450A (en) * 2016-08-25 2017-01-18 成都索贝数码科技股份有限公司 Index method of tree-shaped data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130151565A1 (en) * 2011-12-08 2013-06-13 Xerox Corporation Arithmetic node encoding for tree structures
CN102867059A (en) * 2012-09-19 2013-01-09 浪潮(北京)电子信息产业有限公司 Method and system for processing data in treelike structures
CN106339450A (en) * 2016-08-25 2017-01-18 成都索贝数码科技股份有限公司 Index method of tree-shaped data

Also Published As

Publication number Publication date
CN107092659A (en) 2017-08-25

Similar Documents

Publication Publication Date Title
CN107092659B (en) Universal tree structure storage and analysis method
US10970292B1 (en) Graph based resolution of matching items in data sources
Liu et al. NET–a system for extracting web data from flat and nested data records
CN110059264B (en) Site retrieval method, equipment and computer storage medium based on knowledge graph
CN106503223B (en) online house source searching method and device combining position and keyword information
CN109166615B (en) Medical CT image storage and retrieval method based on random forest hash
CN110795526B (en) Mathematical formula index creating method and system for retrieval system
CN111522892B (en) Geographic element retrieval method and device
CN109815232A (en) A kind of method and system of retrieval, the data processing of the data rank using binary search tree
CN105740428A (en) B+ tree-based high-dimensional disc indexing structure and image search method
CN109254962B (en) Index optimization method and device based on T-tree and storage medium
CN115840751B (en) Novel tree-shaped data coding method
CN105843809A (en) Data processing method and device
CN111414445A (en) Address inverse analysis method applying geographic information
CN110807061A (en) Method for searching frequent subgraphs of uncertain graphs based on layering
CN115309850A (en) GeoHash-based map visual range interest point retrieval method and system
CN104123357A (en) Method and device for querying checkpoint
Vassilakopoulos et al. External balanced regular (x-BR) trees: new structures for very large spatial databases
CN110321353B (en) Multi-dimensional spatial data indexing method based on semi-decomposition strategy
CN114385624A (en) Encoding method, encoding searching method, device, electronic equipment and storage medium
CN114329720A (en) UI data synchronization method and device, electronic equipment and storage medium
CN110297952B (en) Grid index-based parallelization high-speed railway survey data retrieval method
KR101052220B1 (en) Skyline Query Execution Device and Method Including Search Terms
JP7082542B2 (en) Trajectory search device and trajectory search program
CN114491307B (en) Equipment aggregation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant