Enterprise information association relationship query method and device and computer equipment
By conducting two-way query and path construction in the knowledge graph, the problem of low efficiency in enterprise information association relationship query in traditional technology is solved, and a method of efficient identification of deep-level relationships is realized, which improves query efficiency and flexibility.
Patent Information
- Application Number
- CN202411571572.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In traditional technology, when querying enterprise information relationship relationships through connection operation Join, it is less efficient and it is difficult to effectively judge deep-seated relationships such as investment, employment, holding, etc.
Using a two-way query method based on knowledge graph, the storage node corresponding to enterprise information is determined in the preset knowledge graph, and two-way query is carried out according to multiple relationship types to build the correlation relationship between enterprise information, and use query paths and node local indexes to reduce Number of queries to improve efficiency.
It improves the efficiency and flexibility of enterprise information association relationship query, can effectively identify deep-level relationships, reduce the number of query operations, and improve the query success rate.
Smart Images

Figure CN119088983A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer application technology, and in particular to a method, device and computer equipment for querying enterprise information association relationships. Background Art
[0002] As market demand increases, more business opportunities are provided to enterprises, and the number of enterprises is also increasing. For the relationship between enterprises and personnel, if we only analyze it from the surface relationship, it is often difficult to get an effective conclusion. For example, deep relationships such as investment, employment, and holding cannot be judged by surface relationships.
[0003] In traditional technology, structured query language SQL statements are usually used in data storage systems such as relational database Mysql or document database Mongo to perform several join operations to index and query the relationship between enterprise information. However, when the query method in the above traditional technology is used to query through the join operation, it is necessary to cache the query results after each execution of the join operation, resulting in low query efficiency of the relationship. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device and computer equipment for querying enterprise information association relationships with high query efficiency in order to address the above technical problems.
[0005] In a first aspect, the present application provides a method for querying enterprise information association relationships, comprising:
[0006] Acquire first enterprise information and second enterprise information;
[0007] Determine, from a preset knowledge graph, a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information;
[0008] According to the preset multiple relationship types, bidirectional query is started from the first storage node and the second storage node in the knowledge graph respectively to obtain a first associated node corresponding to the first storage node and a second associated node corresponding to the second storage node;
[0009] When the first association node is the same as the second association node, the association relationship between the first enterprise information and the second enterprise information is constructed using a first query path from the first storage node to the first association node and a second query path from the second storage node to the second association node.
[0010] In one embodiment, the multiple relationship types configured in a preset manner, starting a bidirectional query from the first storage node and the second storage node in the knowledge graph respectively, to obtain a first associated node corresponding to the first storage node and a second associated node corresponding to the second storage node, include:
[0011] According to the local index of the node stored in the knowledge graph and each of the relationship types, a first associated node corresponding to the first storage node is queried in the knowledge graph; at the same time, according to the local index of the node and each of the relationship types, a second associated node corresponding to the second storage node is queried in the knowledge graph;
[0012] The node local index stores information about neighboring nodes that have association relationships between each other under any of the relationship types.
[0013] In one embodiment, querying in the knowledge graph to obtain a first associated node corresponding to the first storage node according to the node local index stored in the knowledge graph and each of the relationship types includes:
[0014] According to the node local index corresponding to the first storage node, query in the knowledge graph to obtain a first associated node that has an associated relationship with the first storage node under any of the relationship types;
[0015] Repeat the query operation of searching in the knowledge graph for a new first associated node having an associated relationship with the first associated node under any of the relationship types according to the node local index corresponding to the first associated node;
[0016] The query operation is stopped until the query operation reaches a preset query depth, or the first associated node is the same as the second associated node obtained by querying from the second storage node.
[0017] In one embodiment, when the first association node is the same as the second association node, using a first query path from the first storage node to the first association node and a second query path from the second storage node to the second association node to establish an association relationship between the first enterprise information and the second enterprise information includes:
[0018] Determine a first associated path from the first storage node to the same first associated node using a path search algorithm, and use the first associated path that meets a preset distance condition as the first query path;
[0019] Determine a second associated path from the second storage node to the same second associated node using the path search algorithm, and use the second associated path that meets the preset distance condition as the second query path;
[0020] The first query path and the second query path are connected to form an association relationship between the first enterprise information and the second enterprise information.
[0021] In one embodiment, the connecting the first query path and the second query path to form an association relationship between the first enterprise information and the second enterprise information includes:
[0022] Connecting the first query path and the second query path to obtain a target query path from the first storage node to the second storage node;
[0023] Determine the target connection symbol between the two nodes according to the relationship type between the two nodes in the target query path and the connection symbol corresponding to each relationship type;
[0024] The target connection symbol is used to replace the connection symbol in the target query path to obtain the association relationship.
[0025] In one embodiment, the method further comprises:
[0026] Receive real-time updated enterprise information through pre-set streaming tools;
[0027] Performing entity recognition processing on the enterprise information to obtain an entity recognition result corresponding to the enterprise information;
[0028] The entity recognition result is stored in the corresponding storage node in the knowledge graph, and the storage node that has any of the association relationships with the entity recognition result is searched in the knowledge graph to establish a node local index between the storage nodes.
[0029] In a second aspect, the present application also provides a device for querying enterprise information association relationships, including:
[0030] An information acquisition module, used to acquire the first enterprise information and the second enterprise information;
[0031] A node determination module, used to determine a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information from a preset knowledge graph;
[0032] An association query module, configured to start a bidirectional query from the first storage node and the second storage node in the knowledge graph according to a plurality of relationship types configured in a preset manner, to obtain a first association node corresponding to the first storage node and a second association node corresponding to the second storage node;
[0033] A path construction module is used to construct an association relationship between the first enterprise information and the second enterprise information by using a first query path from the first storage node to the first association node and a second query path from the second storage node to the second association node when the first association node is the same as the second association node.
[0034] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the enterprise information association relationship query method described in any one of the embodiments of the first aspect is implemented.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the enterprise information association relationship query method described in any one of the embodiments of the first aspect is implemented.
[0036] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the enterprise information association relationship query method described in any one of the embodiments of the first aspect is implemented.
[0037] The above-mentioned enterprise information association relationship query method, device, computer equipment, computer-readable storage medium and computer program product obtain the first enterprise information and the second enterprise information, determine the first storage node corresponding to the first enterprise information and the second storage node corresponding to the second enterprise information from the preset knowledge graph, and start a bidirectional query from the first storage node and the second storage node in the knowledge graph according to the preset multiple relationship types, and obtain the first associated node corresponding to the first storage node and the second associated node corresponding to the second storage node. When the first associated node is the same as the second associated node, the association relationship between the first enterprise information and the second enterprise information is constructed by using the first query path from the first storage node to the first associated node and the second query path from the second storage node to the second associated node. It can not only increase the information query range by using different relationship types, thereby improving the flexibility of association relationship query, but also reduce the number of query operations by using the bidirectional query method, thereby improving the query efficiency of the association relationship. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 An application environment diagram of a method for querying enterprise information association relationships in one embodiment;
[0040] Figure 2 A flowchart of a method for querying enterprise information association relationships in one embodiment;
[0041] Figure 3 A schematic diagram of a process flow of an associated node query step in an embodiment;
[0042] Figure 4 A schematic diagram of a process of generating an association relationship in one embodiment;
[0043] Figure 5 A schematic diagram of a flow chart of a connection symbol replacement step in an embodiment;
[0044] Figure 6 A schematic diagram of a flow chart of steps for establishing a node local index in one embodiment;
[0045] Figure 7 A schematic diagram of a process of querying enterprise information association relationships in another embodiment;
[0046] Figure 8 is a structural block diagram of an enterprise information association relationship query device 800 in one embodiment;
[0047] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0050] The enterprise information association relationship query method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 can communicate with the server 104 through the network. The knowledge graph system 106 can be integrated on the server 104, or it can be placed on the cloud or other network servers. Specifically, the server 104 can obtain the first enterprise information and the second enterprise information that the user needs to query through the terminal 102. The server 104 can determine the first storage node corresponding to the first enterprise information and the second storage node corresponding to the second enterprise information from the knowledge graph stored in the knowledge graph system 106. The server 104 can start a bidirectional query from the first storage node and the second storage node in the knowledge graph according to a plurality of relationship types configured by default, and obtain a first associated node corresponding to the first storage node and a second associated node corresponding to the second storage node. The server 104 can use the first query path from the first storage node to the first associated node and the second query path from the second storage node to the second associated node when the first associated node is the same as the second associated node to construct the association relationship between the first enterprise information and the second enterprise information.
[0051] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart TVs, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0052] In an exemplary embodiment, Figure 2 As shown, a method for querying enterprise information association relationships is provided, and the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S202 to S208. Among them:
[0053] Step S202, obtaining first enterprise information and second enterprise information.
[0054] The enterprise information may include but is not limited to one or more of the enterprise name, enterprise number, enterprise legal person, enterprise asset relationship, etc. The first enterprise information and the second enterprise information are only used to distinguish information of different enterprises and do not constitute a limitation on the priority of information processing.
[0055] For example, the server may respond to the enterprise information association relationship query request sent by the terminal, and parse the enterprise information association relationship query request to obtain the first enterprise information and the second enterprise information. Alternatively, the server may also receive the first enterprise information and the second enterprise information sent by the terminal, and automatically trigger the enterprise information association relationship query operation for the first enterprise information and the second enterprise information.
[0056] Step S204, determining a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information from a preset knowledge graph.
[0057] The knowledge graph can be used to store the enterprise information of several enterprises and the enterprise information association relationship. Optionally, in some embodiments, the data stored in the knowledge graph can be structured and stored in the form of triples. Alternatively, in other embodiments, the knowledge graph can also store the index relationship between the enterprise information of different enterprises to facilitate the query of the enterprise information association relationship.
[0058] The storage node can be used to store enterprise information and triple relationships or index relationships related to the enterprise information.
[0059] Exemplarily, a preset knowledge graph is deployed in the server, and the knowledge graph may store first enterprise information, the association relationship between the first enterprise information and other enterprise information, second enterprise information, and the association relationship between the second enterprise information and other enterprise information. The server may query the preset knowledge graph to obtain the first storage node corresponding to the first enterprise information and the second storage node corresponding to the second enterprise information based on the enterprise identifiers in the first enterprise information and the second enterprise information, such as the enterprise name, enterprise number and other identification information.
[0060] Step S206, according to the preset configured multiple relationship types, start a bidirectional query from the first storage node and the second storage node in the knowledge graph respectively, and obtain a first associated node corresponding to the first storage node and a second associated node corresponding to the second storage node.
[0061] Among them, relationship types may include but are not limited to investment relationships, capital contribution relationships, relationships between parent companies and subsidiaries, relationships between head offices and branches, control relationships, management relationships, financial relationships, etc.
[0062] Exemplarily, the knowledge graph in the server is pre-configured with multiple types of relationships between different enterprise information. The server can simultaneously start a bidirectional query from the first storage node and the second storage node in the knowledge graph. For example, from the remaining enterprise information stored at the first storage node in the knowledge graph that has an association relationship with the first enterprise information, the first association node where the remaining enterprise information with an association relationship is located can be queried. Similarly, the second association node where the remaining enterprise information with an association relationship with the second enterprise information is located can be queried based on the second storage node.
[0063] Optionally, in some implementations, the server may also use the first associated node and the second associated node that have been queried as new query starting points, and repeatedly perform the query operation of the first associated node and the second associated node to obtain a new storage node associated with the new query starting point. Until the number of times the query operation is repeated reaches a preset number threshold, or the first associated node is the same as the second associated node, the processing operation of the following step S208 is performed.
[0064] Step S208, when the first associated node is the same as the second associated node, a first query path from the first storage node to the first associated node and a second query path from the second storage node to the second associated node are used to build an association relationship between the first enterprise information and the second enterprise information.
[0065] The query path may be used to represent a path formed by utilizing the association relationship between enterprise information.
[0066] Optionally, the server may compare the first associated node and the second associated node obtained from the current query after each execution of the query operation in step S206. Alternatively, the server may also compare all first associated nodes and all second associated nodes obtained from the current query after executing the query operation in step S206 a preset number of times. When the first associated node is the same as the second associated node, a first query path from the first storage node to the first associated node and a second query path from the second storage node to the second associated node, which are the same as the first storage node, are used to connect and form a target query path between the first storage node and the second storage node. Based on the query paths between the storage nodes in the target query path and the association relationship corresponding to the query paths, an association relationship between the enterprise information and the second enterprise information is constructed.
[0067] In the above-mentioned enterprise information association relationship query method, by obtaining the first enterprise information and the second enterprise information, the first storage node corresponding to the first enterprise information and the second storage node corresponding to the second enterprise information are determined from the preset knowledge graph, and according to the preset multiple relationship types, a bidirectional query is started from the first storage node and the second storage node in the knowledge graph respectively to obtain the first associated node corresponding to the first storage node and the second associated node corresponding to the second storage node. When the first associated node is the same as the second associated node, the association relationship between the first enterprise information and the second enterprise information is constructed by using the first query path from the first storage node to the first associated node and the second query path from the second storage node to the second associated node. This can not only increase the information query scope by using different relationship types, thereby improving the flexibility of the association relationship query, but also reduce the number of query operations by using the bidirectional query method, thereby improving the query efficiency of the association relationship.
[0068] In an exemplary embodiment, the above step S206 may also be implemented in the following manner:
[0069] According to the local index of the node and each relationship type stored in the knowledge graph, the first associated node corresponding to the first storage node is queried in the knowledge graph; at the same time, according to the local index of the node and each relationship type, the second associated node corresponding to the second storage node is queried in the knowledge graph.
[0070] The node local index may store information about neighbor nodes that have association relationships of any type between them.
[0071] Exemplarily, in the process of storing data in the knowledge graph, the received enterprise information can be processed by named entity recognition and relationship type recognition to obtain the relationship type between the enterprise information; alternatively, the relationship type input or selected by the user can be directly received. The received enterprise information is stored in the corresponding storage node, and a node local index corresponding to the storage node is constructed based on the association relationship between the enterprise information and the remaining enterprise information. So that when data is subsequently queried in the knowledge graph, the node local index corresponding to the storage node can be used to realize the index-free adjacency of the storage node and the remaining storage nodes that have an association relationship with the storage node under any relationship type. That is, through the micro-index information of the node local index, a storage node can be directly pointed to another storage node associated with it, without having to query the association relationship of each storage node one by one in the global index.
[0072] The server can query the knowledge graph to obtain the first associated node that has an associated relationship with the first storage node under any relationship type based on the first storage node and the node local index corresponding to the first storage node stored in the knowledge graph. Similarly, since a bidirectional query method is adopted in this embodiment, the second associated node that has an associated relationship with the second storage node under any relationship type can be queried in the knowledge graph based on the second storage node and the node local index corresponding to the second storage node stored in the knowledge graph.
[0073] Compared with the traditional technology that needs to first traverse and query all index information of storage node A in the global index, and then traverse and query all index information of storage node B to obtain the association relationship between storage node A and storage node B, in this embodiment, the index-free adjacency between storage nodes is realized by adopting the node local index method in the knowledge graph, and the associated nodes that have an association relationship with the first storage node and the second storage node under any relationship type are quickly queried according to the node local index. It is possible to directly determine the storage node B that has an association relationship with the storage node A under any relationship type according to the node local index of storage node A, thereby helping to reduce the time complexity of the query and greatly improve the query efficiency of the associated nodes.
[0074] In an exemplary embodiment, Figure 3 As shown, a method for querying a first associated node is also provided, comprising the following steps S302 to S306. Among them:
[0075] Step S302: According to the node local index corresponding to the first storage node, query in the knowledge graph to obtain the first associated node that has an association relationship with the first storage node under any relationship type.
[0076] Exemplarily, the server can read the node local index corresponding to the first storage node from the knowledge graph, and query the knowledge graph to obtain the first associated node that has an associated relationship with the first storage node under any relationship type. At the same time, the second associated node that has an associated relationship with the second storage node under any relationship type can be queried based on the node local index corresponding to the second storage node. Compare the first associated node and the second associated node. When the first associated node is not the same as the second associated node, execute step S304. When the first associated node is the same as the second associated node, execute step S306.
[0077] Step S304, repeatedly executing the query operation of searching in the knowledge graph for a new first associated node having an associated relationship with the first associated node under any relationship type according to the node local index corresponding to the first associated node.
[0078] Exemplarily, the server may repeatedly perform the following operations: query the knowledge graph to obtain a new first associated node that has an associated relationship with the first associated node under any relationship type according to the node local index corresponding to the first associated node. At the same time, query the knowledge graph to obtain a new second associated node that has an associated relationship with the second associated node under any relationship type according to the node local index corresponding to the second associated node.
[0079] Step S306: until the query operation reaches a preset query depth, or the first associated node is the same as the second associated node obtained by querying from the second storage node, the query operation is stopped.
[0080] The query depth may correspond to the number of times the query operation is repeatedly executed, that is, the query depth of the first associated node obtained by executing the query operation once is 1, and the query depth of the first associated node obtained by executing the query operation n times is n.
[0081] For example, when the number of query operations executed reaches a threshold number corresponding to a preset query depth, the server may determine that the current query operation has reached the preset query depth and stop executing the query operation. Alternatively, the server may stop executing the query operation when it is determined that the first associated node and the second associated node obtained by querying in step S304 contain the same node.
[0082] In this embodiment, by repeatedly executing the query operation from the first storage node to find the first associated node and then to the new first associated node, until the first associated node identical to the second associated node is found or the query operation reaches a preset query depth, the query operation is stopped. This can not only improve the query success rate of the association relationship between the first enterprise information and the second enterprise information, but also avoid infinite repetition of the query operation and save computing resources.
[0083] Optionally, in other implementations, when the query operation reaches a preset query depth and the same first associated node and second associated node are still not found, a prompt message indicating that there is no association relationship between the first enterprise information and the second enterprise information may be output.
[0084] In actual application scenarios, the first associated path between the first storage node and the first associated node obtained by querying using the operation methods provided in the above embodiments is not necessarily the shortest path from the first storage node to the first associated node. For example, the first associated path obtained using the above embodiments may be: first storage node A - first associated node B - first associated node C - first associated node D. Among them, the node local index of the first storage node A may store the association relationship with the first associated node C. Then the shortest path from the first storage node A to the first associated node D should be the first storage node A - first associated node C - first associated node D.
[0085] Therefore, in order to avoid redundant information in the association path, in an exemplary embodiment, Figure 4 As shown, the above step S208 may also include the following steps S402 to S406. Among them:
[0086] Step S402: A path search algorithm is used to determine a first associated path from the first storage node to the same first associated node, and the first associated path that meets a preset distance condition is used as a first query path.
[0087] The path search algorithm may include but is not limited to Dijkstra Algo, A* Algo (a heuristic search algorithm), Yen's Algo, and the like.
[0088] Exemplarily, the server may use a path search algorithm to search for a first associated path from a first storage node to a first associated node identical to a second associated node. Compare the path distance of each first associated path obtained by the search (which may be determined based on the number of nodes, for example, when there are m storage nodes in the first associated path, the path distance of the first associated path is m-1). According to a preset distance condition, the first associated path corresponding to the shortest path distance is used as the first query path.
[0089] Step S404: using a path search algorithm to determine a second associated path from the second storage node to the same second associated node, and using the second associated path that meets a preset distance condition as a second query path.
[0090] Exemplarily, similarly, the server may refer to the operation steps in step S402 above, adopt a path search algorithm to determine a second associated path from the second storage node to the same second associated node, and use the second associated path that meets the preset distance condition as the second query path.
[0091] Step S406: connect the first query path and the second query path to form an association relationship between the first enterprise information and the second enterprise information.
[0092] Exemplarily, the server may use the same first association node and the second association node as the connection node connecting the first query path and the second query path, and connect the first query path and the second query path to form a target query path from the first storage node to the second storage node. The association relationship between the nodes in the target query path is used to form the association relationship between the first enterprise information and the second enterprise information.
[0093] In this embodiment, a path search algorithm is used to determine the shortest first query path from the first storage node to the first associated node that is the same as the second associated node, and the shortest second query path from the second storage node to the second associated node that is the same as the first associated node. The first query path and the second query path are connected to obtain the association relationship between the first enterprise information and the second enterprise information, which can improve the efficiency of generating the association relationship and reduce redundant information.
[0094] In an exemplary embodiment, Figure 5 As shown, the above step S406 may also include the following steps S502 to S506. Among them:
[0095] Step S502: connect the first query path and the second query path to obtain a target query path from the first storage node to the second storage node.
[0096] Step S504: determine target connection symbols between two nodes according to the relationship types between two nodes in the target query path and the connection symbols corresponding to each relationship type.
[0097] Step S506: replace the connection symbols in the target query path with the target connection symbols to obtain an association relationship.
[0098] Exemplarily, the server may use a default connection symbol (such as a dash --, a slash / , a plus sign +, etc.), and refer to the method provided in the above step S406 to connect the first query path and the second query path to obtain a target query path from the first storage node to the second storage node. A connection symbol corresponding to the relationship type between two nodes in the target query path is used as a target connection symbol between two nodes in the target query path. The connection symbol in the target query path is replaced with the target connection symbol to obtain the association relationship between the first enterprise information and the second enterprise information.
[0099] Exemplarily, when the target query path from the first storage node to the second storage node is:
[0100] First storage node A——first associated node B / second associated node B——second storage node Z.
[0101] The relationship type between the first storage node A and the first associated node B is a parent company-subsidiary relationship, while the relationship type between the second associated node B and the second storage node Z is an invested relationship. The target connection symbol corresponding to the parent company-subsidiary relationship is →, and the target connection symbol corresponding to the invested relationship is ←.
[0102] The target query path obtained after the above step S506 is:
[0103] First storage node A→first associated node B / second associated node B←second storage node Z.
[0104] The relationship between the first enterprise information and the second enterprise information is:
[0105] First enterprise information→enterprise information stored at the first associated node B / second associated node B←second enterprise information.
[0106] In this embodiment, by replacing the connection symbols in the target query path according to the target connection symbols corresponding to different relationship types, the relationship type between nodes can be more intuitively reflected in the association relationship, thereby achieving a visual display of the relationship type.
[0107] In an exemplary embodiment, Figure 6 As shown, a method for establishing a node local index is also provided, including the following steps S602 to S606. Among them:
[0108] Step S602: receiving real-time updated enterprise information through a preset streaming processing tool.
[0109] Step S604: perform entity recognition processing on the enterprise information to obtain an entity recognition result corresponding to the enterprise information.
[0110] Step S606, store the entity recognition result in the corresponding storage node in the knowledge graph, and query the storage node in the knowledge graph that has any kind of association relationship with the entity recognition result, and establish a node local index between the storage nodes.
[0111] Among them, the streaming processing tool can be used to receive real-time updated data streams.
[0112] Exemplarily, stream processing tools such as the open source stream processing framework Flink, the open source stream processing platform Kafka, and the stream processing framework Apache Storm can be deployed in the server. The enterprise information input by the terminal or updated in real time on the Internet is received through the preset stream processing tool. Entity recognition processing is performed on the enterprise information to obtain the entity recognition result corresponding to the enterprise information. A storage node corresponding to the currently processed enterprise information is created in the knowledge graph, and the entity recognition result of the current enterprise information is stored in the storage node.
[0113] Search the knowledge graph for established storage nodes that have any association relationship with the entity recognition results corresponding to the current enterprise information. Establish node local indexes between storage nodes based on the association relationship.
[0114] In this embodiment, the data writing of the real-time stream can be realized through the streaming processing tool, and the node local index between the storage nodes is established through the association relationship between the entity recognition results, which can improve the efficiency of subsequent retrieval in the knowledge graph, so that the time complexity of querying the association relationship is simplified to O(1). The time complexity of traversing a knowledge graph with a query depth of m using the node local index provided in this embodiment is only O(m), which is much lower than O(mlogn) of the traditional global index method.
[0115] In an exemplary embodiment, Figure 7 As shown, a method for querying enterprise information association relationships is also provided, including the following steps S702 to S710. Among them:
[0116] Step S702, obtaining first enterprise information and second enterprise information.
[0117] Step S704, determining a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information from a preset knowledge graph.
[0118] For example, the server may receive the first enterprise information and the second enterprise information input by the user through the interactive interface of the terminal, and determine the first storage node corresponding to the first enterprise information and the second storage node corresponding to the second enterprise information from the preset knowledge graph according to the identification information such as the enterprise name and the enterprise number.
[0119] Step S706, based on the node local index and multiple relationship types, start a bidirectional query from the first storage node and the second storage node in the knowledge graph respectively, until the query operation reaches a preset query depth or the first associated node obtained by the query is the same as the second associated node, and stop executing the query operation.
[0120] Exemplarily, the server can use a breadth-first search algorithm (BFS algorithm for short) to start a bidirectional query from the first storage node and the second storage node in the knowledge graph, using the node local index stored in the knowledge graph and each relationship type currently configured by the user within the query range, to obtain the first associated node corresponding to the first storage node and the second associated node corresponding to the second storage node. Then, a new first associated node and a new second associated node are obtained based on the node local index of the currently queried first associated node and the second associated node. The query operation is stopped until the query operation reaches the preset query depth or the first associated node obtained by the query is the same as the second associated node.
[0121] Step S708: using a path search algorithm to determine a first query path and a second query path, and connecting the first query path and the second query path to form a target query path.
[0122] Step S710: replace the connection symbol in the target query path with the target connection symbol corresponding to each relationship type to obtain the association relationship between the first enterprise information and the second enterprise information.
[0123] Exemplarily, the server may use a path search algorithm to determine the shortest first query path from the first storage node to the first associated node that is the same as the second associated node, and the shortest second query path from the second storage node to the second associated node that is the same as the first associated node. The first query path and the second query path are connected to form a target query path. The target connection symbol corresponding to the relationship type between the two nodes in the target query path is used to replace the connection symbol in the target query path to obtain the association relationship between the first enterprise information and the second enterprise information.
[0124] In this embodiment, by using a bidirectional query method to search for associated nodes, compared with the query method implemented by the traditional JOIN instruction, the number of query operation executions can be halved at the same query depth, thereby greatly improving the query efficiency of the associated relationship. By querying associated nodes based on the node local index and the preset configured relationship type, the flexibility and query efficiency of the associated relationship query can be improved. By replacing the connection symbol in the original target query path with the target connection symbol corresponding to the relationship type, the intuitive display of different relationship types can be achieved in the associated relationship, which is convenient for users to quickly grasp the enterprise relationship.
[0125] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0126] Based on the same inventive concept, the embodiment of the present application also provides an enterprise information association relationship query device for implementing the enterprise information association relationship query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more enterprise information association relationship query device embodiments provided below can refer to the limitations of the enterprise information association relationship query method above, and will not be repeated here.
[0127] In an exemplary embodiment, Figure 8 As shown, an enterprise information association relationship query device 800 is provided, comprising: an information acquisition module 802, a node determination module 804, an association query module 806 and a path construction module 808, wherein:
[0128] The information acquisition module 802 is used to acquire the first enterprise information and the second enterprise information.
[0129] The node determination module 804 is used to determine a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information from a preset knowledge graph.
[0130] The association query module 806 is used to start a bidirectional query from the first storage node and the second storage node in the knowledge graph according to multiple relationship types configured in advance, and obtain a first association node corresponding to the first storage node and a second association node corresponding to the second storage node.
[0131] The path construction module 808 is used to construct the association relationship between the first enterprise information and the second enterprise information by using the first query path from the first storage node to the first association node and the second query path from the second storage node to the second association node when the first association node is the same as the second association node.
[0132] In an exemplary embodiment, the association query module 806 is also used to query the knowledge graph for a first association node corresponding to the first storage node based on the node local index and each relationship type stored in the knowledge graph; at the same time, query the knowledge graph for a second association node corresponding to the second storage node based on the node local index and each relationship type; wherein the node local index stores information on neighbor nodes that have association relationships between each other under any relationship type.
[0133] In an exemplary embodiment, the association query module 806 is also used to query the knowledge graph for a first association node that has an association relationship with the first storage node under any relationship type based on the node local index corresponding to the first storage node; repeatedly perform a query operation of querying the knowledge graph for a new first association node that has an association relationship with the first association node under any relationship type based on the node local index corresponding to the first association node; and stop executing the query operation until the query operation reaches a preset query depth, or the first association node is the same as the second association node obtained by querying from the second storage node.
[0134] In an exemplary embodiment, the path construction module 808 includes: a first search unit, which is used to use a path search algorithm to determine a first associated path from a first storage node to the same first associated node, and use the first associated path that meets a preset distance condition as a first query path; a second search unit, which is used to use a path search algorithm to determine a second associated path from a second storage node to the same second associated node, and use the second associated path that meets the preset distance condition as a second query path; and a path connection unit, which is used to connect the first query path and the second query path to form an association relationship between the first enterprise information and the second enterprise information.
[0135] In an exemplary embodiment, the path connection unit is also used to connect the first query path and the second query path to obtain a target query path between the first storage node and the second storage node; determine the target connection symbols between the two nodes according to the relationship type between the two nodes in the target query path and the connection symbols corresponding to each relationship type; and use the target connection symbols to replace the connection symbols in the target query path to obtain an association relationship.
[0136] In an exemplary embodiment, the enterprise information association relationship query device 800 also includes an index construction module, which is used to receive real-time updated enterprise information through a preset streaming processing tool; perform entity recognition processing on the enterprise information to obtain entity recognition results corresponding to the enterprise information; store the entity recognition results in the corresponding storage nodes in the knowledge graph, and query the knowledge graph for storage nodes that have any kind of association relationship with the entity recognition results, and establish node local indexes between the storage nodes.
[0137] Each module in the enterprise information association relationship query device 800 can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0138] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as first enterprise information, second enterprise information, knowledge graph, first storage node, second storage node, first query path, and second query path. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for querying enterprise information association relationships is implemented.
[0139] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0140] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0141] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0142] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0143] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0145] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for querying enterprise information association relationships. It is characterized in that The method comprises: Acquire first enterprise information and second enterprise information; Determine, from a preset knowledge graph, a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information; According to the preset multiple relationship types, bidirectional query is started from the first storage node and the second storage node in the knowledge graph respectively to obtain a first associated node corresponding to the first storage node and a second associated node corresponding to the second storage node; When the first association node is the same as the second association node, the association relationship between the first enterprise information and the second enterprise information is constructed using a first query path from the first storage node to the first association node and a second query path from the second storage node to the second association node.
2. The method according to claim 1, It is characterized in that The method of initiating a bidirectional query from the first storage node and the second storage node in the knowledge graph according to the preset multiple relationship types to obtain a first associated node corresponding to the first storage node and a second associated node corresponding to the second storage node includes: According to the node local index stored in the knowledge graph and each of the relationship types, a first associated node corresponding to the first storage node is queried in the knowledge graph; at the same time, According to the node local index and each of the relationship types, query in the knowledge graph to obtain a second associated node corresponding to the second storage node; The node local index stores information about neighboring nodes that have association relationships between each other under any of the relationship types.
3. The method according to claim 2, It is characterized in that The querying in the knowledge graph to obtain a first associated node corresponding to the first storage node according to the node local index stored in the knowledge graph and each of the relationship types includes: According to the node local index corresponding to the first storage node, query in the knowledge graph to obtain a first associated node that has an associated relationship with the first storage node under any of the relationship types; Repeat the query operation of searching in the knowledge graph for a new first associated node having an associated relationship with the first associated node under any of the relationship types according to the node local index corresponding to the first associated node; The query operation is stopped until the query operation reaches a preset query depth, or the first associated node is the same as the second associated node obtained by querying from the second storage node.
4. The method according to claim 1, It is characterized in that When the first associated node is the same as the second associated node, building an association relationship between the first enterprise information and the second enterprise information by using a first query path from the first storage node to the first associated node and a second query path from the second storage node to the second associated node includes: Determine a first associated path from the first storage node to the same first associated node using a path search algorithm, and use the first associated path that meets a preset distance condition as the first query path; Determine a second associated path from the second storage node to the same second associated node using the path search algorithm, and use the second associated path that meets the preset distance condition as the second query path; The first query path and the second query path are connected to form an association relationship between the first enterprise information and the second enterprise information.
5. The method according to claim 4, It is characterized in that The connecting the first query path and the second query path to form an association relationship between the first enterprise information and the second enterprise information includes: Connecting the first query path and the second query path to obtain a target query path from the first storage node to the second storage node; Determine the target connection symbol between the two nodes according to the relationship type between the two nodes in the target query path and the connection symbol corresponding to each relationship type; The target connection symbol is used to replace the connection symbol in the target query path to obtain the association relationship.
6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: Receive real-time updated enterprise information through pre-set streaming tools; Performing entity recognition processing on the enterprise information to obtain an entity recognition result corresponding to the enterprise information; The entity recognition result is stored in the corresponding storage node in the knowledge graph, and the storage node that has any of the association relationships with the entity recognition result is searched in the knowledge graph to establish a node local index between the storage nodes.
7. A device for querying enterprise information association relationships, It is characterized in that The device comprises: An information acquisition module, used to acquire the first enterprise information and the second enterprise information; A node determination module, used to determine a first storage node corresponding to the first enterprise information and a second storage node corresponding to the second enterprise information from a preset knowledge graph; An association query module, configured to start a bidirectional query from the first storage node and the second storage node in the knowledge graph according to a plurality of relationship types configured in a preset manner, to obtain a first association node corresponding to the first storage node and a second association node corresponding to the second storage node; A path construction module is used to construct an association relationship between the first enterprise information and the second enterprise information by using a first query path from the first storage node to the first association node and a second query path from the second storage node to the second association node when the first association node is the same as the second association node.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Inquiry method and apparatus for enterprise relationship, computer device and storage medium
CN109376280A
Multi-data stream analysis method and device, electronic equipment and storage medium
CN116389046A
Enterprise query method and system based on knowledge graph
CN116842124A
Data query terminal based on large-scale knowledge graph
CN116861003A
