Multi-relation knowledge graph construction method and device, equipment and medium
By constructing a global role embedding matrix and a projected relation matrix for a multi-relation knowledge graph, the problem of existing technologies being unable to effectively capture the different roles and interactions of entities in multiple relations is solved, achieving higher link prediction accuracy and knowledge graph completion effect.
Patent Information
- Application Number
- CN202511722883.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-17
AI Technical Summary
Existing knowledge graph construction methods in multi-relationship scenarios cannot effectively capture the different roles and interactions of entities in multiple relationships, resulting in low prediction accuracy, difficulty in inferring multiple implicit relationships, and unsatisfactory performance when dealing with large-scale multi-relationship data.
By obtaining the global role embedding matrix of the initial multi-relation knowledge graph, the role embedding vector of the entity in the target relationship is determined, the projection relationship matrix between the role embedding vector and the entity feature vector is constructed, and the association score between each entity and the target relationship is determined based on the role embedding vector, the projection relationship matrix and the global feature vector of the target relationship.
It improves the accuracy and effectiveness of link prediction in multi-relationship knowledge graphs, enhances the understanding of complex multi-interaction relationships, and improves the quality of knowledge graph completion and the performance of downstream applications.
Smart Images

Figure CN121543686A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology and related technical fields, specifically to a method, apparatus, device, and medium for constructing a multi-relationship knowledge graph. Background Technology
[0002] Link prediction is a key task in knowledge graph completion, aiming to reveal potential relationships between missing entities. With the expanding applications of knowledge graphs, especially in information retrieval, recommender systems, and intelligent question answering, traditional binary relation modeling methods are no longer effective in handling the challenges of complex multi-relationship data, particularly in capturing the different roles and interactions of entities within multiple relationships.
[0003] Most existing methods rely on simple binary relation modeling, neglecting the diverse roles of entities in complex relationships. This leads to low prediction accuracy in multi-relation scenarios and difficulty in inferring multiple implicit relationships. Furthermore, while existing multi-relation modeling techniques can extend binary relation models, they often struggle to accurately capture deep semantics and intrinsic connections when modeling complex entity roles and multi-relation interactions, thus affecting the completion of knowledge graphs. These issues make existing methods cumbersome and inefficient when processing multi-relation graphs, failing to meet the needs of practical applications, especially exhibiting unsatisfactory performance when handling large-scale multi-relation data.
[0004] Given the problems with existing technologies, there is an urgent need for a method to construct multi-relationship knowledge graphs. Summary of the Invention
[0005] The embodiments described herein provide a method, apparatus, device, and medium for constructing a multi-relationship knowledge graph, addressing the problems existing in the prior art.
[0006] Firstly, based on the content of this disclosure, a method for constructing a multi-relationship knowledge graph is provided, including: Obtain the global role embedding matrix of the initial multi-relation knowledge graph, and determine the role embedding vector of each entity in the target relation based on the global role embedding matrix, wherein the global role embedding matrix stores global information related to the role; Based on the feature vectors of the multiple sub-relations included in the target relation, determine the global feature vector of the target relation; Construct the projection relationship matrix between the character embedding vector and the entity feature vector; Based on the role of each entity in the target relation, the embedding vector, the projection relation matrix, and the global feature vector of the target relation, the association score between each entity and the target relation is determined.
[0007] In some embodiments of this disclosure, obtaining the global role embedding matrix of the initial multi-relation knowledge graph and determining the role embedding vector of each entity in the target relation based on the global role embedding matrix includes: Obtain the weight information of each role in the target relationship in the global role embedding matrix and global role embedding vector of the initial multi-relation knowledge graph. The global role embedding matrix includes multiple rows of global role embedding vectors, and each global role embedding vector corresponds to the global information of a role. Based on the global role embedding vector and the weight information of each role in the target relationship, the role embedding vector of each entity in the target relationship is determined.
[0008] In some embodiments of this disclosure, determining the global feature vector of the target relation based on the feature vectors of the multiple sub-relations included in the target relation includes: Obtain descriptive feature vectors for multiple sub-relations included in the target relation, wherein the descriptive feature vectors include relation type, entity connection pattern and role distribution, and the number of sub-relations included in the target relation is the same as the number of roles included in the global role embedding matrix; Based on the role embedding vectors of each entity in the target relation, a role matrix of the target relation is determined, wherein the role matrix includes role embedding vectors of multiple sub-relations; Based on the descriptive feature vector of the target sub-relation, the role embedding vector of the target sub-relation, and the global role embedding matrix, determine the global feature vector of the target sub-relation; The global feature vector of the target relation is determined based on the global feature vector of each target sub-relation and the weight coefficient of each target sub-relation.
[0009] In some embodiments of this disclosure, determining the global feature vector of the target sub-relation based on the descriptive feature vector of the target sub-relation, the role embedding vector of the target sub-relation, and the global role embedding matrix includes: Based on the global role embedding matrix, obtain the global role embedding vector of the target sub-relationship of the target relationship from the global role embedding matrix; Based on the feature extraction function, key feature vectors are extracted from the role embedding vectors of the target sub-relations of the target relation and the global role embedding vectors. Based on the descriptive feature vector of the target sub-relation and the extracted key feature vector, the global feature vector of the target sub-relation is determined.
[0010] In some embodiments of this disclosure, determining the association score between each entity and the target relationship based on the embedding vector of each entity's role in the target relationship, the projection relationship matrix, and the global feature vector of the target relationship includes: Based on the embedding vector of the i-th role played by the target entity in the target relation, the projection relation matrix, and the global feature vector of the target relation, the i-th sub-association score between the target entity and the target relation is determined, where i is the number of roles in the target relation; The association score between the target entity and the target relationship is determined based on the individual association scores of the target entity and the target relationship.
[0011] In some embodiments of this disclosure, it also includes: Based on the association scores of each target entity and each target relationship and the initial multi-relationship knowledge graph, a target multi-relationship knowledge graph is constructed.
[0012] In some embodiments of this disclosure, the step of constructing a target multi-relationship knowledge graph based on the association scores between each target entity and each target relationship and the initial multi-relationship knowledge graph includes: Based on the association scores of each target entity and each target relationship, target entities and target relationships whose association scores meet the preset association scores are selected; In the initial multi-relation knowledge graph, the association relationships between target entities and target relationships that satisfy the preset association scores are constructed to form a target multi-relation knowledge graph.
[0013] Secondly, according to the present disclosure, a multi-relationship knowledge graph construction apparatus is provided, comprising: The role embedding vector determination module is used to obtain the global role embedding matrix of the initial multi-relation knowledge graph, and determine the role embedding vector of each entity in the target relation based on the global role embedding matrix, wherein the global role embedding matrix stores global information related to the role; The global feature vector determination module is used to determine the global feature vector of the target relation based on the feature vectors of multiple sub-relations included in the target relation; The projection relation matrix construction module is used to construct the projection relation matrix between the character embedding vector and the entity feature vector; The association score determination module is used to determine the association score between each entity and the target relationship based on the role of each entity in the target relationship, the embedding vector, the projection relationship matrix, and the global feature vector of the target relationship.
[0014] Thirdly, according to this disclosure, a computer device is provided, comprising: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors perform the method as described in any of the first aspects.
[0015] Fourthly, according to this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the methods described in any of the first aspects.
[0016] The multi-relation knowledge graph construction method, apparatus, device, and medium provided in this disclosure first obtain the global role embedding matrix of the initial multi-relation knowledge graph, and determine the role embedding vector of each entity in the target relation based on the global role embedding matrix; determine the global feature vector of the target relation based on the feature vectors of the multiple sub-relations included in the target relation; and construct a projection relation matrix between the role embedding vector and the entity feature vector; finally, determine the association score between each entity and the target relation based on the role embedding vector of each entity in the target relation, the projection relation matrix, and the global feature vector of the target relation. By treating a relation as a collection of multiple sub-relations, each containing specific implicit information, features are extracted from each sub-relation and effectively integrated to generate a global feature vector for the target relation. This allows for the organic fusion of the role embedding vectors of entities within the multi-relation knowledge graph within the target relation with the global feature vector of the target relation. Analysis of the association between each sub-relation and the entity, as well as the interaction between sub-relation features and entity features, enables the model to gain a deeper understanding of multi-relation data and fully leverage the semantic awareness of entity roles within multiple relations. Even in cases where some relations are missing or role information is incomplete, role modeling can enhance the model's robustness and generalization ability, making it easier to capture complex multi-interaction relationships and thus improving the accuracy and effectiveness of link prediction. Furthermore, the introduction of projection matrices and role modeling methods enables deep mining of implicit semantics in multi-relation scenarios, improving the quality of knowledge graph completion and the performance of downstream applications.
[0017] The above description is merely an overview of the technical solutions of the embodiments of this application. In order to better understand the technical means of the embodiments of this application and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of this application more obvious and understandable, specific implementation methods of this application are described below. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments will be briefly described below. It should be understood that the drawings described below only relate to some embodiments of this disclosure and are not intended to limit this disclosure, wherein: Figure 1 This is a flowchart illustrating a method for constructing a multi-relationship knowledge graph according to an embodiment of this disclosure; Figure 2 This is a schematic diagram of the structure of a multi-relationship knowledge graph construction device provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure.
[0019] In the accompanying diagram, markers with the same last two digits correspond to the same elements. It should be noted that the elements in the diagram are schematic and not drawn to scale. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of this disclosure without creative effort are also within the scope of protection of this disclosure.
[0021] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this subject matter pertains. It will be further understood that terms such as those defined in commonly used dictionaries shall be interpreted as having the meaning consistent with their meaning in the context of the specification and in the relevant art, and shall not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. As used herein, the statement of “connecting” or “coupling” two or more parts together shall mean that these parts are directly joined together or joined through one or more intermediate components.
[0022] The term "embodiment" as used herein means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of the phrase "embodiment" in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists, A and B exist simultaneously, or B exists. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0024] Furthermore, in all embodiments of this disclosure, terms such as “first” and “second” are used only to distinguish one component (or part of a component) from another component (or another part of a component).
[0025] In the description of this application, unless otherwise stated, "multiple" means two or more (including two), and similarly, "multiple groups" means two or more (including two groups).
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0027] Based on the problems existing in the prior art, this disclosure provides a method for constructing a multi-relationship knowledge graph. Figure 1 This is a flowchart illustrating a method for constructing a multi-relationship knowledge graph according to an embodiment of this disclosure, such as... Figure 1 As shown, the methods for constructing multi-relationship knowledge graphs include: S110. Obtain the global role embedding matrix of the initial multi-relation knowledge graph, and determine the role embedding vector of each entity in the target relation based on the global role embedding matrix.
[0028] The global role embedding matrix stores global information related to the role.
[0029] In multi-relation knowledge graphs, missing relationships or links are predicted by accurately modeling the complex interactions between entities and relations. Specifically, given an initial multi-relation knowledge graph, which includes a set of entities... and a set of relationships The process involves inferring the connections between unknown entities and relations from the known initial relationships in a multi-relation knowledge graph. Since entities play different roles in different relations, it is necessary to comprehensively consider the role information of entities in each relation in order to accurately model and predict the links between relations in the multi-relation knowledge graph.
[0030] Therefore, this disclosure provides a method for constructing a multi-relationship knowledge graph. First, a global role matrix is obtained, and then the role embedding vector of each entity in the target relationship is determined based on the global role matrix.
[0031] In the specific implementation, the global role embedding matrix of the initial multi-relation knowledge graph is obtained, and the role embedding vector of each entity in the target relation is determined based on the global role embedding matrix. This includes: obtaining the weight information of each role in the target relation in the global role embedding matrix and global role embedding vector of the initial multi-relation knowledge graph, wherein the global role embedding matrix includes multiple rows of global role embedding vectors, and each global role embedding vector corresponds to the global information of a role; and determining the role embedding vector of each entity in the target relation based on the global role embedding vector and the weight information of each role in the global role embedding vector.
[0032] In a multi-relation representation, entities play different roles in different relations. For each entity... Each entity Corresponding to a feature vector For different relationships Introducing a role matrix , used to represent the role information of an entity in different relationships, where Indicates the number of entities. Representing relations The number of characters in the game The dimension of the embedding vector for the character. In the character matrix. middle, Representing entities In relationship The Middle The role embedding vectors of each character, where... , , This represents all elements in the row, and each row has... Each element.
[0033] By introducing a global role embedding matrix The global character embedding matrix stores global information related to the character, where This represents the total number of roles in the multi-relation knowledge graph. Once the initial multi-relation knowledge graph is constructed, the global role embedding matrix corresponding to it is known. The weight information of each role in the target relation within the global role embedding vector is a preset value. The global role embedding matrix includes multiple rows of global role embedding vectors, with each row representing the global information of a single role. For each relation... Through global role embedding matrix To calculate the first The role embedding vector of each role under this relationship:
[0034] in, Representing entities In relationship The Middle Embedding vectors of each role, Indicates the first position in the global role embedding matrix. Global role embedding vector of the row, It is also the number of global role embedding vectors. It is an activation function used to adjust the weights. It is a global role embedding vector The Each role in the relationship The weights in the equation.
[0035] The entity can be calculated using the above formula. In different relationships They play various roles (i.e., the first role, the second role, ..., the third role) The role embedding vectors of different entities playing roles in the same relation constitute the role matrix of the target relation.
[0036] S120. Determine the global feature vector of the target relation based on the feature vectors of the multiple sub-relations included in the target relation.
[0037] In multi-relational data, many methods treat relations as a whole. However, this approach ignores the implicit information about the different roles entities play within a relation, resulting in insufficient expressive power for implicit interactions in multi-relational data. Consequently, the constructed multi-relational knowledge graph cannot accurately represent the relationships between relations and entities, thus rendering the constructed multi-relational knowledge graph lacking in expressive power. To address this issue, the multi-relational knowledge graph construction method provided in this disclosure involves... Treat as multiple sub-relations The model is a collection of sub-relationships, each containing specific implicit information. By extracting features from each sub-relationship and effectively integrating these features, a comprehensive relation feature vector is generated. By analyzing the association between each sub-relationship and the entity, as well as the interaction between sub-relationship features and entity features, the model can gain a deeper understanding of multi-relationship data.
[0038] In the specific implementation, the global feature vector of the target relationship is determined based on the feature vectors of the multiple sub-relations included in the target relationship. This includes: obtaining the descriptive feature vectors of the multiple sub-relations included in the target relationship, wherein the descriptive feature vectors include the relationship type, entity connection mode, and role distribution, and the number of sub-relations included in the target relationship is the same as the number of roles included in the global role embedding matrix; determining the role matrix of the target relationship based on the role embedding vectors of the roles played by each entity in the target relationship, wherein the role matrix includes the role embedding vectors of multiple sub-relations; determining the global feature vector of the target sub-relation based on the descriptive feature vectors of the target sub-relations, the role embedding vectors of the target sub-relations, and the global role embedding matrix; and determining the global feature vector of the target relationship based on the global feature vectors of each target sub-relation and the weight coefficients of each target sub-relation.
[0039] Specifically, the global feature vector of the target sub-relation is determined based on the descriptive feature vector of the target sub-relation, the role embedding vector of the target sub-relation, and the global role embedding matrix. This includes: obtaining the global role embedding vector of the target sub-relation from the global role embedding matrix; extracting key feature vectors from the role embedding vector of the target sub-relation and the global role embedding vector based on the feature extraction function; and determining the global feature vector of the target sub-relation based on the descriptive feature vector of the target sub-relation and the extracted key feature vectors.
[0040] After obtaining the role embedding vector of the role played by the entity in the target relation in step S110, the role embedding vectors of the roles played by each entity in the same target relation form the role matrix of the target relation, and the role matrix of the target relation includes multiple sub-relationships.
[0041] Specifically, for each sub-relation in the target relation r The feature extraction process is as follows:
[0042] Feature extraction function Responsible for extracting sub-relations from the target relation r Extract key feature vectors, and then based on the sub-relations in the target relation r. The descriptive feature vectors form a set of global feature vectors for sub-relationships. . For sub-relations in target relation r Role embedding vectors, At the same time, sub-relationships The descriptive feature vector is used This indicates that the feature vector describes relation type, entity connection pattern, and role distribution.
[0043] After obtaining the global feature vectors of each target sub-relation in the target relation, for the global feature vector of the target relation... This can be specifically expressed as:
[0044] in, Indicates target relationship global feature vectors These are the weight coefficients of each objective sub-relationship, which are preset values.
[0045] S130. Construct the projection relationship matrix between the role embedding vector and the entity feature vector.
[0046] To further integrate these features, a projection matrix was introduced. The projection matrix is used to map the role embedding vector of an entity in a target relation to the entity feature space. Specifically, the projection matrix... Any element in the projection matrix Indicate the first The character in the first The weights correspond to the embedding vectors in each dimension. The projection matrix enables the optimization and alignment of role embeddings with overall entity features, thereby providing a more accurate relationship.
[0047] By introducing a projection matrix, the embedded representations of roles and entities are further integrated, thereby enhancing the model's ability to understand complex, multi-relational data and significantly improving the accuracy of prediction results.
[0048] S140. Determine the association score between each entity and the target relationship based on the role of each entity in the target relationship, the embedding vector, the projection relationship matrix, and the global feature vector of the target relationship.
[0049] In order to capture a comprehensive representation of relationships Embed the role of the entity in the target relation into the vector. Global feature vector of the target relationship and projection relation matrix Weighted fusion is specifically represented as follows:
[0050] That is, based on the embedding vector of the i-th role played by the target entity in the target relationship, the projection relationship matrix, and the global feature vector of the target relationship, the i-th sub-association score between the target entity and the target relationship is determined, where i is the number of roles in the target relationship; based on the sub-association scores between the target entity and the target relationship, the association score between the target entity and the target relationship is determined.
[0051] After determining the association scores between target entities and target relationships, a target multi-relationship knowledge graph is constructed based on the association scores between each target entity and each target relationship and the initial multi-relationship knowledge graph.
[0052] Specifically, based on the association scores of each target entity and each target relationship and the initial multi-relationship knowledge graph, a target multi-relationship knowledge graph is constructed, including: selecting target entities and target relationships whose association scores satisfy a preset association score based on the association scores of each target entity and each target relationship; and constructing association relationships between target entities and target relationships whose association scores satisfy the preset association score in the initial multi-relationship knowledge graph to form the target multi-relationship knowledge graph.
[0053] The multi-relation knowledge graph construction method provided in this embodiment first obtains the global role embedding matrix of the initial multi-relation knowledge graph, and determines the role embedding vector of each entity in the target relation based on the global role embedding matrix; then determines the global feature vector of the target relation based on the feature vectors of the multiple sub-relations included in the target relation; and constructs a projection relation matrix between the role embedding vector and the entity feature vector; finally, determines the association score between each entity and the target relation based on the role embedding vector of each entity in the target relation, the projection relation matrix, and the global feature vector of the target relation. By treating a relation as a collection of multiple sub-relations, each containing specific implicit information, features are extracted from each sub-relation and effectively integrated to generate a global feature vector for the target relation. This allows for the organic fusion of the role embedding vectors of entities within the multi-relation knowledge graph within the target relation with the global feature vector of the target relation. Analysis of the association between each sub-relation and the entity, as well as the interaction between sub-relation features and entity features, enables the model to gain a deeper understanding of multi-relation data and fully leverage the semantic awareness of entity roles within multiple relations. Even in cases where some relations are missing or role information is incomplete, role modeling can enhance the model's robustness and generalization ability, making it easier to capture complex multi-interaction relationships and thus improving the accuracy and effectiveness of link prediction. Furthermore, the introduction of projection matrices and role modeling methods enables deep mining of implicit semantics in multi-relation scenarios, improving the quality of knowledge graph completion and the performance of downstream applications.
[0054] Based on the above embodiments, this disclosure also provides a multi-relationship knowledge graph construction apparatus. Figure 2 This is a schematic diagram of the structure of a multi-relationship knowledge graph construction device provided in an embodiment of this disclosure, such as... Figure 2 As shown, the multi-relationship knowledge graph construction device includes: The role embedding vector determination module 210 is used to obtain the global role embedding matrix of the initial multi-relation knowledge graph, and determine the role embedding vector of each entity in the target relation based on the global role embedding matrix. The global role embedding matrix stores global information related to the role. The global feature vector determination module 220 is used to determine the global feature vector of the target relation based on the feature vectors of multiple sub-relations included in the target relation; Projection relation matrix construction module 230 is used to construct the projection relation matrix between the character embedding vector and the entity feature vector; The association score determination module 240 is used to determine the association score between each entity and the target relationship based on the role of each entity in the target relationship, the embedding vector, the projection relationship matrix, and the global feature vector of the target relationship.
[0055] The multi-relationship knowledge graph construction apparatus provided in this embodiment first obtains the global role embedding matrix of the initial multi-relationship knowledge graph, and determines the role embedding vector of each entity in the target relationship based on the global role embedding matrix; and determines the global feature vector of the target relationship based on the feature vectors of the multiple sub-relationships included in the target relationship; and constructs a projection relationship matrix between the role embedding vector and the entity feature vector; finally, it determines the association score between each entity and the target relationship based on the role embedding vector of each entity in the target relationship, the projection relationship matrix, and the global feature vector of the target relationship. By treating a relation as a collection of multiple sub-relations, each containing specific implicit information, features are extracted from each sub-relation and effectively integrated to generate a global feature vector for the target relation. This allows for the organic fusion of the role embedding vectors of entities within the multi-relation knowledge graph within the target relation with the global feature vector of the target relation. Analysis of the association between each sub-relation and the entity, as well as the interaction between sub-relation features and entity features, enables the model to gain a deeper understanding of multi-relation data and fully leverage the semantic awareness of entity roles within multiple relations. Even in cases where some relations are missing or role information is incomplete, role modeling can enhance the model's robustness and generalization ability, making it easier to capture complex multi-interaction relationships and thus improving the accuracy and effectiveness of link prediction. Furthermore, the introduction of projection matrices and role modeling methods enables deep mining of implicit semantics in multi-relation scenarios, improving the quality of knowledge graph completion and the performance of downstream applications.
[0056] In a specific implementation, the step of obtaining the global role embedding matrix of the initial multi-relation knowledge graph and determining the role embedding vector of each entity in the target relation based on the global role embedding matrix includes: Obtain the weight information of each role in the target relationship in the global role embedding matrix and global role embedding vector of the initial multi-relation knowledge graph. The global role embedding matrix includes multiple rows of global role embedding vectors, and each global role embedding vector corresponds to the global information of a role. Based on the global role embedding vector and the weight information of each role in the target relationship, the role embedding vector of each entity in the target relationship is determined.
[0057] In a specific implementation, determining the global feature vector of the target relation based on the feature vectors of the multiple sub-relations included in the target relation includes: Obtain descriptive feature vectors for multiple sub-relations included in the target relation, wherein the descriptive feature vectors include relation type, entity connection pattern and role distribution, and the number of sub-relations included in the target relation is the same as the number of roles included in the global role embedding matrix; Based on the role embedding vectors of each entity in the target relation, a role matrix of the target relation is determined, wherein the role matrix includes role embedding vectors of multiple sub-relations; Based on the descriptive feature vector of the target sub-relation, the role embedding vector of the target sub-relation, and the global role embedding matrix, determine the global feature vector of the target sub-relation; The global feature vector of the target relation is determined based on the global feature vector of each target sub-relation and the weight coefficient of each target sub-relation.
[0058] In a specific implementation, determining the global feature vector of the target sub-relation based on the descriptive feature vector of the target sub-relation, the role embedding vector of the target sub-relation, and the global role embedding matrix includes: Based on the global role embedding matrix, obtain the global role embedding vector of the target sub-relationship of the target relationship from the global role embedding matrix; Based on the feature extraction function, key feature vectors are extracted from the role embedding vectors of the target sub-relations of the target relation and the global role embedding vectors. Based on the descriptive feature vector of the target sub-relation and the extracted key feature vector, the global feature vector of the target sub-relation is determined.
[0059] In a specific implementation, determining the association score between each entity and the target relationship based on the role embedding vector of each entity in the target relationship, the projection relationship matrix, and the global feature vector of the target relationship includes: Based on the embedding vector of the i-th role played by the target entity in the target relation, the projection relation matrix, and the global feature vector of the target relation, the i-th sub-association score between the target entity and the target relation is determined, where i is the number of roles in the target relation; The association score between the target entity and the target relationship is determined based on the individual association scores of the target entity and the target relationship.
[0060] In specific implementations, it also includes: Based on the association scores of each target entity and each target relationship and the initial multi-relationship knowledge graph, a target multi-relationship knowledge graph is constructed.
[0061] In a specific implementation, the step of constructing a target multi-relationship knowledge graph based on the association scores between each target entity and each target relationship and the initial multi-relationship knowledge graph includes: Based on the association scores of each target entity and each target relationship, target entities and target relationships whose association scores meet the preset association scores are selected; In the initial multi-relation knowledge graph, the association relationships between target entities and target relationships that satisfy the preset association scores are constructed to form a target multi-relation knowledge graph.
[0062] This application also provides a computer device, please refer to the following for details. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.
[0063] The computer device includes a memory 510 and a processor 520 that are interconnected via a system bus. It should be noted that only a computer device with components 510-520 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components may be implemented alternatively. Those skilled in the art will understand that the computer device described herein is a device capable of automatically performing 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 (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0064] Computer devices can include desktop computers, laptops, handheld computers, and cloud servers. These devices allow for human-computer interaction with users through keyboards, mice, remote controls, touchpads, or voice-activated devices.
[0065] The memory 510 includes at least one type of readable storage medium, including non-volatile memory or volatile memory, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. RAM may include static RAM or dynamic RAM. In some embodiments, the memory 510 may be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the memory 510 may also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, or flash card equipped on the computer device. Of course, the memory 510 may include both internal storage units and external storage devices of the computer device. In this embodiment, the memory 510 is typically used to store the operating system and various application software installed on the computer device, such as the program code of the method described above. In addition, the memory 510 may also be used to temporarily store various types of data that have been output or will be output.
[0066] The processor 520 is typically used to perform the overall operation of a computer device. In this embodiment, the memory 510 is used to store program code or instructions, including computer operation instructions. The processor 520 is used to execute the program code or instructions stored in the memory 510 or to process data, such as program code that runs the methods described above.
[0067] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus system can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0068] Another embodiment of this application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads computer-readable program code stored in the computer-readable medium, enabling the processor to execute the functional actions specified in each step or combination of steps in the above method; and to generate means for implementing the functional actions specified in each block or combination of blocks in the block diagram.
[0069] Computer-readable media include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any suitable combination thereof, wherein the memory is used to store program code or instructions, the program code including computer operation instructions, and the processor is used to execute the program code or instructions of the above-described methods stored in the memory.
[0070] The definitions of memory and processor can be found in the description of the foregoing computer device embodiments, and will not be repeated here.
[0071] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0072] In the various embodiments of this application, the functional units or modules can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0073] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0074] Unless otherwise expressly indicated by the context, the singular form of words used herein and in the appended claims includes the plural form, and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the terms “comprising” and “including” shall be interpreted as including rather than exclusively. Likewise, the terms “including” and “or” shall be interpreted as including unless such interpretation is expressly prohibited herein. Where the term “example” is used herein, particularly when it follows a set of terms, the “example” is merely exemplary and illustrative and should not be considered exclusive or extensive.
[0075] Further aspects and scope of adaptation become apparent from the description provided herein. It should be understood that various aspects of this application may be implemented individually or in combination with one or more other aspects. It should also be understood that the descriptions and specific embodiments herein are for illustrative purposes only and are not intended to limit the scope of this application.
[0076] Several embodiments of this disclosure have been described in detail above. However, it is obvious that those skilled in the art can make various modifications and variations to the embodiments of this disclosure without departing from the spirit and scope of this disclosure. The scope of protection of this disclosure is defined by the appended claims.
Claims
1. A method for constructing a multi-relation knowledge graph, characterized in that, The method comprises the following steps: obtaining a global role embedding matrix of an initial multi-relation knowledge graph, and determining a role embedding vector of each entity in a target relation according to the global role embedding matrix, wherein the global role embedding matrix stores global information related to a role; determining a global feature vector of the target relation according to feature vectors of a plurality of sub-relations included in the target relation; constructing a projection relation matrix of the role embedding vector and an entity feature vector; determining an association score of each entity and the target relation according to the role embedding vector of each entity in the target relation, the projection relation matrix, and the global feature vector of the target relation.
2. The method of claim 1, wherein, The method comprises the following steps: obtaining a global role embedding matrix of an initial multi-relation knowledge graph and weight information of each role in a target relation in a global role embedding vector, wherein the global role embedding matrix comprises a plurality of global role embedding vectors, and each global role embedding vector corresponds to global information of a role; determining a role embedding vector of each entity in the target relation according to the global role embedding vector and the weight information of each role in the target relation in the global role embedding vector.
3. The method of claim 1, wherein, The method comprises the following steps: obtaining a description feature vector of a plurality of sub-relations included in the target relation, wherein the description feature vector comprises a relation type, an entity connection mode, and a role distribution, and the number of sub-relations included in the target relation is the same as the number of roles included in the global role embedding matrix; determining a role matrix of the target relation according to the role embedding vector of each entity in the target relation, wherein the role matrix comprises a plurality of role embedding vectors of sub-relations; determining a global feature vector of a target sub-relation according to the description feature vector of the target sub-relation, the role embedding vector of the target sub-relation, and the global role embedding matrix; determining a global feature vector of the target relation according to the global feature vector of each target sub-relation and a weight coefficient of each target sub-relation.
4. The method of claim 3, wherein, The method comprises the following steps: obtaining a global role embedding vector of a target sub-relation of the target relation from the global role embedding matrix according to the global role embedding matrix; extracting a key feature vector based on a feature extraction function from the role embedding vector of the target sub-relation of the target relation and the global role embedding vector; determining a global feature vector of the target sub-relation according to the description feature vector of the target sub-relation and the extracted key feature vector.
5. The method of claim 1, wherein, The method comprises the following steps: determine an i-th sub-association score of the target entity and the target relation according to the i-th role embedding vector of the target entity in the target relation, the projection relation matrix, and the global feature vector of the target relation, where i is a number of roles in the target relation; determine an association score of the target entity and the target relation according to the sub-association scores of the target entity and the target relation.
6. The method of claim 1, wherein, Further comprising: construct a target multi-relation knowledge graph according to the association scores of the target entities and the target relations and the initial multi-relation knowledge graph.
7. The method of claim 6, wherein, The constructing a target multi-relation knowledge graph according to the association scores of the target entities and the target relations and the initial multi-relation knowledge graph comprises: selecting, according to the association scores of the target entities and the target relations, a target entity and a target relation whose association score meets a preset association score; constructing, in the initial multi-relation knowledge graph, an association relation between the target entity and the target relation whose association score meets the preset association score, to form a target multi-relation knowledge graph. 8.A multi-relation knowledge graph construction apparatus, characterized in that, Comprise: a role embedding vector determination module configured to obtain a global role embedding matrix of an initial multi-relation knowledge graph, and determine a role embedding vector of a role played by each entity in a target relation according to the global role embedding matrix, wherein the global role embedding matrix stores global information related to the role; a global feature vector determination module configured to determine a global feature vector of the target relation according to feature vectors of a plurality of sub-relations included in the target relation; a projection relation matrix construction module configured to construct a projection relation matrix of the role embedding vector and the entity feature vector; an association score determination module configured to determine an association score of each entity and the target relation according to the role embedding vector of the entity in the target relation, the projection relation matrix, and the global feature vector of the target relation.
9. A computer device, comprising: Comprise: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1-7. The program is executed by the processor to implement the method of any one of claims 1-7.