A table data question and answer method and system based on a data fact knowledge graph

By constructing a data fact knowledge graph and using retrieval enhancement generation technology, the diverse analytical needs and accuracy issues of tabular data question-and-answer systems were addressed, enabling unified processing and accurate answers to multiple query intents.

CN121958477APending Publication Date: 2026-05-01ZHEJIANG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG UNIV OF SCI & TECH
Filing Date
2025-12-25
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing tabular data question answering technologies are limited by the traditional paradigm of single task and fragmented architecture, making it difficult to meet diverse analytical needs. Furthermore, large language models, in the absence of external knowledge anchors, cannot guarantee the accuracy of data facts and the rigor of logic.

Method used

We construct a Data Fact Knowledge Graph (DFKG) to uniformly map different types of user queries to operations on the graph. Combined with Retrieval Augmentation Generation (RAG) technology, we use a pre-trained large language model to perform semantic parsing and graph operations to generate interactive visualization charts and natural language explanations.

Benefits of technology

It achieves unified processing of multiple query intents, improves the accuracy and reliability of question answering, avoids model generation illusions, and meets the application needs of rigorous scenarios such as finance and healthcare.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121958477A_ABST
    Figure CN121958477A_ABST
Patent Text Reader

Abstract

A table data question and answer method based on a data fact knowledge graph acquires original table data to be analyzed, automatically extracts data facts, and constructs a knowledge graph containing data fact nodes and semantic relationships thereof; a large language model is used to perform semantic analysis on a natural language query of a user, identify a query intent type, and extract corresponding structured intent elements; the natural language query is mapped to an executable graph operation sequence for the knowledge graph according to the query intent, operations are performed on the graph to retrieve or dynamically generate target data facts and semantic edges thereof; and a data fact obtained is input into a generative large language model as an enhanced context to generate an answer containing a visual chart and a text description. A table data question and answer system based on a data fact knowledge graph is also provided. The present application effectively suppresses hallucinations of a large model by using structured knowledge constraints, and improves the accuracy of question and answer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of data processing, artificial intelligence and information visualization technology, and specifically relates to a tabular data question-answering method and system based on data fact knowledge graph. Background Technology

[0002] With the rapid development of big data and artificial intelligence technologies, tabular data, as a core carrier of information storage and exchange, contains immense value for analysis. Visual Question Answering (VQA) technology allows users to directly obtain pattern information contained in data through natural language queries, and has become an important tool for tabular data analysis and understanding. However, existing tabular data VQA systems typically adopt a "one-size-fits-all" design paradigm, building independent processing pipelines for different types of queries (such as targeted queries, retrieval queries, and data story queries). For example, targeted queries usually rely on predefined visualization task classification methods, retrieval queries rely on pre-built pattern libraries, and data story queries require complex narrative logic generation modules. This fragmented technical architecture leads to poor system versatility, difficulty in collaboration between different functional modules, and users often need to switch between different tools or interfaces when performing complex cross-type analyses, severely impacting analysis efficiency and user experience.

[0003] Furthermore, existing VQA methods are mostly based on large language models (LLMs) to build end-to-end semantic parsing and answer generation frameworks. While LLMs excel in natural language understanding and logical reasoning, their fundamentally probabilistic prediction mechanism has limitations when dealing with highly precise tabular data. Therefore, relying solely on prompting engineering to drive large models to directly generate answers can easily lead to "hallucinations." For example, when dealing with complex numerical aggregation, logical reasoning, or trend analysis involving multiple rows and columns, the model may fabricate non-existent data fields, generate incorrect calculation results, or provide interpretations detached from the actual context of the data. This generation method, lacking deterministic knowledge constraints, makes it difficult to meet the reliability requirements of rigorous application scenarios such as finance, healthcare, or industrial statistics.

[0004] In summary, existing tabular data question answering technologies are limited by the traditional paradigm of single-task and fragmented architecture, making it difficult to meet diverse analytical needs. Furthermore, emerging large-scale modeling technologies, lacking external knowledge anchors, struggle to guarantee the accuracy of data facts and the rigor of logic. Therefore, how to construct a tabular data question answering method that can uniformly accommodate multiple query intents while effectively constraining the generation behavior of large-scale models through external knowledge bases, thereby suppressing illusions and improving answer accuracy, is a pressing technical problem that needs to be solved in this field. Summary of the Invention

[0005] To address the aforementioned technical problems, this invention provides a tabular data question-answering method and system based on a Data Fact Knowledge Graph (DFKG). By constructing a knowledge graph containing data facts and their semantic relationships, different types of user queries are uniformly mapped to operations on the graph. Furthermore, it combines Retrieval Enhancement Generation (RAG) technology to support the generation of answers for multiple query tasks.

[0006] The technical solution of this invention is as follows:

[0007] A tabular data question-answering method based on a data fact knowledge graph, the method comprising the following steps:

[0008] S1. Data Fact Knowledge Graph Construction Steps: Obtain the original tabular data to be analyzed, automatically extract multiple data facts through multi-granularity slicing and attribute combination enumeration, and construct a DFKG based on the logical semantic relationship between the data facts; the DFKG includes a set of data fact nodes and a set of semantic relationship edges connecting the data fact nodes;

[0009] S2. Query Intent Semantic Parsing Step: Receive the user's natural language query input, use a pre-trained large language model to perform semantic parsing on the natural language query, identify the user's query intent type, and extract the structured intent elements corresponding to the query intent type; the query intent type at least covers targeted queries, retrieval queries, and data storytelling queries;

[0010] S3. Graph Operation Mapping and Execution Steps: Based on the identified query intent type and structured intent elements, map the user's natural language query into a set of executable graph operation sequences for the DFKG; execute the graph operation sequences on the data fact knowledge graph to retrieve or dynamically generate target data fact nodes and semantic edges that match the query intent;

[0011] S4. Context-enhanced answer generation step: Based on the Graph Retrieval Enhanced Generation (GraphRAG) mechanism, the target data fact nodes and semantic edge set obtained in step S3 are used as enhanced context and input together with the natural language query and the preset answer instruction into the generative large language model to generate the final answer containing interactive visualization charts and natural language explanations.

[0012] Furthermore, in step S1, the construction process of the data fact node is as follows:

[0013] S1-1. Data Subset Spatial Partitioning: A top-down slicing strategy is adopted for the original tabular data. By applying filtering conditions to the categorical or temporal attributes, multiple data subsets with different granularities are generated.

[0014] S1-2. Multidimensional attribute combination enumeration: For each data subset, traverse the combinations of its included attributes and identify potential data facts according to a preset analysis task classification method; the analysis task classification method includes at least distribution, correlation, trend, proportion and aggregation.

[0015] S1-3. Data Fact Instantiation and Metadata Encapsulation: Instantiate each identified potential data fact to generate a data fact node F containing a metadata 7-tuple; the metadata 7-tuple is defined as:

[0016] F={type,obv_attrs,subset,score,vis,text,vector};

[0017] Where, tupe represents the data fact analysis task type; obv_attrs represents the set of observation attributes involved in the analysis; subset represents the data subset filtering conditions on which the fact is based; score represents the comprehensive interest score of the fact; vis represents the chart specification code generated based on the visualization syntax; text represents the natural language description text of the fact; and vector represents the semantic vector embedding generated based on the natural language description text.

[0018] The data fact text descriptions are generated from a large model using a cueing engineering approach. The semantic vector embeddings are calculated using the Qwen series of language models with an embedding dimension of 4096. The visualization specifications (vis) adopt the Vega-Lite syntax format and are generated from a predefined visual design template. The comprehensive interest score is calculated using the formula: score(F) = w s ·score s (F)+w i ·score i (F) where score s (f) is the significance score, used to quantify the strength or scarcity of the statistical pattern contained in the data fact, and is calculated using a statistical test function; score i (F) is the influence score, used to quantify the proportion of data records covered by the data fact in the original table data. The calculation formula is the number of data rows involved in the fact divided by the total number of data rows; w sand w i The weighting coefficients are preset, and w s +w i =1.

[0019] In step S1, the process of constructing the semantic relationship edge includes: traversing the set of data fact nodes and calculating the semantic relationship edge between any two data fact nodes F. i and F j The metadata logical relationships between them are determined, and directed semantic edges are established according to the following rules:

[0020] Comparison relationship: When F i and F j When data subsets have the same analysis task type, set of observed attributes, and visualization specifications, but the subsets are different and the difference stems from different values ​​of the same classification dimension, a comparison relationship edge is established.

[0021] Drill-down / roll-up relationship: When F i and F j They have the same analysis task type and set of observed attributes, but F i The data subset is F j When constructing a proper subset of a subset of data from F j Pointing to F i The drill-down relationship edge and the reverse roll-up relationship edge;

[0022] Encoding conversion relationship: When F i and F j When data have the same subset and set of observed attributes, but are coded using different visualization chart types, establish coding transformation relationship edges;

[0023] Parallel exploration relationship: when F i and F j When the observation attribute sets obv_attrs are different and belong to different semantically parallel dimensions, parallel exploration relationship edges are established when they have the same analysis task type and data subset.

[0024] Focus / Detail Relationship: When F i and F j They have the same analysis task type and data subset, but F i The set of observed attributes contains F j When the set of observed attributes is expanded and additional attribute dimensions are added, a model is built from F. j Pointing to F i Detailed relation edges and reverse focusing relation edges.

[0025] Furthermore, in step S2, the semantic parsing of the natural language query using a pre-trained large language model specifically includes: constructing a prompt template containing task definitions; inputting the user's natural language query and the metadata schema of the original table data into the large language model; requiring the large language model to output parsing results conforming to a predefined JSON format; if the identified query intent type is a targeted query, the structured intent elements include: target fact type, target observation attribute list, and target data subset constraints; if the identified query intent type is a retrieval query, the structured intent elements include: metadata filtering conditions, semantic description text of the target schema, and the expected number of results K; if the identified query intent type is a data narrative query, the structured intent elements include: narrative scope constraints, narrative theme description, and optional narrative anchor point settings.

[0026] Furthermore, in step S3, the graph operation mapping and execution steps for the targeted query include:

[0027] S3-1-1. Exact Match Search: Perform a node index scan in the data fact knowledge graph to attempt to find a data fact node that is completely consistent with the target fact type, target observation attribute list, and target data subset constraints; if the search is successful, return the node directly.

[0028] S3-1-2. Condition Relaxation Strategy: If the S3-1-1 search fails, the constraints of the target data subset, the target observation attribute list, and the target fact type are relaxed in a preset priority order in order to locate the semantically closest parent data fact node.

[0029] S3-1-3. Dynamic Node Generation: Based on the located parent data fact node, a new data fact node is dynamically instantiated by overlaying the constraints that were relaxed and removed in step S3-1-2.

[0030] S3-1-4. Incremental update of the graph: Write the dynamically instantiated new data fact node into the data fact knowledge graph, and establish semantic relationship edges between the new node and existing nodes according to the rules described in claim 4.

[0031] In step S3, the graph operation mapping and execution steps for the retrieval query include:

[0032] S3-2-1. Initial screening of candidate set: Based on the metadata filtering conditions, the nodes in the data fact knowledge graph are subjected to hard constraint filtering to obtain a candidate node set;

[0033] S3-2-2. Vector Semantic Matching: Using the same vector encoding model as when constructing the graph, the semantic description text of the target pattern is converted into a query vector; the cosine similarity between the query vector and the semantic vectors of each node in the candidate node set is calculated.

[0034] S3-2-3. Hybrid ranking calculation: Combine cosine similarity and the comprehensive interest score of the nodes to calculate the weighted ranking score of each candidate node, and select the top 2K nodes as the initial selection set.

[0035] S3-2-4. Re-ranking optimization: The initial selection set is refined by using the Reranker model to score semantic relevance and select the final K target data fact nodes;

[0036] S3-2-5. Dynamic expansion retrieval: If the number of candidate nodes is less than K, the dynamic expansion mechanism of the graph is triggered. After relaxing the slicing conditions to generate new supplementary nodes, the above retrieval process is executed again.

[0037] In step S3, the graph operation mapping and execution steps for the data narrative query include:

[0038] S3-3-1. Narrative Domain Filtering: Based on the narrative scope constraints, a set of potential narrative candidate nodes is delineated in the data fact knowledge graph;

[0039] S3-3-2. Central Anchor Point Election: Calculate the narrative weight of each node in the narrative candidate node set; the narrative weight is obtained by weighting the node's comprehensive interest score and the semantic relevance of the node to the narrative theme description; select the node with the highest narrative weight as the narrative central anchor point;

[0040] S3-3-3. Bidirectional Path Greedy Expansion: Starting from the narrative center anchor point, perform bidirectional traversal along its inbound and outbound directions respectively; in each traversal step, select the node with the highest comprehensive interest score from the adjacent nodes and add it to the narrative path until the preset path length threshold is reached or there are no available adjacent nodes.

[0041] S3-3-4. Narrative Sequence Generation: Combine the node sequences obtained from traversal in logical order to form a data narrative path containing the logic of introduction, development, transition and conclusion.

[0042] In step S4, based on the Graph Retrieval Enhanced Generation (GraphRAG) mechanism, the target data fact nodes and semantic edge set obtained in step S3 are used as the enhanced context and input together with the natural language query and the preset answer instruction into the generative large language model to generate the final answer containing interactive visualization charts and natural language explanations.

[0043] The large language model is the Qwen series model, and the semantic vector embedding dimension in the data fact knowledge graph is 4096 dimensions; the visualization specification adopts the Vega-Lite syntax format.

[0044] A tabular data question-answering system based on a data fact knowledge graph, the system comprising:

[0045] The data processing and graph construction module is configured to perform data fact extraction and graph construction operations, and generate and store data fact knowledge graphs.

[0046] The intent recognition and parsing module is configured to load large language models, receive user queries, and perform intent parsing operations.

[0047] The graph manipulation and inference engine is configured to receive parsed intent elements, perform targeted lookups, semantic retrieval and path traversal operations, and maintain dynamic updates of the graph.

[0048] The generative response synthesis module is configured to receive node data and context returned by graph operations, and generate the final graph-text response by calling a large language model through the Prompt project.

[0049] Compared with existing technologies, this invention has the following advantages: By constructing a Data Fact Knowledge Graph (DFKG) as an intermediate layer, this invention unifies heterogeneous tasks such as targeted queries, retrieval queries, and data narrative queries into standardized operations (such as search, retrieval, and traversal) on the graph. This design breaks the traditional limitation of "one type of problem, one type of strategy," enabling a single system to seamlessly handle multiple analytical needs and easily extend new query types by defining new graph operations. This invention combines Graph Retrieval Enhanced Generation (GraphRAG) technology, utilizing validated structured data facts in the DFKG as hard-constraint context input to a large language model. This confines the model's reasoning process to reliable data facts, avoiding problems such as fabricated data or erroneous calculations, and improving the authenticity and credibility of the answers. Attached Figure Description

[0050] Figure 1 A schematic diagram of the overall process architecture of a tabular data question-answering method based on data fact knowledge graph provided by the present invention;

[0051] Figure 2 This is an example diagram showing the question-and-answer results generated by the present invention for different types of queries in specific application scenarios. Detailed Implementation Plan

[0052] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the following embodiments are only for illustrating the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention. The technical solutions of the present invention can be appropriately adjusted and improved according to actual application scenarios.

[0053] Reference Figure 1 and Figure 2 This paper presents a tabular data question-answering method based on a data fact knowledge graph. This method is applicable to processing various tabular data. It automatically constructs a DFKG (Data Fact Knowledge Graph) and utilizes LLM (Low-Level Modeling) and GraphRAG technologies to achieve unified processing of targeted queries, retrieval queries, and data narrative queries. The following uses a global internet user dataset (attributes include country, year, cellular subscription rate, percentage of internet users, number of internet users, broadband subscription rate, and region) as an example to detail the specific implementation process of each step. The detailed implementation process of each step is as follows:

[0054] The method includes the following steps:

[0055] S1. Data Fact Knowledge Graph Construction Steps: Obtain the original tabular data to be analyzed, automatically extract multiple data facts through multi-granularity slicing and attribute combination enumeration, and construct a DFKG based on the logical semantic relationship between the data facts; the DFKG includes a set of data fact nodes and a set of semantic relationship edges connecting the data fact nodes;

[0056] In step S1, the construction process of the data fact node is as follows:

[0057] S1-1. Data Subset Spatial Partitioning: A top-down slicing strategy is adopted to partition the original tabular data at multiple granularities. Filtering conditions are limited to categorical attributes (such as region) and temporal attributes (such as year), and a maximum of two filtering conditions are applied to each slice to avoid combinatorial explosion and excessive computational overhead. For example, for the global internet user dataset, a global subset (without filtering) is first generated; then a single filtering condition is added, such as "Region = Asia" to generate the Asia subset; then a double filtering condition is added, such as "Region = Asia AND Year = 2020" to generate the 2020 Asia subset. Finally, multiple subsets are generated, such as the global subset, regional subsets (Asia, Europe, etc.), and temporal subsets (specific years).

[0058] S1-2. Multidimensional Attribute Combination Enumeration: For each data subset, iterate through attribute combinations (up to three attributes) and identify potential data facts based on a pre-defined analysis task classification method. Classification methods include Distribution, Correlation, Trend, Proportion, and Aggregation. For example, in the global subset, enumerating the combination of "Year" and "Cellular Subscription Rate" identifies it as a trend fact. In the Asian subset, enumerating the two attributes "Cellular Subscription Rate" and "Broadband Subscription Rate" identifies them as correlated facts.

[0059] S1-3. Data Fact Instantiation and Metadata Encapsulation: Instantiate each identified potential data fact to generate a data fact node F containing a metadata 7-tuple; the metadata 7-tuple is defined as:

[0060] F={type,obv_attrs,subset,score,vis,text,vector};

[0061] Wherein, `tupe` represents the analysis task type of the data fact, such as `Trend`; `obv_sttrs` represents the set of observed attributes involved in the analysis, such as `["cellular subscription rate", "year"]`; `subset` represents the data subset filtering condition on which the fact is based, such as `[{"region":"Asia"}]`; `score` represents the overall interest score of the fact; `vis` represents the visualization specification of the data fact, generated using the Vega-Lite syntax template, for example, a trend fact is mapped as a line graph, with the x-axis representing "year" and the y-axis representing "cellular subscription rate"; `text` represents the natural language description text of the fact, generated through prompting engineering methods, for example, "...global cellular subscription rate showed a stable upward trend from 2008 to 2020..."; `vector` represents the semantic vector embedding generated based on the natural language description text. The semantic vector embedding `vector` is calculated using the Qwen series model with an embedding dimension of 4096 dimensions; the formula for calculating the overall interest score `score` is: `score(F) = w`. s ·score s (F)+w i ·score i (F) where score s (F) is the significance score, used to quantify the strength or scarcity of the statistical pattern contained in the data fact, and is calculated using a statistical test function; score i (F) is the influence score, used to quantify the proportion of data records covered by the data fact in the original table data. The calculation formula is the number of data rows involved in the fact divided by the total number of data rows; ws and w i The weighting coefficients are preset, and w s +w i =1.

[0062] In step S1, the process of constructing the semantic relationship edge includes: traversing the set of data fact nodes and calculating the semantic relationship edge between any two data fact nodes F. i and F j The metadata logical relationships between them are determined, and directed semantic edges are established according to the following rules:

[0063] Comparison relationship: When F i and F j When data sets have the same analysis task type (type) and observation attribute set (obv_attrs), but different data subsets (subset), and this difference stems from different values ​​of the same classification dimension (e.g., "region = Asia" vs. "region = Europe"), establish a comparison relationship edge.

[0064] Drill-down / roll-up relationship: When F i and F j They have the same analysis task type (type) and observation attribute set (obv_attrs), but F i The data subset is F j When constructing a proper subset of a subset of data from F j Pointing to F i Drill-down relationships and reverse roll-up relationships; for example, a drill-down from a global trend fact to an Asian trend fact.

[0065] Encoding conversion relationship: When F i and F j When data subsets and observation attribute sets obv_attrs have the same data subset and observation attribute set, but are encoded using different visualization chart types (such as bar chart to pie chart), establish encoding transformation relationship edges;

[0066] Parallel exploration relationship: when F i and F j When the observation attribute sets obv_attrs are different and belong to different semantically parallel dimensions, but have the same analysis task type and data subset, such as the observation attribute "cellular subscription rate" being replaced by "broadband subscription rate", a parallel exploration relationship edge is established.

[0067] Focus / Detail Relationship: When F i and F j They have the same analysis task type and data subset, but F i The set of observed attributes contains F jWhen the set of observed attributes is expanded and additional attribute dimensions are added, a model is built from F. j Pointing to F i Detailed relation edges and reverse focusing relation edges.

[0068] S2. Query Intent Semantic Parsing Step: Receive the user's natural language query input, use a pre-trained large language model to perform semantic parsing on the natural language query, identify the user's query intent type, and extract the structured intent elements corresponding to the query intent type; the query intent type at least covers targeted queries, retrieval queries, and data storytelling queries;

[0069] In step S2, the semantic parsing of the natural language query using a pre-trained large language model specifically includes: constructing a prompt template containing task definitions; inputting the user's natural language query and the metadata schema of the original table data into the large language model; requiring the large language model to output parsing results conforming to a predefined JSON format; if the identified query intent type is a targeted query, the structured intent elements include: target fact type, target observation attribute list, and target data subset constraints; if the identified query intent type is a retrieval query, the structured intent elements include: metadata filtering conditions, semantic description text of the target schema, and the expected number of results K; if the identified query intent type is a data narrative query, the structured intent elements include: narrative scope constraints, narrative theme description, and optional narrative anchor point settings. For example, a user query "Please show the distribution of cellular subscription rates in various European countries." is parsed as: {"query_task":"Targeted Query","type":"Distribution","obv_attrs":["cellular subscription rate","country"],"subset":[{"region":"Europe"}]}.

[0070] S3. Graph Operation Mapping and Execution Steps: Based on the identified query intent type and structured intent elements, map the user's natural language query into a set of executable graph operation sequences for the DFKG; execute the graph operation sequences on the data fact knowledge graph to retrieve or dynamically generate target data fact nodes and semantic edges that match the query intent;

[0071] In step S3, the graph operation mapping and execution steps for the targeted query include:

[0072] S3-1-1. Exact Match Search: Perform a node index scan in the data fact knowledge graph to attempt to find a data fact node that is completely consistent with the target fact type, target observation attribute list, and target data subset constraints; if the search is successful, return the node directly.

[0073] S3-1-2. Condition Relaxation Strategy: If the S3-1-1 search fails, the constraints of the target data subset, the target observation attribute list, and the target fact type are relaxed in a preset priority order in order to locate the semantically closest parent data fact node.

[0074] S3-1-3. Dynamic Node Generation: Based on the located parent data fact node, a new data fact node is dynamically instantiated by overlaying the constraints that were relaxed and removed in step S3-1-2.

[0075] S3-1-4. Incremental update of the graph: Write the dynamically instantiated new data fact node into the data fact knowledge graph, and establish semantic relationship edges between the new node and existing nodes according to the rules described in claim 4.

[0076] For example, if a query for "distribution of cellular subscription rates in European countries" is not found, the data subset constraint is first relaxed to "distribution of cellular subscription rates in countries around the world". Then, other constraints are relaxed iteratively until a valid matching data is obtained.

[0077] In step S3, the graph operation mapping and execution steps for the retrieval query include:

[0078] S3-2-1. Initial screening of candidate set: Based on the metadata filtering conditions, the nodes in the data fact knowledge graph are subjected to hard constraint filtering to obtain a candidate node set;

[0079] S3-2-2. Vector Semantic Matching: Using the same vector encoding model as when constructing the graph, the semantic description text of the target pattern is converted into a query vector; the cosine similarity between the query vector and the semantic vectors of each node in the candidate node set is calculated.

[0080] S3-2-3. Hybrid ranking calculation: Combine cosine similarity and the comprehensive interest score of the nodes to calculate the weighted ranking score of each candidate node, and select the top 2K nodes as the initial selection set.

[0081] S3-2-4. Re-ranking optimization: The initial selection set is refined by using the Reranker model to score semantic relevance and select the final K target data fact nodes;

[0082] S3-2-5. Dynamic expansion retrieval: If the number of candidate nodes is less than K, the dynamic expansion mechanism of the graph is triggered. After relaxing the slicing conditions to generate new supplementary nodes, the above retrieval process is executed again.

[0083] For example, the query "find 4 data patterns showing an upward trend" will retrieve and return 4 trend nodes (such as the upward trend of global cellular subscription rates).

[0084] In step S3, the graph operation mapping and execution steps for the data narrative query include:

[0085] S3-3-1. Narrative Domain Filtering: Based on the narrative scope constraints, a set of potential narrative candidate nodes is delineated in the data fact knowledge graph;

[0086] S3-3-2. Central Anchor Point Election: Calculate the narrative weight of each node in the narrative candidate node set; the narrative weight is obtained by weighting the node's comprehensive interest score and the semantic relevance of the node to the narrative theme description; select the node with the highest narrative weight as the narrative central anchor point;

[0087] S3-3-3. Bidirectional Path Greedy Expansion: Starting from the narrative center anchor point, perform bidirectional traversal along its inbound and outbound directions respectively; in each traversal step, select the node with the highest comprehensive interest score from the adjacent nodes and add it to the narrative path until the preset path length threshold is reached or there are no available adjacent nodes.

[0088] S3-3-4. Narrative Sequence Generation: Combine the node sequences obtained from traversal in logical order to form a data narrative path containing the logic of introduction, development, transition and conclusion.

[0089] For example, for the query "data stories about Asian countries", the system generates a factual narrative path: first focusing on the global distribution of cellular subscriptions, then drilling down from macro global trends to regional trends in Asia, and then further expanding in parallel to the dimension of broadband subscription rates.

[0090] S4. Context-enhanced answer generation step: Based on the Graph Retrieval Enhanced Generation (GraphRAG) mechanism, the target data fact nodes and semantic edge set obtained in step S3 are used as enhanced context and input together with the natural language query and the preset answer instruction into the generative large language model to generate the final answer containing interactive visualization charts and natural language explanations.

[0091] In step S4, based on the Graph Retrieval Enhanced Generation (GraphRAG) mechanism, the target data fact nodes and semantic edge set obtained in step S3 are used as enhanced context. This context, along with the natural language query and preset answer instructions, is input into the generative large language model to generate a final answer containing interactive visualizations and natural language explanations. The instructions include role definitions (e.g., "professional data analyst") and step-by-step guidance (e.g., "step 1: analyze the problem; step 2: reason step by step; step 3: answer generation and explanation"). The context acts as a hard constraint, reducing illusions.

[0092] This embodiment also provides a tabular data question-answering system based on a data fact knowledge graph, the system comprising:

[0093] The data processing and graph construction module is configured to perform data fact extraction and graph construction operations, and generate and store data fact knowledge graphs.

[0094] The intent recognition and parsing module is configured to load large language models, receive user queries, and perform intent parsing operations.

[0095] The graph manipulation and inference engine is configured to receive parsed intent elements, perform targeted lookups, semantic retrieval and path traversal operations, and maintain dynamic updates of the graph.

[0096] The generative response synthesis module is configured to receive node data and context returned by graph operations, and generate the final graph-text response by calling a large language model through the Prompt project.

[0097] like Figure 2 As shown, this embodiment demonstrates the specific application process and effects of the method of the present invention in processing a "sleep health and lifestyle dataset". The dataset contains attribute fields across multiple dimensions, including gender, age, occupation, sleep duration, and stress level. In this embodiment, diverse query requests (covering targeted queries, retrieval queries, and data narrative queries) are addressed for users submitting this dataset. Figure 2 The invention demonstrates the final answer generated by the method for the aforementioned query, which includes a visual chart matching the query intent and corresponding natural language explanation text. In this process, the method utilizes structured knowledge provided by DFKG as an enhanced context to constrain the reasoning process of the generative large language model. Compared to unconstrained direct generation using the large language model, the method of this invention can generate more accurate, complete, and user-satisfying answers. By constructing a unified multi-task question-answering framework based on DFKG, this invention provides a tabular data question-answering solution that combines high reliability, strong scalability, and multi-task support capabilities.

[0098] The embodiments described in this specification are merely examples of implementations of the inventive concept and are for illustrative purposes only. The scope of protection of this invention should not be considered limited to the specific forms described in these embodiments; rather, it extends to equivalent technical means conceived by those skilled in the art based on the inventive concept.

Claims

1. A tabular data question-answering method based on a data fact knowledge graph, characterized in that, The method includes the following steps: S1. Data Fact Knowledge Graph Construction Steps: Obtain the original table data to be analyzed, automatically extract multiple data facts through multi-granularity slicing and attribute combination enumeration, and construct a DFKG based on the logical semantic relationship between the data facts; the DFKG includes a set of data fact nodes and a set of semantic relationship edges connecting the data fact nodes. S2, Query Intent Semantic Parsing Step: Receive the user's natural language query input, use a pre-trained large language model to perform semantic parsing on the natural language query, identify the user's query intent type, and extract the structured intent elements corresponding to the query intent type; the query intent type at least covers targeted queries, retrieval queries, and data narrative queries; S3. Graph Operation Mapping and Execution Steps: Based on the identified query intent type and structured intent elements, map the user's natural language query into a set of executable graph operation sequences for the DFKG; execute the graph operation sequences on the data fact knowledge graph to retrieve or dynamically generate target data fact nodes and semantic edges that match the query intent; S4. Context-enhanced answer generation step: Based on the graph retrieval enhancement generation mechanism, the target data fact nodes and semantic edge set obtained in step S3 are used as enhanced context, and input together with the natural language query and the preset answer instruction into the generative large language model to generate the final answer containing interactive visualization charts and natural language explanations.

2. The tabular data question-answering method based on data fact knowledge graph as described in claim 1, characterized in that, In step S1, the construction process of the data fact node is as follows: S1-1. Data Subset Spatial Partitioning: A top-down slicing strategy is adopted for the original tabular data. By applying filtering conditions to the categorical or temporal attributes, multiple data subsets with different granularities are generated. S1-2. Multidimensional attribute combination enumeration: For each data subset, traverse the combinations of its included attributes, and identify potential data facts according to a preset analysis task classification method; the analysis task classification method includes at least distribution, correlation, trend, proportion and aggregation; S1-3. Data Fact Instantiation and Metadata Encapsulation: Instantiate each identified potential data fact to generate a data fact node F containing a 7-tuple of metadata.

3. The tabular data question-answering method based on data fact knowledge graph as described in claim 2, characterized in that, The formula for calculating the comprehensive interest score $score$ is: score(F) = w s ·score s (F)+w i ·score i (F) where score s (F) is the significance score, used to quantify the strength or scarcity of the statistical pattern contained in the data fact, and is calculated using a statistical test function; score i (F) is the influence score, used to quantify the proportion of data records covered by the data fact in the original table data. The calculation formula is the number of data rows involved in the fact divided by the total number of data rows; w s and w i The weighting coefficients are preset, and w s +w i =1.

4. The tabular data question-answering method based on data fact knowledge graphs as described in any one of claims 1 to 3, characterized in that, In step S1, the process of constructing the semantic relationship edge includes traversing the set of data fact nodes and calculating any two data fact nodes F. i and F j The metadata logical relationships between them are determined, and directed semantic edges are established according to the following rules: Comparison relationship: When F i and F j When data subsets have the same analysis task type, set of observed attributes, and visualization specifications, but the subsets are different and the difference stems from different values ​​of the same classification dimension, a comparison relationship edge is established. Drill-down / roll-up relationship: When F i and F j They have the same analysis task type and set of observed attributes, but F i The data subset is F j When constructing a proper subset of a subset of data from F j Pointing to F i The drill-down relationship edge and the reverse roll-up relationship edge; Encoding conversion relationship: When F i and F j When data have the same subset and set of observed attributes, but are coded using different visualization chart types, establish coding transformation relationship edges; Parallel exploration relationship: when F i and F j When the observation attribute sets obv_attrs are different and belong to different semantically parallel dimensions, parallel exploration relationship edges are established when they have the same analysis task type and data subset. Focus / Detail Relationship: When F i and F j They have the same analysis task type and data subset, but F i The set of observed attributes contains F j When the set of observed attributes is expanded and additional attribute dimensions are added, a model is built from F. j Pointing to F i Detailed relation edges and reverse focusing relation edges.

5. The tabular data question-answering method based on data fact knowledge graphs as described in any one of claims 1 to 3, characterized in that, In step S2, the semantic parsing of the natural language query using a pre-trained large language model specifically includes: constructing a prompt word template containing task definitions; inputting the user's natural language query and the metadata pattern of the original table data into the large language model; requiring the large language model to output parsing results conforming to a predefined JSON format; if the identified query intent type is a targeted query, the structured intent elements include: target fact type, target observation attribute list, and target data subset constraints; if the identified query intent type is a retrieval query, the structured intent elements include: metadata filtering conditions, semantic description text of the target pattern, and the expected number of results K; if the identified query intent type is a data narrative query, the structured intent elements include: narrative scope constraints, narrative theme description, and optional narrative anchor point settings.

6. The tabular data question-answering method based on data fact knowledge graph as described in claim 5, characterized in that, In step S3, the graph operation mapping and execution steps for the targeted query include: S3-1-1. Exact Match Search: Perform a node index scan in the data fact knowledge graph to attempt to find a data fact node that is completely consistent with the target fact type, target observation attribute list, and target data subset constraints; if the search is successful, return the node directly. S3-1-2. Condition Relaxation Strategy: If the S3-1-1 search fails, the constraints of the target data subset, the target observation attribute list, and the target fact type are relaxed in a preset priority order in order to locate the semantically closest parent data fact node. S3-1-3. Dynamic Node Generation: Based on the located parent data fact node, a new data fact node is dynamically instantiated by overlaying the constraints that were relaxed and removed in step S3-1-2. S3-1-4. Incremental update of the graph: Write the dynamically instantiated new data fact node into the data fact knowledge graph, and establish semantic relationship edges between the new node and existing nodes according to the rules described in claim 4.

7. The tabular data question-answering method based on data fact knowledge graph as described in claim 5, characterized in that, In step S3, the graph operation mapping and execution steps for the retrieval query include: S3-2-1. Initial screening of candidate set: Based on the metadata filtering conditions, the nodes in the data fact knowledge graph are subjected to hard constraint filtering to obtain a candidate node set; S3-2-2. Vector Semantic Matching: Using the same vector encoding model as when constructing the graph, the semantic description text of the target pattern is converted into a query vector; the cosine similarity between the query vector and the semantic vectors of each node in the candidate node set is calculated. S3-2-3. Hybrid ranking calculation: Combine cosine similarity and the comprehensive interest score of the nodes to calculate the weighted ranking score of each candidate node, and select the top 2K nodes as the initial selection set. S3-2-4. Reordering Optimization: The reordering model is used to perform refined semantic relevance scoring on the initial selection set, and the final K target data fact nodes are selected; S3-2-5. Dynamic Expansion Retrieval: If the number of candidate nodes is less than K, the dynamic expansion mechanism of the graph is triggered, the slicing conditions are relaxed to generate new supplementary nodes, and the above retrieval process is executed again.

8. The tabular data question-answering method based on data fact knowledge graph as described in claim 5, characterized in that, In step S3, the graph operation mapping and execution steps for the data narrative query include: S3-3-1. Narrative Domain Filtering: Based on the narrative scope constraints, a set of potential narrative candidate nodes is delineated in the data fact knowledge graph; S3-3-2. Central Anchor Point Election: Calculate the narrative weight of each node in the narrative candidate node set; the narrative weight is obtained by weighting the node's comprehensive interest score and the semantic relevance of the node to the narrative theme description; select the node with the highest narrative weight as the narrative central anchor point; S3-3-3. Bidirectional Path Greedy Expansion: Starting from the narrative center anchor point, perform bidirectional traversal along its inbound and outbound directions respectively; in each traversal step, select the node with the highest comprehensive interest score from the adjacent nodes and add it to the narrative path until the preset path length threshold is reached or there are no available adjacent nodes. S3-3-4. Narrative Sequence Generation: Combine the node sequences obtained from traversal in logical order to form a data narrative path containing the logic of introduction, development, transition and conclusion.

9. The tabular data question-answering method based on data fact knowledge graphs as described in any one of claims 1 to 3, characterized in that, The large language model is the Qwen series model, and the semantic vector embedding dimension in the data fact knowledge graph is 4096 dimensions; the visualization specification adopts the Vega-Lite syntax format.

10. A system implementing the tabular data question-answering method based on data fact knowledge graph as described in claim 1, characterized in that, The system includes: The data processing and graph construction module is configured to perform data fact extraction and graph construction operations, and generate and store data fact knowledge graphs. The intent recognition and parsing module is configured to load large language models, receive user queries, and perform intent parsing operations. The graph manipulation and inference engine is configured to receive parsed intent elements, perform targeted lookups, semantic retrieval and path traversal operations, and maintain dynamic updates of the graph. The generative response synthesis module is configured to receive node data and context returned by graph operations, and generate the final graph-text response by calling a large language model through the Prompt project.