Inter-table relation recommendation method and system based on large language model and knowledge graph
By employing a collaborative approach combining large language models and knowledge graphs, a multi-dimensional scoring mechanism was established. This addressed the issues of data silos and insufficient intelligence in enterprise digital auditing, enabling rapid and accurate recommendation of data table association paths, thereby improving audit efficiency and result reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BANK OF SHANGHAI
- Filing Date
- 2026-01-21
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies in enterprise digital auditing suffer from problems such as data silos, insufficient flexibility in data analysis, strong reliance on audit experience, and insufficient intelligence, resulting in low efficiency in data association and unreliable results.
By employing a collaborative approach combining large language models and knowledge graphs, and by setting up a multi-dimensional scoring mechanism, including entity-table matching degree, coverage score, and path integrity score, and combining it with data service module, intent matching module, and path recommendation module, we can quickly and accurately recommend data table association paths.
It enables fast and accurate recommendation of optimal data table association paths, improves data association efficiency, ensures the business accuracy and reliability of recommendation results, and reduces the illusion problem of large models.
Smart Images

Figure CN121561114B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of table relationship recommendation technology, and in particular to a method and system for recommending table relationships through the collaboration of large language models and knowledge graphs. Background Technology
[0002] As enterprise digital transformation continues to deepen, massive amounts of data are accumulating in various business systems, fundamentally altering the data foundation for internal audit functions. Traditional audit data analysis methods, reliant on experience and manual verification, show significant shortcomings when faced with massive, complex, and hidden data sets, encountering challenges of being "invisible, incomprehensible, and incomplete." Currently, although auditors have begun using digital tools, the following significant bottlenecks remain at the core "digital intelligence" level:
[0003] Data silos and hidden relationships: Data is scattered across various business systems, and the logical relationships between tables are unclear;
[0004] Insufficient flexibility in data analysis: When faced with sudden risks and suspicious points, auditors spend a lot of time and effort constructing complex multi-table join queries for targeted investigation, resulting in low efficiency;
[0005] Audit experience is highly dependent: the correlation of anomalies is highly dependent on the experience of auditors, and the training period for new employees is long;
[0006] Existing technical solutions lack intelligence: they mostly rely on a single technical path; rule-based methods have poor scalability and high maintenance costs; pure large language models generate results with serious "illusions" and low reliability; traditional graph query methods have complex interactions and high barriers to entry.
[0007] Therefore, it is necessary to provide a method and system for recommending inter-table relationships through collaboration between large language models and knowledge graphs, and to set up a multi-dimensional scoring mechanism, such as entity-table matching degree, coverage score, and path integrity score, to ensure that the recommendation results have business accuracy and reliability, and effectively constrain the illusion problem of large models. Summary of the Invention
[0008] The purpose of this invention is to provide a method and system for recommending inter-table relationships through collaboration between large language models and knowledge graphs. It sets up a multi-dimensional scoring mechanism, using entity-table matching degree, coverage score, and path integrity score to ensure that the recommendation results have business accuracy and reliability, and effectively constrain the illusion problem of large models.
[0009] To address the problems existing in the prior art, this invention provides a method for recommending inter-table relationships through collaboration between a large language model and a knowledge graph, comprising the following steps:
[0010] S1: Set up a data service module to provide data support for large-scale model semantic analysis and knowledge graph construction. The data service module includes a domain knowledge base and a business semantic enhancement knowledge graph.
[0011] S2: Set up the intent matching module to parse semantic entities in the user query and map the semantic entities to the candidate table in the domain knowledge base based on a multi-dimensional scoring mechanism;
[0012] S3: Set up a path recommendation module, which traverses the graph based on the candidate table in S2 and recommends related paths to users in combination with the path scoring mechanism.
[0013] Optionally, in the method for recommending inter-table relationships through the collaboration of large language models and knowledge graphs, providing data support includes the following steps:
[0014] S11: Multi-source relation extraction:
[0015] Historical business model analysis: This involves analyzing operations containing keywords in the historical audit model, specifically JOIN and UNION, and extracting valid inter-table relationships that have been validated by audit practice.
[0016] Database metadata collection, extracting physical foreign key relationships from database tables;
[0017] Data dictionary parsing to obtain table usage descriptions and key field functions;
[0018] S12: Multi-source relation cleaning:
[0019] The raw relationships extracted from all data sources are cleaned and standardized, including:
[0020] Multi-source deduplication merges identical table associations from different sources;
[0021] Standardize naming conventions to unify aliases and abbreviations for table and field names across different sources;
[0022] Relationship type annotation: clearly indicate the type of each association, including physical foreign key associations and business logic associations.
[0023] Optionally, in the inter-table relationship recommendation method that combines a large language model and a knowledge graph, the business semantic enhancement knowledge graph has the following characteristics:
[0024] Enhanced table functionality descriptions: Natural language descriptions are added to each table to clarify its core role in the business system.
[0025] Key field identifiers and function descriptions: Clearly identify the related fields used for table joins and explain their related objects. Key fields include customer number.
[0026] Construct a business semantic network that integrates tables, fields, relationships, and descriptions into a graph structure to form a graph.
[0027] It leverages a graph database engine to achieve storage, indexing, and high-performance traversal queries.
[0028] Optionally, in the inter-table relationship recommendation method that combines a large language model and a knowledge graph, semantic entities are mapped to candidate tables in the domain knowledge base based on a multi-dimensional scoring mechanism, as follows:
[0029] Extract semantic entity sets from natural language queries input by users. For entity e and table T, a five-dimensional matching scoring function is used:
[0030] ;
[0031] in, , , , and As weight, ;
[0032] S21: Calculate the semantic similarity of table names :
[0033] ,
[0034] in, For text embedding functions, a pre-trained language model is used to convert text into a high-dimensional vector representation, T. name For table name, This is the function for calculating cosine similarity.
[0035] S22: Calculate the semantic similarity of the table descriptions :
[0036] ,
[0037] Among them, T desc For table description;
[0038] S23: Calculate field matching degree :
[0039] ,
[0040] Among them, C T This represents the collection of all fields in table T. These are the weighting coefficients.
[0041] Indicator functions:
[0042] ;
[0043] The edit distance similarity function is:
[0044] ;
[0045] in, Edit the distance between entity e and field c. To obtain the maximum value between the absolute value of the length of entity e and the absolute value of the length of field c;
[0046] S24: Calculate structural reinforcement :
[0047] ;
[0048] Where E is the set of entities, this formula is used to check whether the current table T has a foreign key relationship with other tables of identified entities. If a foreign key relationship exists, the score is 1; otherwise, it is 0.
[0049] S25: Calculate entity coverage :
[0050] ;
[0051] Where E is the entity set, and C(T) is the entity set that table T can cover. This formula is used to calculate the coverage ratio of the number of entities that table T can cover to the total number of entities in the query.
[0052] Optionally, in the inter-table relation recommendation method that combines the large language model and knowledge graph, for each entity e in S2, according to The scoring and ranking retains the top-k candidate tables, and the associated paths are queried in the knowledge graph. For each path, a five-dimensional score is applied:
[0053] ;
[0054] in, , , , and As weight, ;
[0055] S31: Calculate path length components :
[0056] ;
[0057] Where k is the path length;
[0058] S32: Calculate the foreign key relationship components :
[0059] ;
[0060] Here, FK is an abbreviation for Foreign Key, meaning a foreign key exists. The value is 1, indicating that there is no foreign key. =0;
[0061] S33: Calculate semantic coherence components :
[0062] ;
[0063] in, This is a text embedding function that uses a pre-trained language model to convert text into a high-dimensional vector representation. Here is the cosine similarity calculation function, where i is the index of the table. and Natural language descriptions representing two adjacent tables;
[0064] S34: Calculate historical feedback components :
[0065] ;
[0066] in, This represents the historical weight of the path, with an initial value of 1.
[0067] The user accepted the recommendation as follows: Users declined recommendations as follows: ;
[0068] S35: Calculate path entity coverage components :
[0069] ;
[0070] in, Let P represent the union of all entities that can be covered by all tables in path P, and E be the set of entities.
[0071] This invention also provides a table-based relation recommendation system that combines a large language model with a knowledge graph, comprising:
[0072] The data service module is configured to provide data support for large-scale model semantic analysis and knowledge graph construction. The data service module includes a domain knowledge base and a business semantic augmented knowledge graph.
[0073] The intent matching module is configured to parse semantic entities in user queries and map semantic entities to candidate tables in the domain knowledge base based on a multi-dimensional scoring mechanism.
[0074] The path recommendation module is configured to traverse the graph based on the candidate table and combine it with a path scoring mechanism to recommend related paths to the user.
[0075] Optionally, in the inter-table relationship recommendation system that integrates a large language model and a knowledge graph, the data service module includes:
[0076] Multi-source relation extraction unit:
[0077] Historical business model analysis: This involves analyzing operations containing keywords in the historical audit model, specifically JOIN and UNION, and extracting valid inter-table relationships that have been validated by audit practice.
[0078] Database metadata collection, extracting physical foreign key relationships from database tables;
[0079] Data dictionary parsing to obtain table usage descriptions and key field functions;
[0080] Multi-source relationship cleaning unit:
[0081] The raw relationships extracted from all data sources are cleaned and standardized, including:
[0082] Multi-source deduplication merges identical table associations from different sources;
[0083] Standardize naming conventions to unify aliases and abbreviations for table and field names across different sources;
[0084] Relationship type annotation: clearly indicate the type of each association, including physical foreign key associations and business logic associations.
[0085] Optionally, in the inter-table relationship recommendation system that integrates the large language model and knowledge graph, the business semantic enhancement knowledge graph has the following characteristics:
[0086] Enhanced table functionality descriptions: Natural language descriptions are added to each table to clarify its core role in the business system.
[0087] Key field identifiers and function descriptions: Clearly identify the related fields used for table joins and explain their related objects. Key fields include customer number.
[0088] Construct a business semantic network that integrates tables, fields, relationships, and descriptions into a graph structure to form a graph.
[0089] It leverages a graph database engine to achieve storage, indexing, and high-performance traversal queries.
[0090] Optionally, in the inter-table relationship recommendation system that integrates a large language model and a knowledge graph, the intent matching module is configured to extract a set of semantic entities for natural language queries input by the user. For entity e and table T, a five-dimensional matching scoring function is used:
[0091] ;
[0092] in, , , , and As weight, ;
[0093] Calculate semantic similarity of table names :
[0094] ,
[0095] in, For text embedding functions, a pre-trained language model is used to convert text into a high-dimensional vector representation, T. name For table name, This is the function for calculating cosine similarity.
[0096] Calculate the semantic similarity of the table descriptions :
[0097] ,
[0098] Among them, T desc For table description;
[0099] Calculate field matching degree :
[0100] ,
[0101] Among them, C T This represents the collection of all fields in table T. These are the weighting coefficients.
[0102] Indicator functions:
[0103] ;
[0104] The edit distance similarity function is:
[0105] ;
[0106] in, Edit the distance between entity e and field c. To obtain the maximum value between the absolute value of the length of entity e and the absolute value of the length of field c;
[0107] Calculate structural reinforcement :
[0108] ;
[0109] Where E is the set of entities, this formula is used to check whether the current table T has a foreign key relationship with other tables of identified entities. If a foreign key relationship exists, the score is 1; otherwise, it is 0.
[0110] Calculate entity coverage :
[0111] ;
[0112] Where E is the entity set, and C(T) is the entity set that table T can cover. This formula is used to calculate the coverage ratio of the number of entities that table T can cover to the total number of entities in the query.
[0113] Optionally, in the inter-table relationship recommendation system that integrates a large language model and a knowledge graph, in the path recommendation module, for each entity e, according to... The scoring and ranking retains the top-k candidate tables, and the associated paths are queried in the knowledge graph. For each path, a five-dimensional score is applied:
[0114] ;
[0115] in, , , , and As weight, ;
[0116] Calculate path length components :
[0117] ;
[0118] Where k is the path length;
[0119] Calculate foreign key relationship components :
[0120] ;
[0121] Here, FK is an abbreviation for Foreign Key, meaning a foreign key exists. The value is 1, indicating that there is no foreign key. =0;
[0122] Calculate semantic coherence components :
[0123] ;
[0124] in, This is a text embedding function that uses a pre-trained language model to convert text into a high-dimensional vector representation. Here is the cosine similarity calculation function, where i is the index of the table. and Natural language descriptions representing two adjacent tables;
[0125] Calculate historical feedback components :
[0126] ;
[0127] in, This represents the historical weight of the path, with an initial value of 1.
[0128] The user accepted the recommendation as follows: Users declined recommendations as follows: ;
[0129] Calculate path entity coverage components :
[0130] ;
[0131] in, Let P represent the union of all entities that can be covered by all tables in path P, and E be the set of entities.
[0132] Compared with the prior art, the present invention has the following advantages:
[0133] (1) This invention proposes a method and system for recommending inter-table relationships by deeply integrating the natural language interaction capabilities of a large language model with the precise reasoning capabilities of a knowledge graph, thereby enabling the rapid, accurate, and automatic recommendation of the optimal data table association path through natural language interaction.
[0134] (2) The present invention sets up a multi-dimensional scoring mechanism, which uses entity-table matching degree, coverage score and path integrity score to ensure that the recommendation results have business accuracy and reliability, and effectively constrain the illusion problem of large models.
[0135] (3) This invention integrates the principles of “most reasonable path first” and “shortest path first”, transforming the professional knowledge of the business domain into a computable model, which shortens the discovery of complex data association paths from several hours to seconds, greatly improving efficiency. Attached Figure Description
[0136] Figure 1 A flowchart illustrating the table relationship recommendation method provided in this embodiment of the invention. Detailed Implementation
[0137] The specific embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. The advantages and features of the present invention will become clearer from the following description. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of the present invention.
[0138] In the following, if the methods described herein include a series of steps, the order of these steps presented herein is not necessarily the only order in which these steps can be performed, and some of the steps described may be omitted and / or some other steps not described herein may be added to the method.
[0139] As enterprise digital transformation continues to deepen, massive amounts of data are accumulating in various business systems, fundamentally altering the data foundation for internal audit functions. Traditional audit data analysis methods, reliant on experience and primarily manual verification, show significant shortcomings when faced with massive, complex, and hidden big data, encountering challenges of being "invisible, incomprehensible, and incomplete." Currently, although auditors have begun using digital tools, many deficiencies remain at the core "digital intelligence" level.
[0140] To address the problems existing in the prior art, this invention provides a method for recommending inter-table relationships through collaboration between a large language model and a knowledge graph. It comprises three core modules: a data service module, an intent matching module, and a path recommendation module, forming a complete technology chain of "data preparation - intent understanding - intelligent recommendation".
[0141] The method for recommending relationships between tables includes the following steps:
[0142] S1: Set up a data service module to provide data support for large-scale model semantic analysis and knowledge graph construction. The data service module includes a domain knowledge base and a business semantic enhancement knowledge graph.
[0143] Providing data support includes the following steps:
[0144] S11: Multi-source relation extraction:
[0145] Historical business model analysis: This involves analyzing operations containing keywords in the historical audit model, specifically JOIN and UNION, and extracting valid inter-table relationships that have been validated by audit practice.
[0146] Database metadata collection, extracting physical foreign key relationships from database tables;
[0147] Data dictionary parsing retrieves semantic information such as table usage descriptions and key field functions;
[0148] S12: Multi-source relation cleaning:
[0149] The raw relationships extracted from all the aforementioned data sources are cleaned and standardized, including:
[0150] Multi-source deduplication merges identical table associations from different sources;
[0151] Standardize naming conventions to unify aliases and abbreviations for table and field names across different sources;
[0152] Relationship type annotation clearly marks the type of each association. Association types include physical foreign key associations (defined by the database system) and business logic associations (where a non-primary foreign key exists in the business logic).
[0153] Business semantic augmented knowledge graphs have the following characteristics:
[0154] The table function descriptions have been enhanced by adding natural language descriptions to each table to clarify its core role in the business system; for example, the description of the fund sales transaction record table is: storing customer fund purchase transaction information.
[0155] Key field identifiers and function descriptions: Clearly identify the related fields used for table joins and explain their related objects. Key fields include customer number; for example, the fund sales transaction record table includes the customer number key field. The customer number is a unique identifier within the fund sales system and is a key foreign key that links the customer channel table and the dual-record information table.
[0156] Construct a business semantic network that integrates elements such as tables, fields, relationships, and descriptions into a graph structure to form a graph; for example, it not only records "table A and table B are related", but also clearly expresses "why they are related, in what business scenarios they are related, and how they are related".
[0157] It leverages a graph database engine to achieve storage, indexing, and high-performance traversal queries.
[0158] S2: As Figure 1 As shown, an intent matching module is set up to receive user natural language queries, parse semantic entities in the user query, and map semantic entities to candidate tables in the domain knowledge base based on a multi-dimensional scoring mechanism.
[0159] Specifically, intent recognition and entity extraction are performed as follows:
[0160] Extract semantic entity sets from natural language queries input by users. For entity e and table T, a five-dimensional matching scoring function is used to score entity-table matching:
[0161] ;
[0162] in, Rate the function. , , , and As weight, ;
[0163] S21: Calculate the semantic similarity of table names :
[0164] ,
[0165] in, For text embedding functions, pre-trained language models (such as BERT, Sentence-BERT) are used to convert text into high-dimensional vector representations, T name For table name, This function calculates cosine similarity, providing a basic scoring basis for entity-table matching.
[0166] S22: Calculate the semantic similarity of the table descriptions :
[0167] ,
[0168] Among them, T desc This component describes the table and, in conjunction with table name similarity, leverages the rich contextual information in the table's functional description to provide semantic verification and supplementation for entity-table matching. It plays a crucial role, especially when table names are not intuitive or there are naming differences, ensuring the system accurately understands user intent and finds the most matching data table.
[0169] S23: Calculate field matching degree :
[0170] ,
[0171] Among them, C T This represents the collection of all fields in table T. These are the weighting coefficients. , ,
[0172] Indicator functions:
[0173] ;
[0174] The edit distance similarity function is:
[0175] ;
[0176] in, Edit the distance between entity e and field c. To obtain the maximum value between the absolute length of entity e and the absolute length of field c; this component is used to implement a dual strategy of exact matching and fuzzy matching, and this field-based micro-matching provides a supplement to entity-table matching.
[0177] S24: Calculate structural reinforcement :
[0178] ;
[0179] Where E is the set of entities, this formula is used to check whether the current table T has a foreign key relationship with other identified entity tables. If a foreign key relationship exists, the score is 1; otherwise, it is 0. By verifying the foreign key relationship between tables, we not only focus on the matching quality of individual tables, but also on the position and relationship of tables in the overall business logic.
[0180] S25: Calculate entity coverage :
[0181] ;
[0182] Where E is the entity set, and C(T) is the entity set that table T can cover. This formula is used to calculate the coverage ratio of the number of entities that table T can cover to the total number of entities in the query. By evaluating the table's ability to cover the overall query intent, it achieves coverage from matching individual entities to the overall query. This coverage-based evaluation strategy ensures that the user's query needs are fully met overall.
[0183] S3: Set up a path recommendation module, using the entities identified in S2 as nodes, traverse the graph based on the candidate table in S2, and combine the path scoring mechanism to recommend related paths to the user.
[0184] Specifically, for each entity e in S2, according to The scoring and ranking process retains the top-k candidate tables, generating a candidate table set to complete knowledge graph path discovery. Each path is based on the entity-table mapping result, using the matched table as a node. Path retrieval is performed in the knowledge graph to generate multi-length candidate paths, forming a candidate path set. Each path is scored across five dimensions, and the path scores are then ranked.
[0185] ;
[0186] in, A comprehensive score for the function of the path. , , , and As weight, ;
[0187] S31: Calculate path length components :
[0188] ;
[0189] Where k is the path length; this component prioritizes the shortest path while avoiding recommending overly complex paths, ensuring the most reasonable path priority principle.
[0190] S32: Calculate the foreign key relationship components :
[0191] ;
[0192] Here, FK is an abbreviation for Foreign Key, meaning a foreign key exists. The value is 1, indicating that there is no foreign key. The value is 0. This component counts the number of foreign key relationships between adjacent tables in path P. This component focuses not only on "whether a connection is possible" but also on "how to connect better," ensuring that the recommended path is logically sound. Through collaboration with other components, the system can recommend path solutions that are both in line with business intent and technically feasible.
[0193] S33: Calculate semantic coherence components :
[0194] ;
[0195] in, For text embedding functions, pre-trained language models (such as BERT and Sentence-BERT) are used to convert text into high-dimensional vector representations. This is a cosine similarity calculation function, providing a basic scoring basis for entity-table matching, where i is the table index. and This component represents the natural language description of two adjacent tables; it obtains an assessment of the overall semantic coherence of the path by taking the arithmetic mean of the sum of the semantic similarities of all adjacent tables in path P.
[0196] S34: Calculate historical feedback components :
[0197] ;
[0198] in, This represents the historical weight of the path, with an initial value of 1.
[0199] The user accepted the recommendation as follows: Users declined recommendations as follows: This component works in conjunction with other components to ensure that the recommendation results are both theoretically optimal and practically validated.
[0200] S35: Calculate path entity coverage components :
[0201] ;
[0202] in, This represents the union of entities covered by all tables in path P, where E is the entity set. This component is used to calculate the coverage ratio of the number of entities covered by all tables in path P to the total number of entities in the query, ensuring that the recommended path can fully cover all user query intents.
[0203] The top-N recommendations are selected based on path scores, and the recommendations are returned.
[0204] S4: Establish a user feedback module to collect user feedback and determine whether the user accepts the recommendation. If the user accepts the recommendation, strengthen the path weight; if the user does not accept the recommendation, reduce the path weight. Update the knowledge graph weight based on strengthening or reducing the path weight.
[0205] This invention also provides a table-based relation recommendation system that combines a large language model with a knowledge graph, comprising:
[0206] (1) Data service module, configured to provide data support for large model semantic analysis and knowledge graph construction. The data service module includes a domain knowledge base and a business semantic enhancement knowledge graph.
[0207] The data service module includes:
[0208] Multi-source relation extraction unit:
[0209] Historical business model analysis: This involves analyzing operations containing keywords in the historical audit model, specifically JOIN and UNION, and extracting valid inter-table relationships that have been validated by audit practice.
[0210] Database metadata collection, extracting physical foreign key relationships from database tables;
[0211] Data dictionary parsing retrieves semantic information such as table usage descriptions and key field functions;
[0212] Multi-source relationship cleaning unit:
[0213] The raw relationships extracted from all the aforementioned data sources are cleaned and standardized, including:
[0214] Multi-source deduplication merges identical table associations from different sources;
[0215] Standardize naming conventions to unify aliases and abbreviations for table and field names across different sources;
[0216] Relationship type annotation clearly marks the type of each association. Association types include physical foreign key associations (defined by the database system) and business logic associations (where a non-primary foreign key exists in the business logic).
[0217] Furthermore, business semantic augmented knowledge graphs have the following characteristics:
[0218] The table function descriptions have been enhanced by adding natural language descriptions to each table to clarify its core role in the business system; for example, the description of the fund sales transaction record table is: storing customer fund purchase transaction information.
[0219] Key field identifiers and function descriptions: Clearly identify the related fields used for table joins and explain their related objects. Key fields include customer number; for example, the fund sales transaction record table includes the customer number key field. The customer number is a unique identifier within the fund sales system and is a key foreign key that links the customer channel table and the dual-record information table.
[0220] Construct a business semantic network that integrates elements such as tables, fields, relationships, and descriptions into a graph structure to form a graph; for example, it not only records "table A and table B are related", but also clearly expresses "why they are related, in what business scenarios they are related, and how they are related".
[0221] It leverages a graph database engine to achieve storage, indexing, and high-performance traversal queries.
[0222] (2) Intent matching module, configured to receive user natural language queries, parse semantic entities in user queries, and map semantic entities to candidate tables in domain knowledge base based on multi-dimensional scoring mechanism;
[0223] Specifically, intent recognition and entity extraction are performed as follows:
[0224] The intent matching module is configured to extract a set of semantic entities for natural language queries input by the user. For entity e and table T, a five-dimensional matching scoring function is used to score entity-table matching:
[0225] ;
[0226] in, Rate the function. , , , and As weight, ;
[0227] Calculate semantic similarity of table names :
[0228] ,
[0229] in, For text embedding functions, pre-trained language models (such as BERT, Sentence-BERT) are used to convert text into high-dimensional vector representations, T name For table name, This function calculates cosine similarity, providing a basic scoring basis for entity-table matching.
[0230] Calculate the semantic similarity of the table descriptions :
[0231] ,
[0232] Among them, T desc This component describes the table and, in conjunction with table name similarity, leverages the rich contextual information in the table's functional description to provide semantic verification and supplementation for entity-table matching. It plays a crucial role, especially when table names are not intuitive or there are naming differences, ensuring the system accurately understands user intent and finds the most matching data table.
[0233] Calculate field matching degree :
[0234] ,
[0235] Among them, C T This represents the collection of all fields in table T. These are the weighting coefficients. , ,
[0236] Indicator functions:
[0237] ;
[0238] The edit distance similarity function is:
[0239] ;
[0240] in, Edit the distance between entity e and field c. To obtain the maximum value between the absolute length of entity e and the absolute length of field c; this component is used to implement a dual strategy of exact matching and fuzzy matching, and this field-based micro-matching provides a supplement to entity-table matching.
[0241] Calculate structural reinforcement :
[0242] ;
[0243] Where E is the set of entities, this formula is used to check whether the current table T has a foreign key relationship with other identified entity tables. If a foreign key relationship exists, the score is 1; otherwise, it is 0. By verifying the foreign key relationship between tables, we not only focus on the matching quality of individual tables, but also on the position and relationship of tables in the overall business logic.
[0244] Calculate entity coverage :
[0245] ;
[0246] Where E is the entity set, and C(T) is the entity set that table T can cover. This formula is used to calculate the coverage ratio of the number of entities that table T can cover to the total number of entities in the query. By evaluating the table's ability to cover the overall query intent, it achieves coverage from matching individual entities to the overall query. This coverage-based evaluation strategy ensures that the user's query needs are fully met overall.
[0247] (3) The path recommendation module is configured to use identified entities as nodes, traverse the graph based on the candidate table, and recommend related paths to users in combination with the path scoring mechanism.
[0248] Specifically, for each entity e, according to The scoring and ranking process retains the top-k candidate tables, generating a candidate table set to complete knowledge graph path discovery. Each path is based on the entity-table mapping result, using the matched table as a node. Path retrieval is performed in the knowledge graph to generate multi-length candidate paths, forming a candidate path set. Each path is scored across five dimensions, and the path scores are then ranked.
[0249] ;
[0250] in, A comprehensive score for the function of the path. , , , and As weight, ;
[0251] Calculate path length components :
[0252] ;
[0253] Where k is the path length; this component prioritizes the shortest path while avoiding recommending overly complex paths, ensuring the most reasonable path priority principle.
[0254] Calculate foreign key relationship components :
[0255] ;
[0256] Here, FK is an abbreviation for Foreign Key, meaning a foreign key exists. The value is 1, indicating that there is no foreign key. The value is 0. This component counts the number of foreign key relationships between adjacent tables in path P. This component focuses not only on "whether a connection is possible" but also on "how to connect better," ensuring that the recommended path is logically sound. Through collaboration with other components, the system can recommend path solutions that are both in line with business intent and technically feasible.
[0257] Calculate semantic coherence components :
[0258] ;
[0259] in, For text embedding functions, pre-trained language models (such as BERT and Sentence-BERT) are used to convert text into high-dimensional vector representations. This is a cosine similarity calculation function, providing a basic scoring basis for entity-table matching, where i is the table index. and This component represents the natural language description of two adjacent tables; it obtains an assessment of the overall semantic coherence of the path by taking the arithmetic mean of the sum of the semantic similarities of all adjacent tables in path P.
[0260] Calculate historical feedback components :
[0261] ;
[0262] in, This represents the historical weight of the path, with an initial value of 1.
[0263] The user accepted the recommendation as follows: Users declined recommendations as follows: This component works in conjunction with other components to ensure that the recommendation results are both theoretically optimal and practically validated.
[0264] Calculate path entity coverage components :
[0265] ;
[0266] in, This represents the union of entities covered by all tables in path P, where E is the entity set. This component is used to calculate the coverage ratio of the number of entities covered by all tables in path P to the total number of entities in the query, ensuring that the recommended path can fully cover all user query intents;
[0267] The top-N recommendations are selected based on path scores, and the recommendations are returned.
[0268] (4) User feedback module, configured to collect user feedback, determine whether the user accepts the recommendation, strengthen the path weight if the user accepts the recommendation, reduce the path weight if the user does not accept the recommendation, and update the knowledge graph weight based on strengthening or reducing the path weight.
[0269] In one embodiment, taking "audit of fund purchase transactions via mobile banking" as an example:
[0270] The user inputs: "Query customer information for purchasing funds through mobile banking".
[0271] Entity recognition results:
[0272] Entity 1: Mobile Banking;
[0273] Entity 2: Purchase funds;
[0274] Entity 3: Customer Information;
[0275] Entity collection: = {"Mobile Banking", "Purchase Funds", "Customer Information"};
[0276] Perform Top-K candidate table set (K=3) and score:
[0277] Table 1: Entity-Table Matching Scoring Weight Coefficient Table
[0278]
[0279] Table 2: Entity 1 - Customer
[0280]
[0281] Table 3: Entity 2 - Mobile Banking
[0282]
[0283] Table 4: Entity 3 - Purchasing Funds
[0284]
[0285] Table 5: Final set of candidate tables:
[0286]
[0287] Path discovery and generation:
[0288] Table 6: Candidate Path Set
[0289]
[0290] Table 7: Path Scoring
[0291]
[0292] Table 8: Scoring Weighting Coefficient Table
[0293]
[0294] The path scoring table clearly demonstrates the innovative value of this invention in multi-objective optimization and business scenario adaptation. Users can select appropriate associated paths according to their actual needs; for example, paths 1-4 meet daily monitoring requirements, while path 5 provides dual-recording information.
[0295] User feedback and learning
[0296] If the user accepts the recommended path, the weights are updated:
[0297] Path 1 weight: ;
[0298] Path 1 score improvement: = 1 / 1.8 ≈ 0.56;
[0299] Path 1 will score higher in the next similar query.
[0300] In summary, compared with the prior art, the present invention has the following advantages:
[0301] (1) This invention proposes a method and system for recommending inter-table relationships by deeply integrating the natural language interaction capabilities of a large language model with the precise reasoning capabilities of a knowledge graph, thereby enabling the rapid, accurate, and automatic recommendation of the optimal data table association path through natural language interaction.
[0302] (2) The present invention sets up a multi-dimensional scoring mechanism, which uses entity-table matching degree, coverage score and path integrity score to ensure that the recommendation results have business accuracy and reliability, and effectively constrain the illusion problem of large models.
[0303] (3) This invention integrates the principles of “most reasonable path first” and “shortest path first”, transforming the professional knowledge of the business domain into a computable model, which shortens the discovery of complex data association paths from several hours to seconds, greatly improving efficiency.
[0304] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the present invention. Any equivalent substitutions or modifications made by those skilled in the art to the technical solutions and content disclosed in the present invention without departing from the scope of the present invention shall be deemed to have remained within the protection scope of the present invention.
Claims
1. A method for recommending inter-table relationships through collaboration between a large language model and a knowledge graph, characterized in that, Includes the following steps: S1: Set up a data service module to provide data support for large-scale model semantic analysis and knowledge graph construction. The data service module includes a domain knowledge base and a business semantic enhancement knowledge graph. S2: Set up the intent matching module to parse semantic entities in the user query and map the semantic entities to the candidate table in the domain knowledge base based on a multi-dimensional scoring mechanism, as follows: Extract semantic entity sets from natural language queries input by users. For entity e and table T, a five-dimensional matching scoring function is used: ; in, , , , and As weight, ; S21: Calculate the semantic similarity of table names : , in, For text embedding functions, a pre-trained language model is used to convert text into a high-dimensional vector representation, T. name For table name, This is the function for calculating cosine similarity. S22: Calculate the semantic similarity of the table descriptions : , Among them, T desc For table description; S23: Calculate field matching degree : , Among them, C T This represents the collection of all fields in table T. These are the weighting coefficients. Indicator functions: ; The edit distance similarity function is: ; in, Edit the distance between entity e and field c. To obtain the maximum value between the absolute value of the length of entity e and the absolute value of the length of field c; S24: Calculate structural reinforcement : ; Where E is the set of entities, this formula is used to check whether the current table T has a foreign key relationship with other tables of identified entities. If a foreign key relationship exists, the score is 1; otherwise, it is 0. S25: Calculate entity coverage : ; Where E is the entity set, and C(T) is the entity set that table T can cover. This formula is used to calculate the coverage ratio of the number of entities that table T can cover to the total number of entities in the query. S3: Set up a path recommendation module, which traverses the graph based on the candidate table in S2 and recommends related paths to users in combination with the path scoring mechanism; For each entity e in S2, according to The scoring and ranking retains the top-k candidate tables, and the associated paths are queried in the knowledge graph. For each path, a five-dimensional score is applied: ; in, , , , and As weight, ; S31: Calculate path length components : ; Where k is the path length; S32: Calculate the foreign key relationship components : ; Here, FK is an abbreviation for Foreign Key, meaning a foreign key exists. The value is 1, indicating that there is no foreign key. =0; S33: Calculate semantic coherence components : ; in, This is a text embedding function that uses a pre-trained language model to convert text into a high-dimensional vector representation. Here is the cosine similarity calculation function, where i is the index of the table. and Natural language descriptions representing two adjacent tables; S34: Calculate historical feedback components : ; in, This represents the historical weight of the path, with an initial value of 1. The user accepted the recommendation as follows: Users declined recommendations as follows: ; S35: Calculate path entity coverage components : ; in, Let P represent the union of all entities that can be covered by all tables in path P, and E be the set of entities.
2. The method for recommending inter-table relationships through the collaboration of a large language model and a knowledge graph as described in claim 1, characterized in that, Providing data support includes the following steps: S11: Multi-source relation extraction: Historical business model analysis: This involves analyzing operations containing keywords in the historical audit model, specifically JOIN and UNION, and extracting valid inter-table relationships that have been validated by audit practice. Database metadata collection, extracting physical foreign key relationships from database tables; Data dictionary parsing to obtain table usage descriptions and key field functions; S12: Multi-source relation cleaning: The raw relationships extracted from all data sources are cleaned and standardized, including: Multi-source deduplication merges identical table associations from different sources; Standardize naming conventions to unify aliases and abbreviations for table and field names across different sources; Relationship type annotation: clearly indicate the type of each association, including physical foreign key associations and business logic associations.
3. The method for recommending inter-table relationships through the collaboration of a large language model and a knowledge graph as described in claim 2, characterized in that, Business semantic augmented knowledge graphs have the following characteristics: Enhanced table functionality descriptions: Natural language descriptions are added to each table to clarify its core role in the business system. Key field identifiers and function descriptions: Clearly identify the related fields used for table joins and explain their related objects. Key fields include customer number. Construct a business semantic network that integrates tables, fields, relationships, and descriptions into a graph structure to form a graph. It leverages a graph database engine to achieve storage, indexing, and high-performance traversal queries.
4. A table-based relation recommendation system that integrates a large language model and a knowledge graph, characterized in that, include: The data service module is configured to provide data support for large-scale model semantic analysis and knowledge graph construction. The data service module includes a domain knowledge base and a business semantic augmented knowledge graph. The intent matching module is configured to parse semantic entities in user queries and map semantic entities to candidate tables in the domain knowledge base based on a multi-dimensional scoring mechanism. The intent matching module is configured to extract a set of semantic entities for natural language queries input by the user. For entity e and table T, a five-dimensional matching scoring function is used: ; in, , , , and As weight, ; Calculate semantic similarity of table names : , in, For text embedding functions, a pre-trained language model is used to convert text into a high-dimensional vector representation, T. name For table name, This is the function for calculating cosine similarity. Calculate the semantic similarity of the table descriptions : , Among them, T desc For table description; Calculate field matching degree : , Among them, C T This represents the collection of all fields in table T. These are the weighting coefficients. Indicator functions: ; The edit distance similarity function is: ; in, Edit the distance between entity e and field c. To obtain the maximum value between the absolute value of the length of entity e and the absolute value of the length of field c; Calculate structural reinforcement : ; Where E is the set of entities, this formula is used to check whether the current table T has a foreign key relationship with other tables of identified entities. If a foreign key relationship exists, the score is 1; otherwise, it is 0. Calculate entity coverage : ; Where E is the entity set, and C(T) is the entity set that table T can cover. This formula is used to calculate the coverage ratio of the number of entities that table T can cover to the total number of entities in the query. The path recommendation module is configured to traverse the graph based on the candidate table and combine it with a path scoring mechanism to recommend related paths to the user. In the path recommendation module, for each entity e, based on The scoring and ranking retains the top-k candidate tables, and the associated paths are queried in the knowledge graph. For each path, a five-dimensional score is applied: ; in, , , , and As weight, ; Calculate path length components : ; Where k is the path length; Calculate foreign key relationship components : ; Here, FK is an abbreviation for Foreign Key, meaning a foreign key exists. The value is 1, indicating that there is no foreign key. =0; Calculate semantic coherence components : ; in, This is a text embedding function that uses a pre-trained language model to convert text into a high-dimensional vector representation. Here is the cosine similarity calculation function, where i is the index of the table. and Natural language descriptions representing two adjacent tables; Calculate historical feedback components : ; in, This represents the historical weight of the path, with an initial value of 1. The user accepted the recommendation as follows: Users declined recommendations as follows: ; Calculate path entity coverage components : ; in, Let P represent the union of all entities that can be covered by all tables in path P, and E be the set of entities.
5. The table relationship recommendation system based on the collaboration of a large language model and knowledge graph as described in claim 4, characterized in that, The data service module includes: Multi-source relation extraction unit: Historical business model analysis: This involves analyzing operations containing keywords in the historical audit model, specifically JOIN and UNION, and extracting valid inter-table relationships that have been validated by audit practice. Database metadata collection, extracting physical foreign key relationships from database tables; Data dictionary parsing to obtain table usage descriptions and key field functions; Multi-source relationship cleaning unit: The raw relationships extracted from all data sources are cleaned and standardized, including: Multi-source deduplication merges identical table associations from different sources; Standardize naming conventions to unify aliases and abbreviations for table and field names across different sources; Relationship type annotation: clearly indicate the type of each association, including physical foreign key associations and business logic associations.
6. The inter-table relationship recommendation system based on the collaboration of a large language model and knowledge graph as described in claim 5, characterized in that, Business semantic augmented knowledge graphs have the following characteristics: Enhanced table functionality descriptions: Natural language descriptions are added to each table to clarify its core role in the business system. Key field identifiers and function descriptions: Clearly identify the related fields used for table joins and explain their related objects. Key fields include customer number. Construct a business semantic network that integrates tables, fields, relationships, and descriptions into a graph structure to form a graph. It leverages a graph database engine to achieve storage, indexing, and high-performance traversal queries.
Citation Information
Patent Citations
Metadata feature and thinking chain-based multi-table associated large language model question and answer method
CN118245591A
Search engine relation chain recommendation method based on knowledge graph
CN121301414A