Knowledge graph construction method and related equipment
By analyzing business materials and applying large-scale language model technologies, the entities and relationships in the knowledge graph are automatically matched and updated, and the problem of insufficient processing capabilities of the existing technology in complex and diverse scenarios is solved, and the efficient, automatic construction and scalability of the knowledge graph are achieved.
Patent Information
- Application Number
- CN202411762823.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-04-04
AI Technical Summary
When building a knowledge graph, it is difficult for the existing technology to effectively expand to complex and diverse scenarios, and the processing capabilities of new domain texts are insufficient. Feature design depends on domain knowledge and it is difficult to express the complete semantics of complex texts.
By analyzing business materials, semantic blocks are extracted and incremental entities and relationships are automatically matched, and knowledge graphs are built using large language model technology to reduce manual annotation work and achieve dynamic updates of entities' consistency and relationships.
It improves the scalability and automatic construction capabilities of the knowledge graph, reduces entity redundancy, enhances the processing ability of complex texts, and can better adapt to diverse scenarios.
Smart Images

Figure CN119761490A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of knowledge graph technology, and in particular to a method for constructing a knowledge graph and related equipment. Background Art
[0002] Currently, most graph entity relationship generation methods use the following method.
[0003] Generate graph entities and relationships based on templates or rules. Design predefined templates or patterns to extract entities and relationships from text. Commonly used templates include regular expressions and contextual vocabulary. Template design relies on domain experts and is difficult to expand to complex and diverse scenarios. It performs poorly for text in new domains.
[0004] Based on traditional machine learning methods. Entities and relationships are represented by manually designed features, including part of speech, dependency, word vectors, etc., and then traditional machine learning models (such as support vector machines, decision trees, logistic regression, etc.) are used for classification and relationship prediction. Feature design relies on domain knowledge, and it is difficult for complex texts to express complete semantics through features.
[0005] Distant supervision and weakly supervised learning. Unlabeled text is automatically labeled through the existing knowledge base for training the relationship extraction model. It is trained with a small amount of labeled data or data with high noise, and optimized through model learning. Only direct copying of content can be detected. There is a lot of annotation noise, and the model is easily disturbed by noise, resulting in reduced accuracy. Summary of the invention
[0006] In view of this, the purpose of this application is to propose a method and related equipment for constructing a knowledge graph.
[0007] Based on the above objectives, this application provides a method for constructing a knowledge graph, including:
[0008] Analyze at least one first business material to obtain a first semantic block; the first business material includes a field name, a field type, a field description, and sample data;
[0009] Based on the first semantic block, extract entities to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating units, the participating personnel and the project results;
[0010] In response to the addition of the second business material, analyzing and extracting the second business material to obtain a second semantic block and a second entity;
[0011] Based on the second entity, updating the first entity to obtain a third entity;
[0012] Based on the requirements of the second business material, the second entity or the third entity is used as a context to construct a knowledge graph corresponding to the second business material.
[0013] In a possible implementation, analyzing at least one first business material to obtain a semantic block includes:
[0014] Preset categories of semantic blocks;
[0015] Based on the category of the semantic block, at least one of the first business materials is analyzed using a large language model to obtain the semantic block.
[0016] In a possible implementation, extracting entities based on the semantic block to obtain a first entity includes:
[0017] The entities in the semantic block are extracted using a large language model to obtain the first entity.
[0018] In a possible implementation manner, the updating the first entity based on the second entity to obtain the third entity includes:
[0019] matching the second entity with the first entity;
[0020] The first entity is updated based on the matching relationship between the second entity and the first entity to obtain the third entity.
[0021] In a possible implementation manner, the updating the first entity based on the relationship between the second entity and the first entity to obtain the third entity includes:
[0022] In response to the second entity being the same as the first entity, not updating the first entity;
[0023] In response to the existence that the second entity is different from the first entity, the first entity is updated based on the similarity between the second entity and the first entity to obtain the third entity.
[0024] In a possible implementation, based on the requirement of the second business material, taking the second entity or the third entity as a context, constructing a knowledge graph corresponding to the second business material includes:
[0025] In response to the second business material having a first requirement, providing the second entity as a context to a large language model, extracting a first entity relationship, and constructing the knowledge graph based on the first entity relationship;
[0026] In response to the second business material having a second requirement, the third entity is provided as context to the large language model, a second entity relationship is extracted, and the knowledge graph is constructed based on the second entity relationship; wherein the accuracy requirement in the first requirement is higher than that in the second requirement; and the comprehensiveness requirement in the second requirement is higher than that in the first requirement.
[0027] Based on the same inventive concept, the embodiment of the present application also provides a device for constructing a knowledge graph, including:
[0028] An analysis module, configured to analyze at least one first business material to obtain a first semantic block; the first business material includes a field name, a field type, a field description and sample data;
[0029] An extraction module is configured to extract entities based on the first semantic block to obtain a first entity; the entity includes a scientific and technological project name, a leading unit, a participating unit, participating personnel, and project results;
[0030] An analysis and extraction module, configured to analyze and extract the second business material in response to the second business material being added, to obtain a second semantic block and a second entity;
[0031] An updating module, configured to update the first entity based on the second entity to obtain a third entity;
[0032] The construction module is configured to construct a knowledge graph corresponding to the second business material based on the needs of the second business material and taking the second entity or the third entity as a context.
[0033] In a possible implementation, the analysis module is further configured to:
[0034] A preset unit, which is configured as a category of preset semantic blocks;
[0035] The analyzing unit is configured to analyze at least one of the first business materials based on the category of the semantic block by using a large language model to obtain the semantic block.
[0036] In a possible implementation, the extraction module is further configured to:
[0037] The extraction unit is configured to extract the entities in the semantic block by using a large language model to obtain the first entity.
[0038] In a possible implementation, the update module is configured as follows:
[0039] a matching unit, configured to match the second entity with the first entity;
[0040] An updating unit is configured to update the first entity based on a matching relationship between the second entity and the first entity to obtain the third entity.
[0041] In a possible implementation, the updating unit is further configured to:
[0042] In response to the second entity being the same as the first entity, not updating the first entity;
[0043] In response to the existence that the second entity is different from the first entity, the first entity is updated based on the similarity between the second entity and the first entity to obtain the third entity.
[0044] In a possible implementation, the building block is further configured as follows:
[0045] A first providing unit is configured to, in response to the second business material having a first requirement, provide the second entity as a context to a large language model, extract a first entity relationship, and construct the knowledge graph based on the first entity relationship;
[0046] The second providing unit is configured to provide the third entity as context to the large language model in response to the second business material having a second requirement, extract a second entity relationship, and construct the knowledge graph based on the second entity relationship; wherein the accuracy requirement in the first requirement is higher than that in the second requirement; and the comprehensiveness requirement in the second requirement is higher than that in the first requirement.
[0047] Based on the same inventive concept, an embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for constructing a knowledge graph as described in any one of the above items is implemented.
[0048] Based on the same inventive concept, an embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute any of the above-mentioned methods for constructing a knowledge graph.
[0049] Based on the same inventive concept, an embodiment of the present application also provides a computer program product, which includes computer program instructions, and the computer instructions are used to enable the computer program product to execute any of the above-mentioned methods for constructing a knowledge graph.
[0050] From the above, it can be seen that the method and related equipment for constructing a knowledge graph provided by the present application obtain a first semantic block by analyzing at least one first business material; the first business material includes field name, field type, field description and sample data; based on the first semantic block, extract entities to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating unit, the participating personnel and the project results; in response to the addition of the second business material, the second business material is analyzed and extracted to obtain a second semantic block and a second entity; based on the second entity, the first entity is updated to obtain a third entity; based on the needs of the second business material, the second entity or the third entity is used as a context to construct a knowledge graph corresponding to the second business material. The embodiment of the present application proposes a device for dynamically and incrementally generating graph entity and relationship data based on a large language model technology, which realizes automatic matching of incremental entities and relationships based on a large language model technology, using related entities as contexts, and reducing a large amount of manual annotation work. By using incremental entity matching extraction and incremental entity relationship matching extraction methods, the consistency of graph entities is achieved through the LLM large model, entity redundancy is reduced, and the scalability and automatic construction capabilities of the graph are enhanced. By using network graph display technology, it is possible to display technology and business knowledge graphs by entities or entity relationships, enriching the display format of the graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0052] Figure 1 A schematic diagram of the method flow for constructing a knowledge graph according to an embodiment of the present application;
[0053] Figure 2 A detailed flowchart of the method for constructing a knowledge graph according to an embodiment of the present application;
[0054] Figure 3 A schematic diagram of the structure of a device for constructing a knowledge graph according to an embodiment of the present application;
[0055] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0057] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "including" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right", etc. are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0058] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0059] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0060] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0061] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0062] As described in the background technology section, current graph entity relationship generation mostly adopts the following method.
[0063] Generate graph entities and relationships based on templates or rules. Design predefined templates or patterns to extract entities and relationships from text. Commonly used templates include regular expressions and contextual vocabulary. Template design relies on domain experts and is difficult to expand to complex and diverse scenarios. It performs poorly for text in new domains.
[0064] Based on traditional machine learning methods. Entities and relationships are represented by manually designed features, including part of speech, dependency, word vectors, etc., and then traditional machine learning models (such as support vector machines, decision trees, logistic regression, etc.) are used for classification and relationship prediction. Feature design relies on domain knowledge, and it is difficult for complex texts to express complete semantics through features.
[0065] Distant supervision and weakly supervised learning. Unlabeled text is automatically labeled through the existing knowledge base for training the relationship extraction model. It is trained with a small amount of labeled data or data with high noise, and optimized through model learning. Only direct copying of content can be detected. There is a lot of annotation noise, and the model is easily disturbed by noise, resulting in reduced accuracy.
[0066] Based on the above considerations, the embodiment of the present application proposes a method for constructing a knowledge graph, by analyzing at least one first business material to obtain a first semantic block; the first business material includes field name, field type, field description and sample data; based on the first semantic block, extract entities to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating unit, the participating personnel and the project results; in response to the addition of the second business material, the second business material is analyzed and extracted to obtain a second semantic block and a second entity; based on the second entity, the first entity is updated to obtain a third entity; based on the needs of the second business material, the second entity or the third entity is used as a context to construct a knowledge graph corresponding to the second business material. The embodiment of the present application proposes a device for dynamically and incrementally generating graph entity and relationship data based on a large language model technology, which realizes automatic matching of incremental entities and relationships based on the large language model technology, taking related entities as context, and reducing a large amount of manual annotation work. By using the incremental entity matching extraction and incremental entity relationship matching extraction methods, the consistency of graph entities is achieved through the LLM large model, entity redundancy is reduced, and the scalability and automatic construction capabilities of the graph are enhanced. By using network graph display technology, it is possible to display technology and business knowledge graphs by entities or entity relationships, enriching the display format of the graph.
[0067] The technical solutions of the embodiments of the present application are described in detail below through specific examples.
[0068] refer to Figure 1 The method for constructing a knowledge graph in the embodiment of the present application comprises the following steps:
[0069] Step S101, analyzing at least one first business material to obtain a first semantic block; the first business material includes a field name, a field type, a field description and sample data;
[0070] Step S102, extracting entities based on the first semantic block to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating units, the participating personnel and the project results;
[0071] Step S103, in response to the second business material being added, analyzing and extracting the second business material to obtain a second semantic block and a second entity;
[0072] Step S104, based on the second entity, updating the first entity to obtain a third entity;
[0073] Step S105 , based on the requirements of the second business material, the second entity or the third entity is used as a context to construct a knowledge graph corresponding to the second business material.
[0074] refer to Figure 2 , which is a detailed flowchart of the method for constructing a knowledge graph according to an embodiment of the present application.
[0075] The following embodiments are combined Figure 1 and Figure 2 Provide detailed explanation.
[0076] like Figure 2 As shown, first obtain the technology business document, then use the large language model to parse the technology business document to obtain JSON field info, and further perform JSON Aggregation to obtain semantic blocks. After obtaining the semantic block, perform entity matching to determine the local entity and the global entity. The local entity here refers to the entity of the newly added document, and the global entity refers to the entity that has been obtained before. After obtaining the global entity, combine the semantic blocks obtained in the previous steps to perform relationship matching. According to the needs of the business document, determine whether to use local local relationships or global entity relationships to generate the knowledge graph in the end. After obtaining the knowledge graph, enter the graph database, and then display the specific network relationship diagram.
[0077] The JSON field info above can be understood as information about the JSON field. This usually involves describing the detailed information of each field in the JSON data structure. JSON is a lightweight data exchange format that uses key-value pairs to represent data structures and is widely used for data transmission and storage.
[0078] In this embodiment, the following may be included:
[0079] Field name (Key): The key in the JSON data, such as "name" and "age".
[0080] Field type: The data type of the field value, such as string, number, Boolean, object, array, etc.
[0081] Field Description: A description of the purpose or meaning of the field.
[0082] Sample data: Sample values to help you understand the type of data and format that the field contains.
[0083] JSON Aggregation usually refers to merging or calculating multiple JSON objects or data collections in order to obtain summary information or build new data structures.
[0084] With respect to step S101, in some embodiments, the analyzing of at least one first business material to obtain a semantic block includes: presetting a category of the semantic block; and based on the category of the semantic block, analyzing at least one first business material using a large language model to obtain the semantic block.
[0085] In this embodiment, the document materials related to the science and technology project are used as the input of the LLM model. The LLM model relies on the predefined architecture design to extract the specific value of the specific key from each document. For each document, a json containing the required information will be obtained. These json files containing partial information are aggregated to finally form the semantic block of the document. By parsing the relevant document materials, the construction of the concept layer of the science and technology business map is guided, and the concept layer entities including science and technology projects, leading units, participating units, scientific researchers, and scientific research results are extracted.
[0086] Next, we will take a hypothetical science and technology project document as an example.
[0087] Suppose there is a document for a scientific and technological project, which contains the following information:
[0088] Name of science and technology project: A system research,
[0089] Lead Institution: University A,
[0090] Participating units: A Research Institute, A Company,
[0091] Participants: Li A, Wang C,
[0092] Project results: 1 patent and 2 published papers.
[0093] First, the entire document is divided into several semantic blocks according to information categories. The definitions of these semantic blocks are pre-set in the method:
[0094] Project name;
[0095] Lead unit;
[0096] Participating units;
[0097] Participants;
[0098] Project outcomes;
[0099] The aforementioned semantic blocks are not the final knowledge graph ontology, but templates used to guide LLM to extract specific information from documents. They are configured as specific classes, similar to the JSON structure:
[0100] For example:
[0101] json
[0102] {
[0103] "Project Name":"",
[0104] "Lead Unit":"",
[0105] "Participating Units": [],
[0106] "Participants": [],
[0107] "Project Outcomes": {
[0108] "Soft": 0,
[0109] "Patent": 0,
[0110] "Paper": 0
[0111] }
[0112] }
[0113] After obtaining the first semantic block, for step S102, extracting entities based on the semantic block to obtain the first entity includes: extracting entities in the semantic block using a large language model to obtain the first entity.
[0114] In this embodiment, the document content is analyzed using LLM, the information corresponding to each semantic block is automatically extracted, and filled into the preset JSON structure:
[0115] json
[0116] {
[0117] "Project Name": "A System Research",
[0118] "Leading Unit": "University A",
[0119] “Participating units”: [“A Research Institute”, “A Company”],
[0120] "Participants": ["Li A", "Wang C"],
[0121] "Project Outcomes": {
[0122] "Patent": 1,
[0123] "Papers": 2
[0124] }
[0125] }
[0126] The final first entity is:
[0127] Lead Institution: University A,
[0128] Participating units: A Research Institute, A Company,
[0129] Participants: Li A, Wang C,
[0130] Project results: patents, papers.
[0131] In some embodiments, the relationship between entities can also be identified and generated based on the extracted entity information. For example:
[0132] Participation: Li A and Wang C participated in study A;
[0133] Undertake: University A undertakes research A;
[0134] Cooperation: Research Institute A and Company A cooperate on research A;
[0135] Achievements: A. Research produces patents and papers.
[0136] Furthermore, with respect to step S103, when the second business material appears, the second business material needs to be analyzed and extracted according to the aforementioned steps S101 and S102 to obtain the corresponding second semantic block and second entity.
[0137] In this embodiment, it is assumed that the second business material is as follows:
[0138] Project name: B Development,
[0139] Lead Institution: University A,
[0140] Participating units: Institute B, Company A,
[0141] Researchers: Zhao B, Li A,
[0142] Research achievements: 1 software copyright and 2 patents.
[0143] In this embodiment, the first entity includes:
[0144] Lead Institution: University A,
[0145] Participating units: A Research Institute, A Company,
[0146] Participants: Li A, Wang C,
[0147] Project results: patents, papers.
[0148] Similarly, the second entity extracted is:
[0149] Lead Institution: University A,
[0150] Participating units: Institute B, Company A,
[0151] Researchers: Zhao B, Li A,
[0152] Research achievements: 1 software copyright and 2 patents.
[0153] In some embodiments, for step S104, the updating of the first entity based on the second entity to obtain the third entity includes: matching the second entity with the first entity; and updating the first entity based on the matching relationship between the second entity and the first entity to obtain the third entity.
[0154] In some embodiments, the updating of the first entity based on the relationship between the second entity and the first entity to obtain the third entity includes: in response to the second entity being the same as the first entity, not updating the first entity; in response to the existence of the second entity being different from the first entity, updating the first entity based on the similarity between the second entity and the first entity to obtain the third entity.
[0155] In this embodiment, LLM is used to extract entity information starting from the first semantic block, and finally the global document entity E' is extracted by iterating all semantic blocks. During the extraction process, corresponding constraints will be imposed, and LLM extracts entities representing a unique concept. In the subsequent document extraction process, the algorithm extracts the local entity E(d) (the second entity), and then matches the local entity with the global entity E (the first entity). If the local entity is found in E(d), it will be added to the matching set E. If not, the algorithm uses the cosine similarity algorithm with a predefined threshold to search for similar entities in E. If no match is found, the local entity is added to E, otherwise, the best matching global entity E(I) is added. Then, the global entity set E is unified with E(d) to update the global entity set. Repeat this process for each document to eventually generate a comprehensive global document entity E' (the third entity).
[0156] In this embodiment, the matching process is:
[0157] Lead Unit: University A is already in the first entity and is a direct match.
[0158] Participating units: Institute B joins the first entity.
[0159] Researchers: Zhao B joins the first entity; Li A already exists in the first entity.
[0160] Research results: The software copyright is added to the first entity, and the patent already exists in the first entity.
[0161] Further, for step S105, the requirement based on the second business material takes the second entity or the third entity as a context to construct a knowledge graph corresponding to the second business material, including: in response to the second business material having a first requirement, providing the second entity as a context to a large language model, extracting a first entity relationship, and constructing the knowledge graph based on the first entity relationship; in response to the second business material having a second requirement, providing the third entity as a context to the large language model, extracting a second entity relationship, and constructing the knowledge graph based on the second entity relationship; wherein the accuracy requirement in the first requirement is higher than that in the second requirement; and the comprehensiveness requirement in the second requirement is higher than that in the first requirement.
[0162] In this embodiment, the global entity set E and each semantic block are provided to the incremental relationship matcher. When the global entity is provided to the LLM as a context, the LLM will extract the relationships directly declared and implied by the semantic block, especially the entities that are not explicitly present in the semantic block. This enriches the technology business knowledge graph with potential information, but increases the possibility of irrelevant relationships. When the locally matched entities are provided to the LLM as context, the LLM only extracts the relationships directly declared by the context. This method reduces the richness of the graph, but also reduces the probability of irrelevant relationships. When actually performing incremental relationship extraction, a trade-off must be made, whether to obtain a richer technology business graph or a more accurate graph, and different methods should be used according to actual needs.
[0163] Specifically, using the context provided by the third entity, LLM can discover potential relationships from the document. For example:
[0164] Since “University A” has a “leadership” relationship with multiple projects (A system research, B development) at the same time, it is possible to infer that “University A” plays the role of a “major contributor” in the field of smart agriculture.
[0165] “Li A” has participated in multiple projects, so we can infer his role as an “important researcher” in field A.
[0166] Using the context provided by the second entity, only directly declared relationships are extracted:
[0167] The lead organization "University A" directly established a "leadership" relationship with the two projects.
[0168] A direct "collaborative" relationship is established between participating units and the project.
[0169] Therefore, in practical applications, it is necessary to make trade-offs based on target requirements:
[0170] Richness first:
[0171] Suitable for scenarios that require building a comprehensive conceptual layer, such as exploring new research directions or fields.
[0172] Use the third entity as context to capture more potential but possibly less precise relationships.
[0173] Accuracy first:
[0174] It is suitable for knowledge graph construction scenarios that require high precision and low noise, such as specific project management and decision support.
[0175] Using the second entity as context, only explicitly stated relations are extracted.
[0176] Through the above method, rich and relevant relationships can be extracted from scientific and technological project documents, and a valuable scientific and technological business knowledge graph can be gradually constructed.
[0177] Furthermore, all entities and relationships can be displayed in the form of a dynamic network diagram on the front end. Through the interface, all entities under a certain relationship can be viewed, and by searching for a certain entity, the entity and the entities that have a relationship with it can be queried.
[0178] It can be seen from the above embodiments that the method for constructing a knowledge graph described in the embodiment of the present application is to obtain a first semantic block by analyzing at least one first business material; the first business material includes field name, field type, field description and sample data; based on the first semantic block, extract entities to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating unit, the participating personnel and the project results; in response to the addition of the second business material, the second business material is analyzed and extracted to obtain a second semantic block and a second entity; based on the second entity, the first entity is updated to obtain a third entity; based on the needs of the second business material, the second entity or the third entity is used as a context to construct a knowledge graph corresponding to the second business material. The embodiment of the present application proposes a device for dynamically and incrementally generating graph entity and relationship data based on a large language model technology, which realizes automatic matching of incremental entities and relationships based on a large language model technology, using related entities as contexts, and reducing a large amount of manual annotation work. By using incremental entity matching extraction and incremental entity relationship matching extraction methods, the consistency of graph entities is achieved through the LLM large model, entity redundancy is reduced, and the scalability and automatic construction capabilities of the graph are enhanced. By using network graph display technology, it is possible to display technology and business knowledge graphs by entities or entity relationships, enriching the display format of the graph.
[0179] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0180] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0181] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a device for constructing a knowledge graph.
[0182] refer to Figure 3 , the device for constructing a knowledge graph comprises:
[0183] The analysis module 31 is configured to analyze at least one first business material to obtain a first semantic block; the first business material includes a field name, a field type, a field description and sample data;
[0184] The extraction module 32 is configured to extract entities based on the first semantic block to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating units, the participating personnel and the project results;
[0185] The analysis and extraction module 33 is configured to analyze and extract the second business material in response to the second business material being added, to obtain a second semantic block and a second entity;
[0186] An updating module 34 is configured to update the first entity based on the second entity to obtain a third entity;
[0187] The construction module 35 is configured to construct a knowledge graph corresponding to the second business material based on the requirements of the second business material and taking the second entity or the third entity as a context.
[0188] In a possible implementation, the analysis module 31 is further configured to:
[0189] A preset unit, which is configured as a category of preset semantic blocks;
[0190] The analyzing unit is configured to analyze at least one of the first business materials based on the category of the semantic block by using a large language model to obtain the semantic block.
[0191] In a possible implementation, the extraction module 32 is further configured to:
[0192] The extraction unit is configured to extract the entities in the semantic block by using a large language model to obtain the first entity.
[0193] In a possible implementation, the updating module 34 is configured to:
[0194] a matching unit, configured to match the second entity with the first entity;
[0195] An updating unit is configured to update the first entity based on a matching relationship between the second entity and the first entity to obtain the third entity.
[0196] In a possible implementation, the updating unit is further configured to:
[0197] In response to the second entity being the same as the first entity, not updating the first entity;
[0198] In response to the existence that the second entity is different from the first entity, the first entity is updated based on the similarity between the second entity and the first entity to obtain the third entity.
[0199] In a possible implementation, the building module 35 is further configured to:
[0200] A first providing unit is configured to, in response to the second business material having a first requirement, provide the second entity as a context to a large language model, extract a first entity relationship, and construct the knowledge graph based on the first entity relationship;
[0201] The second providing unit is configured to provide the third entity as context to the large language model in response to the second business material having a second requirement, extract a second entity relationship, and construct the knowledge graph based on the second entity relationship; wherein the accuracy requirement in the first requirement is higher than that in the second requirement; and the comprehensiveness requirement in the second requirement is higher than that in the first requirement.
[0202] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0203] The device of the above embodiment is used to implement the corresponding method of constructing a knowledge graph in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0204] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for constructing a knowledge graph as described in any of the above embodiments is implemented.
[0205] Figure 4 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0206] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0207] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0208] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0209] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0210] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0211] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0212] The electronic device of the above-mentioned embodiment is used to implement the corresponding method of constructing a knowledge graph in any of the above-mentioned embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0213] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method of constructing a knowledge graph as described in any of the above embodiments.
[0214] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0215] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method of constructing a knowledge graph as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0216] Based on the same inventive concept, corresponding to the method for constructing a knowledge graph described in any of the above embodiments, the present disclosure also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor executes the method for constructing a knowledge graph. Corresponding to the execution subject corresponding to each step in each embodiment of the method for constructing a knowledge graph, the processor that executes the corresponding step may belong to the corresponding execution subject.
[0217] The computer program product of the above-mentioned embodiment is used to enable the computer and / or the processor to execute the method of constructing a knowledge graph as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0218] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0219] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0220] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0221] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. A method for constructing a knowledge graph, characterized in that: include: Analyze at least one first business material to obtain a first semantic block; the first business material includes a field name, a field type, a field description, and sample data; Based on the first semantic block, extract entities to obtain a first entity; the entity includes the name of the scientific and technological project, the leading unit, the participating units, the participating personnel and the project results; In response to the addition of the second business material, analyzing and extracting the second business material to obtain a second semantic block and a second entity; Based on the second entity, updating the first entity to obtain a third entity; Based on the requirements of the second business material, the second entity or the third entity is used as a context to construct a knowledge graph corresponding to the second business material.
2. The method according to claim 1, characterized in that The step of analyzing at least one first business material to obtain a semantic block includes: Preset categories of semantic blocks; Based on the category of the semantic block, at least one of the first business materials is analyzed using a large language model to obtain the semantic block.
3. The method according to claim 1, characterized in that The extracting entities based on the semantic block to obtain the first entity includes: The entities in the semantic block are extracted using a large language model to obtain the first entity.
4. The method according to claim 1, characterized in that The updating of the first entity based on the second entity to obtain a third entity includes: matching the second entity with the first entity; The first entity is updated based on the matching relationship between the second entity and the first entity to obtain the third entity.
5. The method according to claim 4, characterized in that The updating the first entity based on the relationship between the second entity and the first entity to obtain the third entity includes: In response to the second entity being the same as the first entity, not updating the first entity; In response to the existence that the second entity is different from the first entity, the first entity is updated based on the similarity between the second entity and the first entity to obtain the third entity.
6. The method according to claim 1, characterized in that The step of taking the second entity or the third entity as a context based on the requirement of the second business material to construct a knowledge graph corresponding to the second business material includes: In response to the second business material having a first requirement, providing the second entity as a context to a large language model, extracting a first entity relationship, and constructing the knowledge graph based on the first entity relationship; In response to the second business material having a second requirement, the third entity is provided as context to the large language model, a second entity relationship is extracted, and the knowledge graph is constructed based on the second entity relationship; wherein the accuracy requirement in the first requirement is higher than that in the second requirement; and the comprehensiveness requirement in the second requirement is higher than that in the first requirement.
7. A device for constructing a knowledge graph, characterized in that: include: An analysis module, configured to analyze at least one first business material to obtain a first semantic block; the first business material includes a field name, a field type, a field description and sample data; An extraction module is configured to extract entities based on the first semantic block to obtain a first entity; the entity includes a scientific and technological project name, a leading unit, a participating unit, participating personnel, and project results; An analysis and extraction module, configured to analyze and extract the second business material in response to the second business material being added, to obtain a second semantic block and a second entity; An updating module, configured to update the first entity based on the second entity to obtain a third entity; The construction module is configured to construct a knowledge graph corresponding to the second business material based on the needs of the second business material and taking the second entity or the third entity as a context.
8. The device according to claim 7, characterized in that The analysis module is further configured to: A preset unit, which is configured as a category of preset semantic blocks; The analyzing unit is configured to analyze at least one of the first business materials based on the category of the semantic block by using a large language model to obtain the semantic block.
9. The device according to claim 7, characterized in that The extraction module is further configured to: The extraction unit is configured to extract the entities in the semantic block by using a large language model to obtain the first entity.
10. The device according to claim 7, characterized in that The update module is configured to: a matching unit, configured to match the second entity with the first entity; An updating unit is configured to update the first entity based on a matching relationship between the second entity and the first entity to obtain the third entity.
11. The device according to claim 10, characterized in that The updating unit is further configured to: In response to the second entity being the same as the first entity, not updating the first entity; In response to the existence that the second entity is different from the first entity, the first entity is updated based on the similarity between the second entity and the first entity to obtain the third entity.
12. The device according to claim 7, characterized in that The building blocks are further configured to: A first providing unit is configured to, in response to the second business material having a first requirement, provide the second entity as a context to a large language model, extract a first entity relationship, and construct the knowledge graph based on the first entity relationship; The second providing unit is configured to provide the third entity as context to the large language model in response to the second business material having a second requirement, extract a second entity relationship, and construct the knowledge graph based on the second entity relationship; wherein the accuracy requirement in the first requirement is higher than that in the second requirement; and the comprehensiveness requirement in the second requirement is higher than that in the first requirement.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 6.
15. A computer program product, comprising computer program instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 6.