Knowledge graph construction method and device, computer equipment and storage medium

By collecting information from multiple data sources, extracting entities and relationships, identifying patterns to be optimized and performing pattern reshaping, the problems of insufficient applicability and flexibility of knowledge graphs in the existing technology are solved, and a goal that is more in line with needs is generated Knowledge graph.

CN119443233APending Publication Date: 2025-02-14PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411459432.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

When the existing knowledge graph original graph architecture method deals with complex and changeable data in the financial field, it is difficult to effectively balance the needs of knowledge orientation and data orientation, resulting in low applicability and insufficient flexibility in the generated knowledge graph.

Method used

By collecting relevant information from multiple data sources, extracting entities and relationships based on the preset knowledge graph embedding model, building an initial knowledge graph, and identifying the mode to be optimized based on the pattern recognition algorithm, building a reshaping knowledge graph pattern, and calling pattern reshaping The strategy performs pattern reshaping processing, and finally generates a target knowledge graph through query reshaping processing.

Benefits of technology

It realizes the generation of knowledge graphs that are more in line with user needs and practical applications, improves the flexibility, applicability and usability of the reshaped target knowledge graphs, and can better cope with changes and diversity of data structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443233A_ABST
    Figure CN119443233A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence, and relates to a knowledge graph construction method, which is applied to the field of financial science and technology, and comprises the following steps: collecting related information corresponding to an information type from a plurality of data sources; entities and relationships in the related information are extracted based on a knowledge graph embedding model; constructing an initial knowledge graph based on the entities and the relationships; recognizing a to-be-optimized mode in the initial knowledge graph based on a mode recognition algorithm; constructing a remodeling knowledge graph mode in the to-be-optimized mode; calling a mode remodeling strategy corresponding to the knowledge graph remodeling mode to carry out mode remodeling processing on the initial knowledge graph to obtain a first knowledge graph; and querying and remodeling the first knowledge graph to obtain a target knowledge graph. The invention further provides a knowledge graph construction device, computer equipment and a storage medium. In addition, the invention also relates to a block chain technology, and the target knowledge graph can be stored in a block chain. According to the method, the flexibility and the applicability of the constructed target knowledge graph are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of artificial intelligence development technology and financial technology, and in particular to methods, devices, computer equipment and storage media for constructing knowledge graphs. Background Art

[0002] In the financial field, with the rapid development of big data and artificial intelligence technology, knowledge graphs, as a powerful data organization and representation tool, are increasingly showing their great potential in data integration, problem solving, and semantic search. Knowledge graphs provide a solid foundation for deep mining and intelligent application of financial data by constructing a complex network of semantic elements such as entities, relationships, and attributes.

[0003] At present, the construction of knowledge graphs mainly relies on a variety of original graph architecture methods, among which automatic extraction methods and ontology-based knowledge graph original graph architecture methods occupy a dominant position. Automatic extraction methods usually use natural language processing, machine learning and other technologies to automatically identify and extract entities, relationships and other information from unstructured or semi-structured data sources, and then construct knowledge graphs. Ontology-based methods focus on providing clear semantic definitions and hierarchical structures for elements in knowledge graphs through predefined ontology models to ensure the consistency and interpretability of knowledge.

[0004] However, when dealing with complex and changeable data in the financial field, existing knowledge graph original graph architecture methods often directly extract information from data sources and map it to predefined knowledge graph models. Although this plug-and-play approach simplifies the knowledge graph construction process to a certain extent, it is difficult to effectively balance the knowledge-oriented and data-oriented needs. On the one hand, the predefined knowledge graph models are often too general and difficult to fully capture and express the uniqueness and detailed characteristics of specific financial data sets, resulting in the generated knowledge graphs being insufficient in reflecting the true meaning and potential value of the data, and thus having low applicability. On the other hand, overly rigid model definitions limit the flexibility of knowledge graphs, making it difficult to adapt to the rapidly changing data environment and business needs in the financial field. Summary of the invention

[0005] The purpose of the embodiments of the present application is to propose a method, apparatus, computer equipment and storage medium for constructing a knowledge graph, so as to solve the technical problem that the knowledge graph constructed by the existing knowledge graph original graph architecture method has low applicability and low flexibility.

[0006] In order to solve the above technical problems, the present application embodiment provides a method for constructing a knowledge graph, which adopts the following technical solution:

[0007] Collect relevant information corresponding to the preset information type from multiple data sources;

[0008] Extracting entities and relationships from the relevant information based on a preset knowledge graph embedding model;

[0009] Constructing an initial knowledge graph based on the entities and relationships;

[0010] Identify the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm;

[0011] Constructing a corresponding reshaped knowledge graph model based on the model to be optimized;

[0012] Calling a pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain a corresponding first knowledge graph;

[0013] The first knowledge graph is subjected to query reshaping processing to obtain a target knowledge graph.

[0014] Furthermore, the step of identifying the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm specifically includes:

[0015] Selecting a target pattern recognition algorithm from a plurality of preset pattern recognition algorithms;

[0016] Based on the target pattern recognition algorithm, the initial knowledge graph is identified and processed to obtain corresponding existing patterns and potential patterns;

[0017] Performing statistical analysis on the existing pattern and the potential pattern to obtain corresponding analysis results;

[0018] The mode to be optimized is determined from the existing mode and the potential mode based on the analysis result.

[0019] Furthermore, the step of calling the pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain the corresponding first knowledge graph specifically includes:

[0020] Based on the pattern reshaping strategy, construct a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph;

[0021] Performing corresponding structural modification processing on the initial knowledge graph based on the pattern reshaping strategy and the mapping relationship table to obtain a reshaped knowledge graph;

[0022] The reshaped knowledge graph is used as the first knowledge graph.

[0023] Furthermore, the step of performing query reshaping processing on the first knowledge graph to obtain a target knowledge graph specifically includes:

[0024] Call preset query conversion scripts and verification tools;

[0025] Performing query reshaping processing on the first knowledge graph based on the query conversion script to obtain a processed second knowledge graph;

[0026] Performing consistency verification on the second knowledge graph based on the verification tool;

[0027] If the second knowledge graph passes the consistency check, the second knowledge graph is used as the target knowledge graph.

[0028] Furthermore, the step of collecting relevant information corresponding to the preset information type from multiple data sources specifically includes:

[0029] Collecting initial information related to the information type from the multiple data sources based on a preset information extraction script;

[0030] Cleaning the initial information to obtain corresponding first information;

[0031] Performing format conversion processing on the first information to obtain corresponding second information;

[0032] The second information is used as the related information.

[0033] Furthermore, before the step of extracting entities and relationships in the relevant information based on the preset knowledge graph embedding model, it also includes:

[0034] Call the preset initial embedding model;

[0035] Get pre-built scoring functions and hinge loss functions;

[0036] Based on a preset stochastic gradient descent algorithm, the scoring function and the hinge loss function, the initial embedding model is trained and optimized to obtain a specified embedding model that meets preset performance conditions;

[0037] The specified embedding model is used as the knowledge graph embedding model.

[0038] Furthermore, after the step of performing query reshaping processing on the first knowledge graph to obtain a target knowledge graph, the method further includes:

[0039] Get the side information stored during the pattern reshaping process;

[0040] Performing edge re-adding processing on the target knowledge graph based on the edge information to obtain a processed third knowledge graph;

[0041] The third knowledge graph is stored.

[0042] In order to solve the above technical problems, the embodiment of the present application also provides a knowledge graph construction device, which adopts the following technical solution:

[0043] A collection module, used to collect relevant information corresponding to a preset information type from multiple data sources;

[0044] An extraction module, used to extract entities and relationships in the relevant information based on a preset knowledge graph embedding model;

[0045] A first building module, used to build an initial knowledge graph based on the entities and relationships;

[0046] An identification module, used to identify the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm;

[0047] A second construction module is used to construct a corresponding reshaped knowledge graph model based on the model to be optimized;

[0048] A first processing module is used to call a pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain a corresponding first knowledge graph;

[0049] The second processing module is used to perform query reshaping processing on the first knowledge graph to obtain a target knowledge graph.

[0050] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0051] Collect relevant information corresponding to the preset information type from multiple data sources;

[0052] Extracting entities and relationships from the relevant information based on a preset knowledge graph embedding model;

[0053] Constructing an initial knowledge graph based on the entities and relationships;

[0054] Identify the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm;

[0055] Constructing a corresponding reshaped knowledge graph model based on the model to be optimized;

[0056] Calling a pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain a corresponding first knowledge graph;

[0057] The first knowledge graph is subjected to query reshaping processing to obtain a target knowledge graph.

[0058] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0059] Collect relevant information corresponding to the preset information type from multiple data sources;

[0060] Extracting entities and relationships from the relevant information based on a preset knowledge graph embedding model;

[0061] Constructing an initial knowledge graph based on the entities and relationships;

[0062] Identify the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm;

[0063] Constructing a corresponding reshaped knowledge graph model based on the model to be optimized;

[0064] Calling a pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain a corresponding first knowledge graph;

[0065] The first knowledge graph is subjected to query reshaping processing to obtain a target knowledge graph.

[0066] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0067] The present application first collects relevant information corresponding to a preset information type from a variety of data sources; then extracts entities and relationships from the relevant information based on a preset knowledge graph embedding model; and constructs an initial knowledge graph based on the entities and relationships; then identifies the to-be-optimized pattern in the initial knowledge graph based on a preset pattern recognition algorithm; subsequently constructs a corresponding reshaped knowledge graph pattern based on the to-be-optimized pattern; further calls a pattern reshaping strategy corresponding to the reshaped knowledge graph pattern to reshape the initial knowledge graph to obtain a corresponding first knowledge graph; finally, performs a query reshaping process on the first knowledge graph to obtain a target knowledge graph. The present application extracts entities and relationships from the relevant information collected from the data source by using a knowledge graph embedding model, and constructs an initial knowledge graph based on the entities and relationships, then identifies the to-be-optimized pattern in the initial knowledge graph based on a pattern recognition algorithm, and constructs a corresponding reshaped knowledge graph pattern based on the to-be-optimized pattern, and then performs a pattern reshaping process on the initial knowledge graph based on a pattern reshaping strategy corresponding to the reshaped knowledge graph pattern to obtain a first knowledge graph, and finally performs a query reshaping process on the first knowledge graph to obtain a target knowledge graph. The use of pattern reshaping strategies can quickly and accurately complete the pattern reshaping of the initial knowledge graph and generate a final target knowledge graph that is more in line with user needs and practical applications. This effectively improves the flexibility, applicability and usability of the reshaped target knowledge graph, and is able to cope with changes and diversity in data structures. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. 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.

[0069] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0070] Figure 2 A flowchart of an embodiment of a method for constructing a knowledge graph according to the present application;

[0071] Figure 3 is a schematic diagram of the structure of an embodiment of a device for constructing a knowledge graph according to the present application;

[0072] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0073] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0074] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0075] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0076] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0077] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0078] The terminal device 101 can be any electronic device with a display screen and supporting web browsing. In addition to the laptop computer 1011, tablet computer 1012 or mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer, a desktop computer, etc.

[0079] The server 103 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal device 101 .

[0080] It should be noted that the knowledge graph construction method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the knowledge graph construction device is generally set in the server / terminal device.

[0081] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0082] Continue to refer Figure 2 , showing a flowchart of an embodiment of a method for constructing a knowledge graph according to the present application. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted. The method for constructing a knowledge graph provided in the embodiment of the present application can be applied to any scenario that requires knowledge graph construction, and the method for constructing a knowledge graph can be applied to products in these scenarios, for example, knowledge graph construction in the field of finance and insurance. The method for constructing a knowledge graph comprises the following steps:

[0083] Step S201, collecting relevant information corresponding to a preset information type from multiple data sources.

[0084] In this embodiment, the knowledge graph construction method is executed on an electronic device (e.g. Figure 1The server / terminal device shown in the figure) can obtain relevant information through a wired connection or a wireless connection. It should be pointed out that the above-mentioned wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future. The executor of the present application is specifically a knowledge graph construction system, or simply referred to as a system. In the knowledge graph construction scenario in the financial field, the above-mentioned data sources may include at least banks, insurance companies, customer information systems, etc. Among them, the specific implementation process of collecting relevant information corresponding to the preset information type from multiple data sources will be further described in detail in the subsequent specific embodiments of the present application, and will not be elaborated on here.

[0085] Step S202: extract entities and relationships in the relevant information based on a preset knowledge graph embedding model.

[0086] In this embodiment, the above-mentioned related information can be extracted by using the above-mentioned knowledge graph embedding model to obtain corresponding entities and relationships. The obtained entities and relationships can be further embedded into a continuous vector space to capture the semantic relationship between entities and relationships, and to more accurately represent and measure entities and relationships.

[0087] Step S203, constructing an initial knowledge graph based on the entities and relationships.

[0088] In this embodiment, an initial knowledge graph can be constructed by using a graph database or a custom graph data structure, and the obtained entities and relationships are added to the initial knowledge graph to form nodes and edges.

[0089] Step S204: identifying the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm.

[0090] In this embodiment, the specific implementation process of identifying the pattern to be optimized in the initial knowledge graph based on the preset pattern recognition algorithm will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated in detail here.

[0091] Step S205, constructing a corresponding reshaped knowledge graph model based on the model to be optimized.

[0092] In this embodiment, a reshaped knowledge graph model, namely the above-mentioned reshaped knowledge graph model, can be constructed according to the above-mentioned pattern to be optimized and business needs. The above-mentioned reshaped knowledge graph model includes adding new entity types and relationship types (such as introducing new customer attributes or transaction types), merging redundant entities and relationships (such as merging multiple similar customer attributes into one), and refining existing pattern elements (such as subdividing transaction patterns into different types of transactions). The reshaped knowledge graph model is used to transform a given domain knowledge graph model (usually too general) into a more specific model that is suitable for a specific data set.

[0093] Step S206, calling the pattern reshaping strategy corresponding to the reshaped knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain the corresponding first knowledge graph.

[0094] In this embodiment, the above-mentioned model reshaping strategy includes the reshaping target, steps, timetable, etc. The above-mentioned calling of the model reshaping strategy corresponding to the reshaping knowledge graph model to reshape the initial knowledge graph to obtain the specific implementation process of the corresponding first knowledge graph will be further described in detail in the subsequent specific embodiments of this application, and will not be elaborated on here.

[0095] Step S207, perform query reshaping processing on the first knowledge graph to obtain a target knowledge graph.

[0096] In this embodiment, the above-mentioned query reshaping processing of the first knowledge graph to obtain the specific implementation process of the target knowledge graph will be further described in detail in subsequent specific embodiments of this application and will not be elaborated in detail here.

[0097] This application uses a knowledge graph embedding model to extract entities and relationships from relevant information collected from a data source, and constructs an initial knowledge graph based on the entities and relationships, then identifies the pattern to be optimized in the initial knowledge graph based on a pattern recognition algorithm, and constructs a corresponding reshaped knowledge graph pattern based on the pattern to be optimized, and then performs a pattern reshaping process on the initial knowledge graph based on a pattern reshaping strategy corresponding to the reshaped knowledge graph pattern to obtain a first knowledge graph, and finally performs a query reshaping process on the first knowledge graph to obtain a target knowledge graph. This is to achieve the use of a pattern reshaping strategy to quickly and accurately complete the pattern reshaping process of the initial knowledge graph and generate a final target knowledge graph that better meets user needs and practical applications, effectively improving the flexibility, applicability and usability of the reshaped target knowledge graph, and being able to cope with changes and diversity in data structures.

[0098] In some optional implementations, step S204 includes the following steps:

[0099] Filter out the target pattern recognition algorithm from the preset multiple pattern recognition algorithms.

[0100] In this embodiment, the above-mentioned multiple pattern recognition algorithms may at least include frequent item set mining algorithms, such as Apriori algorithm or FP-Growth algorithm, and association rule mining algorithms, such as C4.5 algorithm or CART algorithm, etc. One or more suitable algorithms can be selected from the multiple pattern recognition algorithms as the above-mentioned target pattern recognition algorithm according to actual business needs and data characteristics.

[0101] Based on the target pattern recognition algorithm, the initial knowledge graph is recognized and processed to obtain corresponding existing patterns and potential patterns.

[0102] In this embodiment, the above target pattern recognition algorithm can be applied to the above initial knowledge graph to identify existing patterns (such as common transaction patterns, credit assessment patterns, etc.) and potential patterns (such as potential risk patterns, fraud patterns, etc.) in the initial knowledge graph. For example, common transaction patterns can be discovered through frequent item set mining algorithms, and credit assessment patterns or potential risk patterns can be discovered through association rule mining algorithms.

[0103] Statistical analysis is performed on the existing pattern and the potential pattern to obtain corresponding analysis results.

[0104] In this embodiment, by performing statistical analysis on the identified patterns, indicators such as the frequency, support, and confidence of the patterns are calculated, thereby obtaining corresponding analysis results.

[0105] The mode to be optimized is determined from the existing mode and the potential mode based on the analysis result.

[0106] In this embodiment, the relationship and characteristics between the existing mode and the potential mode are analyzed based on the analysis result to determine the mode that needs to be optimized, that is, the above-mentioned model to be optimized, and the mode that needs to be retained is determined.

[0107] The present application selects a target pattern recognition algorithm from a plurality of preset pattern recognition algorithms; then identifies and processes the initial knowledge graph based on the target pattern recognition algorithm to obtain corresponding existing patterns and potential patterns; then statistically analyzes the existing patterns and potential patterns to obtain corresponding analysis results; and subsequently determines the pattern to be optimized from the existing patterns and potential patterns based on the analysis results. The present application selects a target pattern recognition algorithm from a plurality of preset pattern recognition algorithms; and identifies and processes the initial knowledge graph based on the target pattern recognition algorithm to obtain corresponding existing patterns and potential patterns; then statistically analyzes the existing patterns and potential patterns to obtain analysis results, and subsequently, based on the analysis results, it is possible to quickly and accurately determine the pattern to be optimized from the existing patterns and potential patterns, thereby ensuring the accuracy of the content of the obtained pattern to be optimized.

[0108] In some optional implementations of this embodiment, step S206 includes the following steps:

[0109] Based on the pattern reshaping strategy, a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph is constructed.

[0110] In this embodiment, according to the above-mentioned pattern reshaping strategy, a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph can be constructed. The mapping relationship table includes the mapping relationship between entities and relationships, and the mapping relationship between attributes. Among them, the mapping relationship can be automatically realized by writing a corresponding mapping script based on the query language of the graph database.

[0111] Among them, the pattern reshaping strategy (or pattern reshaping algorithm) selects subsets of nodes and edges in a given domain graph knowledge pattern, which can be mapped to the relational pattern R or contained in the user information U, and then connects these selected subsets with more edges to generate a reshaped pattern.

[0112] The steps of the schema reshaping strategy include the following: (1) Add new entity types and relationship types to reflect new patterns identified in the data. For example, if a new relationship type appears in the data and this relationship is not defined in the existing schema, the schema needs to be extended to include the relationship. (2) Merge redundant entity types and relationship types and delete schema elements that are no longer needed. This step helps reduce the complexity of the knowledge graph and improve the consistency of the data. For example, if some relationship types can be represented by a broader type, these relationships can be merged into a broader relationship type. (3) Refine existing schema elements to make them more consistent with the semantics of the actual data. For example, the definition of some entity types can be refined based on specific attributes in the data so that the characteristics of these entities can be more accurately represented in the knowledge graph.

[0113] The specific algorithm steps of the model reshaping strategy are as follows:

[0114] 1) First, take the main node given in the optional user information as the root node, and select nodes and edges layer by layer from the given domain graph knowledge pattern to expand the tree A to ensure that there is only one path between any node and the root node.

[0115] Then use the root node to initialize the expansion tree A, N out (the outer node set of leaf nodes), N a (the set of nodes visited), and initialize E1 (the set of edges deleted) to an empty set. lea (A's leaf node set) is not empty, initialize the empty set N out .

[0116] Enumerate the current N lea For each node in , create an empty set N belonging to it iout .

[0117] For each leaf node, enumerate the undeleted edges e(n) related to the node in the given domain knowledge graph pattern. i , n j ), check the other node n connected by this edge j If this node is not in N a Then add this node and edge to A, add n i To N a and N iout In; if n j Has been visited (i.e. in N a ), then add the edge to E1.

[0118] After enumerating all the edges, N iout Add all elements in N out middle.

[0119] After enumerating all points n i After N out It became the new N lea .

[0120] 2) Select nodes from the relationship pattern graph according to the user or rule and save them in N p (Selected node set), and then delete the nodes in tree B that are not in N p Nodes in .

[0121] First, use the master node to initialize the ring node set N out , initialize B with A, and initialize B's deleted edge set E2 to an empty set.

[0122] Then select nodes in the relationship pattern graph, or nodes with attributes of the "ID" or "Name" data type, or nodes selected by the user. These nodes are added to the N p middle.

[0123] If N out Not empty. Initialize an empty set N k , then enumerate the current N lea Each node n in i .

[0124] For each leaf node, enumerate the edges e(n) related to the node in A. i , n j ).

[0125] If n j Not selected (not in N p ), then delete node n of B j and edges. If the edge e(n j , n k ) in A, then delete this edge from B and add an edge e(n) with the same label i , n j ) to B. e(n j , n k ) is added to N p In, n i Added to N k middle.

[0126] If n j In N p In, then n j Added to N k middle.

[0127] In all n i After being enumerated, N out Added to N a In, N k Become the new N out .

[0128] In N out After being empty, the items in the given schema-to-relationship table mapping that are present in B are added to the reshaped schema-to-relationship table mapping.

[0129] 3) Add edges.

[0130] Some of the edges deleted in steps 1) and 2) are added back to B, whose heads and tails are both in B, to finally generate the reshaped pattern.

[0131] In addition, the schema reshaping strategy of this application allows the schema to be dynamically adjusted according to specific data and user needs. This makes the knowledge graph of the original graph architecture more flexible and adaptable, and can effectively cope with changes and diversity in data structures. By allowing users to enter key information, such as specifying main nodes or promoting certain attributes to class nodes, the schema reshaping algorithm can help generate knowledge graphs that better meet user needs and practical applications. This improvement improves the usability of the knowledge graph, especially in industrial scenarios that require frequent queries and analysis.

[0132] Among them, the schema reshaping mechanism reduces redundant information in the graph by simplifying the complex graph structure into a tree structure, thereby improving query efficiency. This not only simplifies the structure of the schema, but also reduces the computational complexity of the original graph architecture knowledge graph, making the system more efficient when processing large-scale data.

[0133] In addition, the process of schema reshaping retains the information of edges that may be deleted, and re-adds these edges when appropriate, ensuring that the final generated schema is both concise and retains the important associations in the original schema. This method ensures that the generated knowledge graph conforms to the actual structure of the data without losing key domain knowledge.

[0134] Based on the pattern reshaping strategy and the mapping relationship table, the initial knowledge graph is subjected to corresponding structural modification processing to obtain a reshaped knowledge graph.

[0135] In this embodiment, before reshaping, the initial knowledge graph may be backed up to prevent data loss or damage. Then, according to the pattern reshaping strategy and the mapping relationship table, the nodes and edges in the initial knowledge graph are modified to complete the structural modification of the initial knowledge graph and obtain the reshaped knowledge graph.

[0136] The reshaped knowledge graph is used as the first knowledge graph.

[0137] In this embodiment, the original data in the initial knowledge graph can be subsequently migrated to the reshaped knowledge graph.

[0138] The present application constructs a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph based on the pattern reshaping strategy; then performs corresponding structural modification processing on the initial knowledge graph based on the pattern reshaping strategy and the mapping relationship table to obtain a reshaped knowledge graph; and subsequently uses the reshaped knowledge graph as the first knowledge graph. The present application constructs a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph based on the pattern reshaping strategy; then performs corresponding structural modification processing on the initial knowledge graph based on the pattern reshaping strategy and the mapping relationship table, so that the pattern reshaping processing of the initial knowledge graph can be completed quickly and accurately and the corresponding first knowledge graph can be obtained, which effectively improves the flexibility, adaptability and usability of the reshaped first knowledge graph, and can cope with changes and diversity in data structures.

[0139] In some optional implementations, step S207 includes the following steps:

[0140] Call preset query conversion scripts and validation tools.

[0141] In this embodiment, in order to maintain the query capability of the reshaped graph, a corresponding query conversion script is pre-written. The query conversion script is an automated script that has the function of converting a query based on the original mode into a query based on the reshaped mode. The above verification tool is a consistency check tool for verifying the reshaped knowledge graph to ensure the accuracy and consistency of the graph.

[0142] The first knowledge graph is subjected to query reshaping processing based on the query conversion script to obtain a processed second knowledge graph.

[0143] In this embodiment, the query conversion script is used to perform query reshaping on the first knowledge graph so that the query based on the reshaped mode can be consistent with the query of the original mode, thereby obtaining the processed second knowledge graph. In addition, query rewriting technology can also be used to achieve automatic conversion of queries. Specifically, it is achieved by parsing the original query statement and converting it into a new query statement according to the mapping relationship table.

[0144] Perform a consistency check on the second knowledge graph based on the verification tool.

[0145] In this embodiment, the second knowledge graph can be consistency checked by using the above-mentioned verification tool to compare the graph data before and after the reshaping, check whether there is any inconsistency, and generate a corresponding consistency verification result. The consistency verification result includes passing the consistency verification or failing the consistency verification.

[0146] If the second knowledge graph passes the consistency check, the second knowledge graph is used as the target knowledge graph.

[0147] In this embodiment, if the second knowledge graph passes the consistency check, it is determined that the second knowledge graph can meet the business requirements, and then the second knowledge graph is used as the final target knowledge graph. The reshaped target knowledge graph can be deployed to the production environment and related configuration and debugging can be performed. This can ensure that the target knowledge graph can be applied and play a role in actual business.

[0148] This application calls a preset query conversion script and verification tool; then performs query reshaping processing on the first knowledge graph based on the query conversion script to obtain a processed second knowledge graph; subsequently performs consistency verification on the second knowledge graph based on the verification tool; if the second knowledge graph passes the consistency verification, the second knowledge graph is used as the target knowledge graph. After calling the pattern reshaping strategy to perform pattern reshaping processing on the initial knowledge graph to obtain the first knowledge graph, this application performs query reshaping processing on the first knowledge graph based on the use of the query conversion script to obtain the second knowledge graph, effectively achieving that the query based on the reshaped pattern can be consistent with the query of the original pattern. In addition, the second knowledge graph will be intelligently verified for consistency based on the use of the verification tool, and after the second knowledge graph passes the consistency verification, the second knowledge graph will be used as the final target knowledge graph, ensuring the accuracy and consistency of the generated target knowledge graph, and is conducive to ensuring that the generated target knowledge graph can run stably and meet business needs in actual applications.

[0149] In some optional implementations, step S201 includes the following steps:

[0150] Initial information related to the information type is collected from the multiple data sources based on a preset information extraction script.

[0151] In this embodiment, the information extraction script is a pre-written script with the function of extracting specific information. The data source may include at least a bank system, a customer information system, an insurance system, etc. The information type may include at least a customer type, an account type, a transaction type, a loan type, a credit score type, etc.

[0152] The initial information is cleaned to obtain corresponding first information.

[0153] In this embodiment, the corresponding first information can be obtained by using a data cleaning tool to remove duplicate, invalid or erroneous data in the initial information, and to complete or mark the missing data in the initial information as missing.

[0154] The first information is formatted and processed to obtain corresponding second information.

[0155] In this embodiment, the data format of the obtained first information can be converted to meet the requirements of subsequent processing, thereby obtaining the corresponding second information.

[0156] The second information is used as the related information.

[0157] The present application collects initial information related to the information type from the various data sources based on a preset information extraction script; then cleans the initial information to obtain the corresponding first information; then performs format conversion on the first information to obtain the corresponding second information; and subsequently uses the second information as the relevant information. The present application collects initial information related to the information type from various data sources based on the use of an information extraction script, and then performs cleaning and format conversion on the initial information, so that the required relevant information can be obtained quickly and accurately, ensuring the accuracy of the content of the obtained relevant information.

[0158] In some optional implementations of this embodiment, before step S202, the electronic device may further perform the following steps:

[0159] Call the preset initial embedding model.

[0160] In this embodiment, the above initial embedding model is initially constructed to embed entities and relationships in the knowledge graph into a continuous vector space, thereby capturing the semantic relationship between entities and relationships. These vector representations can reflect the similarity and correlation between entities, which is helpful for the construction and subsequent application of the graph.

[0161] Get pre-built scoring functions and hinge loss functions.

[0162] In this embodiment, different weights are assigned to triples in advance according to different types of relationships (such as one-to-one, one-to-many, etc.). Business rules, statistical methods, or machine learning algorithms can be used to determine weights. Among them, when constructing triples, the weights are stored as part of the triples. In subsequent scoring functions and loss functions, these weights are used to adjust the influence of different relationships. Specifically, a scoring function based on distance or similarity is introduced to calculate the score of the triple. And the scoring function is adjusted according to the weight to reflect the importance of different relationships. And a hinge loss function based on margins is used to make the correct triples score lower and the damaged triples score higher. And according to the scoring function and the weight, the specific form of the loss function is defined.

[0163] The initial embedding model is trained and optimized based on a preset stochastic gradient descent algorithm, the scoring function and the hinge loss function to obtain a specified embedding model that meets preset performance conditions.

[0164] In this embodiment, most of the relation instances in the knowledge graph are hierarchical and non-reflexive. Therefore, the relation of each triple (h, r, t) can be regarded as a directed transfer r from the head entity h to the tail entity t in the embedding space. The core idea of ​​optimizing the embedding model is to assign a weight to each training triple to indicate its mapping degree.

[0165] Specifically, a new scoring function is introduced to distinguish between correct triples and corrupted triples. A margin-based hinge loss function is used to optimize the embedding model. By minimizing this hinge loss function, the model is able to gradually optimize the embedding representation of the triples, making the correct triples score lower and the corrupted triples score higher. Each updated entity is then pulled back to the unit sphere by a projection method to satisfy the embedding constraints. This ensures that the entity representation will not be too large or too small during the optimization process, thereby maintaining the stability of the update. In addition, the model also measures the mapping properties of the relationship by calculating the average number of tail entities corresponding to each different head entity. These values ​​are higher for many-to-many relationship instances and lower for one-to-one relationship instances. In addition, the optimization model uses stochastic gradient descent to iteratively find the optimal solution, and by continuously adjusting the embedding vector to minimize the hinge loss function, it finally obtains a specified embedding model that meets the preset performance conditions. Among them, the performance of the model can be evaluated by using a test dataset, including the ability to distinguish between correct triples and corrupted triples. For example, indicators such as accuracy, recall, and F1 score can be used to measure the performance of the model. Then, the model parameters (such as weights, learning rates, etc.) are adjusted according to the evaluation results to improve the accuracy and generalization ability of the model. Specifically, methods such as grid search, random search, or Bayesian optimization can be used to find the optimal parameters, so as to finally obtain a specified embedding model that meets the performance requirements.

[0166] The specified embedding model is used as the knowledge graph embedding model.

[0167] In this embodiment, the knowledge graph embedding model is obtained by optimizing the embedding model based on the traditional method. The obtained knowledge graph embedding model gives different weights to triples by considering different types of relationship mapping attributes (such as one-to-one, one-to-many, many-to-one, many-to-many), and adjusts the influence of different relationships, so that various relationship types can be handled more flexibly, and the diversified relationship characteristics existing in the knowledge graph can be better captured and utilized.

[0168] In addition, the optimized knowledge graph embedding model solves the limitations of traditional methods in dealing with multi-mapping relationships by assigning different weights to each relationship. By considering the mapping attributes of each triple, the optimized model can effectively avoid entities being too close in the embedding space, thereby improving the discrimination. This means that the model performs better when dealing with complex, multi-mapping relationships.

[0169] In addition, the optimized knowledge graph embedding model assigns weights according to different mapping attributes of the relationship, which enables the model to adapt to multiple different types of relationships. The scoring function of the model combines weights and distance metrics, allowing for more flexible handling of different relationship types during the optimization process. Although relationship weights are introduced, these weights can be pre-calculated, so they do not significantly increase the parameter complexity of the model.

[0170] This application calls a preset initial embedding model; then obtains a pre-built scoring function and hinge loss function; then trains and optimizes the initial embedding model based on a preset stochastic gradient descent algorithm, the scoring function, and the hinge loss function to obtain a specified embedding model that meets preset performance conditions; and subsequently uses the specified embedding model as the knowledge graph embedding model. This application trains and optimizes the called initial embedding model based on a pre-built scoring function and hinge loss function, as well as the use of a stochastic gradient descent algorithm, so that an optimized knowledge graph embedding model can be constructed quickly and intelligently, thereby improving the model effect of the knowledge graph embedding model. This enables the subsequent use of the knowledge graph embedding model to better capture and utilize the diverse relationship characteristics existing in the knowledge graph.

[0171] In some optional implementations of this embodiment, after step S207, the electronic device may further perform the following steps:

[0172] Get the side information stored during the schema reshaping process.

[0173] In this embodiment, the edge information is the information of the edge that may be deleted and is retained during the reshaping process. In the process of calling the pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to reshape the initial knowledge graph, the information of the edge that may be deleted, that is, the edge information, will be retained. This can be achieved by storing the edge information in a temporary table or log file.

[0174] The target knowledge graph is processed by re-adding edges based on the edge information to obtain a processed third knowledge graph.

[0175] In this embodiment, when appropriate, the retained side information is re-added to the reshaped target knowledge graph. Specifically, the corresponding third knowledge graph can be obtained by checking the temporary table or log file and adding the qualified side information to the reshaped target knowledge graph.

[0176] The third knowledge graph is stored.

[0177] In this embodiment, there is no specific limitation on the storage method of the third knowledge graph, which can be determined according to the actual business usage requirements. Exemplarily, any one of local database storage, cloud server storage, network disk storage, blockchain storage, etc. can be used. Among them, blockchain storage is preferably used as the storage method of the third knowledge graph. By using blockchain to store and manage the third knowledge graph, the security and immutability of the third knowledge graph can be effectively guaranteed.

[0178] The present application obtains the side information stored in the process of schema reshaping; then re-adds the target knowledge graph based on the side information to obtain a processed third knowledge graph; and subsequently stores the third knowledge graph. The present application intelligently uses the side information stored in the process of schema reshaping to re-add the target knowledge graph to obtain a third knowledge graph, which can effectively ensure that the schema of the final generated third knowledge graph is both concise and retains the important associations in the original schema. The generated third knowledge graph conforms to the actual structure of the data without losing key domain knowledge. In addition, by storing the third knowledge graph, the security and immutability of the third knowledge graph can be effectively guaranteed.

[0179] In some optional implementations, the user information obtained is subject to the user's consent and complies with relevant laws and policies.

[0180] In addition, the non-Company software tools or components that appear in the embodiments of the present application are merely examples and do not represent actual use.

[0181] In addition, the knowledge graph can be further updated and iterated. After the introduction of the new model, the structure of the knowledge graph becomes richer and can more accurately reflect customer behavior and risk characteristics. The optimized graph is used to support business applications such as credit assessment models and anti-fraud systems. As time goes by and data increases, the knowledge graph is regularly updated and iterated using the model reshaping method to ensure the accuracy and timeliness of the graph.

[0182] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0183] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target knowledge graph, the above-mentioned target knowledge graph can also be stored in a node of a blockchain.

[0184] 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.

[0185] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0186] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0187] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0188] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0189] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a knowledge graph construction device, which is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0190] like Figure 3 As shown, the knowledge graph construction device 300 described in this embodiment includes: a collection module 301, an extraction module 302, a first construction module 303, an identification module 304, a second construction module 305, a first processing module 306 and a second processing module 307. Among them:

[0191] A collection module 301 is used to collect relevant information corresponding to a preset information type from a variety of data sources;

[0192] An extraction module 302 is used to extract entities and relationships in the relevant information based on a preset knowledge graph embedding model;

[0193] A first construction module 303, used to construct an initial knowledge graph based on the entities and relationships;

[0194] An identification module 304 is used to identify a pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm;

[0195] The second construction module 305 is used to construct a corresponding reshaped knowledge graph model based on the model to be optimized;

[0196] The first processing module 306 is used to call the pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain the corresponding first knowledge graph;

[0197] The second processing module 307 is used to perform query reshaping processing on the first knowledge graph to obtain a target knowledge graph.

[0198] In this embodiment, the operations performed by the above modules or units respectively correspond one-to-one to the steps of the method for constructing a knowledge graph in the aforementioned implementation method, and will not be repeated here.

[0199] In some optional implementations of this embodiment, the identification module 304 includes:

[0200] A screening submodule, used to screen out a target pattern recognition algorithm from a plurality of preset pattern recognition algorithms;

[0201] An identification submodule, used to perform identification processing on the initial knowledge graph based on the target pattern recognition algorithm to obtain corresponding existing patterns and potential patterns;

[0202] An analysis submodule, used to perform statistical analysis on the existing pattern and the potential pattern to obtain corresponding analysis results;

[0203] The first determination submodule is used to determine the mode to be optimized from the existing mode and the potential mode based on the analysis result.

[0204] In some optional implementations of this embodiment, the first processing module 306 includes:

[0205] A construction submodule is used to construct a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph based on the pattern reshaping strategy;

[0206] A modification submodule, used to perform corresponding structural modification processing on the initial knowledge graph based on the pattern reshaping strategy and the mapping relationship table to obtain a reshaped knowledge graph;

[0207] The second determination submodule is used to use the reshaped knowledge graph as the first knowledge graph.

[0208] In some optional implementations of this embodiment, the second processing module 307 includes:

[0209] The calling submodule is used to call the preset query conversion script and verification tool;

[0210] A first processing submodule, configured to perform query reshaping processing on the first knowledge graph based on the query conversion script to obtain a processed second knowledge graph;

[0211] A verification submodule, used to perform consistency verification on the second knowledge graph based on the verification tool;

[0212] The third determination submodule is used to use the second knowledge graph as the target knowledge graph if the second knowledge graph passes the consistency check.

[0213] In some optional implementations of this embodiment, the collection module 301 includes:

[0214] A collection submodule, configured to collect initial information related to the information type from the multiple data sources based on a preset information extraction script;

[0215] A second processing submodule is used to clean the initial information to obtain corresponding first information;

[0216] A third processing submodule, configured to perform format conversion processing on the first information to obtain corresponding second information;

[0217] The fourth determining submodule is configured to use the second information as the relevant information.

[0218] In some optional implementations of this embodiment, the knowledge graph construction device further includes:

[0219] A calling module is used to call the preset initial embedding model;

[0220] A first acquisition module is used to acquire a pre-built scoring function and a hinge loss function;

[0221] A third processing module is used to train and optimize the initial embedding model based on a preset stochastic gradient descent algorithm, the scoring function and the hinge loss function to obtain a specified embedding model that meets preset performance conditions;

[0222] A determination module is used to use the specified embedding model as the knowledge graph embedding model.

[0223] In some optional implementations of this embodiment, the knowledge graph construction device further includes:

[0224] A second acquisition module is used to acquire the side information stored in the process of pattern reshaping;

[0225] An adding module, configured to perform edge re-adding processing on the target knowledge graph based on the edge information to obtain a processed third knowledge graph;

[0226] A storage module is used to store and process the third knowledge graph.

[0227] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0228] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0229] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0230] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the construction method of the knowledge graph, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0231] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the method for constructing the knowledge graph.

[0232] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0233] The present application also provides another implementation, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the knowledge graph construction method as described above.

[0234] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0235] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A method for constructing a knowledge graph, characterized in that: The steps include: Collect relevant information corresponding to the preset information type from multiple data sources; Extracting entities and relationships from the relevant information based on a preset knowledge graph embedding model; Constructing an initial knowledge graph based on the entities and relationships; Identify the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm; Constructing a corresponding reshaped knowledge graph model based on the model to be optimized; Calling a pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain a corresponding first knowledge graph; The first knowledge graph is subjected to query reshaping processing to obtain a target knowledge graph.

2. The method for constructing a knowledge graph according to claim 1, characterized in that: The step of identifying the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm specifically includes: Selecting a target pattern recognition algorithm from a plurality of preset pattern recognition algorithms; Based on the target pattern recognition algorithm, the initial knowledge graph is identified and processed to obtain corresponding existing patterns and potential patterns; Performing statistical analysis on the existing pattern and the potential pattern to obtain corresponding analysis results; The mode to be optimized is determined from the existing mode and the potential mode based on the analysis result.

3. The method for constructing a knowledge graph according to claim 1, characterized in that: The step of calling the pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain the corresponding first knowledge graph specifically includes: Based on the pattern reshaping strategy, construct a mapping relationship table between the reshaped knowledge graph pattern and the original pattern of the initial knowledge graph; Performing corresponding structural modification processing on the initial knowledge graph based on the pattern reshaping strategy and the mapping relationship table to obtain a reshaped knowledge graph; The reshaped knowledge graph is used as the first knowledge graph.

4. The method for constructing a knowledge graph according to claim 1, characterized in that: The step of performing query reshaping processing on the first knowledge graph to obtain a target knowledge graph specifically includes: Call preset query conversion scripts and verification tools; Performing query reshaping processing on the first knowledge graph based on the query conversion script to obtain a processed second knowledge graph; Performing consistency verification on the second knowledge graph based on the verification tool; If the second knowledge graph passes the consistency check, the second knowledge graph is used as the target knowledge graph.

5. The method for constructing a knowledge graph according to claim 1, characterized in that: The step of collecting relevant information corresponding to the preset information type from multiple data sources specifically includes: Collecting initial information related to the information type from the multiple data sources based on a preset information extraction script; Cleaning the initial information to obtain corresponding first information; Performing format conversion processing on the first information to obtain corresponding second information; The second information is used as the related information.

6. The method for constructing a knowledge graph according to claim 1, characterized in that: Before the step of extracting entities and relationships in the relevant information based on the preset knowledge graph embedding model, the method further includes: Call the preset initial embedding model; Get pre-built scoring functions and hinge loss functions; Based on a preset stochastic gradient descent algorithm, the scoring function and the hinge loss function, the initial embedding model is trained and optimized to obtain a specified embedding model that meets preset performance conditions; The specified embedding model is used as the knowledge graph embedding model.

7. The method for constructing a knowledge graph according to claim 1, characterized in that: After the step of performing query reshaping processing on the first knowledge graph to obtain a target knowledge graph, the method further includes: Get the side information stored during the pattern reshaping process; Based on the edge information, the target knowledge graph is processed to obtain a processed third knowledge graph; The third knowledge graph is stored.

8. A device for constructing a knowledge graph, characterized in that: include: A collection module, used to collect relevant information corresponding to a preset information type from multiple data sources; An extraction module, used to extract entities and relationships in the relevant information based on a preset knowledge graph embedding model; A first building module, used to build an initial knowledge graph based on the entities and relationships; An identification module, used to identify the pattern to be optimized in the initial knowledge graph based on a preset pattern recognition algorithm; A second construction module is used to construct a corresponding reshaped knowledge graph model based on the model to be optimized; A first processing module is used to call a pattern reshaping strategy corresponding to the reshaping knowledge graph pattern to perform pattern reshaping processing on the initial knowledge graph to obtain a corresponding first knowledge graph; The second processing module is used to perform query reshaping processing on the first knowledge graph to obtain a target knowledge graph.

9. A computer device, characterized in that: It includes a memory and a processor, the memory stores computer-readable instructions, and the processor implements the steps of the knowledge graph construction method as described in any one of claims 1 to 7 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for constructing a knowledge graph as described in any one of claims 1 to 7.