A method, apparatus, device, and storage medium for generating knowledge graphs.
By constructing a knowledge graph to display the relationships between faulty entities and automatically generating test cases, the problem of time-consuming and labor-intensive manual test case construction in chaotic engineering is solved, and efficient and accurate test case management is achieved.
Patent Information
- Application Number
- CN202310066740.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-13
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2043-01-13
AI Technical Summary
Existing chaos engineering test cases require manual construction, which is time-consuming, labor-intensive, inefficient, prone to errors, has low accuracy, and poor maintainability.
By acquiring a set of faults, identifying individual faults and combinations of faults, constructing a knowledge graph, displaying the relationships between fault entities, and generating test cases.
By automatically generating test cases using knowledge graphs, we can save on construction time and manpower costs, improve management efficiency, and enhance accuracy and maintainability.
Smart Images

Figure CN116010623B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of data processing technology, and in particular to a knowledge graph generation method, apparatus, device and storage medium. Background Technology
[0002] Chaos engineering effectively addresses the challenges of distributed systems with numerous transactions and long transaction chains, which often lack resilience testing, through scientific experimental methods. It also allows for fault injection into various aspects of the environment, equipment, and applications, filling gaps in traditional testing methods and improving system availability. In chaos testing, the injected fault scenarios are crucial. Which faults have an extremely low probability of occurrence and do not require injection, and which faults are already addressed in the system design and explicitly implemented to maintain stability, require verification and thus need careful consideration.
[0003] Existing test cases for chaos engineering are mostly manually constructed by engineers based on their own experience. This is time-consuming, labor-intensive, inefficient, prone to errors, has low accuracy, and poor maintainability. Therefore, there is an urgent need to construct a knowledge graph for chaos engineering to automate the generation of test cases. Summary of the Invention
[0004] This invention provides a knowledge graph generation method, apparatus, device, and storage medium, which solves the problems of chaotic engineering test cases requiring manual construction, which is time-consuming, labor-intensive, inefficient, prone to errors, have low accuracy, and poor maintainability.
[0005] According to one aspect of the present invention, a knowledge graph generation method is provided, the method comprising:
[0006] Obtain the fault set;
[0007] Based on the fault set, single faults and combined faults are obtained;
[0008] Identify the fault entity based on single faults and combined faults;
[0009] Determine the relationships between faulty entities based on combined faults;
[0010] A knowledge graph is constructed based on the faulty entity, the relationships between faulty entities, and the target attribute values of the faulty entity.
[0011] According to another aspect of the present invention, a knowledge graph generation apparatus is provided, the apparatus comprising:
[0012] The fault set acquisition module is used to acquire the fault set;
[0013] A fault acquisition module is used to acquire single faults and combined faults based on the fault set.
[0014] The fault entity determination module is used to determine fault entities based on single faults and combined faults.
[0015] The relationship determination module is used to determine the relationships between faulty entities based on combined faults.
[0016] The knowledge graph construction module is used to build a knowledge graph based on faulty entities, the relationships between faulty entities, and the target attribute values of faulty entities.
[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0018] At least one processor; and
[0019] A memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the knowledge graph generation method according to any embodiment of the present invention.
[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the knowledge graph generation method according to any embodiment of the present invention.
[0022] This invention addresses the problems of manually constructing chaotic engineering test cases, which is time-consuming, labor-intensive, inefficient, prone to errors, and has poor maintainability. The knowledge graph provides a more intuitive representation of the relationships between fault entities, facilitating management and maintenance and improving subsequent management efficiency. Furthermore, constructing test cases based on the knowledge graph constructed in this invention saves time and manpower costs associated with test case construction.
[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0024] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of a knowledge graph generation method according to Embodiment 1 of the present invention;
[0026] Figure 2 This is an example diagram of a knowledge graph according to Embodiment 1 of the present invention;
[0027] Figure 3 This is a schematic diagram of the structure of a knowledge graph generation device according to Embodiment 2 of the present invention;
[0028] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] Example 1
[0032] Figure 1This is a flowchart of a knowledge graph generation method according to Embodiment 1 of the present invention. This embodiment is applicable to the generation of fault knowledge graphs in chaos engineering. The method can be executed by the knowledge graph generation device in this embodiment, which can be implemented in software and / or hardware, such as... Figure 1 As shown, the method specifically includes the following steps:
[0033] S110, Obtain the fault set.
[0034] The fault set refers to the set of common faults in chaos engineering. The fault set includes a variety of faults, such as: process killing, process hang, startup exception, heartbeat exception, environment error, package error or corruption, configuration error, accidental deletion, retrieval timeout, single point of failure in the system, asynchronous blocking synchronization, dependency timeout, dependency exception, business thread pool full, unreasonable flow control, monitoring error, OOM, load balancing failure, cache hotspot, cache rate limiting, database crash, memory preemption, context switching, power failure, unwritable, network jitter, packet loss, timeout, DNS failure, etc.
[0035] Specifically, the fault set can be obtained by: obtaining the fault set based on faults already stored in the computer; or by: obtaining the fault set through web crawling; or by: obtaining a recorded fault set. This embodiment of the invention does not impose any limitations on these methods.
[0036] S120, obtain single faults and combined faults based on the fault set.
[0037] Among them, a single fault refers to a fault in which the system can achieve a steady state under a single fault scenario, while a combined fault refers to a combination of faults in which the system still maintains a steady state. The conditions for the system to achieve a steady state are defined by the user. For example, the conditions for the system to achieve a steady state can be determined based on the requirements for the system's reliability, availability, and robustness in the system's non-functional requirements specification.
[0038] Specifically, the method for obtaining single faults and combined faults from the fault set can be as follows: obtain the fault set, filter the fault set, and obtain the single faults and combined faults in the fault set that can achieve steady state.
[0039] S130, determine the fault entity based on single faults and combined faults.
[0040] In this approach, all faults, both single and combined, are treated as fault entities, which are then used to define the entities for the subsequent generation of the knowledge graph. For example, if a single fault includes fault A, and combined faults include fault B and fault C, then fault A is defined as one fault entity, fault B as one fault entity, and fault C as one fault entity.
[0041] Specifically, the method for determining fault entities based on single faults and combined faults can be as follows: obtain a set of faults, select single faults and combined faults that can achieve steady state in the system based on the set of faults, and generate fault entities based on the determined single faults and combined faults.
[0042] S140, determine the relationship between faulty entities based on combined faults.
[0043] Here, "relationship" refers to the relationship between different fault entities in a combined fault. For example, a fault entity in a knowledge graph can be represented by D. If D1 = D2 + D3, then D1 and D2 have an inclusion relationship, and D1 and D3 also have an inclusion relationship. It is important to note that when obtaining the relationship between fault entities, it is possible to compare it with the fault entity relationship table already stored in the system.
[0044] Specifically, the method for determining the relationship between fault entities based on combined faults can be as follows: obtain a set of faults, obtain combined faults based on the set of faults, and obtain the relationship between the fault entities based on the fault entities in the combined faults.
[0045] S150, construct a knowledge graph based on the faulty entity, the relationship between the faulty entities, and the target attribute value of the faulty entity.
[0046] Among them, the faulty entity is determined by single faults and combined faults, the relationship between faulty entities is determined by combined faults, and the target attribute value of the faulty entity can be multiple attribute values of the faulty entity when constructing the knowledge graph. For example, the target attribute values of the faulty entity include: attribute values that characterize whether the faulty entity can keep the system in a steady state, and attribute values that characterize the priority of the faulty entity.
[0047] A knowledge graph consists of a series of interconnected entities and their attributes. It is a data storage structure describing entities and their relationships, oriented towards the integration, management, and value extraction of large-scale data sources from diverse sources. For example, a process hang can be represented as D1, and a killed process can be represented as D2. Relationships can be represented by numbers. If the number occupies two digits (XX), a maximum of 100 relationships can be stored. If this is insufficient, it can be further expanded, for example, by using three digits (XXX). Attributes represent the attribute values of faulty entities and can be represented by C. For example, C1 can represent a steady-state attribute, then the attribute value C1 = 1 for a faulty entity that meets the steady-state requirement. It should be noted that a faulty entity can have multiple attribute values; for example, C1 represents a steady-state attribute, and C2 represents a priority attribute.
[0048] Specifically, the way to construct a knowledge graph based on faulty entities, the relationships between faulty entities, and the target attribute values of faulty entities can be as follows: determine faulty entities based on single faults and combined faults, determine the relationships between faulty entities based on combined faults, determine the target attribute values of faulty entities, and construct a knowledge graph based on faulty entities, the relationships between faulty entities, and the target attribute values of faulty entities.
[0049] Optionally, obtain the target attribute values of the faulty entity, including:
[0050] The priority of faulty entities is determined based on their frequency of occurrence.
[0051] Obtain the identification information carried by the faults in the fault set;
[0052] The first attribute value of the faulty entity is determined based on the identification information carried by the fault.
[0053] The target attribute value of the faulty entity is determined based on the priority of the faulty entity and the first attribute value of the faulty entity.
[0054] The priority of a faulty entity is determined by its frequency of occurrence; higher frequency means higher priority, and lower frequency means lower priority. The frequency of occurrence is derived from historical data on system fault occurrences. Identification information refers to whether a fault in the fault set can maintain the system in a steady state. The first attribute value refers to the attribute value of the faulty entity that helps the system maintain a steady state. For example, the first attribute value can be represented by C1. The target attribute value is any attribute value within the faulty entity. For example, the target attribute value can be determined based on the faulty entity's priority and its first attribute value, or it can be determined based on the faulty entity's priority, its first attribute value, and other attribute values.
[0055] Specifically, the priority of faulty entities can be determined based on their frequency of occurrence. This can be achieved by analyzing the frequency of occurrence of various faulty entities and determining their priorities. For example, one could analyze the priorities among different faulty entities, using C2 to represent the priority. If the priorities are divided into three levels—high, medium, and low—the corresponding numbers are 1, 2, and 3 respectively, then C2 = {1, 2, 3}. If the priority is high, then C2 = 1.
[0056] Specifically, the identification information carried by faults in the fault set can be obtained in two ways: either by obtaining the identification information carried by faults based on the stored list of faults and fault identification information, or by manually labeling them based on one's own experience.
[0057] Specifically, the method for determining the first attribute value of a fault entity based on the identification information carried by the fault can be as follows: after obtaining the identification information carried by the faults in the fault set, determine whether the fault can keep the system in a steady state based on the identification information carried by the faults, and determine the first attribute value of the fault entity based on the identification information of the faults that can keep the system in a steady state. Alternatively, the method for determining the first attribute value of a fault entity based on the identification information carried by the fault can be as follows: select fault entities in the fault set, and determine the first attribute value based on the identification information carried by the fault entities.
[0058] Specifically, the method for determining the target attribute value of a faulty entity based on its priority and its first attribute value can be as follows: combine the priority and the first attribute value of the faulty entity to determine the target attribute value of the faulty entity. Alternatively, the method can be as follows: combine the priority, the first attribute value, and other attribute values of the faulty entity to determine the target attribute value of the faulty entity.
[0059] Optionally, a knowledge graph is constructed based on the faulty entity, the relationships between faulty entities, and the target attribute values of the faulty entity, including:
[0060] If the relationship between the faulty entities is an inclusion relationship, then the relationship between the faulty entities is split into a binary relationship;
[0061] A knowledge graph is constructed based on the faulty entity, the binary relationships between faulty entities, and the target attribute values of the faulty entity.
[0062] Here, a binary relation represents the relationship between two faulty entities.
[0063] Specifically, if the relationship between faulty entities is an inclusion relationship, the way to decompose the relationship between faulty entities into binary relations is as follows: If the relationship between faulty entities is an inclusion relationship, that is, at least three faulty entities form a combined faulty entity, the multivariate relationship between the combined faulty entities is decomposed into binary relations. For example, if the relationship between faulty entities is an inclusion relationship D1 = D2 + D3, this ternary relationship can be decomposed into binary relations (D1R31D2, D1R32D3). The decomposition calculation process is completed by the system and involves common knowledge of mathematics and discrete mathematics, which will not be elaborated here. The first number after R represents the number of ternary relation operations, and the second number is the calculation type, which can be defined as needed. For example, in the above (D1R31D2, D1R32D3), R31 and R32 represent the inclusion type in the ternary relationship. It should be noted that in addition to inclusion relationships, other multivariate relationships can also be decomposed into binary relations using the same method as inclusion relationships, which is more convenient for constructing knowledge graphs.
[0064] Specifically, the method for constructing a knowledge graph based on faulty entities, binary relationships between faulty entities, and target attribute values of faulty entities can be as follows: determine faulty entities based on single faults and combined faults, determine the relationships between faulty entities based on combined faults, decompose the multivariate relationships between faulty entities into binary relationships, determine the target attribute values of faulty entities, and construct a knowledge graph based on faulty entities, binary relationships between faulty entities, and target attribute values of faulty entities.
[0065] Figure 2 This is an example diagram of a knowledge graph from Embodiment 1 of the present invention, such as... Figure 2 As shown, a knowledge graph is presented, consisting of 8 faulty entities, 5 binary relations, and multiple attributes of each faulty entity. The actual system has a much larger knowledge graph than the example graph. Here, D represents a faulty entity, C represents the target attribute value of the faulty entity, and the connection between two faulty entities is a binary relation between them.
[0066] Optionally, after constructing the knowledge graph based on the faulty entities, the relationships between faulty entities, and the target attribute values of the faulty entities, the following steps are also included:
[0067] Generate a set of test cases based on the knowledge graph.
[0068] Among them, the test cases are system fault scenarios injected during chaos testing in chaos engineering. They are cases for verifying the scenarios required by the system to ensure steady state, and also cases for reasonably arranging the relevant combinations of scenarios required by the system to ensure steady state.
[0069] Specifically, the method for generating a test case set based on the knowledge graph is as follows: After generating the knowledge graph, all fault entities that can maintain the steady state of the system, the relationships between fault entities, and the target attribute values of fault entities can be found based on the knowledge graph. Test cases can be automatically generated based on all the fault entities that can maintain the steady state of the system, the relationships between fault entities, and the target attribute values of fault entities.
[0070] Optionally, a set of test cases can be generated based on the knowledge graph, including:
[0071] Query the knowledge graph to generate test cases based on faulty entities, or generate test cases based on faulty entities and faulty entities that are related to the faulty entities.
[0072] Specifically, the way to query the knowledge graph and generate test cases based on faulty entities, or based on faulty entities and faulty entities that are related to the faulty entities, can be as follows: if there is a single faulty entity, then generate test cases based on the single faulty entity; or if there are faulty entities that are related, then generate test cases based on the faulty entities and the relationships between the faulty entities.
[0073] Optionally, test cases can be generated based on the faulty entity and faulty entities that are related to the faulty entity, including:
[0074] By querying the knowledge graph, we can obtain the priority of the faulty entity and the priority of the faulty entities that are related to the faulty entity.
[0075] Test cases are generated based on the priority of the faulty entity and the priority of faulty entities that are related to it.
[0076] Specifically, the way to query the knowledge graph to obtain the priority of the faulty entity and the priority of other faulty entities that are related to the faulty entity can be: query the generated knowledge graph to find the priority of the faulty entity and the priority of other faulty entities that are related to the faulty entity.
[0077] Specifically, the method for generating test cases based on the priority of the faulty entity and the priority of the faulty entities related to the faulty entity can be as follows: generate test cases based on the faulty entity and the faulty entities related to the faulty entity, and determine new priorities based on the priorities of the relevant faulty entities used to generate the test cases. For example, in the knowledge graph, all fault entities D1 and D2 with binary combination steady-state relations, such as (D1R21D2), can be searched. Test cases can be generated based on two fault entities, with the fault scenario being the superposition of the two, and the priority is min(D1-C2, D2-C2). If the test focuses more on the combined fault scenario, the priority can be set to max(D1-C2, D2-C2). When generating test cases for ternary combination fault steady-state relations, binary combination relations (such as R31 and R32) split from ternary relations are searched in the knowledge graph. For example, three fault entities D1, D2, and D3 have a combination relation of (D1R31D2, D1R32D3). Test cases are generated based on the fault entities and combination relations, with the fault scenario being the superposition of the three, and the priority is min(D1-C2, D2-C2, D3-C2). If the test focuses more on the combined fault scenario, the priority can be set to max(D1-C2, D2-C2, D3-C2). Other methods for generating cases of multivariate steady-state relationships are as described above and will not be repeated here.
[0078] It should be noted that if the same faulty entity D2 participates in two ternary relations, such as (D1R31D2, D1R32D3) and (D1R31D2, D1R32D4), the relationships can be easily confused when analyzing R31 and R32. The number of digits after R can be expanded to indicate a pairing relationship. For example, it can be represented as (D1R310D2, D1R320D3) and (D1R311D2, D1R321D4), where R310 and R320 indicate the faulty entity is in one test case, and R311 and R321 indicate the faulty entity is in another test case. The method for expanding relations for the same faulty entity is similar.
[0079] Optional, also includes:
[0080] If the relationship between the first faulty entity and the second faulty entity is mutually exclusive, then the test case containing the first faulty entity and the second faulty entity will be deleted.
[0081] If the relationship between the first fault entity and the second fault entity is one of inclusion, then test cases are generated based on the test cases that include the first fault entity and the second fault entity.
[0082] If the relationship between the first fault entity and the second fault entity is causal, then test cases are generated based on test cases containing the first fault entity, the first fault entity, and the second fault entity.
[0083] The first and second fault entities are set to distinguish the constraints between faults and adjust the generated test cases; they are not fixed to specific fault entities. For example, power outage and data surge are mutually exclusive, so the first fault entity could be power outage and the second fault entity could be data surge; power outage and server crash are inclusive, so the first fault entity could be power outage and the second fault entity could be server crash; network outage and packet loss / timeout are causal, so the first fault entity could be network outage and the second fault entity could be packet loss / timeout.
[0084] Specifically, if the relationship between the first fault entity and the second fault entity is mutually exclusive, the method for deleting test cases containing the first fault entity and the second fault entity can be as follows: generate test cases based on the knowledge graph; if the relationship between the first fault entity and the second fault entity is mutually exclusive, check whether there are test cases containing the first fault entity and the second fault entity; if so, delete the test cases containing the first fault entity and the second fault entity.
[0085] Specifically, if the relationship between the first fault entity and the second fault entity is an inclusion relationship, the way to generate test cases based on test cases containing the first fault entity and the second fault entity can be as follows: generate test cases based on the knowledge graph; if the relationship between the first fault entity and the second fault entity is an inclusion relationship, check whether there is a test case containing the first fault entity; if there is, replace the first fault entity with the second fault entity, and generate new test cases based on the test cases containing the first fault entity and the second fault entity.
[0086] Specifically, if the relationship between the first fault entity and the second fault entity is causal, the method for generating test cases based on test cases containing the first fault entity, the first fault entity, and the second fault entity can be as follows: generate test cases based on the knowledge graph; if the relationship between the first fault entity and the second fault entity is causal, check whether there is a test case generated containing the first fault entity; if so, superimpose the first fault entity and the second fault entity to replace the first fault entity, and generate new test cases based on test cases containing the first fault entity, the first fault entity, and the second fault entity.
[0087] By automatically generating test cases through the multivariate steady-state relationships of fault entities, manpower and time are saved, and testing efficiency is significantly improved. Test cases can also be adjusted according to various fault constraints, making them more suitable for steady-state testing of chaotic experiments.
[0088] The technical solution of this embodiment obtains a fault set; obtains single faults and combined faults based on the fault set; determines fault entities based on single faults and combined faults; determines the relationships between fault entities based on combined faults; and constructs a knowledge graph based on the fault entities, the relationships between fault entities, and the target attribute values of the fault entities. This solves the problems of chaotic engineering test cases requiring manual construction, which is time-consuming, labor-intensive, inefficient, prone to errors, has low accuracy, and poor maintainability. The knowledge graph can more intuitively display the relationships between fault entities, facilitating management and maintenance, and improving later management efficiency. Constructing test cases based on the knowledge graph constructed in this embodiment can save time and manpower costs in constructing test cases.
[0089] Example 2
[0090] Figure 3 This is a schematic diagram of a knowledge graph generation device according to Embodiment 2 of the present invention. This embodiment is applicable to the generation of fault knowledge graphs in chaos engineering. The device can be implemented using software and / or hardware, and can be integrated into any device that provides knowledge graph generation functionality, such as... Figure 3As shown, the knowledge graph generation device specifically includes: a fault set acquisition module 210, a fault acquisition module 220, a fault entity determination module 230, a relationship determination module 240, and a knowledge graph construction module 250.
[0091] The fault set acquisition module 210 is used to acquire the fault set;
[0092] The fault acquisition module 220 is used to acquire single faults and combined faults based on the fault set.
[0093] Fault entity determination module 230 is used to determine fault entities based on single faults and combined faults;
[0094] Relationship determination module 240 is used to determine the relationship between fault entities based on combined faults;
[0095] The knowledge graph construction module 250 is used to construct a knowledge graph based on faulty entities, the relationships between faulty entities, and the target attribute values of faulty entities.
[0096] Optionally, the knowledge graph construction module is specifically used for:
[0097] The priority of faulty entities is determined based on their frequency of occurrence.
[0098] Obtain the identification information carried by the faults in the fault set;
[0099] The first attribute value of the faulty entity is determined based on the identification information carried by the fault.
[0100] The target attribute value of the faulty entity is determined based on the priority of the faulty entity and the first attribute value of the faulty entity.
[0101] Optionally, the knowledge graph construction module is specifically used for:
[0102] If the relationship between the faulty entities is an inclusion relationship, then the relationship between the faulty entities is split into a binary relationship;
[0103] A knowledge graph is constructed based on the faulty entity, the binary relationships between faulty entities, and the target attribute values of the faulty entity.
[0104] Optional, also includes:
[0105] The test case set generation module is used to generate test case sets based on the knowledge graph.
[0106] Optionally, the test case set generation module is specifically used for:
[0107] Query the knowledge graph to generate test cases based on faulty entities, or generate test cases based on faulty entities and faulty entities that are related to the faulty entities.
[0108] Optionally, the test case set generation module is specifically used for:
[0109] By querying the knowledge graph, we can obtain the priority of the faulty entity and the priority of the faulty entities that are related to the faulty entity.
[0110] Test cases are generated based on the priority of the faulty entity and the priority of faulty entities that are related to it.
[0111] Optionally, the test case set generation module is further used for:
[0112] If the relationship between the first faulty entity and the second faulty entity is mutually exclusive, then the test case containing the first faulty entity and the second faulty entity will be deleted.
[0113] If the relationship between the first fault entity and the second fault entity is one of inclusion, then test cases are generated based on the test cases that include the first fault entity and the second fault entity.
[0114] If the relationship between the first fault entity and the second fault entity is causal, then test cases are generated based on test cases containing the first fault entity, the first fault entity, and the second fault entity.
[0115] The above-described products can perform the methods provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects for performing the methods.
[0116] The technical solution of this embodiment obtains a fault set; obtains single faults and combined faults based on the fault set; determines fault entities based on single faults and combined faults; determines the relationships between fault entities based on combined faults; and constructs a knowledge graph based on the fault entities, the relationships between fault entities, and the target attribute values of the fault entities. This solves the problems of chaotic engineering test cases requiring manual construction, which is time-consuming, labor-intensive, inefficient, prone to errors, has low accuracy, and poor maintainability. The knowledge graph can more intuitively display the relationships between fault entities, facilitating management and maintenance, and improving later management efficiency. Constructing test cases based on the knowledge graph constructed in this embodiment can save time and manpower costs in constructing test cases.
[0117] Example 3
[0118] Figure 4This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0119] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0120] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0121] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as knowledge graph generation methods.
[0122] In some embodiments, the knowledge graph generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the knowledge graph generation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the knowledge graph generation method by any other suitable means (e.g., by means of firmware).
[0123] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0125] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0127] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0128] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0129] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0130] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A knowledge graph generation method, characterized in that, The method comprises the following steps: acquiring a fault set; acquiring single faults and combined faults according to the fault set; determining fault entities according to the single faults and the combined faults; determining relationships between the fault entities according to the combined faults; constructing a knowledge graph according to the fault entities, the relationships between the fault entities and target attribute values of the fault entities; wherein, the target attribute values of the fault entities are acquired by: determining priorities of the fault entities according to occurrence frequencies of the fault entities; acquiring identification information carried by the faults in the fault set; determining first attribute values of the fault entities according to the identification information carried by the faults; determining target attribute values of the fault entities according to the priorities of the fault entities and the first attribute values of the fault entities; the determination of the first attribute values of the fault entities according to the identification information carried by the faults comprises: judging whether the faults make the system keep steady state according to the identification information carried by the faults, and determining the first attribute values of the fault entities according to the identification information of the faults that make the system keep steady state; the construction of the knowledge graph according to the fault entities, the relationships between the fault entities and the target attribute values of the fault entities comprises: if the relationships between the fault entities are inclusion relationships, then the relationships between the fault entities are split into binary relationships; constructing the knowledge graph according to the fault entities, the binary relationships between the fault entities and the target attribute values of the fault entities.
2. The method of claim 1, wherein, After the construction of the knowledge graph according to the fault entities, the relationships between the fault entities and the target attribute values of the fault entities, the method further comprises: generating a test case set according to the knowledge graph.
3. The method of claim 2, wherein, The generation of the test case set according to the knowledge graph comprises: inquiring the knowledge graph to generate a test case according to a fault entity, or to generate a test case according to a fault entity and a fault entity having an associated relationship with the fault entity.
4. The method of claim 3, wherein, The generation of the test case according to a fault entity and a fault entity having an associated relationship with the fault entity comprises: inquiring the knowledge graph to obtain priorities of the fault entity and the fault entity having the associated relationship with the fault entity; generating the test case according to the priorities of the fault entity and the fault entity having the associated relationship with the fault entity.
5. The method of claim 4, wherein, The method further comprises: if a relationship between a first fault entity and a second fault entity is a mutual exclusion relationship, then deleting a test case containing the first fault entity and the second fault entity; if the relationship between the first fault entity and the second fault entity is an inclusion relationship, then generating a test case according to a test case containing the first fault entity and the second fault entity; if the relationship between the first fault entity and the second fault entity is a cause-effect relationship, then generating a test case according to a test case containing the first fault entity, the first fault entity and the second fault entity.
6. A knowledge graph generation apparatus, characterized by comprising: The method comprises the following steps: a fault set acquisition module, configured to acquire a fault set; a fault acquisition module, configured to acquire single faults and combined faults according to the fault set; a fault entity determination module, configured to determine fault entities according to the single faults and the combined faults; a relationship determination module, configured to determine relationships between the fault entities according to the combined faults; a knowledge graph construction module, configured to construct a knowledge graph according to the fault entities, the relationships between the fault entities and target attribute values of the fault entities; the knowledge graph construction module is specifically configured to: Determine a priority of the fault entity according to a frequency of occurrence of the fault entity; Obtain identification information carried by the fault in the fault set; Determine a first attribute value of the fault entity according to the identification information carried by the fault; Determine a target attribute value of the fault entity according to the priority of the fault entity and the first attribute value of the fault entity; The determining of the first attribute value of the fault entity according to the identification information carried by the fault comprises: Determining whether the fault causes the system to remain in a steady state according to the identification information carried by the fault, and determining the first attribute value of the fault entity according to the identification information of the fault that causes the system to remain in the steady state; The knowledge graph construction module is specifically configured to: If the relationship between the fault entities is a containing relationship, split the relationship between the fault entities into a binary relationship; Construct a knowledge graph according to the fault entity, the binary relationship between the fault entities, and the target attribute value of the fault entity.
7. An electronic device, comprising: The electronic device comprises: At least one processor; and A memory connected in communication with the at least one processor; wherein The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the knowledge graph generation method in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing the processor to execute the knowledge graph generation method in any one of claims 1-5 when executed.
Citation Information
Patent Citations
Fault data processing method and device and terminal equipment
CN114201609A
Chaotic engineering fault assessment method based on FMEA
CN115033415A
Construction method and diagnosis method of fault diagnosis knowledge graph of production equipment
CN115146081A