Global knowledge reasoning method and system equipment based on knowledge graph completion and medium
By constructing the training data set and knowledge path, and using semantic representation model to perform semantic transformation and training on the data in the knowledge graph, the problem of knowledge graph inference in the context of no query input is solved, and efficient reasoning of missing knowledge in the global knowledge graph is achieved.
Patent Information
- Application Number
- CN202411427022.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-28
AI Technical Summary
Existing knowledge graph inference methods cannot query the global knowledge graph for missing knowledge in the query-free input situation.
By constructing training data sets and knowledge paths, semantic transformations of knowledge paths and triples using semantic representation models, the semantic representation model is trained to calculate latent knowledge scores, and thus the latent knowledge in the knowledge graph is inferred.
It realizes the inference of missing entities without querying entities and relationships, and can query missing knowledge for global knowledge graphs without being affected by entity embedding.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and in particular to a global knowledge reasoning method, system equipment and medium based on knowledge graph completion. Background Art
[0002] Knowledge graph is a structured data representation that organizes information into entities and relationships between entities in the form of a graph, and describes these entities through attributes. Data in knowledge graphs are usually modeled as triples, that is, in the form of "subject-predicate-object". This allows machines to understand and process this information, thereby supporting complex query and reasoning tasks. Knowledge graph reasoning is a technology that has emerged in the context of the big data era to meet the needs of artificial intelligence for deep semantic understanding. It organizes and associates data in a structured way to achieve complex queries and logical inferences. It is widely used in many fields such as improving the quality of search engines, enhancing natural language processing capabilities, and optimizing business decisions.
[0003] Most of the existing knowledge graph reasoning methods are based on user-generated query entities and relationships, and use knowledge graph completion technology to infer missing entities, ignoring the reasoning mode for global knowledge graph queries in the absence of query input. However, the global knowledge graph has the characteristics of large scale and complex data types, and an effective method is needed to efficiently reason about missing knowledge in the knowledge graph. Summary of the invention
[0004] The present invention provides a global knowledge reasoning method, system equipment and medium based on knowledge graph completion, which solves the problem that existing knowledge graph reasoning methods are unable to query the global knowledge graph due to lack of knowledge in the absence of query input.
[0005] In a first aspect, an embodiment of the present invention provides a global knowledge reasoning method based on knowledge graph completion, and the method flow is as follows:
[0006] Construct a training data set based on the knowledge graph, and construct a knowledge path based on the training data set;
[0007] Based on the semantic representation model, semantic transformation is performed on the knowledge path and the triples in the training data set to obtain the semantic representation of the knowledge path and the semantic representation of the triples;
[0008] The semantic representation model is trained based on the distance between the semantic representation of the knowledge path and the semantic representation of the triple;
[0009] Constructing a potential knowledge set based on the knowledge graph, and constructing a potential knowledge path based on the potential knowledge set;
[0010] Based on the trained semantic representation model, semantic transformation is performed on the potential knowledge path and the potential triples in the potential knowledge set to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triples;
[0011] The potential knowledge score is calculated based on the semantic representation of the potential knowledge path and the semantic representation of the potential triples, and the knowledge reasoning result is obtained based on the potential score ranking.
[0012] In the above embodiment, the present invention first searches for possible missing knowledge based on the global knowledge graph, and screens potential knowledge based on relationship patterns and paths, and then derives potential knowledge in the knowledge graph based on path reasoning. Missing entities can be inferred without querying entities and querying relationships.
[0013] As some optional implementation modes of the present application, the training data set includes several triples, and the potential knowledge set includes several potential triples.
[0014] As some optional implementation methods of the present application, the process of constructing a knowledge path based on a training data set is as follows:
[0015] For the triples in the training dataset, delete the edge between the head entity and the tail entity in the network structure of the knowledge graph;
[0016] The walk is performed with the head entity as the starting point and the tail entity as the end point to obtain the shortest path between the head entity and the tail entity, and the entities and relationships in the walk are recorded to construct a knowledge path.
[0017] In the above embodiment, the present invention uses the shortest path method to perform knowledge search, and can obtain entities and relationships that are strongly related to triples.
[0018] As some optional implementations of the present application, the process of performing semantic transformation on the knowledge path and the triples in the training data set based on the semantic representation model to obtain the semantic representation of the knowledge path and the semantic representation of the triples is as follows:
[0019] Convert the triples and corresponding knowledge paths in the training data set into natural language to obtain texts corresponding to the triples and texts corresponding to the knowledge paths;
[0020] The text corresponding to the knowledge path and the text corresponding to the triple are input into the semantic representation model for semantic representation to obtain the semantic representation of the knowledge path and the semantic representation of the triple.
[0021] In the above-mentioned embodiment, the present invention trains the semantic representation model so that the trained semantic representation model can represent potential knowledge paths and potential triples.
[0022] As some optional implementations of the present application, the semantic representation of the knowledge path and the semantic representation of the triple are expressed as follows:
[0023] Emb (s,r,o) =PLM(S (s,r,o) )
[0024]
[0025] Among them, S (s,r,o) Represents the text corresponding to the triple, Indicates the text corresponding to the knowledge path, Emb (s,r,o) Represents the semantic representation of triples, Represents the semantic representation of knowledge paths.
[0026] As some optional implementations of the present application, the process of training the semantic representation model based on the distance between the semantic representation of the knowledge path and the semantic representation of the triple is as follows:
[0027] Construct the semantic representation of negative samples based on the semantic representation of triples in the knowledge graph;
[0028] Based on the semantic representation of the knowledge path, the semantic representation of the triple and the semantic representation of the negative sample, the similarity between the semantic representation of the knowledge path and the semantic representation of the triple is calculated;
[0029] The loss function is constructed by the similarity between the semantic representation of the knowledge path and the semantic representation of the triple to construct the semantic connection between the relationship and the path.
[0030] In the above embodiment, the present invention trains the model by constructing a loss function, so that the semantic representation model can accurately represent the potential knowledge paths and potential triples.
[0031] As some optional implementations of the present application, the calculation formula of the loss function is as follows:
[0032]
[0033] Among them, Loss represents the loss function, G represents the knowledge graph, and Emb (s,r',o) Represents the semantic representation of negative samples, Emb (s,r,o) represents the semantic representation of the original triple, It represents the semantic representation of the knowledge path, and cos_sim represents the cosine similarity calculation formula.
[0034] In the above embodiment, the present invention constructs a loss function based on cosine similarity to perform similarity training, and establishes a semantic connection between the relationship and the path through similarity training between the path semantic representation and the original triple semantic representation.
[0035] As some optional implementations of the present application, the process of performing semantic transformation on potential knowledge paths and potential triples in potential knowledge sets based on the trained semantic representation model to obtain semantic representations of potential knowledge paths and semantic representations of potential triples is as follows:
[0036] Converting potential triples and corresponding potential knowledge paths in the potential knowledge set into natural language to obtain texts corresponding to the potential triples and texts corresponding to the potential knowledge paths;
[0037] The text corresponding to the potential knowledge path and the text corresponding to the potential triple are input into the trained semantic representation model for semantic representation to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triple.
[0038] As some optional implementations of the present application, the semantic representation of the potential knowledge path and the semantic representation of the potential triple are expressed as follows:
[0039]
[0040] Among them, S(s i ,r k ,o i ) represents the text corresponding to the potential triple, Represents the text corresponding to the potential knowledge path, represents the semantic representation of the potential triples, It represents the semantic representation of potential knowledge paths, and PLM stands for semantic representation model.
[0041] As some optional implementations of the present application, the calculation formula of the potential knowledge score is as follows:
[0042]
[0043] Among them, Score(s i ,r k ,o i ) represents the potential knowledge score, and cos_sim represents the cosine similarity calculation formula.
[0044] In the above embodiment, the present invention calculates the score Score (s) of each pair of potential triples based on the semantic representation of the potential knowledge triples and the semantic representation of the potential knowledge paths. i ,r k ,o i ), and select the potential triples with the highest scores as the reasoning results of the potential knowledge subgraph to construct the answer knowledge set.
[0045] In a second aspect, the present invention provides a global knowledge reasoning system based on knowledge graph completion, the system comprising:
[0046] A training data construction unit, wherein the training data construction unit constructs a training data set based on the knowledge graph, and constructs a knowledge path based on the training data set;
[0047] A training data semantic representation unit, wherein the training data semantic representation unit performs semantic transformation on the knowledge path and the triples in the training data set based on the semantic representation model to obtain the semantic representation of the knowledge path and the semantic representation of the triples;
[0048] A semantic representation model training unit, wherein the semantic representation model training unit trains a semantic representation model based on a distance between a semantic representation of a knowledge path and a semantic representation of a triple;
[0049] An inference data construction unit, wherein the inference data construction unit constructs a potential knowledge set based on the knowledge graph, and constructs a potential knowledge path based on the potential knowledge set;
[0050] An inference data semantic representation unit, which performs semantic transformation on potential knowledge paths and potential triples in potential knowledge sets based on a trained semantic representation model to obtain semantic representations of potential knowledge paths and semantic representations of potential triples;
[0051] A global knowledge reasoning unit calculates a potential knowledge score based on a semantic representation of a potential knowledge path and a semantic representation of a potential triple, and obtains a knowledge reasoning result based on a potential score ranking.
[0052] In a third aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the global knowledge reasoning method based on knowledge graph completion when executing the computer program.
[0053] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the global knowledge reasoning method based on knowledge graph completion is implemented.
[0054] The beneficial effects of the present invention are as follows: the present invention first searches for possible missing knowledge based on the global knowledge graph, and screens potential knowledge based on relationship patterns and paths, and then derives potential knowledge in the knowledge graph based on path reasoning. Missing entities can be inferred without querying entities and querying relationships, and knowledge reasoning can be achieved in the absence of user input, which is not affected by entity embedding and can reason about missing knowledge for unknown entities. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0056] Figure 1 is a schematic diagram of the computer device structure of the hardware operating environment described in the embodiment of the present invention;
[0057] Figure 2 is a flow chart of the global knowledge reasoning method according to an embodiment of the present invention;
[0058] Figure 3 It is a structural block diagram of the global knowledge reasoning system described in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] 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.
[0060] In order to solve the problem that existing knowledge graph reasoning methods cannot query the global knowledge graph without query input, the present application provides a global knowledge reasoning method, system equipment and medium based on knowledge graph completion. Before introducing the specific technical solution of the present application, the hardware operating environment involved in the embodiment of the present application is first introduced.
[0061] See also Figure 1 , Figure 1 A schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application.
[0062] like Figure 1 As shown, the computer device may include: a processor, such as a central processing unit (CPU), a communication bus, a user interface, a network interface, and a memory. Among them, the communication bus is used to realize the connection and communication between these components. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), and optionally, the user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity interface). The memory may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory may optionally be a storage device independent of the aforementioned processor.
[0063] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.
[0064] like Figure 1 As shown, the memory as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module and an electronic program module.
[0065] exist Figure 1 In the computer device shown, the network interface is mainly used for data communication with the network server; the user interface is mainly used for data interaction with the user; the processor and memory in the computer device of the present application can be set in the computer device, and the computer device calls the global knowledge reasoning system based on knowledge graph completion stored in the memory through the processor, and executes the global knowledge reasoning method based on knowledge graph completion provided in the embodiment of the present application.
[0066] Based on the hardware environment of the aforementioned embodiment, the embodiment of the present application provides a global knowledge reasoning method based on knowledge graph completion, please refer to Figure 2 , Figure 2 is a flow chart of the global knowledge reasoning method, and the method flow is as follows:
[0067] (1) Construct a training dataset based on the knowledge graph, and construct a knowledge path based on the training dataset.
[0068] In an embodiment of the present invention, for an existing knowledge graph, entities and relationships between entities are extracted, and a training data set in the form of triples is constructed according to the entity names and relationship names. The training data set includes several triples, and a single triple is represented as (s, r, o), where s represents the head entity, r represents the relationship, and o represents the tail entity.
[0069] In an embodiment of the present invention, the process of constructing a knowledge path based on a training data set is as follows:
[0070] (1.1) For the triples in the training dataset, delete the edge between the head entity and the tail entity in the network structure of the knowledge graph.
[0071] (1.2) Walk with the head entity as the starting point and the tail entity as the end point to obtain the shortest path between the head entity and the tail entity, and record the entities and relationships in the walking process to construct a knowledge path; wherein the shortest path can be constructed using the Dijkstra algorithm.
[0072] Specifically, the knowledge path is expressed as:
[0073] P (s,r,o) =(s,r1,e1,r2,…,e n-2 ,r n-1 ,o)
[0074] Among them, P (s,r,o) represents the knowledge path, r i (i=1,…,n-1) represents the relationship on the knowledge path, e i (i=1,…,n) represents the entities on the knowledge path. If there is no knowledge path between the head entity and the tail entity, the triple needs to be removed from the training data set.
[0075] (2) Based on the semantic representation model, the knowledge path and the triples in the training data set are semantically transformed to obtain the semantic representation of the knowledge path and the semantic representation of the triples.
[0076] In the embodiment of the present invention, the process of obtaining the semantic representation of the knowledge path and the semantic representation of the triple is as follows:
[0077] (2.1) Convert the triples and corresponding knowledge paths in the training data set into natural language to obtain the text corresponding to the triples and the text corresponding to the knowledge paths.
[0078] The text corresponding to the triple and the text corresponding to the knowledge path are expressed as follows:
[0079] S (s,r,o) ="[CLS]sro[SEP]"
[0080]
[0081] Among them, S (s,r,o) Represents the text corresponding to the triple, Represents the text corresponding to the knowledge path.
[0082] (2.2) Input the text corresponding to the knowledge path and the text corresponding to the triple into the semantic representation model for semantic representation, select the semantic representation corresponding to the keyword as the semantic representation of the whole sentence, so as to obtain the semantic representation of the knowledge path and the semantic representation of the triple; wherein the semantic representation model includes but is not limited to pre-trained language models such as BERT and ERNIE.
[0083] Specifically, the semantic representation of the knowledge path and the semantic representation of the triple are expressed as follows:
[0084] Emb (s,r,o) =PLM(S (s,r,o) )
[0085]
[0086] Among them, S (s,r,o) Represents the text corresponding to the triple, Indicates the text corresponding to the knowledge path, Emb (s,r,o) Represents the semantic representation of triples, It represents the semantic representation of knowledge path, and PLM represents the semantic representation model.
[0087] (3) The semantic representation model is trained based on the distance between the semantic representation of the knowledge path and the semantic representation of the triple.
[0088] In an embodiment of the present invention, the training process of the semantic representation model is as follows:
[0089] (3.1) Constructing a semantic representation of a negative sample based on the semantic representation of the triple in the knowledge graph; the negative sample is represented as (s, r', o), wherein the negative sample is obtained by replacing the relation r in the original triple (s, r, o) with a random relation r'.
[0090] (3.2) Based on the semantic representation of the knowledge path, the semantic representation of the triple, and the semantic representation of the negative sample, the similarity between the semantic representation of the knowledge path and the semantic representation of the triple is calculated.
[0091] (3.3) A loss function is constructed by comparing the similarity between the semantic representation of the knowledge path and the semantic representation of the triple to construct the semantic connection between the relationship and the path.
[0092] Specifically, the calculation formula of the loss function is as follows:
[0093]
[0094] Among them, Loss represents the loss function, G represents the knowledge graph, and Emb (s,r',o) Represents the semantic representation of negative samples, Emb (s,r,o) represents the semantic representation of the original triple, It represents the semantic representation of the knowledge path, and cos_sim represents the cosine similarity calculation formula.
[0095] (4) Construct a potential knowledge set based on the knowledge graph, and construct a potential knowledge path based on the potential knowledge set.
[0096] In the embodiment of the present invention, for a known knowledge graph, entity pairs that do not have a relationship are extracted, and the entity pairs are individually represented as (s i ,o i ), and for each entity pair, possible relations are added in turn to construct potential triples, thereby obtaining a potential knowledge set containing several potential triples.
[0097] Specifically, by performing a single entity pair (s i ,o i ) to add relations to obtain a potential knowledge subgraph:
[0098]
[0099] Specifically, for all entities [(s1,o1),(s2,o2),…,(s n ,o n )] to add relationships to obtain a potential knowledge set:
[0100] G'={G' i |i=1,…,n}
[0101] In the embodiment of the present invention, a relational model is constructed based on existing potential triples, entity types, and relationship types. Most relations only exist between fixed entity types. By extracting entity types from potential triples, a relational model of the form (type s ,type r ,type o ) relationship model, type s ,type r ,type o Represent the types of head entity, relation and tail entity respectively. According to the relation pattern, the potential triples in the potential knowledge set are filtered to eliminate the potential triples that do not conform to the entity type and relation pattern.
[0102] In an embodiment of the present invention, the process of constructing a potential knowledge path based on a potential knowledge set is as follows:
[0103] (1.1) For the potential triples in the potential knowledge set, delete the edge between the head entity and the tail entity on the network structure of the knowledge graph.
[0104] (1.2) Walk with the head entity as the starting point and the tail entity as the end point to obtain the shortest path between the head entity and the tail entity, and record the entities and relationships in the walking process to construct a potential knowledge path. The shortest path can be constructed using the Dijkstra algorithm.
[0105] Specifically, the potential knowledge path is expressed as:
[0106]
[0107] in, represents the potential knowledge path, r i (i=1,…,n-1) represents the relationship on the potential knowledge path, e i(i=1,…,n) represents the entities on the potential knowledge path. If there is no knowledge path between the head entity and the tail entity, the potential triple needs to be removed from the potential knowledge set.
[0108] (5) Based on the trained semantic representation model, semantic transformation is performed on the potential knowledge path and the potential triples in the potential knowledge set to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triples.
[0109] In an embodiment of the present invention, the process of obtaining the semantic representation of the potential knowledge path and the semantic representation of the potential triple is as follows:
[0110] (5.1) The potential triples in the potential knowledge set and the corresponding potential knowledge paths are converted into natural language to obtain texts corresponding to the potential triples and texts corresponding to the potential knowledge paths.
[0111] The text corresponding to the potential triples and the text corresponding to the potential knowledge paths are expressed as follows:
[0112]
[0113] in, represents the text corresponding to the potential triple, Represents the text corresponding to the potential knowledge path.
[0114] (5.2) The text corresponding to the potential knowledge path and the text corresponding to the potential triple are input into the trained semantic representation model for semantic representation to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triple.
[0115] Specifically, the semantic representation of the potential knowledge path and the semantic representation of the potential triple are expressed as follows:
[0116]
[0117] Among them, (s i ,r k ,o i ) represents the text corresponding to the potential triple, Represents the text corresponding to the potential knowledge path, represents the semantic representation of the potential triples, A semantic representation that represents the underlying knowledge path.
[0118] (6) Calculate the potential knowledge score based on the semantic representation of the potential knowledge path and the semantic representation of the potential triples, and obtain the knowledge reasoning results based on the potential score ranking.
[0119] In the embodiment of the present invention, the calculation formula of the potential knowledge score is as follows:
[0120]
[0121] Among them, Score(s i ,r k ,o i ) represents the potential knowledge score, and cos_sim represents the cosine similarity calculation formula.
[0122] In the embodiment of the present invention, the knowledge inference result is obtained based on the potential score sorting by selecting the potential triple corresponding to the relationship with the highest knowledge score as the potential knowledge subgraph G' i Reasoning results and constructing answer knowledge set.
[0123] Specifically, the inference result is expressed as follows:
[0124]
[0125] in, represents the i-th potential knowledge pair (s i ,o i )’s answer relationship.
[0126] In an embodiment of the present invention, after constructing the answer knowledge set, potential triples in the answer knowledge set with scores higher than a score threshold are selected as inference results of the global graph. Specifically, the score threshold includes but is not limited to being set to 0.9, and can be adjusted according to actual conditions.
[0127] In summary, the present invention first searches for possible missing knowledge based on the global knowledge graph, and screens potential knowledge based on relationship patterns and paths, and then derives potential knowledge in the knowledge graph based on path reasoning. Missing entities can be inferred without querying entities and querying relationships, and knowledge reasoning can be achieved in the absence of user input. It is not affected by entity embedding and can reason about missing knowledge for unknown entities.
[0128] In addition, in one embodiment, based on the same inventive idea as the above embodiment, the embodiment of the present invention provides a global knowledge reasoning system based on knowledge graph completion, and the system corresponds one-to-one with the method in embodiment 1, please refer to Figure 3 , Figure 3 is a structural block diagram of the global knowledge reasoning system, the system comprising:
[0129] A training data construction unit, wherein the training data construction unit constructs a training data set based on the knowledge graph, and constructs a knowledge path based on the training data set;
[0130] A training data semantic representation unit, wherein the training data semantic representation unit performs semantic transformation on the knowledge path and the triples in the training data set based on the semantic representation model to obtain the semantic representation of the knowledge path and the semantic representation of the triples;
[0131] A semantic representation model training unit, wherein the semantic representation model training unit trains a semantic representation model based on a distance between a semantic representation of a knowledge path and a semantic representation of a triple;
[0132] An inference data construction unit, wherein the inference data construction unit constructs a potential knowledge set based on the knowledge graph, and constructs a potential knowledge path based on the potential knowledge set;
[0133] An inference data semantic representation unit, which performs semantic transformation on potential knowledge paths and potential triples in potential knowledge sets based on a trained semantic representation model to obtain semantic representations of potential knowledge paths and semantic representations of potential triples;
[0134] A global knowledge reasoning unit calculates a potential knowledge score based on a semantic representation of a potential knowledge path and a semantic representation of a potential triple, and obtains a knowledge reasoning result based on a potential score ranking.
[0135] It should be noted that each unit in the global knowledge reasoning system based on knowledge graph completion in this embodiment corresponds one-to-one to each step in the global knowledge reasoning method based on knowledge graph completion in the aforementioned embodiment. Therefore, the specific implementation manner and technical effects achieved by this embodiment can refer to the implementation manner of the aforementioned global knowledge reasoning method based on knowledge graph completion, which will not be repeated here.
[0136] In addition, in one embodiment, the present application also provides a computer device, which includes a processor, a memory, and a computer program stored in the memory, and the computer program implements the method in the aforementioned embodiment when executed by the processor.
[0137] In addition, in one embodiment, the present application further provides a computer storage medium, on which a computer program is stored, and the computer program implements the method in the aforementioned embodiment when executed by a processor.
[0138] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.
[0139] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0140] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0141] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0143] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0144] 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 a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0145] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A global knowledge reasoning method based on knowledge graph completion, characterized in that: The method flow is as follows: Construct a training data set based on the knowledge graph, and construct a knowledge path based on the training data set; Based on the semantic representation model, semantic transformation is performed on the knowledge path and the triples in the training data set to obtain the semantic representation of the knowledge path and the semantic representation of the triples; The semantic representation model is trained based on the distance between the semantic representation of the knowledge path and the semantic representation of the triple; Constructing a potential knowledge set based on the knowledge graph, and constructing a potential knowledge path based on the potential knowledge set; Based on the trained semantic representation model, semantic transformation is performed on the potential knowledge path and the potential triples in the potential knowledge set to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triples; The potential knowledge score is calculated based on the semantic representation of the potential knowledge path and the semantic representation of the potential triples, and the knowledge reasoning result is obtained based on the potential score ranking.
2. A global knowledge reasoning method based on knowledge graph completion according to claim 1, characterized in that: The training data set includes a number of triplets, and the potential knowledge set includes a number of potential triplets.
3. A global knowledge reasoning method based on knowledge graph completion according to claim 2, characterized in that: The process of building a knowledge path based on the training data set is as follows: For the triples in the training dataset, delete the edge between the head entity and the tail entity in the network structure of the knowledge graph; The walk is performed with the head entity as the starting point and the tail entity as the end point to obtain the shortest path between the head entity and the tail entity, and the entities and relationships in the walk are recorded to construct a knowledge path.
4. A global knowledge reasoning method based on knowledge graph completion according to claim 1, characterized in that: The process of semantically transforming the knowledge path and the triples in the training data set based on the semantic representation model to obtain the semantic representation of the knowledge path and the semantic representation of the triples is as follows: Convert the triples and corresponding knowledge paths in the training data set into natural language to obtain texts corresponding to the triples and texts corresponding to the knowledge paths; The text corresponding to the knowledge path and the text corresponding to the triple are input into the semantic representation model for semantic representation to obtain the semantic representation of the knowledge path and the semantic representation of the triple.
5. A global knowledge reasoning method based on knowledge graph completion according to claim 4, characterized in that: The semantic representation of the knowledge path and the semantic representation of the triple are expressed as follows: Emb (s,r,o) =PLM(S (s,r,o) ) Among them, S (s,r,o) Represents the text corresponding to the triple, Indicates the text corresponding to the knowledge path, Emb (s,r,o) represents the semantic representation of triples, It represents the semantic representation of knowledge path, and PLM represents the semantic representation model.
6. A global knowledge reasoning method based on knowledge graph completion according to claim 1, characterized in that: The process of training the semantic representation model based on the distance between the semantic representation of the knowledge path and the semantic representation of the triple is as follows: Construct the semantic representation of negative samples based on the semantic representation of triples in the knowledge graph; Based on the semantic representation of the knowledge path, the semantic representation of the triple and the semantic representation of the negative sample, the similarity between the semantic representation of the knowledge path and the semantic representation of the triple is calculated; The loss function is constructed by the similarity between the semantic representation of the knowledge path and the semantic representation of the triple to construct the semantic connection between the relationship and the path.
7. A global knowledge reasoning method based on knowledge graph completion according to claim 6, characterized in that: The calculation formula of the loss function is as follows: Among them, Loss represents the loss function, G represents the knowledge graph, and Emb (s,r',o) Represents the semantic representation of negative samples, Emb (s,r,o) represents the semantic representation of the original triple, It represents the semantic representation of the knowledge path, and cos_sim represents the cosine similarity calculation formula.
8. A global knowledge reasoning method based on knowledge graph completion according to claim 1, characterized in that: The process of semantically transforming the potential knowledge path and the potential triples in the potential knowledge set based on the trained semantic representation model to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triples is as follows: Converting potential triples and corresponding potential knowledge paths in the potential knowledge set into natural language to obtain texts corresponding to the potential triples and texts corresponding to the potential knowledge paths; The text corresponding to the potential knowledge path and the text corresponding to the potential triple are input into the trained semantic representation model for semantic representation to obtain the semantic representation of the potential knowledge path and the semantic representation of the potential triple.
9. A global knowledge reasoning method based on knowledge graph completion according to claim 8, characterized in that: The semantic representation of the potential knowledge path and the semantic representation of the potential triple are expressed as follows: Among them, S(s i ,r k ,o i ) represents the text corresponding to the potential triple, Represents the text corresponding to the potential knowledge path, represents the semantic representation of the potential triples, It represents the semantic representation of potential knowledge paths, and PLM stands for semantic representation model.
10. A global knowledge reasoning method based on knowledge graph completion according to claim 9, characterized in that: The calculation formula of the potential knowledge score is as follows: Among them, Score(s i ,r k ,o i ) represents the potential knowledge score, and cos_sim represents the cosine similarity calculation formula.
11. A global knowledge reasoning system based on knowledge graph completion, characterized in that: The system comprises: A training data construction unit, wherein the training data construction unit constructs a training data set based on the knowledge graph, and constructs a knowledge path based on the training data set; A training data semantic representation unit, wherein the training data semantic representation unit performs semantic transformation on the knowledge path and the triples in the training data set based on the semantic representation model to obtain the semantic representation of the knowledge path and the semantic representation of the triples; A semantic representation model training unit, wherein the semantic representation model training unit trains a semantic representation model based on a distance between a semantic representation of a knowledge path and a semantic representation of a triple; An inference data construction unit, wherein the inference data construction unit constructs a potential knowledge set based on the knowledge graph, and constructs a potential knowledge path based on the potential knowledge set; An inference data semantic representation unit, which performs semantic transformation on potential knowledge paths and potential triples in potential knowledge sets based on a trained semantic representation model to obtain semantic representations of potential knowledge paths and semantic representations of potential triples; A global knowledge reasoning unit calculates a potential knowledge score based on a semantic representation of a potential knowledge path and a semantic representation of a potential triple, and obtains a knowledge reasoning result based on a potential score ranking.
12. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it implements the global knowledge reasoning method based on knowledge graph completion as described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements a global knowledge reasoning method based on knowledge graph completion as described in any one of claims 1-10.