An intelligent question-answering method and system based on a knowledge graph

CN116204625BActive Publication Date: 2026-10-09杭州半云科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310336807.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2026-10-09
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

[0005]鉴于上述的分析,本发明实施例旨在提供一种基于知识图谱的智能问答方法及系统,用以解决现有未充分利用和分析用户对问题答案的满意度而导致无法精准挖掘出深层次信息,从而无法提升问题答案准确度和用户满意度的问题

Benefits of technology

[0038] Compared with existing technologies, this invention can achieve at least one of the following beneficial effects: Starting from the user's satisfaction with the answer to the question, it automatically generates reasoning tasks based on the user's question. By configuring and executing the reasoning tasks, it mines the knowledge needed by the user to supplement and update the knowledge graph, thereby improving the satisfaction of the evaluation in a targeted manner; It combines rule templates to quickly combine various conditional rules and result rules to configure reasoning tasks, mining implicit entity attributes and relationships, which is convenient, fast, and easy to understand. Users only need business knowledge to operate it, without having to write complex graph database statements or have professional knowledge of graph algorithms, machine learning, etc. for data analysis; Through rule validation, rule transformation, and rule execution, it automatically adds and changes graph data, increases the richness and comprehensiveness of knowledge, and improves the accuracy of knowledge question answering and user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116204625B_ABST
    Figure CN116204625B_ABST
Patent Text Reader

Abstract

The application relates to an intelligent question and answer method and system based on a knowledge graph, and belongs to the technical field of knowledge graphs, and solves the problem that the satisfaction degree of a user for a question answer is low due to the lack of deeper information in the prior art. The method comprises the following steps: receiving a user question, extracting key words in the user question; retrieving a knowledge graph according to the key words to obtain a retrieval result, sorting the retrieval result, and taking the retrieval result as a question answer according to a preset quantity; obtaining an evaluation satisfaction degree of the user for the question answer, and generating a reasoning task according to a user question corresponding to the evaluation satisfaction degree lower than a threshold value; based on the knowledge graph, a conditional rule and a result rule are configured for each reasoning task by using a conditional rule template and a result rule template; the reasoning task that passes the verification is run, the conditional rule and the result rule in the reasoning task are converted into operation statements of a graph database, the operation statements are executed, and the knowledge graph is updated. The accuracy of the question answer and the satisfaction degree of the user are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph technology, and in particular to an intelligent question-answering method and system based on knowledge graphs. Background Technology

[0002] With the rapid development of science and technology, various industries have generated massive amounts of data, most of which is queried and used based on relational databases. However, bottlenecks arise when performing complex relational queries and analyses. Large tables and multi-table joins significantly reduce query efficiency. To better store and analyze such relational data, and to make full use of unstructured data, graph database storage technology has emerged, and the application of various knowledge graphs based on graph databases is also increasing.

[0003] Intelligent question answering based on knowledge graphs aims to find answers to given questions expressed in natural language from existing knowledge graphs. Current intelligent question answering focuses on retrieving answers from the knowledge graph and semantically encapsulating them, merely evaluating user satisfaction based on statistical measures of whether the answer meets their needs. Furthermore, knowledge graph updates are often limited to changes in business data, lacking the ability to mine deeper or more multi-dimensional information, resulting in low user satisfaction with the answers.

[0004] Therefore, existing technologies lack further analysis of the satisfaction level of the answers to questions, and ignore the entity and relational information implicit in user questions, resulting in a lack of a large amount of valuable data. Even if the knowledge graph is updated, it cannot improve user satisfaction with the answers to questions. Summary of the Invention

[0005] Based on the above analysis, the embodiments of the present invention aim to provide an intelligent question-answering method and system based on knowledge graphs, in order to solve the problem that existing methods do not fully utilize and analyze user satisfaction with question answers, resulting in the inability to accurately mine deeper information, thereby failing to improve the accuracy of question answers and user satisfaction.

[0006] On one hand, embodiments of the present invention provide an intelligent question-answering method based on knowledge graphs, comprising the following steps:

[0007] Receive user questions, extract keywords from the questions; retrieve search results from the knowledge graph based on the keywords, sort the search results, and extract the search results according to a preset number as the answers to the questions;

[0008] Obtain user satisfaction ratings for question answers; generate reasoning tasks based on user questions with satisfaction ratings below a threshold; configure conditional rules and result rules for each reasoning task using conditional rule templates and result rule templates based on a knowledge graph.

[0009] Run the validated inference task, convert the conditional rules and result rules in the inference task into operation statements for the graph database, execute the operation statements, and update the knowledge graph.

[0010] Based on a further improvement to the above method, an inference task is generated according to the user questions corresponding to satisfaction levels below a threshold, including:

[0011] Use user questions corresponding to satisfaction ratings below a threshold as task descriptions; use keywords from user questions as task keywords; obtain the task name based on the keywords and the current date; and create a reasoning task based on the task name, task description, and task keywords.

[0012] Based on further improvements to the above method, the conditional rule template includes: entity A and entity B have a relation C, attribute B of entity A satisfies condition C, attribute B of relation A satisfies condition C, define attribute B of entity A as variable B, define attribute B of relation A as variable B, and variable A and variable B satisfy condition C; the result rule template includes: entity A and entity B add relation C, attribute B of entity A is set to C, and attribute B of relation A is set to C.

[0013] Further improvements to the above method, based on knowledge graphs, utilize conditional rule templates and result rule templates to configure conditional rules and result rules for each inference task, including:

[0014] Select entities, relations, entity attributes, and relation attributes from the knowledge graph, configure one or more conditional rules, and one result rule;

[0015] The same entity, relation, entity attribute, and relation attribute are each identified by a unique variable name in the same reasoning task;

[0016] The conditions in a conditional rule template include operators and condition values;

[0017] Multiple conditional rules are related by "AND".

[0018] Based on further improvements to the above method, a valid reasoning task means that the variable names of the condition rules and result rules in the reasoning task are valid, the condition values ​​match the attribute types, and the attribute values ​​are valid.

[0019] Based on the further improvement of the above method, the valid variable names include: each variable name does not contain Chinese characters or symbols; each variable name corresponds to only one entity, relation, or attribute; and the variable names in the conditional rules configured according to the rule templates "define the attribute of entity A as variable B" and / or "define the attribute of relation A as variable B" exist in the conditional rules configured according to the rule template "variable A and variable B satisfy condition C".

[0020] A condition value matching an attribute type includes: the condition value is not NULL or an empty string; and the condition value matches the type of the attribute of the corresponding entity or relation.

[0021] A valid attribute value includes: the attribute value is not empty, and the attribute value exists in the corresponding entity or relation.

[0022] Based on the above method, further improvements are made to convert the conditional rules in the reasoning task into operation statements for the graph database, including:

[0023] Based on the conditional rule template, the conditional rules in the reasoning task are converted into entity relation statements and conditional statements;

[0024] Based on the result rules in the reasoning task, obtain the corresponding operation object;

[0025] Based on the syntax of graph database operation statements, entity relation statements, conditional statements, and operation objects are concatenated to obtain operation statements.

[0026] Based on the above method, further improvements are made to the conditional rules in the reasoning task, which are converted into entity relation statements and conditional statements according to the conditional rule template, including:

[0027] When the conditional rules include the conditional rules configured in the rule templates of "define the attribute of entity A as variable B" and "define the attribute of relation A as variable B", the correspondence between variable names will be identified and stored.

[0028] When the conditional rules include the conditional rules configured in the rule templates such as "Attribute B of entity A satisfies condition C", "Attribute B of relation A satisfies condition C", and "Variable A and variable B satisfy condition C", then the conditional statements corresponding to the entities or relations are obtained by combining the correspondence of variable names.

[0029] Based on the conditional rules configured in the rule template “Entity A and Entity B have relationship C”, the entities are linked together through the relationship to obtain the entity relationship statement.

[0030] Based on the above method, further improvements are made to the result rules in the reasoning task, which are then converted into operation statements for the graph database, including:

[0031] When the result rule in the reasoning task corresponds to "add relation C to entity A and entity B", the result rule is converted into an insert relation statement;

[0032] When the result rule in the reasoning task corresponds to "the attribute B of entity A is set to C", the result rule is converted into an entity attribute update statement.

[0033] When the result rule in the reasoning task corresponds to "set attribute B of relation A to C", the result rule is converted into a statement to update relation attributes.

[0034] On the other hand, embodiments of the present invention provide an intelligent question-answering system based on a knowledge graph, comprising:

[0035] The intelligent question-answering module receives user questions, extracts keywords from the questions, retrieves search results from the knowledge graph based on the keywords, sorts the search results, and extracts the search results according to a preset number as the answers to the questions.

[0036] The reasoning task construction module is used to obtain user satisfaction ratings for question answers and generate reasoning tasks based on user questions with satisfaction ratings below a threshold. Based on the knowledge graph, conditional rules and result rules are configured for each reasoning task using conditional rule templates and result rule templates.

[0037] The knowledge graph update module is used to run validated reasoning tasks, convert the conditional rules and result rules in the reasoning tasks into operation statements for the graph database, execute the operation statements, and update the knowledge graph.

[0038] Compared with existing technologies, this invention can achieve at least one of the following beneficial effects: Starting from the user's satisfaction with the answer to the question, it automatically generates reasoning tasks based on the user's question. By configuring and executing the reasoning tasks, it mines the knowledge needed by the user to supplement and update the knowledge graph, thereby improving the satisfaction of the evaluation in a targeted manner; It combines rule templates to quickly combine various conditional rules and result rules to configure reasoning tasks, mining implicit entity attributes and relationships, which is convenient, fast, and easy to understand. Users only need business knowledge to operate it, without having to write complex graph database statements or have professional knowledge of graph algorithms, machine learning, etc. for data analysis; Through rule validation, rule transformation, and rule execution, it automatically adds and changes graph data, increases the richness and comprehensiveness of knowledge, and improves the accuracy of knowledge question answering and user satisfaction.

[0039] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0040] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0041] Figure 1 This is a flowchart of an intelligent question-answering method based on knowledge graphs in Embodiment 1 of the present invention;

[0042] Figure 2 This is a schematic diagram illustrating the conversion of conditional rules into operation statements in Embodiment 1 of the present invention;

[0043] Figure 3 This is a flowchart illustrating the operation of updating the knowledge graph based on the reasoning task in Embodiment 2 of the present invention. Detailed Implementation

[0044] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0045] Example 1

[0046] A specific embodiment of the present invention discloses an intelligent question-answering method based on knowledge graphs, such as... Figure 1 As shown, it includes the following steps:

[0047] S11: Receive user questions, extract keywords from user questions; retrieve search results from the knowledge graph based on keywords, sort the search results, and extract the search results according to a preset quantity as the answer to the question.

[0048] It should be noted that a knowledge graph utilizes a constructed entity model to map collected structured and unstructured business data onto a graph database, forming a set of nodes and edges. Nodes represent entities, and edges represent relationships between entities; both entities and relationships include attributes. Furthermore, knowledge graphs from different teams or projects can be isolated using a graph space. This embodiment does not limit the method of constructing the knowledge graph.

[0049] For the received user questions, the jieba word segmentation is used to obtain the word segmentation results, which are then compared with the keyword database in the knowledge graph to extract the keywords from the user questions. The keyword database can be pre-constructed based on word frequency statistics methods.

[0050] The system retrieves entities and relationships from the knowledge graph based on keywords. It calculates scores for the search results based on keyword weights and search frequency, sorts them from highest to lowest, extracts a preset number of results, encapsulates the results using semantic templates, and displays the answers to the questions on the front end. Users can then rate their satisfaction with the displayed answers.

[0051] S12: Obtain user satisfaction ratings for the answers to the questions; generate reasoning tasks based on user questions with satisfaction ratings below a threshold; configure conditional rules and result rules for each reasoning task using conditional rule templates and result rule templates based on the knowledge graph.

[0052] It should be noted that the satisfaction rating in this embodiment can be obtained directly from the user's rating of the answer to the question, or it can be obtained by first classifying the user's questions according to the keywords in the user's questions, and then calculating the average rating of each type of question. There is no limitation here.

[0053] Furthermore, based on the user questions corresponding to satisfaction levels below a threshold, an inference task is generated, including:

[0054] Use user questions corresponding to satisfaction ratings below a threshold as task descriptions; use keywords from user questions as task keywords; obtain the task name based on the keywords and the current date; and create a reasoning task based on the task name, task description, and task keywords.

[0055] Preferably, by monitoring tasks and periodically calculating the satisfaction level of question answers, reasoning tasks can be created in a timely manner, and relevant business personnel can be notified. If the satisfaction level is obtained by categorizing and calculating the average score, to avoid having too many user questions, some user questions with lower satisfaction levels can be selected as task descriptions.

[0056] Business personnel can view detailed information about reasoning tasks and retrieve reasoning tasks with the same keywords from historical reasoning tasks for reference.

[0057] Compared with existing technologies, this embodiment starts with the user's satisfaction with the answer to the question, automatically generates reasoning tasks based on the user's question, establishes a correlation between user satisfaction and knowledge graph data, thereby mining the knowledge needed by the user and improving the accuracy of the answer to the question and user satisfaction.

[0058] When configuring an inference task, all entity and relation information in the knowledge graph space to which the inference task belongs is read and cached on the front-end page. During rule configuration, entities, relations, entity attributes, and relation attributes are selected via dropdown menus. An inference task includes one or more conditional rules, but only one result rule, meaning that a single inference result rule can be extracted based on the configured conditional rules.

[0059] Specifically, the conditional rule template includes: entity A and entity B have a relation C, attribute B of entity A satisfies condition C, attribute B of relation A satisfies condition C, define attribute B of entity A as variable B, define attribute B of relation A as variable B, and variable A and variable B satisfy condition C; the result rule template includes: entity A and entity B add relation C, attribute B of entity A is set to C, and attribute B of relation A is set to C.

[0060] It is important to note that A, B, and C mentioned above only distinguish between their respective rule templates and do not correspond to each other across rule templates. When configuring conditional rules, you can select one or more conditional rule templates. One conditional rule template can configure one or more conditional rules. The "condition" in a conditional rule template includes operators and condition values; multiple conditional rules are related by "AND".

[0061] In order to correctly identify entities, relations and attributes in knowledge mining and avoid the problem of rule judgment confusion caused by repeatedly introducing the same rule template, "variable names" are introduced to replace the original names of entities, relations and attributes. The same selected entity, relation, entity attribute and relation attribute are identified by unique variable names in the same reasoning task.

[0062] The following explains the six conditional rule templates.

[0063] 1) Entity A and entity B have relationship C

[0064] This rule template determines whether entity A and entity B in a graph database have a relationship C, where entity A and entity B can be the same entity or different entities. For example, in a bus graph, a stop (entity A) and a stop (entity B) have a next stop relationship (relation C), and a bus route (entity A) and a stop (entity B) have an inclusion relationship (relation C).

[0065] When configuring rules, you need to set "variable names" for two entities and one relation. For example, in the bus map, the entity name of the bus route is gongjiaoxianlu, and the variable name is gjxl; the entity name of the station is zhandian, and the variable name is zd; the relation name containing the relationship is baohan, and the variable name is bh.

[0066] 2) Attribute B of entity A satisfies condition C.

[0067] This rule template determines whether an attribute B of entity A in a graph database satisfies a certain condition C. The operators for this condition include, but are not limited to: greater than, greater than or equal to, equal to, less than, less than or equal to, not equal to, and contain. For example, in a bus graph, the bus company (entity name gongjiaogongsi, variable name gjgs) has assets (attribute name zhichan) greater than 1 million (condition C). The condition "greater than 1 million" is set to "greater than" via a dropdown menu, and the condition value "100" is entered into the input box (the backend processes this as 1 million).

[0068] 3) Attribute B of relation A satisfies condition C.

[0069] This rule template determines whether an attribute B of relation A in a graph database satisfies a certain condition C. The operators for this condition include, but are not limited to: greater than, greater than or equal to, equal to, less than, less than or equal to, not equal to, and contain. For example, in a bus route map, the bus company owns the route relation (relation name gjyongyouxl, variable name yy), and its time (attribute name xltime) is greater than 2022-01-01 (condition C). The condition "greater than 2022-01-01" is set to "greater than" via a dropdown menu, and the condition value "2022-01-01" is entered into the input box.

[0070] 4) Define the attribute of entity A as variable B.

[0071] This rule template assigns a variable B to a specific attribute of entity A in the graph database. Variable B represents the value of this attribute and is used in the comparison of variable values ​​in the condition "variable A and variable B satisfy condition C". For example, in a public transport map, the operating status (attribute name yunyinzhuangtai) of a station (entity name zhandian, variable name zd) is set to the variable name zdyyzt.

[0072] 5) Define the attribute of relation A as variable B.

[0073] This rule template assigns a variable B to a specific attribute of relation A in a graph database. Variable B is used to compare the values ​​of variables in the condition "variable A and variable B satisfy condition C". For example, in a bus route map, the operational status (attribute name yunyinzhuangtai) of the containment relation (relation name baohan, variable name bh) between bus routes and stops is set to the variable name bhyyzt.

[0074] 6) Variables A and B satisfy condition C

[0075] This rule template uses the entity attribute variable names and relation attribute variable names defined in steps 4) and 5) above to perform conditional comparisons between variable names. The conditional operators include, but are not limited to: greater than, greater than or equal to, equal to, less than, less than or equal to, not equal to, and contain. For example, in a bus route map, the operating status of a station is set as the variable name "zdyyzt", and the operating status of the containment relationship between a bus route and a station is set as the variable name "bhyyzt". To set the variable values ​​of the two operating statuses to be equal, the configuration would be "zdyyzt" = "bhyyzt".

[0076] The following explains the three result rule templates.

[0077] 1) Add relationship C between entity A and entity B.

[0078] This rule template adds relation C to entities A and B in a graph database, updating the graph database. For example, in a public transport graph, it adds a covering relation (relation name fggx) to the bus company (entity name gongjiaogongsi, variable name gjgs) and station (entity name zhandian, variable name zd) in a dataset that meets the conditional rules.

[0079] 2) Set attribute B of entity A to value C.

[0080] This rule template updates the graph database by setting attribute B of entity A to value C. For example, in a public transport graph, the enterprise size (attribute name qygm) of the public transport company (entity name gongjiaogongsi, variable name gjgs) in the dataset that meets the condition rule is set to "medium size".

[0081] 3) Attribute B of relation A is set to value C.

[0082] This rule template updates the graph database by setting attribute B of relation A to value C. For example, in a bus route map, the route type (attribute name xllx) of the bus company-owned route relation (relation name gjyongyouxl, variable name yy) in the dataset that meets the condition rule is set to "temporary route".

[0083] Compared with existing technologies, this embodiment summarizes the discovery and reasoning of knowledge in graph databases into 6 conditional rules and the updating of graph databases into 3 result rules. Through a visual interface, data that meets the conditions is automatically mined according to the flexibly configured conditional rules, and implicit knowledge is added according to the result rules to enrich the knowledge graph and improve the accuracy of intelligent question answering.

[0084] S13: Run the validated inference task, convert the conditional rules and result rules in the inference task into operation statements for the graph database, execute the operation statements, and update the knowledge graph.

[0085] Specifically, step S13 includes:

[0086] S131: Verify the condition rules and result rules in the reasoning task.

[0087] It should be noted that the conditional rules and result rules configured on the front end are passed to the back end. Each conditional rule is mapped to a conditional rule object, forming a list of conditional rules. Each result rule is mapped to a result rule object. By comparing the attributes of the conditional rule objects and result rule objects, the rules are validated. After the validation is successful, the information in the conditional rule objects and result rule objects is stored in a relational database for easy display on the interface.

[0088] Rule validation involves comprehensively verifying the configured conditional rules and result rules. Only after successful validation can the inference task proceed; otherwise, it cannot run. Rule validation sequentially checks whether the variable name is valid, whether the condition value matches the attribute type, and whether the attribute value is valid. If any one of these fails, an error message is displayed, and the task status is set to "validation failed." Only after all rules pass does the status change to "normal." In other words, successful validation of both conditional and result rules includes: valid variable names, conditional values ​​matching the attribute type, and valid attribute values.

[0089] Specifically, when validating variable names, the following conditions must be met: 1) Variable names containing symbols or Chinese characters are invalid; 2) Variable names defined repeatedly by different entities, relations, or attributes are invalid; 3) Attributes defined in a previous rule but not used in subsequent rules are invalid; 4) Variable names used in a rule comparing variables but not defined in any rule are invalid. All of these situations constitute validation failure. Therefore, valid variable names include: each variable name does not contain Chinese characters or symbols; each variable name corresponds to only one entity, relation, or attribute; and 5) Variable names in the conditional rules configured according to the rule templates "Define attribute of entity A as variable B" and / or "Define attribute of relation A as variable B" exist in the conditional rules configured according to the rule template "Variable A and variable B satisfy condition C".

[0090] When validating whether a condition value matches an attribute type, if the attribute type of the entity or relation is numeric, but the condition value is Chinese or English characters or symbols, the rule is invalid. Similarly, if the attribute value of the entity or relation is set to null or an empty string, the rule is considered invalid, and all such cases result in validation failure. Therefore, validating a condition value to an attribute type includes: the condition value is not NULL or an empty string; and the condition value matches the type of the corresponding entity or relation attribute.

[0091] When validating attribute values, if an entity or relationship attribute needs to be selected during configuration but is not selected, or if the attribute is manually modified after selection, the rule is invalid and the validation fails. Therefore, a valid attribute value includes: the attribute value is not empty, and the attribute value exists in the corresponding entity or relationship.

[0092] Preferably, if there are multiple conditional rules configured with the rule template "Entity A and Entity B have relationship C", then based on the connection direction of entities and relationships in the knowledge graph, it is further verified whether there is a serial connection between multiple entities.

[0093] For example, if the rule configured for "Entity A and Entity B have a relationship C" is: the bus company and the bus route have an ownership relationship, and the bus route and the station have an inclusion relationship, then based on the connection direction of the entities and relationships, it can be chained as: (Bus Company) - [Own] -> (Bus Route) - [Inclusion] -> (Station), which is a valid rule and passes the validation. If the rule configured for "Entity A and Entity B have a relationship C" is: the bus company and the bus route have an ownership relationship (Bus Company) - [Own] -> (Bus Route), and the stations have a next-stop relationship (Station) - [Next Stop] -> (Station), since there are no identical entities, they cannot be chained together, which is an invalid rule and fails the validation. If the rule configured for "Entity A and Entity B have a relationship C" is: the bus company and the bus route have an ownership relationship (Bus Company) - [Own] -> (Bus Route), and the bus company and the bus driver have an ownership relationship (Bus Company) - [Own] -> (Bus Driver), the connection direction of the relationships cannot chain the entities together, which is an invalid rule and fails the validation.

[0094] Preferably, the entity or relation corresponding to the task keyword of the reasoning task is verified to exist in the entity and relation selected by the condition rule and the result rule. If neither exists, a prompt message is displayed for the user to confirm whether to ignore it. If ignored, the verification passes; otherwise, the verification fails.

[0095] After the conditional rules and result rules pass the validation, they are converted into operation statements for the graph database. The operation statements corresponding to the conditional rules are used to query the datasets that meet the conditions, while the operation statements corresponding to the result rules are used to perform insertion or update operations on the datasets that meet the conditions.

[0096] It should be noted that the operation statements of the graph database are based on the query language specification of the graph database used in knowledge graphs. Mainstream graph databases include Neo4j, Dgraph, JanusGraph, HugeGraph, and Nebula. This embodiment uses the Nebula graph database and converts it into operation statements supported by the corresponding nGQL language.

[0097] Specifically, it includes:

[0098] ① Based on the condition rule template, convert the condition rules in the reasoning task into entity relation statements and condition statements.

[0099] It should be noted that conditional rule template 1) is used to configure entity relationships, and conditional rule templates 2), 3), and 6) are used to configure conditions; conditional rule templates 4) and 5) are used to define variables, which are used in conditional rule template 6). This embodiment parses and transforms the rules for each reasoning task in the order of variables first, then conditions, and finally entity relationships.

[0100] For example, such as Figure 2 As shown, the entity relation statement and condition statement are obtained by processing the conditional rules through the following three steps:

[0101] a) Recognize and convert attribute variable names.

[0102] That is, when the conditional rules include the conditional rules configured in the rule templates of "define the attribute of entity A as variable B" and "define the attribute of relation A as variable B", the correspondence between variable names will be identified and stored.

[0103] Specifically, "defining an attribute of entity A as variable B" configures entity A and its variable name, entity attribute and its variable name B; "defining an attribute of relation A as variable B" configures relation A and its variable name, relation attribute and its variable name B; in subsequent rules, if the same entity, relation and attribute are used, the corresponding variable name can be directly obtained.

[0104] b) Identification and transformation for conditional comparison

[0105] In other words, when the conditional rules include the conditional rules configured in the rule templates such as "Attribute B of entity A satisfies condition C", "Attribute B of relation A satisfies condition C", and "Variable A and variable B satisfy condition C", then the conditional statements corresponding to the entities or relations are obtained by combining the correspondence of variable names.

[0106] It should be noted that the conditional rule "Attribute B of entity A satisfies condition C" and "Attribute B of relation A satisfies condition C" is converted into a statement according to "entity / relation variable name.attribute condition operator condition value". For example, if the assets (attribute name zhichan) of a bus company (entity name gongjiaogongsi, variable name gjgs) are greater than 1 million, the converted conditional statement is: gjgs.zhichan>100.

[0107] The condition rule "Variable A and Variable B satisfy condition C" requires obtaining the variable name of the entity or relation corresponding to the variable name based on the correspondence of variable names obtained in the first step, and then obtaining the transformation statement according to "entity / relation variable name.attribute variable name condition operator entity / relation variable name.attribute variable name".

[0108] For example, the operational status of a station is set to the variable zdyyzt, and the operational status of the inclusion relationship between a bus route and a station is set to the variable bhyyzt. The variable values ​​of these two operational statuses are equal, and the conditional rule is configured as "zdyyzt" = "bhyyzt". When transforming the conditional statement, it is necessary to find the corresponding entity and relationship based on the correspondence of the variable names. The transformed conditional statement is: zd.zdyyzt == bh.bhyyzt.

[0109] c) Perform entity relationship identification and conversion.

[0110] That is, based on the conditional rules configured in the rule template "Entity A and Entity B have relationship C", the entities are linked together through the relationship to obtain the entity relationship statement.

[0111] It should be noted that if there are multiple conditional rules for "Entity A and Entity B have relation C", you can first create a linked list, sort the rules according to the direction of relation connection and store them in the linked list, and then chain the entities together according to "(entity variable name 1: entity name 1)-[relation variable name 1: relation name 1]->(entity variable name 2: entity name 2)" to obtain the entity relation statement.

[0112] For example, a bus company (entity name gongjiaogongsi, variable name gjgs) has an ownership relationship with a bus route (entity name gongjiaoxianlu, variable name gjxl) (relationship name yongyou, variable name yy), and a bus route (entity name gongjiaoxianlu, variable name gjxl) has an inclusion relationship with a stop (entity name zhandian, variable name zd) (relationship name baohan, variable name bh). The transformed entity relationship statement is: (gjgs:gongjiaogongsi)-[yy:yongyou]->(gjxl:gongjiaoxianlu)-[bh:baohan]->(zd:zhandian).

[0113] ②According to the result rules in the reasoning task, obtain the corresponding operation object.

[0114] It should be noted that when the result rule in the reasoning task corresponds to "add relation C to entity A and entity B", the operation objects are entity A and entity B; when the result rule in the reasoning task corresponds to "set attribute B of entity A to C", the operation object is entity A; and when the result rule in the reasoning task corresponds to "set attribute B of relation A to C", the operation object is relation A.

[0115] For example, the result rule is configured as follows: add an overriding relationship (relationship name fggx) between the bus company (entity name gongjiaogongsi, variable name gjgs) and the station (entity name zhandian, variable name zd), then the operation objects are the bus company gjgs and the station zd.

[0116] ③ Based on the syntax of the graph database operation statements, concatenate entity relation statements, conditional statements, and operation objects to obtain the operation statements.

[0117] It should be noted that the operation statement obtained based on the conditional rules is a query operation statement, used to retrieve data results that meet the conditions. The format of the query operation statement is: MATCH entity relation statement WHERE 1==1 and conditional statement RETURN operand; when there are two operands, the operands are concatenated with commas.

[0118] For example, the concatenated query statement is: "MATCH(gjgs:gongjiaogongsi)-[yy:yongyou]->(gjxl:gongjiaoxianlu)-[bh:baohan]->(zd:zhandian)WHERE 1==1andzd.zdyyzt==bh.bhyyzt RETURN gjgs,zd.

[0119] S133: Convert the result rules in the reasoning task into operation statements for the graph database.

[0120] Specifically, it includes:

[0121] When the result rule in the inference task corresponds to "add relation C to entity A and entity B", the result rule is converted into an insert relation statement. The format of the insert relation statement is: INSERT EDGE C() VALUES "primary key of A" -> "primary key of B":().

[0122] When the result rule in the inference task corresponds to "the attribute B of entity A is set to C", the result rule is converted into an entity attribute update statement. The format of the entity attribute update statement is: UPDATE VERTEX ON A "primary key of A" SET attribute B = C.

[0123] When the result rule in the inference task corresponds to "set attribute B of relation A to C", the result rule is converted into an update relation attribute statement. The format of the update relation attribute statement is: UPDATE EDGE ON A "starting point id of A"->"ending point id of A"@0 SET attribute B=C.

[0124] The statements obtained from the above three result rule templates are used as result operation statements.

[0125] S134: Execute the operation statement to update the knowledge graph.

[0126] It should be noted that the execution operation statement includes: first, executing the query operation statement obtained by transforming the condition rules, temporarily storing the data results that meet the conditions in memory, then retrieving the temporarily stored data, and using the corresponding executor to execute the result operation statement obtained by transforming the result rules to insert or update the temporarily stored data.

[0127] Preferably, all inserted or updated records are stored in the result data cache. After the task is completed, the data in the cache is statistically analyzed, and the statistical data is stored in the task result table of the business database. After the task is completed, the total number of tasks and detailed records for each task are displayed on the front-end page.

[0128] Preferably, each reasoning task is executed periodically as a timed task to replenish the knowledge graph data in a timely manner.

[0129] Compared with existing technologies, this embodiment provides a knowledge graph-based intelligent question-answering method that starts with user satisfaction with the answers to questions. It automatically generates reasoning tasks based on user questions, and through the configuration and execution of these tasks, mines the knowledge required by the user to supplement and update the knowledge graph, thereby specifically improving satisfaction. It combines rule templates to quickly combine various conditional and result rules to configure reasoning tasks, uncovering implicit entity attributes and relationships. This method is convenient, fast, and easy to understand. Users only need business knowledge; they do not need to write complex graph database statements or possess expertise in graph algorithms, machine learning, or other data analysis skills. Through rule validation, rule transformation, and rule execution, it automatically adds and modifies graph data, increasing the richness and comprehensiveness of knowledge, and improving the accuracy of knowledge-based question answering and user satisfaction.

[0130] Example 2

[0131] Another embodiment of the present invention discloses a knowledge graph-based intelligent question-answering system, thereby implementing the knowledge graph-based intelligent question-answering method in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. The system includes:

[0132] The intelligent question-answering module receives user questions, extracts keywords from the questions, retrieves search results from the knowledge graph based on the keywords, sorts the search results, and extracts the search results according to a preset number as the answers to the questions.

[0133] The reasoning task construction module is used to obtain user satisfaction ratings for question answers and generate reasoning tasks based on user questions with satisfaction ratings below a threshold. Based on the knowledge graph, conditional rules and result rules are configured for each reasoning task using conditional rule templates and result rule templates.

[0134] The knowledge graph update module is used to run validated reasoning tasks, convert the conditional rules and result rules in the reasoning tasks into operation statements for the graph database, execute the operation statements, and update the knowledge graph.

[0135] Taking the public transportation industry as an example, a public transportation knowledge graph is first obtained through a knowledge construction module. Users then use the intelligent question-and-answer module to search for questions related to travel and public transportation operations. Statistics show that the satisfaction rate of answers for queries about bus company-covered stations is relatively low, automatically generating a reasoning task. The next step is to... Figure 3 The process shown involves configuring the reasoning task and updating the knowledge graph. The steps in the process are explained below:

[0136] 1) Selecting a reasoning task: Selecting a bus company and bus stop for the reasoning task.

[0137] 2) Add conditional rules: Enter the task editing page to add conditional rules. Conditional rules can be one or multiple, depending on business needs. Multiple rules are in a union relationship; all rules must be satisfied before the result can be processed.

[0138] ① Bus ​​company owns bus routes: Add the first rule, select "Entity A and entity B have relationship C" in the condition rule template, then select the entity object "Bus Company" in the entity drop-down, set the variable name to "gjgs", select "Own" in the relationship drop-down box, set the variable name to "yy", select "Bus routes" in the entity drop-down box, and set the variable name to "gjxl".

[0139] ② Bus routes include stops: Add a second rule. In the conditional rule template, select "Entity A and entity B have relationship C". Then, select the entity object "Bus routes" from the entity drop-down list and set the variable name to "gjxl". In the relationship drop-down list, select "Contains" and set the variable name to "bh". In the entity drop-down list, select "Stops" and set the variable name to "zd".

[0140] 3) Add result rules: Select the "Add Relationship C to Entity A and Entity B" template, then select the entity object "Bus Company" from the entity drop-down list, set the variable name to "gjgs", select "Override" from the relationship drop-down list, select "Station" from the entity drop-down list, and set the variable name to "zd".

[0141] Save the added conditional rules and result rules, and store the entities, relations, attributes and variable names in the rules in an associated manner.

[0142] 4) Rule Validation: Using the "Rule Validation" button, check the following in sequence: whether the variable name is valid, whether the condition value matches the attribute type, and whether the attribute value is valid. If the validation passes, the status will be "Normal," and a "Rule Validation Successful" message will be displayed on the page. If any one of these checks fails, an error message will be displayed, the task status will be set to "Validation Failed," and the user will return to the rule configuration interface. The rule can then be modified, and rule validation will be performed again until all validations pass, at which point the status will change back to "Normal."

[0143] 5) Run the task:

[0144] Once the rules pass validation, the task can be run. Click the "Run" button in the task interface. First, convert the conditional rules and result rules into query and result operation statements for the graph database, respectively. The graph database's graph statement executor first executes the query operation statement, temporarily storing the bus companies and stations that meet the conditions. Then, it executes the result operation statement, inserting an "overwrite" relationship between the temporarily stored bus companies and stations. All updated detailed records are stored in the result data cache. After the task runs, the data in the cache is statistically analyzed, and the statistical data is stored in the task result table of the business database. This can be viewed in the run results after the task is completed. The detailed record details display the data for "Bus Company" – "Overwrite" – "Station" in a list format.

[0145] Since the knowledge graph-based intelligent question-answering system in this embodiment and the aforementioned knowledge graph-based intelligent question-answering method can be mutually referenced, this description is redundant and will not be repeated here. Because this system embodiment shares the same principle as the above method embodiment, it also possesses the corresponding technical effects of the above method embodiment.

[0146] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0147] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A knowledge graph-based intelligent question answering method, characterized in that, Includes the following steps: Receive user questions, extract keywords from the questions; retrieve search results from the knowledge graph based on the keywords, sort the search results, and extract the search results according to a preset number as the answers to the questions; Obtain user satisfaction ratings for question answers, and generate reasoning tasks based on user questions corresponding to satisfaction ratings below a threshold. Based on knowledge graphs, conditional rule templates and result rule templates are used to configure conditional rules and result rules for each reasoning task; Running a validated inference task converts the conditional rules and result rules in the inference task into operation statements for the graph database. This includes: converting the conditional rules in the inference task into entity relation statements and conditional statements based on the conditional rule template; obtaining the corresponding operation objects based on the result rules in the inference task; concatenating the entity relation statements, conditional statements, and operation objects according to the syntax of the graph database operation statements to obtain query operation statements and result operation statements; executing the operation statements, including: first executing the query operation statements converted from the conditional rules, temporarily storing the data results that meet the conditions in memory, then retrieving the temporarily stored data, and using the graph database's graph statement executor to execute the result operation statements converted from the result rules to perform insertion or update operations on the temporarily stored data; and updating the knowledge graph.

2. The intelligent question-answering method based on knowledge graphs according to claim 1, characterized in that, The step of generating a reasoning task based on user questions corresponding to satisfaction levels below a threshold includes: Use user questions corresponding to satisfaction ratings below a threshold as task descriptions; use keywords from user questions as task keywords; obtain the task name based on the keywords and the current date; and create a reasoning task based on the task name, task description, and task keywords.

3. The intelligent question-answering method based on knowledge graphs according to claim 1, characterized in that, The conditional rule template includes: entity A and entity B have a relationship C, attribute B of entity A satisfies condition C, attribute B of relationship A satisfies condition C, attribute B of entity A is defined as variable B, attribute B of relationship A is defined as variable B, and variable A and variable B satisfy condition C; the result rule template includes: entity A and entity B add a relationship C, attribute B of entity A is set to C, and attribute B of relationship A is set to C.

4. The intelligent question-answering method based on knowledge graphs according to claim 3, characterized in that, The method, based on knowledge graphs and utilizing conditional rule templates and result rule templates, configures conditional rules and result rules for each reasoning task, including: Select entities, relations, entity attributes, and relation attributes from the knowledge graph, configure one or more conditional rules, and one result rule; The same entity, relation, entity attribute, and relation attribute are each identified by a unique variable name in the same reasoning task; The conditions in a conditional rule template include operators and condition values; Multiple conditional rules are related by "AND".

5. The intelligent question-answering method based on knowledge graphs according to claim 4, characterized in that, A reasoning task that passes the verification means that the variable names of the condition rules and result rules in the reasoning task are valid, the condition values ​​match the attribute types, and the attribute values ​​are valid.

6. The intelligent question-answering method based on knowledge graphs according to claim 5, characterized in that, The validity of the variable names includes: each variable name does not contain Chinese characters or symbols; each variable name corresponds to only one entity, relation, or attribute; and the variable names in the conditional rules configured according to the rule templates "Define the attribute of entity A as variable B" and / or "Define the attribute of relation A as variable B" exist in the conditional rules configured according to the rule template "Variable A and variable B satisfy condition C". The matching of the condition value with the attribute type includes: the condition value is not NULL or an empty string; and the condition value matches the type of the attribute of the corresponding entity or relation. The validity of an attribute value includes: the attribute value is not empty, and the attribute value exists in the corresponding entity or relation.

7. The intelligent question-answering method based on knowledge graphs according to claim 1, characterized in that, The process of converting conditional rules in the reasoning task into entity relation statements and conditional statements based on the conditional rule template includes: When the conditional rules include the conditional rules configured in the rule templates of "define the attribute of entity A as variable B" and "define the attribute of relation A as variable B", the correspondence between variable names will be identified and stored. When the conditional rules include the conditional rules configured in the rule templates such as "Attribute B of entity A satisfies condition C", "Attribute B of relation A satisfies condition C", and "Variable A and variable B satisfy condition C", then the conditional statements corresponding to the entities or relations are obtained by combining the correspondence of variable names. Based on the conditional rules configured in the rule template "Entity A and Entity B have relationship C", the entities are linked together through the relationship to obtain the entity relationship statement.

8. The intelligent question-answering method based on knowledge graphs according to claim 1, characterized in that, The result rules in the inference task are converted into operation statements for the graph database, including: When the result rule in the reasoning task corresponds to "add relation C to entity A and entity B", the result rule is converted into an insert relation statement; When the result rule in the reasoning task corresponds to "set attribute B of entity A to C", the result rule is converted into an entity attribute update statement; When the result rule in the reasoning task corresponds to "set attribute B of relation A to C", the result rule is converted into a statement to update relation attributes.

9. A knowledge graph-based intelligent question-answering system, characterized in that, include: The intelligent question-answering module receives user questions, extracts keywords from the questions, retrieves search results from the knowledge graph based on the keywords, sorts the search results, and extracts the search results according to a preset number as the answers to the questions. The reasoning task construction module is used to obtain users' satisfaction ratings for the answers to questions, and to generate reasoning tasks based on user questions with satisfaction ratings below a threshold. Based on knowledge graphs, conditional rule templates and result rule templates are used to configure conditional rules and result rules for each reasoning task; The knowledge graph update module is used to run validated inference tasks, converting the conditional rules and result rules in the inference tasks into operation statements for the graph database. This includes: converting the conditional rules in the inference tasks into entity relation statements and conditional statements based on the conditional rule template; obtaining the corresponding operation objects based on the result rules in the inference tasks; concatenating the entity relation statements, conditional statements, and operation objects according to the syntax of the graph database operation statements to obtain query operation statements and result operation statements; executing the operation statements, including: first executing the query operation statements converted from the conditional rules, temporarily storing the data results that meet the conditions in memory, then retrieving the temporarily stored data, and using the graph database's graph statement executor to execute the result operation statements converted from the result rules to perform insertion or update operations on the temporarily stored data; and updating the knowledge graph.

Citation Information

Patent Citations

  • Knowledge graph visual editing and persistence implementation method and system architecture

    CN111339316A

  • Power failure intelligent question answering method and device based on knowledge graph

    CN113051382A