IP Library Granted Patent US 12,475,113
Granted Patent B2
US 12,475,113 · App. 17/457,445 · Granted Nov 18, 2025

Generation of query templates for knowledge-graph based question answering system

Inventors: Jing Li (Beijing, CN); Jian Wang (Beijing, CN); Jian Min Jiang (Beijing, CN); Zi Ming Huang (Beijing, CN); Zhen Zhang (Beijing, CN); Wanqing Liu (Hefei, CN)
Assignee: International Business Machines Corporation
G06F16/24522G06F16/243G06F40/295G06N5/02
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,475,113
App. No.
17/457,445
Granted
Nov 18, 2025
Kind
B2
Abstract

A processor obtains a pair including a question and an answer in natural language; determines at least one entity in the question and an entity type of each of the at least one entity consistent with the schema of a knowledge graph (KG); identifies a subset of candidate query templates based on the entity type of each of the at least one entity, wherein the candidate query templates are generated based on the schema of the KG; composes a set of queries by populating the at least one entity into each of the subset of candidate query templates; executes the set of queries on the KG to generate respective answers; identifies a first answer from the respective answers that is matching with the answer in the pair; and determines a candidate query template, from the subset of candidate query templates, corresponding to the first answer as a query template.

Claims (56)

1 . A computer implemented method comprising:

obtaining, by one or more processing units, a pair including a question and an answer in natural language, the pair originating from an online resource;

determining, by one or more processing units, at least one entity in the question and an entity type of each of the at least one entity in consistence with a schema of a knowledge graph;

identifying, by one or more processing units, a subset of candidate query templates based on the entity type of each of the at least one entity, wherein the candidate query templates are generated based on the schema of the knowledge graph and traverse a schema space of the schema, wherein the schema space is represented by a graph of nodes representing entity types of entities in the knowledge graph, and wherein the graph is traversed into a sub-graph by a query statement and the sub-graph is constrained by a maximal length of a path;

composing, by one or more processing units, a set of queries by populating the at least one entity into each of the subset of candidate query templates;

executing, by one or more processing units, the set of queries on the knowledge graph to generate respective answers;

identifying, by one or more processing units, a first answer from the respective answers that is matching with the answer in the pair; and

determining, by one or more processing units, a candidate query template, from the subset of candidate query templates, corresponding to the first answer as a query template.

2 . The computer implemented method of claim 1 , wherein the candidate query templates comply with Cypher, and wherein the candidate query templates are generated by using a MATCH clause of a Cypher query statement.

3 . The computer implemented method of claim 2 , wherein a directed edge linking one node with another node of the nodes represents a relation of the one node with the another node.

4 . The computer implemented method of claim 3 , wherein using the MATCH clause of Cypher query statement comprises:

using, by one or more processing units, the MATCH clause of Cypher query statement to traverse the sub-graph of the graph, and wherein the sub-graph complies with constraints limiting a size of the sub-graph.

5 . The computer implemented method of claim 1 , further comprising:

including, by one or more processing units, the candidate query template determined as the query template in a library of query templates.

6 . The computer implemented method of claim 1 , wherein executing the set of queries on the knowledge graph to generate the respective answers comprises:

composing, by one or more processing units, the respective answers in natural language based on data retrieved from the knowledge graph in response to execution of the set of queries on the knowledge graph.

7 . The computer implemented method of claim 1 , further comprising:

determining, by one or more processing units, a relationship of an entity type with at least one other object in the question, and

wherein identifying the subset of candidate query templates based on the entity type of each of the at least one entity further comprises:

identifying, by one or more processing units, a subset of candidate query templates based on the relationship of the entity type with the at least one other object in the question.

8 . A system, comprising:

a processor; and

a memory containing a program that, when executed on the processor, performs an operation, the operation comprising:

obtaining a pair including a question and an answer in natural language, the pair originating from an online resource;

determining, by one or more processing units, at least one entity in the question and an entity type of each of the at least one entity in consistence with a schema of a knowledge graph;

identifying a subset of candidate query templates based on the entity type of each of the at least one entity, wherein the candidate query templates are generated based on the schema of the knowledge graph and traverse a schema space of the schema, wherein the schema space is represented by a graph of nodes representing entity types of entities in the knowledge graph, and wherein the graph is traversed into a sub-graph by a query statement and the sub-graph is constrained by a maximal length of a path;

composing a set of queries by populating the at least one entity into each of the subset of candidate query templates;

executing the set of queries on the knowledge graph to generate respective answers;

identifying a first answer from the respective answers that is matching with the answer in the pair; and

determining a candidate query template, from the subset of candidate query templates, corresponding to the first answer as a query template.

9 . The system of claim 8 , wherein the candidate query templates comply with Cypher, and wherein the candidate query templates are generated by using MATCH clause of Cypher query statement.

10 . The system of claim 9 , wherein a directed edge linking one node with another node of the nodes represents a relation of the one node with the another node.

11 . The system of claim 10 , wherein using the MATCH clause of Cypher query statement comprises using the a MATCH clause of a Cypher query statement to traverse the sub-graph of the graph, and wherein the sub-graph complies with constraints limiting a size of the sub-graph.

12 . The system of claim 8 , further comprising:

including the candidate query template determined as the query template in a library of query templates.

13 . The system of claim 8 , wherein executing the set of queries on the knowledge graph to generate the respective answers comprises:

composing the respective answers in natural language based on data retrieved from the knowledge graph in response to execution of the set of queries on the knowledge graph.

14 . The system of claim 8 , further comprising:

determining a relationship of an entity type with at least one other object in the question, and wherein identifying the subset of candidate query templates based on the entity type of each of the at least one entity further comprising:

identifying a subset of candidate query templates based on the relationship of the entity type with the at least one other object in the question.

15 . A computer program product comprising:

a computer-readable storage medium having computer-readable program code embodied therewith, the computer-readable program code executable by one or more computer processors to perform an operation, the operation comprising:

obtaining a pair including a question and an answer in natural language, the pair originating from an online resource;

determining, by one or more processing units, at least one entity in the question and an entity type of each of the at least one entity in consistence with a schema of a knowledge graph;

identifying a subset of candidate query templates based on the entity type of each of the at least one entity, wherein the candidate query templates are generated based on the schema of the knowledge graph and traverse a schema space of the schema, wherein the schema space is represented by a graph of nodes representing entity types of entities in the knowledge graph, and wherein the graph is traversed into a sub-graph by a query statement and the sub-graph is constrained by a maximal length of a path;

composing a set of queries by populating the at least one entity into each of the subset of candidate query templates;

executing the set of queries on the knowledge graph to generate respective answers;

identifying a first answer from the respective answers that is matching with the answer in the pair; and

determining a candidate query template, from the subset of candidate query templates, corresponding to the first answer as a query template.

16 . The computer program product of claim 15 , wherein the candidate query templates comply with Cypher, and wherein the candidate query templates are generated by using a MATCH clause of a Cypher query statement.

17 . The computer program product of claim 16 , wherein a directed edge linking one node with another node of the nodes represents a relation of the one node with the another node.

18 . The computer program product of claim 17 , wherein using the MATCH clause of Cypher query statement comprises using the MATCH clause of Cypher query statement to traverse the sub-graph of the graph, and wherein the sub-graph complies with constraints limiting a size of the sub-graph.

19 . The computer program product of claim 15 , further comprising:

including the candidate query template determined as the query template in a library of query templates.

20 . The computer program product of claim 15 , wherein executing the set of queries on the knowledge graph to generate respective answers comprises:

composing the respective answers in natural language based on data retrieved from the knowledge graph in response to execution of the set of queries on the knowledge graph.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 3, 2021
From: LI, JING; WANG, JIAN; JIANG, JIAN MIN; HUANG, ZI MING; ZHANG, ZHEN; LIU, WANQING
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 058276/0881 →
Continuity (1)
Related Publication 20230177363A1 · Jun 8, 2023
References Cited (34)
US 5519608A · Kupiec · 1996 [cited by applicant]
US 9183511B2 · Li · 2015 [cited by examiner]
US 11086911B2 · Jagan · 2021 [cited by applicant]
US 11487795B2 · Sun · 2022 [cited by examiner]
US 11922942B1 · Kilinc · 2024 [cited by examiner]
US 20170032689A1 · Beason · 2017 [cited by applicant]
US 20170109355A1 · Li · 2017 [cited by examiner]
US 20170199928A1 · Zhao · 2017 [cited by applicant]
US 20190034410A1 · Hudson · 2019 [cited by applicant]
US 20190057145A1 · Huang · 2019 [cited by examiner]
US 20190065576A1 · Peng · 2019 [cited by applicant]
US 20190311003A1 · Tonkin · 2019 [cited by examiner]
US 20190392066A1 · Kim · 2019 [cited by examiner]
US 20200110835A1 · Zhao · 2020 [cited by applicant]
US 20210201174A1 · Huang · 2021 [cited by examiner]
US 20210216577A1 · Xiao · 2021 [cited by examiner]
US 20210382923A1 · Gragnani · 2021 [cited by examiner]
US 20220075948A1 · Yuan · 2022 [cited by examiner]
US 20230177363A1 · Li · 2023 [cited by examiner]
CN 107633060A · 2018 [cited by applicant]
CN 108038234A · 2018 [cited by applicant]
DE 112017003946T5 · 2019 [cited by applicant]
Biermann et al., “A Guided Template-Based Question Answering System over Knowledge Graphs”, CEUR Workshop Proceedings (CEUR-WS.org), Proceedings of the EKAW 2018 Posters and Demonstrations Session (EKAW-PD 2018), Nancy,… [cited by applicant]
Huang et al., “Generating Question Templates in a Knowledge-Graph Based Question and Answer System”, U.S. Appl. No. 16/730,083, filed Dec. 30, 2019, 27 pages. [cited by applicant]
IBM, “List of IBM Patents or Patent Applications Treated As Related”, Filed Herewith, 2 pages. [cited by applicant]
Monk, Eric, “Visual Cypher: Presenting Tools That Create, Visualize and Parse Cypher”, Solutions Engineer, Neo4j. Aug. 28, 2019, 13 pages. [cited by applicant]
Wu, “Computer-implemented method for dialoguing with user and computer system”, Feb. 13, 2018 (Year: 2018). [cited by applicant]
Abujabal et al., “Automated Template Generation for Question Answering over Knowledge Graphs”, International World Wide Web Conference Committee (IW3C2), Www 2017, Perth, Australia, Apr. 3-7, 2017, 10 Pages. [cited by applicant]
Indurthi et al., “Generating Natural Language Question-Answer Pairs from a Knowledge Graph Using a RNN Based Question Generation Model”, Proceedings of the 15th Conference of the European Chapter of the Association for … [cited by applicant]
Seyler et al., “Knowledge Questions from Knowledge Graphs”, arXiv:1610.09935v2 [cs.CL], Nov. 1, 2016, 9 Pages. [cited by applicant]
Sneiders, Eriks, “Automated Question Answering Using Question Templates That Cover the Conceptual Model of the Database”, International Conference on Applications of Natural Language to Information Systems, Feb. 28, 200… [cited by applicant]
Zhao et al., “Automatically Generating Questions from Queries for Community-based Question Answering”, Proceedings of the 5th International Joint Conference on Natural Language Processing, Chiang Mai, Thailand, Nov. 8-1… [cited by applicant]
Mell et al., “The NIST Definition of Cloud Computing”, Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-145, Sep. 2011, 7 pages. [cited by applicant]
IBM Appendix P, “List of patent and patent applications treated as related”, Filed Herewith, 2 pages. [cited by applicant]