Case relationship query method, device and equipment and readable storage medium
By performing multi-hop query in the case relationship diagram, selecting the closest node to jump until the target case reaches the target case, the problem of inefficiency in traditional recursive algorithms when querying large-scale case relationships is solved, and fast and accurate case relationship query is achieved.
Patent Information
- Application Number
- CN202510273603.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-06
AI Technical Summary
When traditional recursive algorithms query case relationships in large-scale business systems, they require a lot of time and computing resources, resulting in inefficient query.
By conducting multiple jump query on the starting node in the case relationship diagram, select the closest node each time, until it jumps to the end node where the target case is located, record the target jump path, and then determine the case relationship.
It realizes the rapid and accurate query of case relationships between cases in different data sources, and significantly improves query efficiency compared with traditional recursive query algorithms.
Smart Images

Figure CN120104842A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data analysis, and in particular to a method, device, computer equipment and readable storage medium for querying case relations. Background Art
[0002] In most business systems, such as insurance claims systems, bank settlement systems, and online medical consultation service management systems, it is necessary to query or analyze the case relationships between different cases. Traditional recursive algorithms usually use a layer-by-layer traversal of nodes to query, which requires a lot of time and computing resources. However, in actual applications, due to the huge amount of data, the distance between nodes is often very large, resulting in a very large amount of calculation, which reduces the efficiency of querying case relationships.
[0003] Therefore, how to improve the efficiency of case relationship queries has become an urgent problem to be solved. Summary of the invention
[0004] The present application provides a case relationship query method, apparatus, computer equipment and readable storage medium, which can realize fast and accurate query of case relationships between cases in different data sources. Compared with the traditional recursive query algorithm, it can effectively improve the query efficiency of case relationships.
[0005] In a first aspect, the present application provides a method for querying case relations, the method comprising:
[0006] Determine a first case and a second case to be queried; determine a starting node corresponding to the first case in a preset case relationship graph, wherein the case relationship graph includes a plurality of nodes, each node corresponds to a case, and an edge between two adjacent nodes corresponds to a relationship between the two cases; in the case relationship graph, perform a multi-hop query on the starting node, select the node closest to the starting node for each jump, until the jump is to the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node; determine the case relationship query result between the first case and the second case based on the target jump path between the starting node and the end node.
[0007] In a second aspect, the present application further provides a case relationship query device, the case relationship query device comprising:
[0008] A case determination module, used to determine a first case and a second case to be queried;
[0009] A starting node determination module, used to determine the starting node corresponding to the first case in a preset case relationship graph, wherein the case relationship graph includes a plurality of nodes, each node corresponds to a case, and an edge between two adjacent nodes corresponds to a relationship between the two cases;
[0010] A multi-hop query module, used to perform a multi-hop query on the starting node in the case relationship graph, select the node closest to the starting node for each jump, and jump to the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node;
[0011] A query result determination module is used to determine the case relationship query result between the first case and the second case according to the target jump path between the starting node and the end node.
[0012] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;
[0013] The memory is used to store computer programs;
[0014] The processor is used to execute the computer program and implement the case relationship query method as described above when executing the computer program.
[0015] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the case relationship query method as described above.
[0016] The present application discloses a case relationship query method, device, computer equipment and readable storage medium, the method comprising: determining a first case and a second case to be queried; determining a starting node corresponding to the first case in a preset case relationship graph, the case relationship graph comprising a plurality of nodes, each node corresponding to a case, and the edge between two adjacent nodes corresponding to the relationship between the two cases; in the case relationship graph, performing a multi-hop query on the starting node, selecting the node with the closest distance for each jump, until jumping to the terminal node where the second case is located, stopping the multi-hop query, and recording the target jump path between the starting node and the terminal node; determining the case relationship query result between the first case and the second case according to the target jump path between the starting node and the terminal node. The embodiment of the present application performs a multi-hop query on the starting node in the case relationship graph, selecting the node with the closest distance for each jump, until jumping to the terminal node where the second case is located, and determining the best path by minimizing the distance, so as to realize fast and accurate query of case relationships between cases in different data sources, and can effectively improve the query efficiency of case relationships compared with the traditional recursive query algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 is a structural schematic diagram of a computer device provided in an embodiment of the present application;
[0019] Figure 2 It is a schematic flow chart of a case relationship query method provided in an embodiment of the present application;
[0020] Figure 3 It is a schematic diagram of a case relationship diagram provided in an embodiment of the present application;
[0021] Figure 4 is a schematic flow chart of another case relationship query method provided in an embodiment of the present application;
[0022] Figure 5 It is a schematic block diagram of a case relationship query device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0025] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0026] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0027] At present, traditional recursive algorithms usually use the method of traversing nodes layer by layer to query, which requires a lot of time and computing resources. However, in practical applications, due to the huge amount of data, the distance between nodes is often very large, resulting in a very large amount of calculation, which reduces the efficiency of case relationship query.
[0028] To this end, the embodiments of the present application provide a case relationship query method, device, computer equipment and readable storage medium. Among them, the case relationship query method can be applied to a computer device, based on the shortestPath strategy multi-hop query algorithm, a multi-hop query is performed on the starting node in the case relationship graph, each jump selects the node closest to jump until it jumps to the end node where the second case is located, and the optimal path is determined by minimizing the distance, so that the case relationship between cases in different data sources can be queried quickly and accurately, and compared with the traditional recursive query algorithm, the query efficiency of the case relationship can be effectively improved.
[0029] Exemplarily, the computer device can be a server or a terminal. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal can be an electronic device such as a smartphone, tablet computer, laptop computer, and desktop computer.
[0030] See also Figure 1 , Figure 1 1 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device may include a processor and a memory, wherein the processor and the memory may be connected via a bus, and the bus may be any applicable bus such as an Inter-integrated Circuit (I2C) bus.
[0031] The memory may include a storage medium and an internal memory. The storage medium may be a non-volatile storage medium or a volatile storage medium. The storage medium may store an operating system and a computer program, and the internal memory provides an environment for the operation of the computer program in the storage medium. The computer program includes program instructions, and when the program instructions are executed, the processor may execute the case relationship query method described in any embodiment.
[0032] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0033] The processor may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or any conventional processor.
[0034] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0035] Determine the first case and the second case to be queried; determine the starting node corresponding to the first case in a preset case relationship graph, the case relationship graph includes multiple nodes, each node corresponds to a case, and the edge between two adjacent nodes corresponds to the relationship between the two cases; in the case relationship graph, perform a multi-hop query on the starting node, select the node closest to jump each time, until jumping to the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node; determine the case relationship query result between the first case and the second case according to the target jump path between the starting node and the end node.
[0036] In one embodiment, the processor performs a multi-hop query on the starting node in the case relationship graph, and selects the nearest node for each jump, so as to implement:
[0037] Determine at least one adjacent node that is shared or interconnected with an edge of a starting node; determine a path distance between the starting node and at least one adjacent node; determine an adjacent node with the shortest path distance as a target node, and jump to the target node, wherein each node performs one jump.
[0038] In one embodiment, when determining the path distance between the starting node and at least one adjacent node, the processor is configured to implement:
[0039] Determine a weight value corresponding to an edge between a starting node and at least one adjacent node; based on a graph theory algorithm, determine a path distance between the starting node and at least one adjacent node according to the weight value corresponding to the edge between the starting node and at least one adjacent node.
[0040] In one embodiment, before determining the weight value corresponding to the edge between the starting node and at least one adjacent node, the processor is further configured to implement:
[0041] Based on the importance value of the relationship between two cases corresponding to the edge between two adjacent nodes in the case relationship graph, a weight value corresponding to the edge between two adjacent nodes is determined, wherein the weight value is positively correlated with the importance value.
[0042] In one embodiment, after recording the target jump path between the start node and the end node, the processor is further configured to implement:
[0043] If the historical shortest path between the start node and the end node is found from the preset shortest path set, determine whether the length of the target jump path is less than the length of the historical shortest path; if so, update the historical shortest path in the shortest path set according to the target jump path.
[0044] In one embodiment, when determining the case relationship query result between the first case and the second case according to the target jump path between the start node and the end node, the processor is used to implement:
[0045] According to each intermediate node on the target jump path, the intermediate case between the first case and the second case is determined; according to the edges between adjacent nodes on the target jump path, the case relationship between two adjacent cases is determined; according to the first case, the second case, the intermediate case and the case relationship between two adjacent cases, the case relationship query result is determined.
[0046] In one embodiment, before determining the starting node corresponding to the first case in the preset case relationship graph, the processor is configured to implement:
[0047] Obtain case information from at least one preset data source, where the case information includes multiple cases and case relationships between different cases; construct a relationship graph based on the multiple cases and case relationships between different cases to obtain a case relationship graph, wherein a corresponding node in the case relationship graph is generated according to each case, and edges between corresponding adjacent nodes in the case relationship graph are generated according to the case relationships between different cases.
[0048] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features of the embodiments can be combined with each other. Figure 2 , Figure 2 FIG. 1 is a schematic flow chart of a case relationship query method provided in an embodiment of the present application. Figure 2 As shown, the case relationship query method may include steps S101 to S103.
[0049] Step S101: Determine a first case and a second case to be queried.
[0050] The case relationship query method provided in the embodiment of the present application can be applied to a business system, wherein the business system may include but is not limited to an insurance claim system, a bank settlement system, an online shopping transaction system, an online medical consultation service management system, etc. For example, the case may be a claim case, a medical case, a loan case, etc. In the embodiment of the present application, a claim case will be taken as an example for explanation.
[0051] Exemplarily, the first case is a case specified by the user. For example, when the user needs to query the case relationship between claim case A and other cases, claim case A can be determined as the first case to be queried.
[0052] In some embodiments, the second case is a case specified by the user, or the second case is a case that has at least one common feature with the first case. The features may include case number, case type, time of case occurrence, location of case occurrence, persons involved in the case, etc. Exemplarily, the second case may be a claim case specified by the user, for example, claim case B. The second case may also be a case that has the same features as the first case, for example, claim case C that has similar features to claim case A, such as accident type, loss amount, time, etc., is taken as the second case. It should be noted that the second case is not necessarily a known case, and a case that needs to be obtained through query.
[0053] In the above embodiment, by configuring the second case as a case specified by the user, it is possible to query the case relationship between the first case and the known second case. By configuring the second case as a case that has at least one common feature with the first case, it is possible to query similar cases that have the same or similar features as the first case. The query scope is wider, which can meet the different needs of users and improve the user experience.
[0054] Step S102: determine the starting node corresponding to the first case in a preset case relationship graph, where the case relationship graph includes multiple nodes, each node corresponds to a case, and an edge between two adjacent nodes corresponds to the relationship between the two cases.
[0055] In the embodiment of the present application, the preset case relationship diagram is constructed based on case information in different data sources in advance. The following will describe in detail how to construct the case relationship diagram.
[0056] In some embodiments, before determining the starting node corresponding to the first case in the preset case relationship graph, it also includes: obtaining case information from at least one preset data source, the case information including multiple cases and case relationships between different cases; constructing a relationship graph based on the case relationships between multiple cases and different cases to obtain a case relationship graph, wherein a corresponding node in the case relationship graph is generated according to each case, and edges between corresponding adjacent nodes in the case relationship graph are generated according to the case relationships between different cases.
[0057] In the embodiment of the present application, the construction of the case relationship diagram may include the following steps:
[0058] 1. Data collection and preprocessing:
[0059] For example, case information, such as claim case information, can be collected from different data sources (such as databases, files, APIs, etc.). The collected case information is preprocessed, including deduplication and normalization. Deduplication is used to ensure that each claim case is recorded only once, and normalization is used to convert case information in different formats or units into a unified format or unit to reduce the amount of data and calculations and improve the efficiency of subsequent processing.
[0060] Exemplarily, claim case information may include various data directly related to the claim case, such as case number, case type, accident time, accident location, persons involved (such as policyholder, insured, beneficiary), loss details (such as loss amount, lost items), claim status, compensation amount, compensation object, etc.
[0061] 2. Determine nodes and edges:
[0062] Node: Each claim case is regarded as a node, which may contain various information related to the claim case, such as case number, case type, accident time, persons involved, etc.
[0063] Edge: The case relationship between two claims cases is considered an edge. This case relationship can be based on some logic or business rules, such as two cases involving the same accident, the same person, similar accident type or location, etc. Optionally, the weight of the edge can be set to indicate the importance or closeness of the case relationship.
[0064] Exemplarily, case relationships may include the same accident relationship, the same personnel relationship, similar feature relationship, time sequence relationship and compensation relationship.
[0065] Among them, the same accident association: two claims cases may involve the same accident. For example, the same car accident may cause damage to multiple vehicles and casualties, resulting in multiple claims cases.
[0066] Same person association: Two claims may involve the same person. For example, the same insured may have two accidents at different times or locations, resulting in two claims.
[0067] Similar feature association: Two claims may have similar features, such as accident type, accident location, loss type, etc. This similarity may indicate that there is some underlying connection or pattern between them.
[0068] Time sequence relationship: Two claims may have a certain time sequence relationship. For example, one claim may lead to the occurrence of another claim, or the two claims may occur consecutively in the same time period.
[0069] Payment correlation: Two claims cases may be related in terms of payment. For example, the payment of one claim case may affect the payment amount or payment method of another claim case.
[0070] 3. Construct case relationship diagram:
[0071] A graph data structure (such as an adjacency matrix, an adjacency list, etc.) can be used to represent the case relationship graph between claim cases. Based on the preprocessed data and the determined nodes and edges, each claim case is added to the graph as a node, and edges are added according to the relationship between them.
[0072] 4. Improve the case relationship diagram:
[0073] Check whether the case relationship graph is complete and ensure that all relevant claims cases and the case relationships between them are correctly represented. Optionally, the case relationship graph can be further optimized or adjusted according to actual conditions, such as merging duplicate nodes, deleting irrelevant edges, etc.
[0074] See also Figure 3 , Figure 3 is a schematic diagram of a case relationship diagram provided in an embodiment of the present application, such as Figure 3 As shown in the figure, each triangle in the case relationship graph is a node, each node corresponds to a case, and the edge between two adjacent nodes corresponds to the relationship between the two cases. The numbers and letters in the triangle (such as "V", "Ⅲ", "IV", etc.) represent the specific identifier or classification of the case. The arrows represent the relationship between the cases, which can be causal, chronological, or other related relationships. The combination of numbers and letters represents the attributes or status codes between cases, which are used to further refine the case relationship. For example, if the status code (010) of node V points to node II, it means that node V has a direct relationship with node II in a certain state (010).
[0075] In the above embodiment, by constructing a case relationship graph based on case information in different data sources, a graph theory algorithm can be applied to the constructed case relationship graph to calculate the shortest path from each claim case to all other cases, so that the case relationship between claim cases can be queried quickly and accurately between different data sources, thereby improving the efficiency and accuracy of claim settlement. In the embodiment of the present application, nodes can also be added to the case relationship graph, thereby improving scalability and adapting to large-scale data analysis and processing needs.
[0076] Exemplarily, when determining the starting node corresponding to the first case in the preset case relationship graph, since the node in the case relationship graph contains the case number corresponding to the case, the corresponding node can be searched in the case relationship graph according to the case number of the first case, and the node corresponding to the case number of the first case can be determined as the starting node.
[0077] Step S103: In the case relationship diagram, perform a multi-hop query on the starting node, select the node closest to the starting node for each jump, until the jump reaches the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node.
[0078] Exemplarily, based on the shortestPath strategy multi-hop query algorithm, a multi-hop query can be performed on the starting node in the case relationship graph, and each jump selects the node with the closest distance to jump. Among them, a multi-hop query refers to starting from a claim case (starting node) in the case relationship graph, and performing multiple jumps by selecting the nearest neighbor node, and finally reaching the end node. In an embodiment of the present application, the calculated shortest path can be used to guide the multi-hop query, ensuring that each jump selects the neighbor node with the shortest distance, so as to quickly and accurately find the relevant claim cases. The multi-hop query of the starting node will be described in detail below.
[0079] See also Figure 4 , Figure 4 FIG. 1 is a schematic flow chart of another method for querying case relationships provided in an embodiment of the present application. Figure 4 As shown, step S103 may include steps S1031 to S1033.
[0080] Step S1031: Determine at least one adjacent node that is shared or interconnected with the edge of the start node.
[0081] For example, Figure 3 As shown, when the starting node is node V, the adjacent nodes that share or are interconnected with the edge of node V may include node II, node IV, and node VI.
[0082] Step S1032: Determine the path distance between the start node and at least one adjacent node.
[0083] Exemplarily, after determining at least one adjacent node that is shared or interconnected with the edge of the start node, the path distance between the start node and the at least one adjacent node may be calculated.
[0084] In some embodiments, determining the path distance between the starting node and at least one adjacent node includes: determining the path distance between the starting node and at least one adjacent node based on a graph theory algorithm.
[0085] For example, the shortest path distance between the starting node and at least one adjacent node can be calculated based on graph theory algorithms such as Dijkstra algorithm and Bellman-Ford algorithm. The calculation process of the shortest path distance can refer to the relevant technology and will not be described in detail here.
[0086] The above embodiment can quickly and accurately find the optimal query path by calculating the path distance between the starting node and at least one adjacent node based on a graph theory algorithm. Compared with the traditional recursive query algorithm, there is no need to traverse each node, thereby improving the efficiency and accuracy of querying case relationships.
[0087] In other embodiments, determining the path distance between a starting node and at least one adjacent node includes: determining a weight value corresponding to an edge between the starting node and at least one adjacent node; and determining the path distance between the starting node and at least one adjacent node based on a graph theory algorithm and the weight value corresponding to the edge between the starting node and at least one adjacent node.
[0088] It should be noted that in the embodiment of the present application, when the node includes a weight value corresponding to the edge, the path distance can be calculated according to the weight value corresponding to the edge. Since the size of the weight can reflect the importance of the case relationship between cases or the cost considered during the query, increasing the weight value corresponding to the edge to calculate the path distance can improve the accuracy of the path distance, thereby improving the accuracy of the query case relationship.
[0089] Among them, based on graph theory algorithms such as Dijkstra algorithm and Bellman-Ford algorithm, the shortest path distance between the starting node and at least one adjacent node can be determined according to the weight value corresponding to the edge between the starting node and at least one adjacent node.
[0090] In some embodiments, before determining the weight value corresponding to the edge between the starting node and at least one adjacent node, it also includes: based on the importance value of the relationship between two cases corresponding to the edge between two adjacent nodes in the case relationship graph, determining the weight value corresponding to the edge between two adjacent nodes, wherein the weight value is positively correlated with the importance value.
[0091] For example, the greater the importance value of the relationship between two cases, the greater the weight value corresponding to the edge between the two adjacent nodes; the smaller the importance value of the relationship between two cases, the smaller the weight value corresponding to the edge between the two adjacent nodes. By configuring the weight value corresponding to the edge between two adjacent nodes to be positively correlated with the importance value of the relationship between the two cases, the weight value can reflect the importance value of the relationship between the cases, so that when querying case relationships, cases with stronger correlation can be queried, improving the accuracy of the query.
[0092] The above embodiment, by calculating the path distance between the starting node and at least one adjacent node based on the graph theory algorithm according to the weight value corresponding to the edge between the starting node and at least one adjacent node, can quickly and accurately find the optimal query path, further improving the efficiency and accuracy of querying case relationships.
[0093] Step S1033: determine the adjacent node with the shortest path distance as the target node, and jump to the target node, wherein each node performs one jump.
[0094] Exemplarily, after determining the path distance between the start node and at least one adjacent node, the adjacent node with the shortest path distance may be determined as the target node, and the node is jumped to the target node, wherein each node performs one jump.
[0095] like Figure 3 As shown, when the starting node is node V, if it is determined that the path distance between node IV and node V is the shortest, node IV is determined as the target node and the process jumps to node IV. Then, at least one adjacent node that is shared or interconnected with the edge of node IV is determined, and the adjacent node with the shortest path distance is determined as the target node, and the process jumps to the target node, and so on, until the process jumps to the end node where the second case is located.
[0096] In the embodiment of the present application, each node performs a jump once, which can avoid repeated jumps to the same node, thereby minimizing the amount of calculation and time cost, and improving the query efficiency and accuracy of case relationships.
[0097] In some embodiments, the target jump path between the start node and the end node is recorded. For example, the node to which each jump is made and the edges between the nodes can be recorded. It should be noted that by recording the target jump path between the start node and the end node, a case relationship query result can be generated based on the target jump path later.
[0098] In the embodiment of the present application, after recording the target jump path between the starting node and the end node, the preset shortest path set can also be updated. The shortest path set can include the shortest paths between different claims cases, which are used for the graph theory algorithm to calculate the path distance between different nodes.
[0099] In some embodiments, after recording the target jump path between the start node and the end node, it also includes: if the historical shortest path between the start node and the end node is queried from a preset shortest path set, determining whether the length of the target jump path is less than the length of the historical shortest path; if so, updating the historical shortest path in the shortest path set according to the target jump path.
[0100] Exemplarily, if the length of the target jump path is less than the length of the historical shortest path, the historical shortest path in the shortest path set is updated according to the target jump path. For example, if the starting node A can reach the end node C through the adjacent node B, and this path is shorter than the path from the starting node A directly to the end node C, then the shortest path from the starting node A to the end node C needs to be updated.
[0101] The update process may include deleting an existing longer path, adding a new shorter path, or adjusting the priority of the path.
[0102] In the above embodiment, by updating the historical shortest path in the shortest path set according to the target jump path when determining whether the length of the target jump path is less than the length of the historical shortest path, a dynamic update mechanism can be used to update the shortest paths between different nodes, ensuring that the latest shortest path is used each time a case relationship is queried, thereby improving the efficiency and accuracy of querying case relationships. In addition, by adopting a dynamic update mechanism, graph theory algorithms can be helped to maintain efficient operation when facing large-scale data sets and complex case relationship graphs.
[0103] Step S104: Determine the case relationship query result between the first case and the second case according to the target jump path between the start node and the end node.
[0104] Exemplarily, after recording the target jump path between the start node and the end node, the case relationship query result between the first case and the second case can be determined according to the target jump path between the start node and the end node.
[0105] In some embodiments, determining the case relationship query result between the first case and the second case based on the target jump path between the starting node and the end node may include: determining the intermediate case between the first case and the second case based on the intermediate nodes on the target jump path; determining the case relationship between two adjacent cases based on the edges between adjacent nodes on the target jump path; determining the case relationship query result based on the case relationship between the first case, the second case, the intermediate case and the two adjacent cases.
[0106] Exemplarily, since each node in the case relationship graph corresponds to a case, the intermediate case between the first case and the second case can be determined according to each intermediate node on the target jump path. For example, the intermediate cases between the first case and the second case include case 3, case 4, and case 5 in sequence.
[0107] Exemplarily, the case relationship between two adjacent cases is determined based on the edge between adjacent nodes on the target jump path. The case relationship between the first case and case 3 can be determined based on the edge between the node where the first case is located and the node where case 3 is located, and the case relationship between case 3 and case 4 can be determined based on the edge between the node where case 3 is located and the node where case 4 is located. For example, the first case and case 3 are cases associated with the same accident, and case 3 and case 4 are cases associated with the same person.
[0108] Exemplarily, after determining the case relationship between two adjacent cases, the first case, the second case, the intermediate case, and the case relationship between two adjacent cases may be determined as case relationship query results.
[0109] In the above embodiment, by performing a multi-hop query on the starting node in the case relationship graph, the node closest to the starting node is selected for each jump until the jump is to the end node where the second case is located. The optimal path is determined by minimizing the distance, and the case relationship between cases in different data sources can be queried quickly and accurately. Compared with the traditional recursive query algorithm, the query efficiency of case relationships can be effectively improved.
[0110] See also Figure 5 , Figure 5 The embodiment of the present application further provides a schematic block diagram of a case relationship query device 1000, which is used to execute the aforementioned case relationship query method. The case relationship query device 1000 can be configured in a computer device.
[0111] like Figure 5 As shown, the case relationship query device 1000 includes: a case determination module 1001, a start node determination module 1002, a multi-hop query module 1003 and a query result determination module 1004.
[0112] The case determination module 1001 is used to determine a first case and a second case to be queried.
[0113] The starting node determination module 1002 is used to determine the starting node corresponding to the first case in the preset case relationship diagram. The case relationship diagram includes multiple nodes, each node corresponds to a case, and the edge between two adjacent nodes corresponds to the relationship between the two cases.
[0114] The multi-hop query module 1003 is used to perform a multi-hop query on the starting node in the case relationship diagram, select the nearest node for each jump, until jumping to the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node.
[0115] The query result determination module 1004 is used to determine the case relationship query result between the first case and the second case according to the target jump path between the start node and the end node.
[0116] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0117] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program. The computer program includes program instructions. The processor executes the program instructions to implement any case relationship query method provided in the embodiment of the present application.
[0118] For example, the program is loaded by the processor and may execute the following steps:
[0119] Determine the first case and the second case to be queried; determine the starting node corresponding to the first case in a preset case relationship graph, the case relationship graph includes multiple nodes, each node corresponds to a case, and the edge between two adjacent nodes corresponds to the relationship between the two cases; in the case relationship graph, perform a multi-hop query on the starting node, select the node closest to jump each time, until jumping to the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node; determine the case relationship query result between the first case and the second case according to the target jump path between the starting node and the end node.
[0120] The computer-readable storage medium may be an internal storage unit of the computer device of the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (Flash Card), etc. equipped on the computer device.
[0121] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0122] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0123] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A case relationship query method, characterized in that: include: Determine the first case and the second case to be queried; Determine a starting node corresponding to the first case in a preset case relationship graph, wherein the case relationship graph includes a plurality of nodes, each node corresponds to a case, and an edge between two adjacent nodes corresponds to a relationship between the two cases; In the case relationship graph, a multi-hop query is performed on the starting node, and each time a jump is performed, the node closest to the starting node is selected for jumping, until the jump is to the end node where the second case is located, the multi-hop query is stopped, and the target jump path between the starting node and the end node is recorded; According to the target jump path between the starting node and the end node, a case relationship query result between the first case and the second case is determined.
2. The case relationship query method according to claim 1, characterized in that: In the case relationship graph, performing a multi-hop query on the starting node, and selecting the nearest node for each jump, includes: Determine at least one adjacent node that is shared or interconnected with an edge of the start node; Determining a path distance between the starting node and at least one of the adjacent nodes; The adjacent node with the shortest path distance is determined as the target node, and the node is jumped to the target node, wherein each node performs one jump.
3. The case relationship query method according to claim 2, characterized in that: The determining of the path distance between the starting node and at least one of the adjacent nodes comprises: Determine a weight value corresponding to an edge between the starting node and at least one of the adjacent nodes; Based on a graph theory algorithm, a path distance between the starting node and at least one of the adjacent nodes is determined according to a weight value corresponding to an edge between the starting node and at least one of the adjacent nodes.
4. The case relationship query method according to claim 3, characterized in that: Before determining the weight value corresponding to the edge between the starting node and at least one of the adjacent nodes, the method further includes: Based on the importance value of the relationship between two cases corresponding to the edge between two adjacent nodes in the case relationship graph, a weight value corresponding to the edge between the two adjacent nodes is determined, wherein the weight value is positively correlated with the importance value.
5. The case relationship query method according to claim 1, characterized in that: After recording the target jump path between the starting node and the end node, the method further includes: If the historical shortest path between the starting node and the end node is found from the preset shortest path set, determining whether the length of the target jump path is less than the length of the historical shortest path; If so, the historical shortest path in the shortest path set is updated according to the target jump path.
6. The case relationship query method according to claim 1, characterized in that: The determining, according to the target jump path between the starting node and the end node, a case relationship query result between the first case and the second case includes: Determine, according to each intermediate node on the target jump path, an intermediate case between the first case and the second case; Determining the case relationship between two adjacent cases according to the edges between adjacent nodes on the target jump path; The case relationship query result is determined according to the case relationship between the first case, the second case, the intermediate case and two adjacent cases.
7. The case relationship query method according to any one of claims 1 to 6, characterized in that: Before determining the starting node corresponding to the first case in the preset case relationship graph, the method further includes: Acquire case information from at least one preset data source, wherein the case information includes multiple cases and case relationships between different cases; A relationship graph is constructed based on the multiple cases and the case relationships between the different cases to obtain the case relationship graph, wherein a corresponding node in the case relationship graph is generated based on each of the cases, and corresponding edges between adjacent nodes in the case relationship graph are generated based on the case relationships between the different cases.
8. A case relationship query device, characterized in that: include: A case determination module, used to determine a first case and a second case to be queried; A starting node determination module, used to determine the starting node corresponding to the first case in a preset case relationship graph, wherein the case relationship graph includes a plurality of nodes, each node corresponds to a case, and an edge between two adjacent nodes corresponds to a relationship between the two cases; A multi-hop query module, used to perform a multi-hop query on the starting node in the case relationship graph, select the node closest to the starting node for each jump, and jump to the end node where the second case is located, stop the multi-hop query, and record the target jump path between the starting node and the end node; A query result determination module is used to determine the case relationship query result between the first case and the second case according to the target jump path between the starting node and the end node.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the case relationship query method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the case relationship query method as described in any one of claims 1 to 7.