A database metadata intelligent positioning method and system based on a double vector and a multi-alias expression
Patent Information
- Application Number
- CN202611005070.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-10-23
AI Technical Summary
[0010]发明目的:本发明的目的是提供了一种基于双向量与多别名表述的数据库元数据智能定位方法及系统,解决数据库元数据定位中短输入匹配命中率低、同一取值跨表难区分、同一字段及字段值在不同用户间存在多种习惯称呼的问题,实现 AI Agent 在数据库自然语言查询场景中准确高效地工作
[0036](1)本发明针对同一元数据对象,在索引构建阶段并行生成两种向量表示并予以存储:其一仅基于该对象自身的核心描述内容生成,不附加任何库表归属层面的上下文信息,从而确保当用户以简短的查询词进行检索时,不会因额外信息的向量干扰而导致匹配失败;其二则将对象自身的描述内容与其所属的库表、字段等层级归属信息联合编码,使得即便多个不同数据表中的字段值在字面上完全相同,各自的第二向量也能因归属语境不同而呈现显著差异,进而在后续排序中能够被有效区分。通过上述两种向量在各元数据对象上的并存存储,本发明从数据索引的底层结构上兼顾了简短查询的高召回率与同值异源场景的高区分度,避免了在单一向量模式下被迫在两者之间取舍的困境。
Smart Images

Figure CN122964106A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent data query and information retrieval technology, and particularly relates to a method and system for intelligent positioning of database metadata based on dual vectors and multiple aliases. Background Technology
[0002] With the rapid development of large language model technology, AI agents based on large language models have shown great potential in the field of natural language database querying. Users can ask questions in natural language, and the AI agent can understand the intent, locate relevant metadata, generate SQL, and execute the query. In this process, accurate matching of database metadata—including table names, field names, and optional field values—is a crucial step in determining the correctness of the query.
[0003] Traditional database metadata matching methods have the following main shortcomings:
[0004] First, the general RAG (Retrieval Augmentation) scheme generates a single vector for each document, which is ineffective in database metadata scenarios. Taking the field value "Jingjiang" as an example, this value belongs to the "Power Plant Name" field in the data dictionary. If a vectorized text with a description of the "Power Plant Name" belonging to it is generated, when a user only enters "Jingjiang" for retrieval, the text vectorization model will include the belonging description in the vector, resulting in a decrease in the similarity between the "Jingjiang" vector and the "Jingjiang" vector with the attached field belonging description. As a result, the user cannot find the field value with a short input.
[0005] Second, conversely, if only the field value itself is stored without any accompanying table or database description, then when the same value (such as "running") appears in multiple fields of multiple tables (such as "power plant information table.plant_status" and "generator set operation information table.GEN_STATUS"), the retrieval results cannot distinguish these values in different data contexts, and the AI Agent cannot correctly determine the target table and field.
[0006] Third, existing dual-path retrieval schemes typically employ a "multi-path result fusion" strategy, which involves simultaneously using vectorized retrieval and keyword retrieval for two-way recall, then scoring and merging or sorting the results from both paths before inputting them into a large model. While this approach expands the retrieval coverage, it fails to resolve the core contradictions in metadata matching scenarios: "low hit rate for short inputs" and "difficulty in distinguishing the same value across tables."
[0007] Fourth, existing agent-based NL2SQL solutions mainly focus on multiple rounds of verification and error correction in the SQL generation process, but do not pay attention to the matching accuracy problem in the metadata acquisition stage, and cannot fundamentally solve the SQL generation deviation caused by incorrect metadata positioning.
[0008] Fifth, existing solutions lack support for multiple customary names for the same field and its optional values. In large enterprise systems, different business departments may have different naming conventions for the same field. For example, the field `plant_status` might be called "running status" by department A and "operational status" by department B; the optional value "1001" might be queried by some users as the code "1001" and by others as its business meaning "running". Traditional single-name solutions can only configure a fixed Chinese name for each field and store only a single descriptive text for optional values, failing to cover the diverse expression habits of different user groups. This results in significant differences in the agent's retrieval hit rate among users in different departments.
[0009] In summary, there is an urgent need for a method and system that can simultaneously guarantee the recall rate, accuracy, and representation coverage of database metadata, so as to support AI agents to work accurately and efficiently in database natural language query scenarios. Summary of the Invention
[0010] Purpose of the invention: The purpose of this invention is to provide a database metadata intelligent location method and system based on dual vectors and multiple aliases, which solves the problems of low matching hit rate of short inputs, difficulty in distinguishing the same value across tables, and multiple habitual names for the same field and field value among different users in database metadata location, so as to enable AI Agent to work accurately and efficiently in database natural language query scenarios.
[0011] Technical solution:
[0012] In a first aspect, the present invention provides a method for intelligently locating database metadata based on dual-vector and multiple alias representations, the method comprising:
[0013] Establish a dual-vector and multiple-alias representation index library, including constructing the first vector and the second vector in parallel for the table metadata, field metadata and field optional value metadata in the database metadata set, and storing them in the vector index library;
[0014] Receive and parse the user's natural language query, construct a first query description string and a second query description string, and then generate a first query vector and a second query vector;
[0015] Based on the first query vector, a search is performed in the first vector to obtain a candidate metadata object set, and based on the second query vector, the candidate metadata object set is sorted and filtered in the second vector to obtain a finely sorted metadata object set;
[0016] Based on the refined metadata object set, the target database metadata is located, a database query statement is generated and executed, and the query results are returned to the user.
[0017] Furthermore, the database table attribution information of the database metadata dataset includes at least one of the following: the database table name, field name, business system code, and application function module information.
[0018] The field metadata is configured with one or more field synonyms, and expanded into multiple independent field description index records according to the field synonyms;
[0019] The optional value metadata of the field establishes an optional value index record with the optional value itself as the main body, and configures one or more optional value synonyms. The optional value synonyms are expanded into multiple independent optional value expression index records. Each field expression index record, optional value index record, and optional value expression index record generate corresponding first vectors and second vectors respectively and are associated and stored in the vector index library.
[0020] The first vector is generated by vectorizing the main description text of the corresponding metadata object or index record and does not include the library / table belonging information to which the object belongs; the second vector is generated by vectorizing the main description text of the corresponding metadata object or index record and its library / table belonging description.
[0021] The database metadata dataset includes multiple independent vector index sets, which are used to store database table metadata, field metadata, and field optional value metadata, respectively; the vector distribution characteristics in each vector index set are matched with the length and expression format of the description text of the corresponding metadata object.
[0022] Further, the process of receiving and parsing the user's natural language query, constructing a first query description string and a second query description string, and then generating a first query vector and a second query vector specifically involves: using an AI Agent to parse the user's natural language query, extracting core query elements and location limiting elements; the AI Agent constructing a first query description string based on the core query elements and a second query description string based on the location limiting elements; the first and second query description strings being passed to the two-stage retrieval module in the same metadata location request, and the two-stage retrieval module executing them in sequence according to the order of coarse screening and fine sorting; the system generating a first query vector corresponding to the first query description string and a second query vector corresponding to the second query description string; the location limiting elements included in the second query description string being dynamically generated by the AI Agent based on its understanding of the query intent and the acquired metadata.
[0023] Further, the step of retrieving candidate metadata objects in the first vector based on the first query vector, and sorting and filtering the candidate metadata objects in the second vector based on the second query vector to obtain a finely ranked metadata object set, specifically involves: performing a coarse screening retrieval in the first vector domain based on the first query vector to recall candidate metadata objects containing core query elements; performing a fine sorting of the candidate metadata objects in the second vector domain based on the second query vector to re-score and filter the candidate results to obtain a finely ranked metadata object set; wherein, the coarse screening retrieval and fine sorting are performed in a concatenated manner, and the first query vector and the second query vector are scored independently without cross-stage score merging.
[0024] Furthermore, the recall number of the coarse screening is N times the preset final return number, where N is a positive integer greater than 1; the coarse screening and fine sorting use different vector fields, and the named vector mechanism in the vector database enables the differentiated storage and independent retrieval of multiple vectors of the same object.
[0025] Furthermore, the table metadata has a first vector generated by vectorizing the combination of the Chinese and English names of the table, and a second vector generated by vectorizing the combination of the Chinese and English names of the table and the table description information; the field metadata's field description index record has a first vector generated by vectorizing the combination of the field synonym and the field English name, and a second vector generated by vectorizing the combination of the field synonym, the field English name, the Chinese name of the table to which it belongs, and the English name of the table to which it belongs; the field optional value metadata's optional value description index record has a first vector generated by vectorizing the combination of the optional value synonym and the field optional value, and a second vector generated by vectorizing the combination of the optional value synonym, the field optional value, the English name of the field to which it belongs, and the English name of the table to which it belongs.
[0026] Furthermore, the database metadata dataset includes multiple independent vector index sets, which are used to store database table metadata, field metadata, and field optional value metadata, respectively; the vector distribution characteristics in each vector index set match the length and expression format of the description text of the corresponding metadata object.
[0027] Furthermore, the method also includes: when a field metadata corresponds to multiple synonyms of a field, an independent field description index record is generated for each synonym of a field; multiple field description index records share the same field identifier and have independent vector storage points in the vector index library; during retrieval, each field description index record participates in vector matching independently; during output, they are merged into a single field metadata and returned according to the field identifier.
[0028] Furthermore, the method also includes: generating at least one optional value index record for each field optional value metadata, with the field optional value itself as the main body of the description; when the field optional value metadata corresponds to multiple optional value synonyms, generating an independent optional value representation index record for each optional value synonym; the optional value index record and the optional value representation index record share the same optional value identifier and have independent vector storage points in the vector index library, independently participate in vector matching during retrieval, and are merged into a single field optional value metadata for output.
[0029] Furthermore, the metadata of the optional values of the field is stored independently in the vector index library according to the table to which it belongs and the field to which it belongs. When the optional values of the same field appear in different tables, multiple independent records are generated, and each record independently stores the first vector and the second vector.
[0030] Secondly, the present invention provides a database metadata intelligent location system based on dual-vector and multiple alias representations, comprising:
[0031] Index building module: Establishes a dual-vector and multi-alias representation index library, constructs the first vector and the second vector in parallel for the table metadata, field metadata and field optional value metadata in the database metadata set, and stores them in association to the vector index library;
[0032] Parsing module: Receives and parses the user's natural language query, constructs a first query description string and a second query description string, and then generates a first query vector and a second query vector;
[0033] Two-stage retrieval module: Based on the first query vector, a retrieval is performed in the first vector to obtain a candidate metadata object set, and based on the second query vector, the candidate metadata object set is sorted and filtered in the second vector to obtain a finely sorted metadata object set;
[0034] Merge Output Module: Based on the refined metadata object set, locate the target database metadata, generate a database query statement and execute the query, and return the query results to the user.
[0035] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0036] (1) For the same metadata object, this invention generates and stores two vector representations in parallel during the index building stage: the first is generated solely based on the core description of the object itself, without any additional contextual information about the database or table affiliation, thus ensuring that when a user performs a search with short query terms, the matching will not fail due to vector interference from additional information; the second is jointly encoded with the object's own description and its hierarchical affiliation information such as the database or table it belongs to, so that even if the field values in multiple different data tables are literally identical, their respective second vectors can show significant differences due to different affiliation contexts, and thus can be effectively distinguished in subsequent sorting. By storing the above two vectors concurrently on each metadata object, this invention balances the high recall rate of short queries and the high distinguishability of scenarios with the same value but different sources from the underlying structure of the data index, avoiding the dilemma of having to choose between the two in a single vector mode.
[0037] (2) This invention uses a first vector and a second vector in a two-stage serial retrieval method rather than a multi-path result fusion method, thus maintaining the independent retrieval targets of the two stages. The first stage uses the first vector for coarse screening and broad recall, and the second stage uses the second vector for precise sorting of the coarse screening results. The two stages do not perform cross-stage scoring and merging, ensuring that the independence and accuracy of the retrieval results of each stage are not interfered with by the other stage.
[0038] (3) This invention constructs a first query description string and a second query description string simultaneously through an AI Agent, and the system completes coarse screening and fine sorting within a single retrieval request, reducing the interaction overhead caused by the Agent calling the retrieval tool multiple times. At the same time, the second query description string can be dynamically generated by the AI Agent based on the query intent and the acquired metadata context, enabling deep integration of the retrieval process and the Agent's reasoning process.
[0039] (4) This invention expands a field or a field's optional value into multiple independent index records by using a multi-synonymous expression expansion mechanism for field metadata and field optional value metadata. Each record generates an independent first vector and second vector. When different users use different expression habits to query the same field or the same field value, as long as any expression matches the user's input, the query will be successful. This solves the problem of insufficient expression coverage caused by "multiple names for the same object" and significantly improves the retrieval hit rate for user groups with different business backgrounds.
[0040] (5) The present invention stores database metadata into independent vector sets according to object type. The vector distribution of each set matches the description text length and expression characteristics of the corresponding object, avoiding interference between different types of vectors in the same vector domain, thus improving indexing efficiency and retrieval accuracy.
[0041] (6) This invention is particularly suitable for large enterprise-level business systems with a large number of database tables and fields. In this scenario, there are a large number of field values with the same name and the same coded values with different business meanings among different tables. Different business departments have different naming habits for the same field and two ways of querying the same coded value: by code and by business meaning. The three mechanisms of dual vector, multiple synonym representation and dual-stage retrieval in this invention work together to significantly improve the accuracy of metadata positioning of AI Agent in this scenario. Attached Figure Description
[0042] Figure 1 This is an overall flowchart of the method described in this invention.
[0043] Figure 2 This is a schematic diagram illustrating the construction of a dual-vector index and the expansion and storage of multiple synonym representations according to an embodiment of the present invention.
[0044] Figure 3 This is a schematic diagram of the two-stage retrieval process according to an embodiment of the present invention.
[0045] Figure 4 This is a schematic diagram illustrating the vector matching effect when multiple tables independently store the same optional field values in an embodiment of the present invention. Detailed Implementation
[0046] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0047] Example 1
[0048] like Figure 1 As shown, this embodiment provides a database metadata intelligent location method based on dual-vector and multiple alias representations. The method includes:
[0049] Establish a dual-vector and multiple-alias representation index library. Construct the first vector and the second vector in parallel for the three types of objects in the database metadata set: table metadata, field metadata, and field optional value metadata, and store them together in the vector index library.
[0050] Receive and parse the user's natural language query, construct a first query description string and a second query description string, and then generate a first query vector and a second query vector;
[0051] Based on the first query vector, a search is performed in the first vector to obtain a candidate metadata object set, and based on the second query vector, the candidate metadata object set is sorted and filtered in the second vector to obtain a finely sorted metadata object set;
[0052] Based on the refined metadata object set, the target database metadata is located, a database query statement is generated and executed, and the query results are returned to the user.
[0053] Specifically, the following details the construction process of the dual-vector index and the expanded storage mechanism for multiple synonym representations of fields.
[0054] The metadata object includes database table metadata, field metadata, and field optional value metadata; the database table attribution information to which the metadata object belongs includes at least one of the following: the database table name, field name, business system code, and application function module information.
[0055] For database table metadata, the first vector is generated by a text vectorization model from the main description composed of the Chinese and English names of the table, such as "Power Plant Information Table rt_con_plant"; the second vector is generated from the complete description composed of the Chinese and English names of the table and the table description information, such as "Power Plant Information Table (rt_con_plant): Stores basic information about power plants, such as plant name, region, installed capacity, and operating status."
[0056] For field metadata, each field can be configured with one or more synonyms. For example, the field `plant_status` can be configured with a set of synonyms ["Operating Status", "Commissioning Status"]. Each field synonym generates an independent field description index record, and each record independently generates a first vector and a second vector. The first vector of a field description index record is generated by concatenating the field synonym and the field's English name, such as "Operating Status plant_status" or "Commissioning Status plant_status"; its second vector is generated by concatenating the field synonym, the field's English name, the Chinese name of the table it belongs to, and the English name of the table it belongs to, such as "Operating Status (plant_status), Table: Power Plant Information Table (rt_con_plant)". Multiple field description index records share the same field identifier, participate independently in vector matching during retrieval, and are merged into a single field metadata according to the field identifier during output.
[0057] Through the above-mentioned multi-synonym expansion mechanism, even if the same field is referred to by different department users with different names, the index record can still hit the target field through at least one field description.
[0058] For optional field value metadata, a multiple synonym representation mechanism is also adopted. Each optional field value can generate two types of index records: optional value index records and optional value representation index records. The first vector of the optional value index record is the optional field value itself (when there is no description) or the optional field value concatenated with the value description (when there is a description), such as "Jingjiang" or "1001 Running"; its second vector is generated by concatenating the optional field value, the English name of the field to which it belongs, the Chinese name of the field to which it belongs, the English name of the table to which it belongs, and the Chinese name of the table to which it belongs, such as "Jingjiang, power plant name (PLANT_NAME), power plant information table (rt_con_plant)". The first vector of the optional value representation index record is generated by concatenating the optional value synonym representation with the optional field value, such as "Running 1001" or "Out of service 1002"; its second vector is generated by concatenating the optional value synonym representation, the optional field value, the English name of the field to which it belongs, and the English name of the table to which it belongs, such as "Running 1001, running status (plant_status), power plant information table (rt_con_plant)". When a user queries with the code "1001", the optional value index record provides a direct match; when a user queries with the business meaning "run", the optional value description index record provides an alias match.
[0059] As attached Figure 3 As shown, when the same optional value for a field appears in different tables, each table stores an independent index record, generating its own first vector and second vector. Taking the value "Running" as an example, its three independent index records have the same first vector (all "Running"), but different second vectors: the second vector of the first record is "Running, running status (plant_status), power plant information table (rt_con_plant)"; the second vector of the second record is "Running, unit status (GEN_STATUS), generator unit running information table (RT_DEV_GENERATOR)"; and the second vector of the third record is "Running, running status (WIND_STATUS), wind farm information table (RT_WIND_PLANT)".
[0060] Specifically, the detailed process of two-stage retrieval is explained below.
[0061] (1) The AI Agent receives and parses the user's natural language query. Taking the user's question "What is the current power generation of Jingjiang Power Plant?" as an example, the AI Agent extracts the core query elements (such as "Jingjiang" and "power generation") and the location limiting elements (such as "Jingjiang in the power plant name field" and "power generation field in the power plant information table"). Among them, "Jingjiang" is mainly used to locate the query object, and "power generation" is mainly used to locate the target indicator field.
[0062] (2) The AI Agent simultaneously inputs a first query description string and a second query description string in a single field optional value retrieval request. For example, the first query description string is "Jingjiang", and the second query description string is "Jingjiang in the power plant name field of the power plant information table". The system encodes the two description strings into a first query vector and a second query vector, respectively.
[0063] (3) The system first performs a coarse screening search in the first vector field of the meta_values set based on the first query vector. Since the first query description string only contains the query key value "Jingjiang" and does not include table name and field name attribution interference, a high hit rate can be ensured. The coarse screening search recalls candidate results with a scaling factor of top_k × N (N=5). The candidate set may contain "Jingjiang" values from multiple tables, such as "Jingjiang" in the power plant information table and "Jingjiang" in the regional information table.
[0064] (4) The system then performs fine sorting on the coarsely screened candidate set in the second vector domain based on the second query vector generated in the same request. Since the second query description string contains complete table name and field name attribution information, the vector encoding results of the same value under different database tables are significantly different. The system can accurately filter out "Jingjiang" as the power plant name in the power plant information table and eliminate interference from the same name value in other tables such as the regional information table. For the "power generation" element in the query, AIAgent can further use the same dual query description method to locate the power generation field and generate a query statement together with the located power plant object. The two stages are executed in a concatenated manner. The coarse screening score does not participate in the fine sorting, and the two paths do not perform cross-stage scoring merging. Since the first query description string and the second query description string are submitted at the same time in one request, the system can reduce the Agent's multiple tool calls and improve the retrieval accuracy by using fine sorting.
[0065] (5) The AI Agent locates the target database table and field based on the ranking results, generates SQL query statements and executes them, and returns the results to the user.
[0066] Example 2
[0067] This embodiment illustrates the role of the field multiple synonym representation mechanism in the retrieval process through specific examples.
[0068] Scenario: In a large enterprise data platform, the table rt_con_plant (power plant information table) contains a field called plant_status, which physically represents the current grid connection / disconnection status of the power plant. Internally, Department A typically refers to it as "operational status," while Department B typically refers to it as "commissioning status." In a traditional approach, if only "operational status" is configured as the field name, users in Department B will not be able to find this field when searching for "commissioning status."
[0069] In this invention, the field plant_status is configured with a set of synonyms ["running status", "commissioning status"], which expands into two independent field description index records: description record A (synonym "running status") and description record B (synonym "commissioning status").
[0070] When a user in Department B searches for "operation status," the AI Agent can simultaneously input the first query description string "operation status" and the second query description string "operation status field in the power plant information table" in a single field retrieval request. The system first performs a coarse search in the first vector field of the meta_fields set. Since the first vector of statement record B contains a synonym for the field "operation status," statement record B is successfully recalled. Subsequently, the system can use the second query vector corresponding to the second query description string to perform fine sorting of candidate fields. In contrast, the traditional solution, which only configures a single nominal field name, cannot match the user input of "operation status."
[0071] The multiple synonym representation mechanism and the dual vector mechanism can work together: In the second vector domain, the second vector representing record B carries complete table name attribution information. Therefore, even if the concise vectors representing multiple fields of the index record are different, the interference of fields with the same name in other tables can still be eliminated by using the database table attribution information during the fine sorting stage. This improves the representation coverage without sacrificing retrieval accuracy.
[0072] Furthermore, when multiple synonymous expressions for the same field (such as "running status" and "commissioning status" in this embodiment) are simultaneously matched due to ambiguity in the user's query, multiple expression index records can be merged into a single field metadata record based on the field identifier, and the expression record with the highest score or closest to the query intent will be used as the representative expression result for that field. For field optional value metadata, multiple synonymous expressions for the same optional value corresponding to the same table, the same field, and the same field value can also be merged and output based on the optional value identifier. This "expand matching, merge output" mechanism allows multiple synonymous expressions to expand the expression coverage without increasing the decision-making burden of the downstream Agent; when further disambiguation is required, the system can still use the index records before merging or the metadata context after merging to continue performing fine sorting.
[0073] Example 3
[0074] This embodiment takes a large enterprise-level business system as an example. The database contains a large number of optional values for fields with the same name but different meanings, as well as situations where the same field is referred to by different business departments under different names.
[0075] A user asked, "Please check the operational status of Jingjiang Power Plant." After parsing the query, the AI Agent dynamically identified that "Jingjiang" is an optional field value used to locate the power plant object, "operational status" is a field description used to locate the status field, and "power plant" refers to the power plant information table.
[0076] (1) The AI Agent uses the search_values tool to simultaneously pass in the first query description string "Jingjiang" and the second query description string "Jingjiang in the power plant name field of the power plant information table" in a single request. The system first uses the first query vector to recall candidate values of "Jingjiang" in different tables, and then uses the second query vector to perform fine sorting on the candidate values to determine the target object as the Jingjiang power plant in the power plant information table.
[0077] (2) The AI Agent uses the search_fields tool to simultaneously pass in the first query description string "operation status" and the second query description string "operation status field in the power plant information table" in a single request. Since the field plant_status is configured with the synonym "operation status", the corresponding field description index records can be recalled in the coarse screening stage; if multiple tables also contain similar status fields, the system will then perform fine sorting on the field candidate set based on the second query vector to determine the target field as plant_status in the power plant information table.
[0078] (3) The AI Agent combines the located target object "Jingjiang Power Plant" with the target field plant_status, generates an SQL statement, executes it, and returns the query results. In traditional solutions, the expression "commissioning status" may not match the field name configured only as "operation status"; at the same time, "Jingjiang" may also be difficult to disambiguate due to the same name appearing in multiple tables. However, this invention, through the synergy of field synonym expressions, field optional value synonym expressions, and dual-vector dual-stage retrieval, can simultaneously complete field name coverage and cross-table disambiguation of the same value, thereby completing the query.
[0079] Example 4
[0080] This embodiment provides a database metadata intelligent location system based on dual-vector and multiple alias representations to implement the above method, including:
[0081] Index building module: Establishes a dual-vector and multi-alias representation index library, constructs the first vector and the second vector in parallel for the table metadata, field metadata and field optional value metadata in the database metadata set, and stores them in association to the vector index library;
[0082] Parsing module: Receives and parses the user's natural language query, constructs a first query description string and a second query description string, and then generates a first query vector and a second query vector;
[0083] Two-stage retrieval module: Based on the first query vector, a retrieval is performed in the first vector to obtain a candidate metadata object set, and based on the second query vector, the candidate metadata object set is sorted and filtered in the second vector to obtain a finely sorted metadata object set;
[0084] Merge Output Module: Based on the refined metadata object set, locate the target database metadata, generate a database query statement and execute the query, and return the query results to the user.
[0085] Example 5
[0086] This embodiment also provides a computer device, the device including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the programs, when executed by the processors, implement the steps of the database metadata intelligent location method based on dual vector and multiple alias representation as described above.
[0087] Example 6
[0088] This embodiment also provides a computer storage medium storing a computer program, which, when executed by a processor, implements the steps of a power data query method based on two-stage keyword recall and SQL real-time governance as described above.
[0089] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus (systems), computer devices, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0090] This invention is described with reference to a flowchart of a method according to embodiments of the invention. It should be understood that each step in the flowchart and combinations thereof can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A device for a function specified in one or more processes.
[0091] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 The function specified in one or more processes.
[0092] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 Steps of a specified function in one or more processes.
Claims
1. A method for intelligently locating database metadata based on dual-vector and multiple alias representations, characterized in that, The method includes: Establish a dual-vector and multiple-alias representation index library, including constructing the first vector and the second vector in parallel for the table metadata, field metadata and field optional value metadata in the database metadata set, and storing them in the vector index library; Receive and parse the user's natural language query, construct a first query description string and a second query description string, and then generate a first query vector and a second query vector; Based on the first query vector, a search is performed in the first vector to obtain a candidate metadata object set, and based on the second query vector, the candidate metadata object set is sorted and filtered in the second vector to obtain a finely sorted metadata object set; Based on the refined metadata object set, the target database metadata is located, a database query statement is generated and executed, and the query results are returned to the user.
2. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, The database table attribution information of the database metadata dataset includes at least one of the following: the database table name, field name, business system code, and application function module information. The field metadata is configured with one or more field synonyms, and expanded into multiple independent field description index records according to the field synonyms; The field optional value metadata establishes optional value index records with the field optional value itself as the main body, and configures one or more optional value synonyms, which are expanded into multiple independent optional value expression index records according to the optional value synonyms; Each field description index record, optional value index record, and optional value description index record generates a corresponding first vector and second vector, which are then associated and stored in the vector index library. The first vector is generated by vectorizing the main description text of the corresponding metadata object or index record and does not include the library / table belonging information to which the object belongs; the second vector is generated by vectorizing the main description text of the corresponding metadata object or index record and its library / table belonging description.
3. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, The process of receiving and parsing a user's natural language query, constructing a first query description string and a second query description string, and then generating a first query vector and a second query vector specifically involves: using an AI Agent to parse the user's natural language query, extracting core query elements and location limiting elements; the AI Agent constructing a first query description string based on the core query elements and a second query description string based on the location limiting elements; the first and second query description strings being passed to a two-stage retrieval module in the same metadata location request, and the two-stage retrieval module executing them in sequence according to the order of coarse screening and fine sorting; the system generating a first query vector corresponding to the first query description string and a second query vector corresponding to the second query description string; the location limiting elements included in the second query description string being dynamically generated by the AI Agent based on its understanding of the query intent and the acquired metadata.
4. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, The process of retrieving candidate metadata objects from the first vector based on the first query vector and sorting and filtering the candidate metadata objects from the second vector based on the second query vector to obtain a finely ranked metadata object set specifically involves: performing a coarse screening retrieval in the first vector domain based on the first query vector to recall candidate metadata objects containing core query elements; performing a fine sorting of the candidate metadata objects from the second vector domain based on the second query vector to re-score and filter the candidate results to obtain a finely ranked metadata object set; wherein the coarse screening retrieval and fine sorting are performed in a concatenated manner, and the first query vector and the second query vector are scored independently without cross-stage score merging.
5. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, The table metadata has two vectors: a first vector generated by combining the Chinese and English names of the table, and a second vector generated by combining the Chinese and English names of the table and the table description information. The field metadata's field description index record has two vectors: a first vector generated by combining the field synonym and the field's English name, and a second vector generated by combining the field synonym, the field's English name, the Chinese name of the table it belongs to, and the English name of the table it belongs to. The field optional value metadata's optional value description index record has two vectors: a first vector generated by combining the optional value synonym and the field optional value, and a second vector generated by combining the optional value synonym, the field optional value, the English name of the field it belongs to, and the English name of the table it belongs to.
6. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, The database metadata dataset includes multiple independent vector index sets, which are used to store database table metadata, field metadata, and field optional value metadata, respectively. The vector distribution characteristics in each vector index set match the length and format of the description text of the corresponding metadata object.
7. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, When a field metadata corresponds to multiple synonyms, an independent field description index record is generated for each synonym. Multiple field description index records share the same field identifier and have independent vector storage points in the vector index library. During retrieval, each field description index record participates in vector matching independently. When outputting, they are merged into a single field metadata according to the field identifier and returned.
8. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, Each field optional value metadata record generates at least one optional value index record, primarily describing the field optional value itself. When the field optional value metadata corresponds to multiple synonymous expressions, an independent optional value expression index record is generated for each synonymous expression. The optional value index record and the optional value expression index record share the same optional value identifier and have independent vector storage points in the vector index library. During retrieval, they independently participate in vector matching, and during output, they are merged into a single field optional value metadata record based on the optional value identifier.
9. The intelligent positioning method for database metadata based on dual-vector and multiple alias representations according to claim 1, characterized in that, The optional value metadata of the field is stored independently in the vector index library according to the table and the field to which it belongs. When the optional value of the same field appears in different tables, multiple independent records are generated, and each record independently stores the first vector and the second vector.
10. A database metadata intelligent location system based on dual-vector and multiple alias representations, characterized in that, include: Index building module: Establishes a dual-vector and multi-alias representation index library, constructs the first vector and the second vector in parallel for the table metadata, field metadata and field optional value metadata in the database metadata set, and stores them in association to the vector index library; Parsing module: Receives and parses the user's natural language query, constructs a first query description string and a second query description string, and then generates a first query vector and a second query vector; Two-stage retrieval module: Based on the first query vector, a retrieval is performed in the first vector to obtain a candidate metadata object set, and based on the second query vector, the candidate metadata object set is sorted and filtered in the second vector to obtain a finely sorted metadata object set; Merge Output Module: Based on the refined metadata object set, locate the target database metadata, generate a database query statement and execute the query, and return the query results to the user.