Dynamic rule serial number generation method and system based on demand structure tree, computer readable storage medium and electronic equipment
By building a requirement structure tree in demand management and dynamically generating a unique hierarchical sequence number, the problem of inconsistent sequence numbers in demand management is solved, management efficiency and accuracy are improved, and it is suitable for demand structure trees of different sizes and complexities.
Patent Information
- Application Number
- CN202411585933.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the demand management process, it is difficult for the existing technology to dynamically generate and update the demand serial numbers, resulting in inconsistent serial numbers of the demand structure tree, affecting the efficiency and accuracy of the demand management of the project team.
Using the dynamic rule number generation method based on the demand structure tree, by building the demand structure tree, assigning a unique hierarchical sequence number to each requirement according to the hierarchy and relationship of the requirement, and automatically updating the sequence number when the demand changes to ensure that the sequence number and Consistency of the structure tree.
It improves the efficiency and accuracy of demand management, reduces errors caused by serial number duplication and confusion, supports demand structure trees of different sizes and complexities, and has good scalability.
Smart Images

Figure CN119088808A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and system for generating dynamic rule sequence numbers based on a demand structure tree, a computer-readable storage medium, and electronic equipment, and belongs to the technical field of demand management. Background Art
[0002] Requirements management technology is an important part of project management. It focuses on how to effectively identify, record, track and change project requirements. In large and complex projects, the number of requirements may reach hundreds or even thousands. Therefore, a systematic method is needed to organize and manage requirements.
[0003] The requirement structure tree is an effective tool for organizing and managing requirements. It forms a tree structure by layering and classifying requirements according to certain logical relationships (such as parent-child relationships, dependency relationships, etc.). Such a structure can clearly show the hierarchy and relationship between requirements, making it easier for project team members to understand and manage.
[0004] In the process of requirements management, it is very important to assign a unique and meaningful serial number to each requirement. The serial number can not only help team members quickly locate requirements, but also reflect the hierarchy and relationship between requirements. However, as the project progresses, the addition, deletion and change of requirements are inevitable. This requires a method that can dynamically generate, update and adjust the requirement serial number. Summary of the invention
[0005] In order to solve the above problems, the present invention discloses a method for generating dynamic rule serial numbers based on the demand structure tree. According to the hierarchy and relationship of the requirements in the demand structure tree, a unique, hierarchical serial number is assigned to each requirement. When the chapters and requirements change, the algorithm can automatically update and adjust the serial number to maintain the consistency of the serial number with the demand structure tree. The specific technical solution is as follows: A method for generating dynamic rule sequence numbers based on a demand structure tree comprises the following steps: Model building phase: Step 1: Build a requirement structure tree. Each node in the requirement structure tree represents a chapter or requirement. The parent-child relationship between nodes represents the hierarchical relationship between requirements. Step 2: Define the sequence number generation rules. Each node has a unique sequence number, which is composed of the sequence number of the parent node and the position information of the sequence number under the parent node. The sequence number adopts a hierarchical encoding method. Step 3: When adding a new chapter or requirement to the requirement structure tree, generate a new serial number for the new chapter or requirement according to the serial number generation rules to ensure the uniqueness of the serial number; Step 4: When the demand structure tree undergoes changes such as adding, deleting, or moving nodes, the serial number update mechanism is triggered to regenerate the serial numbers of the affected nodes and their child nodes according to the new structure, keeping the serial numbers consistent with the structure tree; Model usage phase: Step 5: Initialize global variables; Step 6: Process the first node: For the first node, initialize the node number according to the node type; Step 7: Traverse the nodes of the structure tree and determine the node type: If the node is a chapter node, execute the chapter node processing flow; If the node is a demand node, execute the demand node processing flow; Step 8: Recursively process child nodes For each node, call the corresponding processing flow according to the node type; Step 9: Backtracking Phase After processing all child nodes of a node, trace back to the parent node level; Step 10: End Condition Phase: After traversing all nodes of the structure tree, this round of operation ends.
[0006] Furthermore, after the corresponding serial numbers are generated in step 3 and step 4, a step of checking the uniqueness of the serial numbers is also performed to ensure that each requirement has a unique serial number.
[0007] Furthermore, the hierarchical coding method of the sequence number in step 2 is expressed as "parent node sequence number. child node sequence number. grandchild 1 node sequence number...grandchild N node sequence number", which means "the first parent node. the second child node. the third demand...the N+2th demand", where N is a positive integer greater than or equal to 2.
[0008] Furthermore, the sequence number generation rule in step 2 is specifically as follows: Step 2.1: First node rule: For the first node, initialize the node number according to the node type. The node types include chapter nodes and requirement nodes. If it is a chapter type, the number is 1. If it is a requirement type, the number is 0-1. Step 2.2: Chapter number rule 1: If a chapter is the first node at the same level, get the parent node and append ".1" to the parent node number as the node number. Step 2.3: Chapter number rule 2: Processing flow for determining whether there are chapter nodes at the same level: Step 2.3.1, if there is a chapter node at the same level, get the last chapter node at the same level, and add 1 to the number after the last "." in the chapter node sequence number as the node sequence number; Step 2.3.2: If there is no chapter node at the same level, get the parent node and append ".1" to the parent node number as the node number; Step 2.4: Requirement serial number rule 1: If the requirement is the first node of the same level, get the parent node and append ".0-1" to the parent node serial number as the node serial number; Step 2.5: Requirement sequence number rule 2: Determine whether there are same-level requirement nodes: Step 2.5.1, if there is a demand node at the same level, get the last demand node at the same level, and add "1" to the number after the last "-" in the demand node sequence number as the node sequence number; Step 2.5.2: If there is no required node at the same level, obtain the last chapter node at the same level and append "-1" to the chapter node number as the node number.
[0009] Furthermore, the global variables include a nodeMap set, an indexNodeMap set, a number index, and an object currentNode. The nodeMap collection represents the storage of all nodes on the path from the root node to the current node. In a mapping structure, the key is the node ID and the value is the node with the storage sequence number. The indexNodeMap collection represents the ID set of all nodes in the current level indicated by index. The key in a mapping structure is the level index, and the value is the mapping of the current level node ID set. The number index indicates the current level index, that is, the root node level, starting from 0; The object currentNode represents the node object currently being processed.
[0010] Furthermore, the attribute information of the object currentNode node includes: The string Id represents the node ID. The string pid represents the parent node ID. The string number represents the sequence number. The string orderNumber represents the position of the node in this layer, the first one is 0, The string title represents the node name. The string type indicates the node type, 0 indicates a chapter, and 1 indicates a requirement.
[0011] A system for implementing the above-mentioned method for generating dynamic rule sequence numbers based on a demand structure tree comprises: The requirement structure tree building module is used to build a requirement structure tree that represents the hierarchy and relationships between sections and requirements; The serial number generation module generates a unique serial number for each chapter and requirement node in the requirement structure tree according to the serial number generation rules; The serial number update module triggers and executes the serial number update mechanism when the demand structure tree changes, and regenerates the serial numbers of the affected nodes and their child nodes.
[0012] Furthermore, the sequence number generation module also includes a sequence number uniqueness checking unit, which is used to check the uniqueness of the sequence number when generating the sequence number.
[0013] A computer-readable storage medium storing a dynamic rule sequence number generation system based on a demand structure tree, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the dynamic rule sequence number generation method based on the demand structure tree can be implemented.
[0014] An electronic device storing a dynamic rule sequence number generation system based on a demand structure tree, the electronic device comprising a processor and a memory, the memory storing a computer program, and the computer program, when executed by the processor, can implement the above-mentioned dynamic rule sequence number generation method based on the demand structure tree.
[0015] The working principle of the present invention is: The present invention provides a method for generating dynamic rule serial numbers based on a demand structure tree, aiming to improve the functionality and efficiency of demand management software. The algorithm dynamically generates a continuous and unique serial number for each node on the demand structure tree by constructing a demand structure tree to display the hierarchical relationship and dependency relationship between requirements. This structured display method helps team members quickly understand the overall picture of project requirements and reduces communication costs.
[0016] During the execution of the method, first initialize the global variables, then initialize the starting value of the serial number according to the rules, then check the input data, distinguish the type of node, and then execute the algorithm corresponding to the node type. By recursively processing the child nodes and appropriate backtracking operations, finally generate a requirement structure tree that meets the rules.
[0017] The beneficial effects of the present invention are: Improve management efficiency: By assigning unique, hierarchical numbers to chapters and requirements, the requirements management process can be simplified and management efficiency can be improved.
[0018] Reduce errors: Since serial numbers are unique and hierarchical, errors caused by duplication or confusion of serial numbers can be greatly reduced.
[0019] Dynamicity: Ability to dynamically generate and update serial numbers based on changes in the demand structure tree, maintaining consistency between the serial numbers and the structure tree.
[0020] Scalability: The algorithm is applicable to demand structure trees of different sizes and complexities and has good scalability.
[0021] In summary, the dynamic rule-based serial number generation method based on the requirement structure tree provides an effective solution in the requirement management technology solution. By constructing the requirement structure tree and generating a unique, hierarchical serial number for each chapter and requirement, this method can ensure clear identification, effective tracking and rapid location of requirements, and improve the efficiency and quality of project management. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is the overall flow chart of the present invention.
[0023] Figure 2 It is a flowchart of generating serial numbers for chapter type nodes in the present invention.
[0024] Figure 3 This is a flow chart of generating sequence numbers for demand type nodes in the present invention.
[0025] Figure 4 It is a schematic diagram of a structure tree in which a chapter is the first node in an embodiment of the present invention.
[0026] Figure 5 It is a schematic diagram of a structure tree of the first node required in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0028] The method for generating dynamic rule sequence numbers based on the demand structure tree includes the following steps: Step 1: Build a requirement structure tree, where each node of the tree represents a chapter or requirement, and the parent-child relationship between nodes represents the hierarchical relationship between requirements; Define the serial number generation rules. Each node has a unique serial number, which is composed of the serial number of the parent node and the position information of the node under the parent node. The serial number adopts a hierarchical encoding method. The serial number generation process also includes a step of checking the uniqueness of the serial number to ensure that each requirement has a unique serial number.
[0029] When a new chapter or requirement is added to the requirement structure tree, a new serial number is generated for the chapter or requirement according to the serial number generation rules to ensure the uniqueness of the serial number.
[0030] First node rule: The first node (index=0&&orderNumber=0) has its sequence number initialized according to the node type (chapter or requirement). If it is a chapter type, the sequence number is 1; if it is a requirement type, the sequence number is 0-1.
[0031] Chapter number rule 1: A chapter is the first node of the same level (orderNumber=0). Get the parent node and append ".1" to the parent node number as the node number.
[0032] Chapter number rule 2: Determine whether there is a processing flow for chapter nodes at the same level.
[0033] 1. If there are chapter nodes at the same level, get the last chapter node at the same level, and add 1 to the number after the last "." in the chapter node sequence number as the node sequence number.
[0034] 2. If there is no chapter node at the same level, get the parent node and append ".1" to the parent node number as the node number.
[0035] Requirement sequence number rule 1: The requirement is the first node of the same level (orderNumber=0), get the parent node, and append ".0-1" to the parent node sequence number as the node sequence number.
[0036] Requirement sequence number rule 2: Determine whether there are requirement nodes at the same level: 1. If there is a demand node at the same level, get the last demand node at the same level, and add "1" to the number after the last "-" in the demand node sequence number as the node sequence number.
[0037] 2. If there is no required node at the same level, get the last chapter node at the same level and append "-1" to the chapter node number as the node number.
[0038] When the demand structure tree changes (such as adding, deleting or moving nodes), the serial number update mechanism is triggered to regenerate the serial numbers of the affected nodes and their child nodes according to the new structure to maintain the consistency of the serial numbers with the structure tree.
[0039] Step 2: Initialize global variables: Set global variables: nodeMap, indexNodeMap, index, currentNode. The types and descriptions of each variable are shown in Table 1 below: Table 1
[0040] The attribute information of the currentNode node is shown in Table 2 below: Table 2
[0041] Step 3: Traverse the structure tree: 3.1) Processing the first node: For the first node (index=0&&orderNumber=0), initialize its sequence number according to the node type (chapter or requirement). If it is a chapter type, the sequence number is 1, and if it is a requirement type, the sequence number is 0-1. Update the number value in currentNode, the mapping relationship between the index set of indexNodeMap and the id set of the current level node.
[0042] 3.2) Traverse the nodes of the structure tree and determine the node type: If the node is a chapter node, execute the chapter node processing flow.
[0043] If the node is a demand node, execute the demand node processing flow.
[0044] Step 4: Chapter node processing flow, see the flow chart Figure 2 : 4.1) Determine whether it is the first node at the same level: If it is the first node of the same level (orderNumber=0), get the parent node and append ".1" to the parent node's sequence number as this node's sequence number.
[0045] If it is not the first node of the same level (orderNumber>0), continue to determine whether there is a processing flow of chapter nodes of the same level.
[0046] If there are chapter nodes at the same level, get the last chapter node at the same level, and add 1 to the number after the last "." in the chapter node sequence number as the node sequence number.
[0047] If there is no chapter node at the same level, get the parent node and append ".1" to the parent node number as the node number.
[0048] 4.2) Update currentNode and indexNodeMap data.
[0049] Step 5: Demand node processing flow, see the flow chart Figure 3 : 5.1) Determine whether it is the first node of the same level: If it is the first node of the same level (orderNumber=0), get the parent node and append ".0-1" to the parent node number as the node number.
[0050] If it is not the first node of the same level (orderNumber>0), continue to determine whether there is a node of the same level required.
[0051] If there are demand nodes at the same level, get the last demand node at the same level, and add "1" to the number after the last "-" in the demand node sequence number as the node sequence number.
[0052] If there is no required node at the same level, get the last chapter node at the same level and append "-1" to the chapter node number as the node number.
[0053] 5.2) Update currentNode and indexNodeMap data.
[0054] Step 6: Recursively process child nodes: For each node, the corresponding processing flow is called according to its type (section or requirement).
[0055] Step 7: Backtracking phase: After processing all child nodes of a node, trace back to the parent node level, traverse the keys in indexNodeMap (keys of the indexNodeMap collection), and clear all keys in indexNodeMap that are greater than the current index level to maintain data correctness.
[0056] Step 8: End condition phase: After traversing all the nodes of the structure tree, the algorithm ends. The structure tree chapter and requirement sequence number effects are shown in Figure 4 and Figure 5 .
[0057] The advantage of the present invention is that it can automatically and accurately assign unique serial numbers to the requirements in the structure tree, avoiding the tediousness and errors of manually filling in the serial numbers. At the same time, the algorithm adopts a reasonable data structure and algorithm design, which can support the processing of large amounts of data and improve work efficiency. In summary, the application of dynamic rule serial number generation of the demand structure tree in the field of demand management is mainly reflected in clarifying the demand hierarchy, dynamically generating rule serial numbers, optimizing the demand management process, supporting demand changes and tracking, and improving the efficiency and accuracy of demand management. These applications can greatly improve the efficiency and quality of demand management and provide strong support for the development of enterprises.
[0058] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.
[0059] With the above-mentioned ideal embodiments of the present invention as inspiration, through the above-mentioned description content, relevant personnel can make various changes and modifications without departing from the scope of the technical idea of the present invention.
Claims
1. A method for generating dynamic rule sequence numbers based on a demand structure tree, characterized in that: The following steps are involved: Model building phase: Step 1: Build a requirement structure tree. Each node in the requirement structure tree represents a chapter or requirement. The parent-child relationship between nodes represents the hierarchical relationship between requirements. Step 2: Define the sequence number generation rules. Each node has a unique sequence number, which is composed of the sequence number of the parent node and the position information of the sequence number under the parent node. The sequence number adopts a hierarchical encoding method. Step 3: When adding a new chapter or requirement to the requirement structure tree, generate a new serial number for the new chapter or requirement according to the serial number generation rules to ensure the uniqueness of the serial number; Step 4: When the demand structure tree undergoes changes such as adding, deleting, or moving nodes, the serial number update mechanism is triggered to regenerate the serial numbers of the affected nodes and their child nodes according to the new structure, keeping the serial numbers consistent with the structure tree; Model usage phase: Step 5: Initialize global variables; Step 6: Process the first node: For the first node, initialize the node number according to the node type; Step 7: Traverse the nodes of the structure tree and determine the node type: If the node is a chapter node, execute the chapter node processing flow; If the node is a demand node, execute the demand node processing flow; Step 8: Recursively process child nodes For each node, call the corresponding processing flow according to the node type; Step 9: Backtracking Phase After processing all child nodes of a node, trace back to the parent node level; Step 10: End Condition Phase: After traversing all nodes of the structure tree, this round of operation ends.
2. The method for generating dynamic rule sequence numbers based on a demand structure tree according to claim 1, characterized in that: After the corresponding serial numbers are generated in step 3 and step 4, a step of checking the uniqueness of the serial numbers is also performed to ensure that each requirement has a unique serial number.
3. The method for generating dynamic rule sequence numbers based on a demand structure tree according to claim 1, characterized in that: The hierarchical coding method of the sequence number in step 2 is expressed as "parent node sequence number. child node sequence number. grandchild 1 node sequence number...grandchild N node sequence number", which means "first parent node. second child node. third demand...N+2th demand", where N is a positive integer greater than or equal to 2.
4. The method for generating dynamic rule sequence numbers based on a demand structure tree according to claim 1, characterized in that: The specific sequence number generation rules in step 2 are: Step 2.1: First node rule: For the first node, initialize the node number according to the node type. The node types include chapter nodes and requirement nodes. If it is a chapter type, the number is 1. If it is a requirement type, the number is 0-1. Step 2.2: Chapter number rule 1: The chapter is the first node of the same level. Get the parent node and append ".1" to the parent node number as the node number. Step 2.3: Chapter number rule 2: Processing flow for determining whether there are chapter nodes at the same level: Step 2.3.1, if there is a chapter node at the same level, get the last chapter node at the same level, and add 1 to the number after the last ".." of the chapter node sequence number as the node sequence number; Step 2.3.2, if there is no chapter node at the same level, get the parent node, and append ".1" to the parent node number as the node number; Step 2.4: Requirement serial number rule 1: The requirement is the first node of the same level, get the parent node, and append ".0-1" to the parent node serial number as the node serial number; Step 2.5: Requirement sequence number rule 2: Determine whether there are same-level requirement nodes: Step 2.5.1, if there is a demand node at the same level, get the last demand node at the same level, and add "1" to the number after the last "-" in the demand node sequence number as the node sequence number; Step 2.5.2: If there is no required node at the same level, obtain the last chapter node at the same level and append "-1" to the chapter node number as the node number.
5. The method for generating dynamic rule sequence numbers based on a demand structure tree according to claim 1, characterized in that: The global variables include nodeMap collection, indexNodeMap collection, number index, and currentNode object. The nodeMap collection represents the storage of all nodes on the path from the root node to the current node. In a mapping structure, the key is the node ID and the value is the node with the storage sequence number. The indexNodeMap collection represents the ID set of all nodes in the current level indicated by index. The key in a mapping structure is the level index, and the value is the mapping of the current level node ID set. The number index indicates the current level index, that is, the root node level, starting from 0; The object currentNode represents the node object currently being processed.
6. The method for generating dynamic rule sequence numbers based on a demand structure tree according to claim 5, characterized in that: The attribute information of the object currentNode node includes: The string Id represents the node ID. The string pid represents the parent node ID. The string number represents the sequence number. The string orderNumber represents the position of the node in this layer, the first one is 0, The string title represents the node name. The string type indicates the node type, 0 indicates a chapter, and 1 indicates a requirement.
7. A dynamic rule sequence number generation system based on a demand structure tree, characterized in that: include: The requirement structure tree building module is used to build a requirement structure tree that represents the hierarchy and relationships between sections and requirements; The serial number generation module generates a unique serial number for each chapter and requirement node in the requirement structure tree according to the serial number generation rules; The serial number update module triggers and executes the serial number update mechanism when the demand structure tree changes, and regenerates the serial numbers of the affected nodes and their child nodes.
8. The dynamic rule sequence number generation system based on the demand structure tree according to claim 7 is characterized in that: The sequence number generation module further comprises a sequence number uniqueness checking unit, which is used to check the uniqueness of the sequence number when generating the sequence number.
9. A computer-readable storage medium storing the dynamic rule sequence number generation system based on the demand structure tree according to claim 8, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it can implement the method for generating dynamic rule serial numbers based on a demand structure tree as described in any one of claims 1 to 6.
10. An electronic device storing the dynamic rule sequence number generation system based on the demand structure tree according to claim 8, characterized in that: The electronic device includes a processor and a memory, the memory stores a computer program, and when the computer program is executed by the processor, it can implement the dynamic rule sequence number generation method based on the demand structure tree described in any one of claims 1-6.
Citation Information
Patent Citations
Demand file processing method and device, storage medium and equipment
CN114782010A
Tree coding method and system
CN115994141A
Structural tree generation method and device, computer equipment and storage medium
CN118093949A
Hierarchical business rule model
US20170083837A1
