CN118093949A - Structure tree generation method, device, computer equipment and storage medium - Google Patents

Structure tree generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN118093949A
CN118093949A CN202410282195.7A CN202410282195A CN118093949A CN 118093949 A CN118093949 A CN 118093949A CN 202410282195 A CN202410282195 A CN 202410282195A CN 118093949 A CN118093949 A CN 118093949A
Authority
CN
China
Prior art keywords
node
tree
generating
structure tree
task
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.)
Pending
Application number
CN202410282195.7A
Other languages
Chinese (zh)
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.)
Jindiyun Technology Co ltd
Original Assignee
Jindiyun Technology 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 Jindiyun Technology Co ltd filed Critical Jindiyun Technology Co ltd
Priority to CN202410282195.7A priority Critical patent/CN118093949A/en
Publication of CN118093949A publication Critical patent/CN118093949A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9035Filtering based on additional data, e.g. user or group profiles
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application relates to a structure tree generation method, apparatus, computer device, storage medium and computer program product. The method comprises the following steps: determining specified filtering conditions and structural tree root nodes positioned in the first hierarchy according to configuration information of the structural tree generating task; generating child nodes of the root node of the structure tree according to data filtered from a preset database based on specified filtering conditions; when the structure tree generating mode is determined to be the breadth-first generating mode according to the configuration information, the step of generating the child nodes of the first structure tree node is continuously executed until a finally generated structure tree is obtained; when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate a sub-structure tree taking the second structure tree node of the current generating level as a root node if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value, so as to obtain a finally generated structure tree. The method can greatly improve the efficiency of generating the structural tree.

Description

Structure tree generation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for generating a structure tree.
Background
With the continued development of information technology, the data that needs to be transmitted becomes increasingly large and complex. For large or ultra-large tree structure data, a great deal of time is typically spent if conventional methods are used to build the complete tree structure or to operate on tree nodes.
At present, asynchronous hierarchical loading is adopted, and a tree structure is recorded by means of a cache service so as to achieve the purposes of fast rendering, operating and searching tree nodes, but the method additionally introduces the cache service, so that the complexity of a system, the maintenance difficulty of the cache and the design of a data structure are increased, and flexible filtering and calculation cannot be realized.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, apparatus, computer device, computer readable storage medium, and computer program product for generating a structural tree that is capable of quickly rendering, manipulating, and finding tree nodes.
In a first aspect, the present application provides a method for generating a structural tree. The method comprises the following steps:
Receiving a structure tree generating task, and determining specified filtering conditions and structure tree root nodes positioned in a first hierarchy according to configuration information of the structure tree generating task;
Generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
When the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, generating a child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, determining the next level, taking the next level as a new current generation level, and returning to the step of generating the child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, and continuing to execute until a finally generated structure tree is obtained;
When the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate a sub-structure tree taking the second structure tree node of the current generating level as a root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value so as to obtain a finally generated structure tree.
In a second aspect, the application further provides a structure tree generating device. The device comprises:
The determining module is used for receiving the structure tree generating task and determining specified filtering conditions and structure tree root nodes positioned in the first hierarchy according to configuration information of the structure tree generating task;
the first generation module is used for generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
The second generating module is used for generating sub-nodes of the first structural tree node according to the first structural tree node and the appointed filtering condition for each first structural tree node in the current generating level from the second level when the structural tree generating mode is determined to be the breadth-first generating mode according to the configuration information, determining the next level, taking the next level as a new current generating level, and returning to the step of generating the sub-nodes of the first structural tree node according to the first structural tree node and the appointed filtering condition until the finally generated structural tree is obtained;
And the third generating module is used for triggering the generation of the sub-structure tree taking the second structure tree node of the current generating level as the root node to obtain the finally generated structure tree when the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value for the current generating level from the second level when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
Receiving a structure tree generating task, and determining specified filtering conditions and structure tree root nodes positioned in a first hierarchy according to configuration information of the structure tree generating task;
Generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
When the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, generating a child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, determining the next level, taking the next level as a new current generation level, and returning to the step of generating the child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, and continuing to execute until a finally generated structure tree is obtained;
When the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate a sub-structure tree taking the second structure tree node of the current generating level as a root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value so as to obtain a finally generated structure tree.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Receiving a structure tree generating task, and determining specified filtering conditions and structure tree root nodes positioned in a first hierarchy according to configuration information of the structure tree generating task;
Generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
When the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, generating a child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, determining the next level, taking the next level as a new current generation level, and returning to the step of generating the child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, and continuing to execute until a finally generated structure tree is obtained;
When the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate a sub-structure tree taking the second structure tree node of the current generating level as a root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value so as to obtain a finally generated structure tree.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
Receiving a structure tree generating task, and determining specified filtering conditions and structure tree root nodes positioned in a first hierarchy according to configuration information of the structure tree generating task;
Generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
When the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, generating a child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, determining the next level, taking the next level as a new current generation level, and returning to the step of generating the child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, and continuing to execute until a finally generated structure tree is obtained;
When the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate a sub-structure tree taking the second structure tree node of the current generating level as a root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value so as to obtain a finally generated structure tree.
The method, the device, the computer equipment, the storage medium and the computer program product for generating the structure tree comprise the steps of firstly, generating a task by receiving the structure tree, and determining appointed filtering conditions and structure tree root nodes positioned in a first hierarchy according to configuration information of the structure tree generating task; the method and the device realize quick positioning of the target data range, reduce unnecessary calculation and resource consumption, and enable construction of the structure tree to have pertinence and high efficiency.
Then generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions; the method realizes accurate screening of data, avoids filling of the structural tree with invalid or redundant information, improves the quality and accuracy of the structural tree data, and is convenient for subsequent data analysis and processing.
Finally, when the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, generating a child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, determining the next level, taking the next level as a new current generation level, returning to the step of generating the child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, and continuing to execute until a finally generated structure tree is obtained; in this way, the offspring of all nodes in the same hierarchy can be ensured to be generated completely and once, which is beneficial to showing the transverse relevance among the nodes and is convenient for comprehensively knowing various conditions in the same hierarchy.
And when the structure tree generating mode is determined to be a depth-first generating mode according to the configuration information, triggering generation of the sub-structure tree taking the second structure tree node of the current generating level as a root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value so as to obtain the finally generated structure tree. In this way, it is possible to focus on mining the longitudinal associations of individual nodes and their descendants, facilitating in-depth analysis of complex data structures, especially when deep associations or paths need to be found more efficiently.
Drawings
FIG. 1 is an application environment diagram of a structure tree generation method in one embodiment;
FIG. 2 is a flow diagram of a method of generating a structure tree in one embodiment;
FIG. 3 is a schematic diagram of a method of generating a structural tree in one embodiment;
FIG. 4 is a schematic diagram of breadth-first task generation and task status in one embodiment;
FIG. 5 is a schematic diagram of depth-first task generation and task status in one embodiment;
FIG. 6 is a flow chart of a method of generating a structure tree in another embodiment;
FIG. 7 is a block diagram of a structure tree generating device in one embodiment;
FIG. 8 is a block diagram of a structure tree generating apparatus in another embodiment;
fig. 9 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The structure tree generation method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The terminal 102 generates a structure tree generation request and then sends the structure tree generation request to the server 104 to cause the server 104 to generate a final structure tree. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a method for generating a structural tree is provided, and the method is applied to 104 in fig. 1 for illustration, and includes the following steps:
step 202, receiving a structure tree generating task, and determining specified filtering conditions and structure tree root nodes in the first hierarchy according to configuration information of the structure tree generating task.
Wherein, the configuration center in the application responds to the configuration operation of the user on the tree structure data to generate the structure tree generating task, and through a series of processing on the structure tree generating task, the complete structure tree corresponding to the tree structure data can be constructed. Configuration information of each component or device in the system required by the structure tree is included in the structure tree generation task. The configuration center refers to a component that centrally manages configuration information. It typically provides configuration changes, configuration pushes, history version management, gray level publishing, configuration change auditing, etc. The cost of managing the configuration information in the distributed system can be reduced through the functions, and the risks of usability reduction and even failure caused by the error configuration information change are reduced. In a data structure or algorithm, particularly in constructing or traversing a tree structure (e.g., binary tree, multi-way tree, file system directory tree, etc.), filtering conditions refer to a set of rules or predicates that are used to decide which nodes should be included in the final generated tree structure. These conditions are typically defined based on the attributes of the node itself (e.g., node value, node label, node weight, etc.). The filtering condition is realized in the forms of functions, expressions or callback methods, and the like, and the filtering condition can dynamically judge whether each node meets the reservation condition when traversing the existing data, so that the specific form and content of the tree structure are affected. In the tree data structure, a root node is a start point and a center point of the entire tree structure. It will be appreciated that a root node is the top or starting point of a tree, which is the basis for building and identifying the entire tree, and that all other nodes are directly or indirectly connected to the root node.
Specifically, first, a user performs a series of configuration operations on tree structure data at a configuration center, and the configuration center generates a structure tree generation task in response to the series of configuration operations with the user, and configuration information of each component or device in the system required for generating the structure tree is included in the structure tree generation task. The configuration center then sends the generated structure tree generation task to the decision maker. The decision maker is a processing unit or module, has specific functions in a system architecture or an algorithm flow, and is specifically used for analyzing and judging input data and generating a corresponding output result based on a preset rule. Next, the decision maker performs a series of analyses on configuration information of various components or devices in the system required to generate the structural tree carried in the structural tree generation task, resulting in specified filtering conditions and starting and center points of the complete structural tree for deciding which nodes should be included in the final generated tree structure.
Step 204, generating child nodes of the root node of the structure tree according to the data filtered from the preset database based on the specified filtering condition.
The preset database is used for storing tree data. It is easy to understand that the form of the preset database is not particularly limited, and the preset database can be set according to actual needs. Therefore, the data filtered from the preset database is also tree structure data, and the tree structure data refers to all basic units forming a tree, namely each individual node and the association mode between the nodes. Such data may be stored in a variety of formats, such as in the form of arrays, linked lists, or other complex forms. In a structural tree, child nodes are concepts used to describe a particular relationship between a node and other nodes. For example, if node A is located directly below node B, then A is referred to as a child node of B, and conversely B is referred to as a parent/superordinate node of A. Such parent-child relationships constitute the basic skeleton of the entire structural tree.
Specifically, first, the decision maker decides which nodes should be included in the finally generated tree structure according to the specified filtering condition analyzed, and the starting point and the center point of the complete tree structure. Then, tree data conforming to the condition is screened from a database for storing tree data according to the specified filtering condition. And finally, taking the screened tree data meeting the conditions as child nodes of the root node of the complete structure tree. It will be appreciated that the relationship between a root node and its child nodes is determined by specifying filter conditions.
And step 206, when the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, generating the child nodes of the first structure tree node according to the first structure tree node and the appointed filtering condition for each first structure tree node in the current generation level from the second level, determining the next level, returning the next level as a new current generation level, and returning to the step of generating the child nodes of the first structure tree node according to the first structure tree node and the appointed filtering condition until the finally generated structure tree is obtained.
Wherein the breadth first generation mode refers to a mode of generating child nodes through breadth first search, and the breadth first search refers to an algorithm for traversing or searching a tree or a graph. After the starting point V is accessed, sequentially accessing the adjacent points of V; then sequentially accessing the adjacent points which are not accessed in the points (next layer); until all vertices have been visited. The first structural tree node refers to a child node of the structural tree root node obtained in the previous step. Each of the sub-nodes except the root node has different filtering conditions due to different properties, and the filtering conditions corresponding to each of the sub-nodes are called data filtering conditions. It is easy to understand that the form of the data filtering condition is not particularly limited, and the application can be set according to actual requirements. For example, the data filtering condition for each node may be "parent node is child of that node".
Specifically, in the structure tree generation task, a root node, which is a first-level node of the entire structure tree, is first determined. The root node is typically screened from a pre-set database according to specified filtering conditions based on specific configuration information. And secondly, after entering the breadth-first generation flow, processing each first structural tree node in the current hierarchy from the second hierarchy (namely, the direct child node hierarchy of the root node). The "first structure tree node" herein refers to a child node of a previous level that has been generated. For each first structural tree node, the system then applies the corresponding data filtering conditions. These filtering conditions may be set based on the node's own attributes or other context information and may be different from the filtering conditions of other nodes. For example, it may require that a data record be found that has some specific association with the node. And then, using the data filtering conditions to screen out records meeting the conditions from a preset database, and further generating child nodes of the first structural tree node, wherein the child nodes form the next hierarchy of the structural tree. Finally, after all the sub-nodes of the current hierarchy are generated, the system marks the next hierarchy as a new current generation hierarchy, and then repeats the process, namely, generating the respective sub-nodes according to each node in the new hierarchy and the corresponding data filtering condition. This process will continue until no more nodes need to generate child nodes or some termination condition is reached (e.g., the entire data set is traversed). The final result is a structure tree which is completely generated by breadth-first traversal, wherein all data nodes meeting all filtering conditions are contained, and the generation of nodes entering the next hierarchy after traversing all nodes of the current hierarchy is ensured on any hierarchy. The structure tree can clearly display the transverse association relation between the data, and is convenient for a user to analyze the relation between nodes at the same level.
And step 208, when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate the sub-structure tree taking the second structure tree node of the current generating level as the root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is greater than or equal to a preset number threshold value so as to obtain the finally generated structure tree.
Specifically, firstly, according to given configuration information, the system determines that the generation mode of the structure tree is a depth-first generation mode. The depth-first generation approach is a strategy of traversing along the depth of the tree, i.e. it searches the branch paths as deep as possible when exploring the hierarchy, and does not trace back to other branches of the previous level nodes until the leaf node (node without child nodes) is reached. Next, starting from the second level of the structure tree (i.e., the direct child level of the root node), the system checks whether the number of second structure tree nodes is greater than or equal to a preset threshold for the level currently being generated. Then when this condition is met, i.e. there are a sufficient number (at least equal to a preset number threshold) of second structural tree nodes in the current hierarchy, the system triggers a new generation of a sub-structural tree for each of these nodes. In this process, the selected second structural tree node becomes the root node of the newly generated sub-structural tree. Each sub-structure tree is then built further down in a depth-first manner, i.e. the sub-node of the current root node is generated first, the sub-node of the sub-node is considered again, and so on until a certain termination condition is reached (e.g. no more nodes can be generated, or a predetermined maximum depth is reached, etc.). Finally, a series of nested sub-structure trees can be obtained through a layer-by-layer recursion depth first generation process. The sub-structure trees are summarized to form a complete structure tree, which reflects deep, longitudinal dependency or association relationships between data.
In one embodiment, generating a breadth query task of a root node of a structural tree according to specified filtering conditions; storing the breadth query task of the structural tree root node in a task queue so that the computer nodes in the computer cluster pull the breadth query task of the structural tree root node from the task queue, executing the breadth query task of the structural tree root node, and screening first filtering data meeting specified filtering conditions from a preset database; and generating child nodes of the root node according to the first filtering data.
The computer cluster is a server cluster formed by a plurality of servers to jointly serve a client request, each server in the cluster can be regarded as identical, any one server can independently respond to a user request, and the response capability of the system is improved by using the cluster in level. A computer node refers to a portion of a computer cluster, such as a single computer or virtual machine instance, in which a particular service or application is run to accomplish an assigned task. Each computing node may have different functions: for example, some may be depth first calculators, breadth first calculators, etc., depending on the particular application scenario and requirements. The breadth query task corresponds to breadth-first search, a method of searching all nodes layer by layer starting from the root. It first accesses all nodes of the current hierarchy and will only proceed to the next hierarchy to operate if all nodes on the same hierarchy are accessed.
Specifically, first, the decision maker reads the configuration center to obtain the root node specified by the user and specify the filtering condition. And then, the decision maker calls a task generator according to the read root node and the appointed filtering condition to construct the breadth query task corresponding to the root node. And then, storing the breadth query task corresponding to the root node in a task queue, so that the computer nodes in the computer cluster pull the breadth query task corresponding to the root node stored in the task queue from the task queue. And finally, executing the breadth query task corresponding to the root node, screening out data meeting the specified filtering condition from a preset database in a specific execution process, and taking the screened data as child nodes of the root node.
Due to the combination of the capability of the computer cluster and the features of the breadth-first search algorithm, the computer cluster can increase or decrease the node number as required so as to adapt to the continuously-changing workload. This not only improves the resource utilization but also enhances the stability of the system. The processing unit takes out tasks from the task queue and executes the tasks respectively, so that the computing capacity among the nodes of the cluster is effectively utilized, and the overall progress is accelerated. And the user can select the proper filtering condition to locate the information of interest, so that the flexibility and the personalization degree of the use are increased.
In one embodiment, a preset database is determined; the data in the database comprises attribute information, and the attribute information records father node information of corresponding data; and according to the respective father node information of each data in the preset database, filtering out first filtering data taking the structural tree root node as the father node from the database.
Wherein the attribute information refers to a data structure component for describing and recording data characteristics. Specifically, the attribute information describes parent node information of corresponding data, which means that each data item carries a reference or identification pointing to its parent node, and the design forms a tree relationship structure between the data items. For example, in a file system, each file or directory may be considered as a data node, and its attribute information may include a "parent directory" item, where the attribute information describes the information of the upper directory (i.e., parent node) where the file or directory is located. By means of the attribute information, operations such as breadth-first traversal query and the like on the whole directory tree can be achieved.
Specifically, a preset database is aimed at, wherein the stored data structures are organized according to a tree structure. Each data entry contains, in addition to its own specific content, attribute information, in which parent node information of the corresponding data node is specifically described. And starting from the root node of the structural tree, performing breadth-first traversal query operation. Breadth-first traversal is an algorithm for accessing nodes in a tree layer by layer, wherein a root node is accessed first, all children nodes of the root node are then accessed, children nodes of the children nodes are then accessed, and the like, and after all nodes of each layer are accessed, the next layer is accessed. And screening the database according to the father node information attribute of each data record in the database. Specifically, all data items of which the parent node information points to the root node of the current structure tree are found, namely all child nodes directly subordinate to the root node are found, and the data are defined as first filtering data. Through the steps, the first-level child node set taking the root node of the structural tree as the father node is finally obtained.
Under the condition that certain resources are limited or the requirement on response time is high, the memory usage (for example, the nodes to be accessed are stored in a queue with fixed size) can be effectively controlled by adopting a mode of starting from a root node and expanding the search range outwards layer by layer, so that the problem of deep recursion caused by depth-first traversal is avoided. And based on parent node information attribute screening data, a first-level child node set taking a root node as a starting point in a tree structure can be quickly constructed, and the visualization effect is very beneficial to understanding, managing and maintaining the hierarchical relationship in the database.
In one embodiment, for each first structural tree node in the current generation hierarchy other than the first hierarchy, data filtering conditions for the first structural tree node are generated based on the first structural tree node and specified filtering conditions, and child nodes of the first structural tree node are generated based on data filtered from the database based on the data filtering conditions.
Specifically, in building the structural tree, each first structural tree node located at any current level other than the first level is first processed starting from that level. The "first structural tree node" herein refers to a parent node of which child nodes need to be generated that is currently of interest in the building process. Then, for each first structural tree node of the current hierarchy, the technical scheme firstly combines the information of the node and preset specified filtering conditions to generate specific data filtering conditions applicable to the node. This means that there may be different data screening criteria for different nodes. Then, according to the generated specific data filtering condition, a query operation is performed in the database, wherein the query operation is used for screening out data records which are associated with the current node and meet the specific filtering condition from mass data. And finally, the screened data record is used as a basis for generating the child node of the corresponding first structural tree node. In other words, each set of data satisfying the filtering condition will correspond to a child node under the node, thereby constructing a structured hierarchical relationship.
In the process of constructing the structural tree, related data is dynamically extracted and organized from the database by utilizing a method of combining each level node with a specified filtering condition, so that the nodes of the next level in the structural tree are formed, and therefore, the generation of the structural tree can be ensured to reflect the characteristics of the bottom data and meet the filtering requirement customized by a user.
In one embodiment, the data name filter criteria is determined based on specified filter criteria; determining a parent node filtering condition according to the first structure tree node; generating a data filtering condition of the first structural tree node according to the data name filtering condition and the parent node filtering condition; the data filtering condition is used for generating a breadth query task of the first structure tree node; the breadth query task of the first structure tree node is used for triggering the computer cluster to filter second filtering data from a preset database; the second filter data is parent nodes based on nodes determined based on parent node filter conditions, and the data names of the second filter data include characters specified by the data name filter conditions.
The data name filtering condition refers to a condition of filtering data according to names. The parent node filtering condition refers to a condition for filtering data according to information of the parent node. And the data filtering condition refers to a condition obtained by combining the data name filtering condition and the parent node filtering condition.
Specifically, first, the user sets a data name filtering condition according to the requirement, and the condition may include a series of characters, keywords or regular expression patterns, so as to screen out the data with specific name attribute. The system then establishes a parent node filter condition based on the provided first structure tree node information. This means that only those other nodes in the structure tree that have a direct or indirect parent-child relationship with the specified node are considered. The two filtering conditions (i.e., the data name filtering condition and the parent node filtering condition) are then combined to generate a specific data filtering condition for the first structural tree node. This complex condition meets both the requirements for the data name properties and the hierarchical position requirements in the structural tree. Based on the generated data filtering condition, a breadth query task aiming at the first structural tree node is created. The query task is characterized in that direct child nodes of a target node are searched first according to a hierarchical sequence, and then the direct child nodes are expanded to further offspring nodes layer by layer. And after the breadth query task is triggered, searching operation is executed in a preset database. The cluster will screen the database for all data records meeting the following conditions: first, their parent nodes in the structural tree meet the previously defined parent node filtering conditions; second, the name portion of these data records contains the characters or patterns specified by the data name filtering conditions. And finally, the result of the query is a group of second filtered data subjected to double filtering, and the data meets the requirements of the structural tree relation and meets the matching standard of the data names.
Because of combining the data name filtering condition and the father node filtering condition, the method can realize the accurate search of the structured tree-shaped data in the database, avoid the interference of irrelevant data and improve the relevance and accuracy of the query result. In addition, the method reserves the tree structure characteristic in the original data, and the returned data can still reflect the original hierarchical relationship, which is very critical for applications which depend on the context information or need to show father-son association.
In one embodiment, if the number of the second structure tree nodes in the current generation hierarchy is greater than or equal to a preset number threshold, generating a depth query task of the second structure tree nodes in the current generation hierarchy; and storing the deep query task in a task queue so that computer nodes in the computer cluster pull the deep query task from the task queue, and executing the deep query task to generate a sub-structure tree taking the second structure tree node as a root node.
Wherein the depth query task corresponds to a depth-first search, an algorithm for traversing or searching a tree or graph. The nodes of the tree are traversed along the depth of the tree, searching for branches of the tree as deep as possible. When the edge of node V has been found, the search will trace back to the starting node that found the edge of node V. This process continues until all nodes reachable from the source node have been discovered. If there are still nodes that are not found, one of them is selected as the source node and the above process is repeated, and the entire process is iterated until all nodes are accessed. In the present application, the preset number threshold refers to the total number of all the computer nodes in the computer cluster.
Specifically, it is easy to understand that the generation modes of the structure tree that the user can set at the configuration center include two kinds of breadth-first generation modes and depth-first generation modes. When the depth-first generation mode is set, starting from a second level except the first level where the root node is located, if the number of all nodes (namely the number of all second structure tree nodes) in a certain current generation level is larger than or equal to the number of computing nodes in the hierarchical computer cluster, generating depth query tasks corresponding to all nodes (namely all second structure tree nodes) in the current generation level, and sequentially issuing the generated multiple depth query tasks to a task queue. And then, pulling the deep query task from the task queue by each computing node in the computing cluster to execute, taking one of the deep query tasks as an example, taking the computing node as a new root node when the deep query task is pulled by a certain computing node, traversing a preset database to sequentially determine sub-nodes, and finally determining a structural tree taking the level of the root node as a first level.
The depth query task is distributed to a plurality of nodes in the computing cluster, so that the parallel processing capability of each computing node in the cluster can be fully utilized, and the traversing speed of a large number of structural tree nodes and substructures thereof is increased. And when the number of nodes of a certain level exceeds the number of the calculated nodes, the system can generate a corresponding number of deep query tasks according to actual requirements. Therefore, dynamic task allocation can be realized, overload of a single node is avoided, and the load balancing capability of the whole system is improved.
In one embodiment, a task state tree is determined, and a determination is made as to whether a final generated structural tree has been obtained based on the values of the task state nodes in the task state tree.
In particular, the progress and status of the entire task or a series of interrelated tasks can be reflected first in the task status tree. Each node represents a particular task phase or subtask state in the task state tree, which may be different state identifications of "on-going", "completed" and "failed". Each node in the task state tree then has a corresponding value that reflects the current state of the task represented by that node. For example, if a node represents a task phase of "structure tree generation," its value may indicate whether the phase has been completed or successful. Finally, according to the task state tree, the system traverses or monitors the task state nodes related to the structure tree generation. When the values of these nodes are checked to show "completed" or other status indicating success, it is indicated that the structure tree generation task has ended and the expected result, i.e. the structure tree that was ultimately generated, is obtained.
Since it is determined whether the structure tree has been successfully built by maintaining and tracking node states in the task state tree that are related to the generation of the structure tree. Thus, it helps to achieve efficient management and control of complex processes, ensuring that all necessary steps have been properly performed and that the intended objective has been achieved.
In one embodiment, when the structure tree generating mode is determined to be the breadth-first generating mode according to the configuration information and the values of the nodes in the latest generating level of the task state tree are all the first target values, determining that the structure tree generating task is completed in generating and executing, and obtaining a finally generated structure tree; the first target value is a value that characterizes that the task has been completed and has no child nodes.
Specifically, as each level in the structural tree is continuously generated, the task state tree is updated accordingly. Different structural tree generation schemes may also result in different task state trees. According to the structure tree generation mode set by the user in the configuration center is a breadth-first generation mode, when all nodes on a certain level of the structure tree cannot inquire about child nodes, correspondingly, all nodes of the latest generation level corresponding to the level in the structure tree in the structure state tree are uniformly represented by one value (namely a first target value). It is to be readily understood that the form of the first target value is not particularly limited, and may be set according to actual needs. When the situation occurs in the structural state tree, the generation state of the structural tree is terminated, and the complete structural tree is obtained according to the determined node situation in each level in the structural tree.
Because the unified first target value is used for filling the hierarchy without the child nodes, redundant information is reduced in the state tree, the representation of the state space is simplified, and meanwhile, the situation that which parts in the whole structure are completely unfolded or reach the boundary condition can be intuitively reflected. And for problem solving, if the first target value represents a certain ending condition or a default state, the situation that the branch cannot be continued can be rapidly identified on a shallower level, so that algorithm convergence is accelerated, and useless exploration is reduced.
In one embodiment, when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, if no node with the value of the second target value exists in the task state tree, determining that the structure tree generating task is completed in generating and executing, and obtaining a finally generated structure tree; a second target value, which is a value that characterizes a task having an incomplete task.
Specifically, first, the user sets the generation mode of the structure tree to the depth-first generation mode in the configuration center. This means that the system will build the nodes of the structure tree layer by layer deep in accordance with the principles of the depth-first search algorithm. Then, each time a first structural node is created in one level (the current generation level) of the structural tree, a corresponding task state node is created in the corresponding level of the task state tree, and different values are given to represent the states of the nodes according to the execution conditions of the nodes. Wherein the second target value is used to indicate that a certain node or task has not yet been completed. Then, when detecting that the number of all the first structural tree nodes in a certain level exceeds the cluster computing resources, a deep query task is allocated to each node according to the requirement, and a task state tree is updated. And in the process of continuously generating and executing the structure tree, the system can continuously check the task state tree. If no node having the second target value (i.e., a value indicating that there are outstanding tasks) is found in the overall task state tree, it indicates that all tasks assigned have completed execution. Finally, based on the checking result, if it is confirmed that the state node with the second target value does not exist, it can be determined that the whole structure tree generating task is already executed, and the final complete structure tree generated by depth priority is obtained. For example, the task state nodes may have values of 0 and 2, where 0 represents that the first fabric node has been queried according to a deep query task; 2 represents that the first structural node remembers not yet been queried according to the deep query task. The generation state of the structure tree is determined according to whether the value of each task state node in the task state tree is 0 or2, and when the values of all task state nodes in the task state tree are 2 or are not 0, the continuous generation state of the structure tree is terminated.
Since it is determined whether the entire structural tree has been completely generated by examining the second target value (the value of the incomplete task), this mechanism ensures that all potential structural branches are considered and built, resulting in a complete structural tree model. And because of adopting the explicit state identification, when the problem occurs in the structure tree generating process, the task node with the problem can be rapidly positioned according to the task state tree, and the debugging and the repairing of the problem are facilitated.
In one embodiment, determining a task state tree, and adding a task state node corresponding to a third structure tree node in the task state tree for the third structure tree node currently generated in the structure tree when the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information; and determining the value of the task state node corresponding to the third structure tree node according to the currently generated breadth query task execution result of the structure tree node. The task state tree is used for representing whether each node is queried or not and whether a child node exists or not.
Specifically, for each structure tree node (i.e., the third structure tree node) in the current generation hierarchy in the structure tree, a task state node corresponding to each structure tree node in the current generation hierarchy is also created in the task state tree. And then further inquiring the execution state (i.e. whether the task is inquired) and the execution result (i.e. whether the child node exists) of the task according to the respective corresponding breadth of each structure tree node. And finally, correspondingly determining the value of each corresponding task state node of each structure tree node in the task state tree.
The scheduler can easily adjust the task allocation policy according to the task state tree, such as to prioritize the nodes that are not queried or to decide whether to go deep into the query sub-nodes according to the query result, since the execution state of each node is clearly known. And the task state tree corresponds to the structure tree one by one, so that the query task progress of each structure tree node can be tracked accurately in real time, and the state of the whole construction process can be monitored conveniently, including which nodes have completed the query and which are waiting or executing.
In one embodiment, when the structure tree generation mode is determined to be a depth-first generation mode according to the configuration information, adding a task state node corresponding to each depth query task in the task state tree species; and determining the value of the corresponding task state node according to the respective execution result of each deep query task.
Specifically, as each level in the structural tree is continuously generated, the task state tree is updated accordingly. Different structural tree generation schemes may also result in different task state trees. And when the total number of all the first structural tree nodes in a certain current generation level in the structural tree is judged to be greater than or equal to the total number of all the computing nodes in the computer cluster, at the moment, each first structural node in the current generation level respectively establishes a depth query task. Correspondingly, generating a hierarchy corresponding to the current generation hierarchy in the task state tree, and further constructing a node corresponding to the first structural tree node in the hierarchy corresponding to the task state tree and the current generation hierarchy. And assigning values to all task state nodes in the task state tree according to respective execution results (including whether the nodes have been queried and whether the presence of child nodes has been queried) of each first structure node in the current generation hierarchy of the structure tree. Different assigned values may characterize different execution results for different first fabric nodes. The application does not limit the characterization method specifically, and can be set according to actual needs. Alternatively, the task state nodes may have values of 0 and 2, where 0 represents that the first structure node has been queried according to the deep query task; 2 represents that the first structural node remembers not yet been queried according to the deep query task.
Since the query state of each first structural node is accurately recorded through the task state tree, real-time state monitoring and management can be realized. Different state values (e.g., 0 for queried and 2 for non-queried) make the overall system's operating conditions clear at a glance, facilitating scheduling and decision making. And the state of each node is clearly recorded in the task state tree, so that the fault detection and task progress tracking are greatly simplified, and the maintainability and the debuggeability of the system are enhanced.
In one embodiment, as shown in fig. 3, fig. 3 is a schematic diagram of a method for generating a structural tree in one embodiment, and the schematic diagram is taken as an example for explanation.
In the application, the structure tree generating method is carried out by a structure tree generating device, and each component related by the structure tree generating device mainly comprises a configuration center, a decision maker, a scheduling center, an assembly center, a computer cluster and a monitoring center. The configuration center is mainly used for maintaining the core configuration of the device, and comprises the following steps of: depth or breadth first, data source information, core compute node, maximum compute node, and task timeout time. The main functions of the decision maker include decision task generation strategies (fully exerting the maximum calculation force of the device), generating and issuing calculation tasks and maintaining task states. The main function of the dispatching center is to dispatch the computing clusters to realize dynamic capacity expansion and capacity reduction. The computer cluster is mainly a computing task consumption end and is responsible for executing computing tasks. The monitoring center is mainly used for monitoring the running state and key indexes of each module in the whole device.
In one embodiment, as shown in fig. 4, fig. 4 is a schematic diagram of breadth-first task generation and task status in one embodiment, and the following description will take the schematic diagram of breadth-first task generation and task status as an example.
Firstly, a decision maker receives a root and a filtering condition designated by a user, reads configuration center configuration, invokes a task generator to build inquiry tasks (task batch number, traversing mode, node serial number, filtering condition and node information) in batches according to a hierarchy, adds a task state node (state array with the length equal to the task number of the batch) in a task state tree, and records depth, batch number and task state (0: incomplete 1: completed son 2: completed no son). The task is then pushed to the task queue. And calculating queue consumers of all nodes in the cluster, actively pulling tasks from the task queues, analyzing task information, and calling a breadth-first calculator according to a traversing mode to search all child node sets of the current node. And then, reporting the result to the assembly center after the task of the computing node is completed, and updating the state. When the state is 1, the result is summarized to a decision maker, the task is regenerated, and when all the state bits of all the nodes of the checking state tree are not 0, the task is completed and exits. And finally, each computing node finishes the task and continues to pull the task from the queue, and the steps 2,3 and 4 are repeated.
In one embodiment, as shown in fig. 5, fig. 5 is a schematic view of depth-first task generation and task status in one embodiment, and the depth-first task generation and task status is described below as an example.
Firstly, the decision center receives the root and the filtering condition designated by the user and reads the configuration of the configuration center. The decision maker calls a task generator to build breadth query tasks (task batch number, traversing mode, node serial number, filtering condition and node information) according to the configuration batch by batch, adds a task state node (state array with the length equal to the batch task number) in a task state tree, and records depth, batch number and task state (0: incomplete 1: completed son 2: completed). The task is then pushed to the task queue. The computing clusters perform breadth computations. Reporting the result to an assembly center after the task is completed by the computing node, updating the task completion state, waiting for all task batches at the current depth to be completed, summarizing the result to a decision maker, and deciding whether to generate the depth task by the decision maker (when the result set is larger than or equal to the number of computing cluster nodes by default, generating the depth task). Finally, if the current result set is small in size, the maximum computing power of the computing cluster is not exerted, and the steps 2-5 are repeated. Otherwise, generating a deep query task for each child node in the result set. Pushing the result to a task queue, and after waiting for all the deep task calculation to be completed, exiting (when the state bits of all the nodes of the state tree are not 0), and returning the result.
In one embodiment, as shown in fig. 6, fig. 6 is a flow chart of a method for generating a structural tree in another embodiment, which includes the following steps:
step 602, receiving a structure tree generating task, and determining a designated filtering condition and a structure tree root node positioned in a first hierarchy according to configuration information of the structure tree generating task;
Step 604, generating a breadth query task of the root node of the structural tree according to the specified filtering condition; storing the breadth query task of the structural tree root node in a task queue so that the computer nodes in the computer cluster pull the breadth query task of the structural tree root node from the task queue, and executing the breadth query task of the structural tree root node to determine a preset database; the data in the database comprises attribute information, and the attribute information records father node information of corresponding data; according to the respective father node information of each data in a preset database, filtering first filtering data taking a structural tree root node as a father node from the database; generating child nodes of the root node according to the first filtering data;
Step 606, when the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, for each first structure tree node in the current generation level except the first level, determining a data name filtering condition according to the designated filtering condition; determining a parent node filtering condition according to the first structure tree node; generating a data filtering condition of the first structural tree node according to the data name filtering condition and the parent node filtering condition; generating sub-nodes of the first structural tree node according to the data filtered from the database based on the data filtering condition, determining the next level, taking the next level as a new current generation level, returning to the step of generating the sub-nodes of the first structural tree node according to the first structural tree node and the designated filtering condition, and continuing to execute until a finally generated structural tree is obtained;
Step 608, when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, for the current generating level from the second level, if the number of the second structure tree nodes in the current generating level is greater than or equal to the preset number threshold, generating a depth query task of the second structure tree nodes in the current generating level; and storing the deep query task in a task queue so that computer nodes in the computer cluster pull the deep query task from the task queue, and executing the deep query task to generate a sub-structure tree taking the second structure tree node as a root node to obtain a finally generated structure tree.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a structure tree generating device for realizing the above related structure tree generating method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiment of one or more structure tree generating devices provided below may refer to the limitation of the structure tree generating method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 7, there is provided a structure tree generating apparatus 700, comprising: a determination module 702, a first generation module 704, a second generation module 706, and a third generation module 708, wherein:
A determining module 702, configured to receive a structure tree generating task, and determine a specified filtering condition and a root node of the structure tree located in a first hierarchy according to configuration information of the structure tree generating task;
A first generating module 704, configured to generate child nodes of the root node of the structure tree according to data filtered from a preset database based on specified filtering conditions;
A second generating module 706, configured to, when it is determined that the structure tree generating manner is a breadth-first generating manner according to the configuration information, generate, for each first structure tree node in the current generating hierarchy from the second hierarchy, a child node of the first structure tree node according to the first structure tree node and the specified filtering condition, determine a next hierarchy, return the next hierarchy to the new current generating hierarchy, and generate the child node of the first structure tree node according to the first structure tree node and the specified filtering condition, until a finally generated structure tree is obtained;
And a third generating module 708, configured to trigger, when it is determined according to the configuration information that the structure tree generating manner is a depth-first generating manner, to generate, for a current generating hierarchy from the second hierarchy, a sub-structure tree with the second structure tree node of the current generating hierarchy as a root node if the number of second structure tree nodes in the current generating hierarchy is greater than or equal to a preset number threshold, so as to obtain a finally generated structure tree.
In one embodiment, a first generating module 704 is configured to generate a breadth query task of a root node of the structure tree according to a specified filtering condition; storing the breadth query task of the structural tree root node in a task queue so that the computer nodes in the computer cluster pull the breadth query task of the structural tree root node from the task queue, executing the breadth query task of the structural tree root node, and screening first filtering data meeting specified filtering conditions from a preset database; and generating child nodes of the root node according to the first filtering data.
In one embodiment, a first generating module 704 is configured to determine a preset database; the data in the database comprises attribute information, and the attribute information records father node information of corresponding data; and according to the respective father node information of each data in the preset database, filtering out first filtering data taking the structural tree root node as the father node from the database.
In one embodiment, the second generating module 706 is configured to generate, for each first structural tree node in the current generation hierarchy except for the first hierarchy, a data filtering condition of the first structural tree node according to the first structural tree node and the specified filtering condition, and generate a child node of the first structural tree node according to data filtered from the database based on the data filtering condition.
In one embodiment, the second generating module 706 is configured to determine a data name filtering condition according to the specified filtering condition; determining a parent node filtering condition according to the first structure tree node; and generating the data filtering condition of the first structural tree node according to the data name filtering condition and the parent node filtering condition.
In one embodiment, the third generating module 708 is configured to generate a deep query task of the second structure tree node in the current generation level if the number of the second structure tree nodes in the current generation level is greater than or equal to a preset number threshold; and storing the deep query task in a task queue so that computer nodes in the computer cluster pull the deep query task from the task queue, and executing the deep query task to generate a sub-structure tree taking the second structure tree node as a root node.
In one embodiment, the structure tree generating device further includes a determining module 710, configured to determine a task state tree, and determine whether a finally generated structure tree has been obtained according to the values of the task state nodes in the task state tree.
In one embodiment, the structure tree determining module 710 is configured to determine that the structure tree generating task is completed when the structure tree generating mode is determined to be the breadth-first generating mode according to the configuration information and the values of the nodes in the latest generating hierarchy of the task state tree are all the first target values, and obtain a finally generated structure tree; a first target value that is a value that characterizes that the task has been completed and that has no child node; when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, if no node with the value of the second target value exists in the task state tree, determining that the structure tree generating task is completely executed, and obtaining a finally generated structure tree; a second target value, which is a value that characterizes a task having an incomplete task.
In one embodiment, the structure tree determining module 710 is configured to add, when it is determined that the structure tree generating manner is the breadth-first generating manner according to the configuration information, a task state node corresponding to a third structure tree node in the task state tree for the third structure tree node currently generated in the structure tree; and determining the value of the task state node corresponding to the third structure tree node according to the currently generated breadth query task execution result of the structure tree node.
In one embodiment, the structure tree determining module 710 is configured to add, when it is determined that the structure tree generating manner is a depth-first generating manner according to the configuration information, a task state node corresponding to each depth query task in the task state tree species; and determining the value of the corresponding task state node according to the respective execution result of each deep query task.
In another embodiment, as shown in fig. 8, fig. 8 is a block diagram of a structure tree generating apparatus in another embodiment, including: a determination module 702, a first generation module 704, a second generation module 706, and a third generation module 708. The structure tree generating device 700 further includes a structure tree determining module 710.
The respective modules in the above-described structure tree generating apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data related to the generation of the structural tree. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a structure tree generation method.
It will be appreciated by persons skilled in the art that the architecture shown in fig. 9 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magneto-resistive random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (PHASE CHANGE Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (13)

1. A method of generating a structural tree, the method comprising:
Receiving a structure tree generating task, and determining specified filtering conditions and structure tree root nodes positioned in a first hierarchy according to configuration information of the structure tree generating task; generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
When the structure tree generation mode is determined to be the breadth-first generation mode according to the configuration information, for each first structure tree node in the current generation level from the second level, generating a child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, determining the next level, taking the next level as a new current generation level, and returning to the step of generating the child node of the first structure tree node according to the first structure tree node and the appointed filtering condition, and continuing to execute until a finally generated structure tree is obtained;
When the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, triggering to generate a sub-structure tree taking the second structure tree node of the current generating level as a root node for the current generating level from the second level if the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value so as to obtain a finally generated structure tree.
2. The method of claim 1, wherein generating the child nodes of the structural tree root node from data filtered from a preset database based on the specified filtering conditions comprises:
Generating a breadth query task of the root node of the structural tree according to the specified filtering condition;
Storing the breadth query task of the structural tree root node in a task queue, so that the computer nodes in a computer cluster pull the breadth query task of the structural tree root node from the task queue, execute the breadth query task of the structural tree root node, and screen out first filtering data meeting the specified filtering condition from a preset database;
And generating child nodes of the root node according to the first filtering data.
3. The method according to claim 2, wherein the screening the first filtering data satisfying the specified filtering condition from the preset database includes:
Determining a preset database; the data in the database comprises attribute information, wherein the attribute information records father node information of corresponding data;
and filtering first filtering data taking the root node of the structural tree as a father node from the database according to the father node information of each data in the preset database.
4. The method of claim 1, wherein generating the child node of the first structural tree node based on the first structural tree node and the specified filtering condition comprises:
for each first structural tree node in a current generation hierarchy other than the first hierarchy, generating a data filtering condition of the first structural tree node according to the first structural tree node and the specified filtering condition, and generating a child node of the first structural tree node according to data filtered from the database based on the data filtering condition.
5. The method of claim 4, wherein generating the data filtering condition for the first structural tree node based on the first structural tree node and the specified filtering condition comprises:
determining a data name filtering condition according to the appointed filtering condition;
determining a parent node filtering condition according to the first structure tree node;
Generating a data filtering condition of the first structural tree node according to the data name filtering condition and the parent node filtering condition;
The data filtering condition is used for generating a breadth query task of the first structure tree node; the breadth query task of the first structure tree node is used for triggering the computer cluster to filter second filtering data from a preset database; the second filter data is parent nodes with nodes determined based on the parent node filter conditions, and the data names of the second filter data contain characters specified by the data name filter conditions.
6. The method according to claim 1, wherein triggering generation of the sub-structure tree with the second structure tree node of the current generation level as a root node if the number of the second structure tree nodes of the current generation level is greater than or equal to a preset number threshold comprises:
If the number of the second structural tree nodes in the current generation level is greater than or equal to a preset number threshold, generating a depth query task of the second structural tree nodes in the current generation level;
And storing the deep query task in a task queue so that computer nodes in a computer cluster pull the deep query task from the task queue, and executing the deep query task to generate a sub-structure tree taking the second structure tree node as a root node.
7. The method according to any one of claims 1 to 5, further comprising:
and determining a task state tree, and determining whether a finally generated structure tree is obtained according to the values of the task state nodes in the task state tree.
8. The method of claim 7, wherein the method further comprises:
When the structure tree generating mode is determined to be a breadth-first generating mode according to the configuration information and the values of nodes in the latest generating level of the task state tree are all first target values, determining that the structure tree generating task is completely executed, and obtaining a finally generated structure tree; the first target value is a value which represents that the task is completed and does not have a child node;
When the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information, if no node with the value of a second target value exists in the task state tree, determining that the structure tree generating task is completely executed, and obtaining a finally generated structure tree; the second target value is a value representing a task having an incomplete task.
9. The method of claim 7, wherein the method further comprises:
When the structure tree generating mode is determined to be the breadth-first generating mode according to the configuration information, adding a task state node corresponding to a third structure tree node in the task state tree for the third structure tree node currently generated in the structure tree;
and determining the value of the task state node corresponding to the third structure tree node according to the breadth query task execution result of the currently generated structure tree node.
10. The method of claim 7, wherein the method further comprises:
when the structure tree generation mode is determined to be a depth-first generation mode according to the configuration information, adding a task state node corresponding to each depth query task in the task state tree species;
and determining the value of the corresponding task state node according to the respective execution result of each deep query task.
11. A structure tree generating apparatus, the apparatus comprising:
The determining module is used for receiving the structure tree generating task and determining specified filtering conditions and structure tree root nodes positioned in the first hierarchy according to configuration information of the structure tree generating task;
the first generation module is used for generating child nodes of the structural tree root node according to data filtered from a preset database based on the specified filtering conditions;
The second generating module is used for generating sub-nodes of the first structural tree node according to the first structural tree node and the appointed filtering condition for each first structural tree node in the current generating level from the second level when the structural tree generating mode is determined to be the breadth-first generating mode according to the configuration information, determining the next level, taking the next level as a new current generating level, and returning to the step of generating the sub-nodes of the first structural tree node according to the first structural tree node and the appointed filtering condition until the finally generated structural tree is obtained;
And the third generating module is used for triggering the generation of the sub-structure tree taking the second structure tree node of the current generating level as the root node to obtain the finally generated structure tree when the number of the second structure tree nodes in the current generating level is larger than or equal to a preset number threshold value for the current generating level from the second level when the structure tree generating mode is determined to be the depth-first generating mode according to the configuration information.
12. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 10 when the computer program is executed.
13. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 10.
CN202410282195.7A 2024-03-12 2024-03-12 Structure tree generation method, device, computer equipment and storage medium Pending CN118093949A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410282195.7A CN118093949A (en) 2024-03-12 2024-03-12 Structure tree generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410282195.7A CN118093949A (en) 2024-03-12 2024-03-12 Structure tree generation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN118093949A true CN118093949A (en) 2024-05-28

Family

ID=91148637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410282195.7A Pending CN118093949A (en) 2024-03-12 2024-03-12 Structure tree generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118093949A (en)

Similar Documents

Publication Publication Date Title
US11971890B2 (en) Database management system for optimizing queries via multiple optimizers
US11922221B2 (en) System and method for automatic dependency analysis for use with a multidimensional database
US11449529B2 (en) Path generation and selection tool for database objects
US11797496B2 (en) System and method for parallel support of multidimensional slices with a multidimensional database
US9449115B2 (en) Method, controller, program and data storage system for performing reconciliation processing
CN112905595A (en) Data query method and device and computer readable storage medium
US8396852B2 (en) Evaluating execution plan changes after a wakeup threshold time
US20070250517A1 (en) Method and Apparatus for Autonomically Maintaining Latent Auxiliary Database Structures for Use in Executing Database Queries
CN104915717B (en) Data processing method, Analysis of Knowledge Bases Reasoning method and relevant apparatus
US11755284B2 (en) Methods and systems for improved data retrieval and sorting
CN110740079A (en) full link benchmark test system for distributed scheduling system
US9020954B2 (en) Ranking supervised hashing
CN116755939B (en) Intelligent data backup task planning method and system based on system resources
CN111752945A (en) Time sequence database data interaction method and system based on container and hierarchical model
Raghavan et al. Progressive result generation for multi-criteria decision support queries
US20200218735A1 (en) Methods and systems for indexlet based aggregation
CN113886111B (en) Workflow-based data analysis model calculation engine system and operation method
CN115168389A (en) Request processing method and device
Ocaña et al. Data analytics in bioinformatics: Data science in practice for genomics analysis workflows
CN112800056B (en) Multi-layer index construction method based on multi-granularity space-time data
CN118093949A (en) Structure tree generation method, device, computer equipment and storage medium
CN115248815A (en) Predictive query processing
Papanikolaou Distributed algorithms for skyline computation using apache spark
US7185006B2 (en) Method and apparatus for reducing the scope of queries that seek information from networked computers
US20230214375A1 (en) Relationship analysis using vector representations of database tables

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