Index query method, device, equipment, medium and product
By constructing structured data and large language models to understand user intent, and using the most distinctive difference attributes for interaction, the problem of inconsistent indicator definitions in higher education data platforms has been solved, enabling flexible and intelligent indicator queries and improving the accuracy and consistency of results.
Patent Information
- Application Number
- CN202611283476.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2046-08-24
AI Technical Summary
Inconsistent indicator definitions across different systems within a higher education data platform lead to a lack of comparability and consistency in query results. Existing technologies struggle to achieve flexible, intelligent natural language interaction and standardized definitions.
Construct structured data containing the correspondence between indicators and definitions, understand user intent through a large language model, determine a set of candidate definitions, and use the most discriminative difference attributes for interaction, gradually updating the candidate set until the target definition is selected, and finally query the target indicator results.
It achieves rapid disambiguation, reduces the number of interactions, improves the accuracy and consistency of indicator queries, reduces the waste of computing resources, and provides efficient support for university management and decision-making.
Smart Images

Figure CN122796096B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, specifically to indicator query methods, devices, equipment, media, and products. Background Technology
[0002] With the improvement of educational informatization, universities have generally established educational data platforms covering multiple business systems such as academic affairs, personnel, scientific research, and student affairs. However, there are problems of inconsistent data standards and inconsistent indicator definitions between different systems, which can cause the same indicator to vary in different scenarios. For example, the "number of full-time teachers" statistics of a college often differ in standard from the data collected by the university's personnel department, resulting in incomparable and inconsistent statistical results. Summary of the Invention
[0003] In view of this, this application provides a method, apparatus, device, medium and product for querying indicators, in order to solve the problem that users' indicator query results are prone to errors due to inconsistent educational indicator definitions.
[0004] Firstly, this application provides a method for querying indicators, the method comprising: Obtain the user query text in natural language; Determine the target metric to be queried in the user's query text; Based on preset structured data, candidate calibers corresponding to the target indicators are determined, and a corresponding set of candidate calibers is generated; the structured data includes the correspondence between indicators and calibers, as well as the attribute information of each caliber. If the candidate aperture set includes multiple candidate apertures, perform an update process for the candidate aperture set until the updated candidate aperture set includes a unique candidate aperture or the maximum hit probability of at least one candidate aperture in the updated candidate aperture set exceeds a preset hit rate threshold, and select the target aperture from the updated candidate aperture set. Based on the target caliber, query the database to determine the query results corresponding to the target indicator; The update process for the candidate caliber set includes: For the current candidate caliper in the candidate caliper set, the difference attributes between the current candidate calipers are determined based on the attribute information of each current candidate caliper in the structured data. Select the target difference attribute with the highest discriminative power from all the difference attributes, and generate and output the question text based on the target difference attribute; Obtain the answer text corresponding to the question text, and determine the target attribute information of the target difference attribute based on the answer text; Delete the current candidate calipers in the candidate caliper set that do not match the target attribute information, so as to update the candidate caliper set.
[0005] Secondly, this application provides an indicator query device, the device comprising: The acquisition module is used to acquire the user's query text in natural language. The parsing module is used to determine the target indicator to be queried in the user query text; The caliber management module is used to determine the candidate calibers corresponding to the target indicator based on preset structured data and generate a corresponding candidate caliber set. The structured data includes the correspondence between the indicator and the caliber and the attribute information of each caliber. When the candidate caliber set includes multiple candidate calibers, the module performs an update process for the candidate caliber set until the updated candidate caliber set includes a unique candidate caliber or the maximum hit probability of at least one candidate caliber in the updated candidate caliber set exceeds a preset hit rate threshold, and then selects the target caliber from the updated candidate caliber set. The processing module is used to query the database according to the target caliber and determine the query result corresponding to the target indicator; The update process for the candidate caliber set includes: For the current candidate caliper in the candidate caliper set, the difference attributes between the current candidate calipers are determined based on the attribute information of each current candidate caliper in the structured data. Select the target difference attribute with the highest discriminative power from all the difference attributes, and generate and output the question text based on the target difference attribute; Obtain the answer text corresponding to the question text, and determine the target attribute information of the target difference attribute based on the answer text; Delete the current candidate calipers in the candidate caliper set that do not match the target attribute information, so as to update the candidate caliper set.
[0006] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the index query method of the first aspect or any corresponding embodiment described above.
[0007] Fourthly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the index query method of the first aspect or any corresponding embodiment described above.
[0008] Fifthly, this application provides a computer program product, including computer instructions for causing a computer to execute the index query method described in the first aspect or any of its corresponding embodiments.
[0009] The indicator query method provided in this application pre-constructs structured data containing the correspondence between indicators and definitions, as well as the attribute information of each definition. When a user needs to query a target indicator, a candidate definition set is determined based on this structured data, and the difference attributes between each candidate definition are identified. The attribute with the highest discriminative power is then selected as the optimal follow-up attribute. This is used to interact with the user, determining the required target attribute information based on the user's response text, and deleting unsuitable candidate definitions. The candidate definition set is updated progressively until a suitable target definition can be selected. Finally, the desired indicator result can be obtained based on this target definition. During the user interaction, the optimal target difference attribute is selected for each query, which helps reduce the number of interactions, achieves rapid disambiguation, and effectively avoids wasting computational resources. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0011] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a schematic diagram of the first type of index query method according to an embodiment of this application; Figure 3 This is a schematic diagram of the second type of index query method according to the embodiments of this application; Figure 4 This is a partial schematic diagram of an educational indicator knowledge graph according to an embodiment of this application; Figure 5 This is a schematic diagram illustrating the generation of a candidate caliber set based on a caliber-based intelligent agent according to an embodiment of this application; Figure 6 This is a schematic diagram illustrating the generation of a target query statement according to an embodiment of this application; Figure 7 This is a schematic diagram illustrating the working principle of an indicator query system according to an embodiment of this application; Figure 8 This is a structural block diagram of an index query device according to an embodiment of this application; Figure 9This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0014] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0015] Before providing a detailed description of the embodiments of this application, some of the terms and concepts involved in the embodiments of this application will be explained. These explanations are intended to make the embodiments of this application easier to understand and should not be considered as limiting the scope of protection claimed in this application.
[0016] (1) Large Language Model (LLM): A deep learning-based model that can understand and generate natural language for semantic parsing and question answering tasks.
[0017] (2) Educational indicators: Data items used in higher education management and analysis to measure the level of teaching, research and management, such as the student-to-faculty ratio and graduation rate.
[0018] (3) Indicator library: A collection of standardized educational indicator definitions that stores and manages, including atomic indicators, derived indicators and custom indicators.
[0019] (4) Atomic indicators: the most basic and indivisible educational indicators, such as “number of full-time teachers” and “number of students”.
[0020] (5) Derived indicators: Indicators derived from atomic indicators through calculation relationships, such as “Teacher-student ratio = number of students ÷ number of teachers”.
[0021] (6) Custom metrics: Metrics that users define temporarily according to specific needs, which may not be pre-defined in the standard library initially.
[0022] (7) Indicator caliber: The definitions and rules used in the statistical and calculation process of education indicators may vary depending on the department or system.
[0023] (8) Indicator governance rule base: a knowledge base used to standardize and unify the definition of education indicators, including priority, definition mapping and conflict handling strategies.
[0024] (9) Graph: A knowledge structure that describes the semantic relationships between educational indicators, used to support indicator mapping and ambiguity resolution.
[0025] (10) Questions: The process by which users ask questions in natural language and the system parses them into queries and executes them.
[0026] (11) ADS (Application Data Service): The application-oriented summary layer in the data warehouse, which stores processed indicator data and is used preferentially for querying.
[0027] (12) DWS (Data Warehouse Summary): The level in the data warehouse that stores summary results and is used for intermediate-level statistical analysis.
[0028] (13) DWD (Data Warehouse Detail): The detail layer of the data warehouse, which stores the most original and unsummarized data.
[0029] (14) SQL (Structured Query Language): A standard query language for accessing and manipulating relational databases.
[0030] (15) Data tracing: The process of tracing and explaining the data source, table structure and calculation logic involved in the query results.
[0031] Educational indicators play a fundamental and core role in the daily management, teaching quality evaluation, and development planning of higher education. Typical indicators include the student-to-faculty ratio, the number of full-time teachers, research funding, graduation rate, and employment rate. These indicators serve as the basis for education authorities to conduct macro-level statistics and policy formulation, and are also important references for universities to conduct teaching management, faculty development, and strategic decision-making.
[0032] Meanwhile, university administrators and faculty members hope to directly query various educational indicators using natural language in their daily work, rather than relying on professional data analysts. However, in current practice, users often need to use fixed SQL queries, manually write statistical rules, or rely on BI (Business Intelligence) reporting tools to obtain results. This not only raises the barrier to entry but also makes the query process rigid, failing to meet the needs for personalization and flexibility.
[0033] Solution 1: Query method based on fixed SQL or script.
[0034] Universities typically employ query methods based on fixed SQL statements or scripts when compiling educational indicator statistics. The typical implementation process involves data administrators or developers pre-writing SQL statements or stored procedures according to the definition of the educational indicators, and then storing these in a fixed format in the database or application system. When a user needs to query a specific indicator, the system directly calls the corresponding SQL script, executes the query, and returns the result. For example, when calculating the "number of full-time teachers," the system might consistently call a specific query from the personnel database; when calculating the "student-to-faculty ratio," a script joins the teacher and student tables to complete the calculation.
[0035] The advantage of this approach lies in its simplicity and clear logic, and it can quickly return results when the indicator definitions are stable and the query requirements are relatively simple. However, its shortcomings are also quite obvious: (1.1) Poor flexibility: Once users raise new query requirements (such as cross-analysis of different dimensions or statistics at special time granularity), the existing fixed SQL cannot directly meet them, and the developers must rewrite the script.
[0036] (1.2) Uncontrollable caliber: SQL scripts written by different personnel may use different filtering conditions or statistical rules, resulting in inconsistent results for the same indicator in different departments or scenarios.
[0037] (1.3) High maintenance costs: With the expansion of educational indicators and the increase in query scenarios, the number of SQL scripts has increased dramatically, making maintenance and management difficult.
[0038] (1.4) Lack of natural language interaction capability: Ordinary users cannot directly obtain indicator results through natural language and must rely on data technicians, which has a high threshold for use.
[0039] Therefore, although this type of approach was widely used in the early stages of educational informatization, it is no longer sufficient to meet the requirements of universities for intelligence and consistency when faced with the needs of multi-dimensional, multi-level and diversified educational indicators.
[0040] Option 2: Indicator statistics and reports based on traditional BI tools.
[0041] This technical approach leverages traditional business intelligence (BI) tools to statistically analyze and visualize educational indicators. A typical implementation involves pre-defining the calculation rules and dimensional models for educational indicators within a data warehouse or data mart, and configuring fixed reports, dashboards, or visualization components within the BI system. Users can then retrieve the corresponding indicator results by selecting report templates or using dropdown filters. For example, users can view pre-configured indicators such as "Number of Full-Time Teachers" and "Student-Teacher Ratio" in the "Teacher Development" report of the BI tool, or view statistical information such as student enrollment and graduation rate in the "Student Registration Management" report.
[0042] The advantages of this approach are: it lowers the barrier to understanding and use for users through visual charts, and the interface is user-friendly; users can view data from different dimensions by filtering conditions, which provides a certain degree of flexibility.
[0043] However, its shortcomings are also quite obvious: (2.1) Reliance on preset templates: Most BI tools can only operate within the scope of predefined indicators and dimensions, which makes it difficult to meet the temporary and personalized natural language query needs proposed by users.
[0044] (2.2) Disparate definitions: The definitions and calculation methods of indicators may differ in different departments or different report templates, lacking a unified governance and definition explanation.
[0045] (2.3) Results are not interpretable: Report results usually only present data, but lack the calculation method of indicators, source table and traceability link, making it difficult for users to understand the logic behind the results.
[0046] (2.4) Difficult to dynamically expand: When universities add new business scenarios (such as new discipline evaluation, scientific research performance statistics), report developers need to redefine indicators and models, which is costly to expand.
[0047] Therefore, while such technologies improve the visualization and accessibility of educational data, they still have significant shortcomings in intelligent parsing, standardized terminology, and natural language interaction.
[0048] Solution 3: Educational data question-and-answer system based on rule base.
[0049] With the development of natural language processing technology, some universities and educational IT vendors have begun to explore building rule-based educational data question-answering systems. The typical implementation involves first establishing a rule base or mapping table that associates indicators with question expressions, mapping potential natural language questions from users to predefined indicators, SQL statements, or query templates. When a user inputs a natural language question, the system uses keyword matching, pattern recognition, or regular expression parsing to convert the question into known indicator query rules, thereby generating the corresponding SQL and returning the result. For example, when a user inputs "What is the student-to-faculty ratio in our college?", the system might match the indicator "student-to-faculty ratio" using rules, invoke a pre-defined calculation rule, and return the result.
[0050] Compared to pure SQL, this method has some natural language interaction capabilities, allowing users to ask questions in a more conversational way; moreover, rule-based matching and conversion are fast and have high execution efficiency, making it suitable for high-frequency, fixed question scenarios.
[0051] However, it also has the following shortcomings: (3.1) Poor scalability: The rule base relies on manual pre-definition and has limited coverage. When user questions exceed the scope of the rule base, the system cannot correctly understand or return results.
[0052] (3.2) Difficulty in handling ambiguity: When the same natural language problem may correspond to multiple indicator standards, the system lacks an automated ambiguity resolution mechanism.
[0053] (3.3) Inconsistent standards: Although a rule base has been established, different departments often maintain the rules independently, which may lead to differences in standards.
[0054] (3.4) High maintenance costs: With the diversification of educational indicators and questioning methods, the number of rules continues to increase, making system maintenance and updates a heavy burden.
[0055] Therefore, although this type of rule-based question-answering system alleviates users' demand for natural language questions to some extent, it still has significant shortcomings in terms of flexibility, consistency, and intelligence due to its lack of semantic understanding and caliber management capabilities.
[0056] Furthermore, with the widespread application of Large Language Models (LLMs) in the Text-to-SQL (Text to Structured Query Language) field, natural language processing techniques for higher education data have seen some development. However, educational indicators (such as student-to-faculty ratio and number of full-time teachers) often have complex and even conflicting statistical definitions across different business systems (academic affairs, human resources, research, etc.). Faced with such conflicting multi-definition scenarios, parsing methods based on large models or rule bases have certain technical limitations.
[0057] Specifically, when the same natural language question is mapped to multiple different metrics, enumeration-based traversal (listing all candidate metrics for the user to choose from) or hard-coded rule-based follow-up questions are commonly used. This approach lacks mathematical measurement of the metric differences (such as information value), making it impossible to determine which attribute can most quickly distinguish the user's true intent. This results in multiple rounds of human-computer interaction, redundant system state machine transitions, and difficulty in achieving optimal disambiguation path addressing.
[0058] As one optional application scenario in the embodiments of this application, such as Figure 1 As shown, application 101 is installed in terminal device 110, and user 130 can interact with application 101 through terminal device 110 and / or access device of terminal device 110.
[0059] For example, application 101 can be any application that provides question-and-answer related services. For instance, application 101 could be a question-and-answer interactive application, such as an education metrics query application. Figure 1 In the application scenario shown, if application 101 is active, the terminal device 110 can display the interface 102 of application 101. The interface 102 may include various pages that application 101 can provide, such as interactive pages, settings pages, query pages, etc.
[0060] In some embodiments, terminal device 110 is communicatively connected to server 120 to provide services to application 101. Terminal device 110 may be a mobile terminal, fixed terminal, or portable terminal, including but not limited to mobile phones, desktop computers, laptop computers, multimedia tablets, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, terminal device 110 may also support any type of interface, and server 120 may be various types of computing systems or servers capable of providing computing power, including but not limited to mainframes, edge computing nodes, and computing devices in cloud environments.
[0061] It should be noted that, Figure 1 This is merely an example of an application scenario and does not limit the scope of protection of this application.
[0062] The indicator query method provided in this embodiment pre-constructs structured data containing the correspondence between indicators and definitions, as well as the attribute information of each definition. When a user needs to query a target indicator, a candidate definition set is determined based on this structured data, and the difference attributes between each candidate definition are identified. The attribute with the highest discriminative power is then selected as the optimal follow-up attribute, and a question-and-answer interaction is initiated with the user. Based on the user's response, the required target attribute information is determined, and unsuitable candidate definitions are deleted. The candidate definition set is gradually updated until a suitable target definition can be selected. Finally, the indicator result required by the user can be obtained based on this target definition. During the question-and-answer interaction with the user, the optimal target difference attribute is selected for each question, which helps reduce the number of interactions, achieves rapid disambiguation, and effectively avoids wasting computational resources. Achieving indicator parsing, definition alignment, and data querying through natural language interaction not only improves the accuracy and consistency of questions but also provides more efficient and reliable support for educational management and decision-making.
[0063] According to an embodiment of this application, an embodiment of an index query method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0064] This embodiment provides an indicator query method, which can be used in the aforementioned terminal devices or servers. Figure 2 This is a flowchart of the index query method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps.
[0065] Step S201: Obtain the user query text in natural language.
[0066] In this embodiment, when a user needs to query specific information about a certain indicator, they can initiate a corresponding query request, which includes a user query text Q in natural language. The user can actively input the user query text Q in text format using an input device such as a keyboard; alternatively, the user can input the query voice, and the system can analyze the voice query to extract the user query text Q.
[0067] For example, if a user needs to query educational indicators such as "number of full-time teachers", the user query text Q they enter could be: How many full-time teachers are there in the School of Computer Science? Step S202: Determine the target metric to be queried in the user's query text.
[0068] The user query text Q typically contains metrics that the user is interested in, i.e., target metrics. For example, target metrics can be extracted from the user query text Q using rule-based matching methods such as entity matching.
[0069] In the context of actual query scenarios, the natural language query Q entered by users may contain a lot of redundant information or implicit conditions. Therefore, semantic understanding of the user query text Q can be performed based on the Large Language Model (LLM) to extract user intent information, including target metrics.
[0070] Step S203: Determine the candidate calibers corresponding to the target indicators based on the preset structured data, and generate the corresponding candidate caliber set; the structured data includes the correspondence between indicators and calibers, as well as the attribute information of each caliber.
[0071] In this embodiment, structured data, such as data tables or knowledge bases, is pre-set. This structured data records various indicators and possible applicable definitions, and establishes the correspondence between indicators and definitions. Furthermore, each definition also has corresponding attribute information, which represents the relevant characteristics of the definition. This structured data can be manually set, or the reasoning capabilities of a large language model can be used to summarize the data from various business systems to generate the corresponding structured data. Other schemes that can automatically generate structured data can also be used; this embodiment does not limit this approach.
[0072] Taking education indicators as an example, structured data can include various indicators such as the number of full-time teachers and the student-teacher ratio, as well as the indicator definitions corresponding to different business systems. For example, the number of full-time teachers can be defined using personnel or academic affairs definitions. Furthermore, the relevant definitions can include attributes such as whether or not external teachers are included.
[0073] After determining the target metric that the user wants to query, one or more candidate metrics can be determined based on structured data, forming a set including each candidate metric, i.e., the candidate metric set.
[0074] Step S204: If the candidate caliper set includes multiple candidate calipers, perform an update process for the candidate caliper set until the updated candidate caliper set includes a unique candidate caliper or the maximum hit probability of at least one candidate caliper in the updated candidate caliper set exceeds a preset hit rate threshold, and select the target caliper from the updated candidate caliper set.
[0075] In this embodiment, if the candidate aperture set includes only one candidate aperture, then that unique candidate aperture can be directly used as the target aperture, and subsequent step S205 can be executed. If the candidate aperture set includes multiple candidate apertures, it indicates that there is an aperture conflict problem. In this case, the candidate aperture set will be updated until the updated candidate aperture set meets the stopping condition, so that the target aperture can be selected from the updated candidate aperture set. The stopping condition specifically includes: the updated candidate aperture set includes a unique candidate aperture, or the maximum hit probability of at least one candidate aperture in the updated candidate aperture set exceeds a preset hit rate threshold, such as 0.8.
[0076] During the process of updating the candidate caliper set, unsuitable candidate calipers will be deleted. Specifically, the "updating process of the candidate caliper set" in step S204 includes steps a1 to a4.
[0077] Step a1: For the current candidate caliber in the candidate caliber set, determine the difference attributes between the current candidate calibers based on the attribute information of each current candidate caliber in the structured data.
[0078] Step a2: Select the target difference attribute with the highest discrimination from all difference attributes, and generate and output the question text based on the target difference attribute.
[0079] Step a3: Obtain the answer text corresponding to the question text, and determine the target attribute information of the target difference attribute based on the answer text.
[0080] Step a4: Delete the current candidate calipers in the candidate caliper set that do not match the target attribute information, in order to update the candidate caliper set.
[0081] In this embodiment, the candidate caliper set can be updated once or multiple times. For ease of description, the candidate calipers in the candidate caliper set will be referred to as "current candidate calipers" during the current update process. For each current candidate caliper, relevant attribute information can be obtained from structured data. By comparing the attribute information of each current candidate caliper, it can be determined that there are different attributes between them, i.e., difference attributes.
[0082] For example, if the target indicator is "number of full-time teachers", there are two candidate definitions: personnel definition and academic affairs definition. In the personnel definition, the attribute regarding whether or not external teachers are included is "no", while in the academic affairs definition, the attribute regarding whether or not external teachers are included is "yes". Since the two attributes are different, "whether or not external teachers are included" can be used as a difference attribute.
[0083] For each difference attribute, its discriminative power can be determined. This discriminative power is used to represent the degree to which different candidate statements can be distinguished based on the difference attribute. The higher the discriminative power of the difference attribute used in subsequent questioning and interaction with the user, the easier and faster it is to determine the candidate statement that the user is interested in. That is, the target statement can be determined more quickly, and ambiguity can be eliminated with the least system overhead and interaction rounds.
[0084] Specifically, the attribute with the highest discriminative power can be used as the target discriminative attribute, which is the optimal follow-up attribute. If there is only one discriminative attribute, then that attribute has the highest discriminative power and can be directly used as the target discriminative attribute.
[0085] Next, based on the target difference attribute, the system interacts with the user by asking follow-up questions, specifically inquiring about what the target difference attribute should be like. Specifically, it can output corresponding question text, instructing the user to answer it. This allows the system to obtain the user's answer text, and then accurately determine the specific information or value of the target difference attribute based on this answer text. This value is the expected value corresponding to the target difference attribute, i.e., the target attribute information. Subsequently, candidate categories that do not meet the user's requirements can be removed from the candidate category set, updating the candidate category set. The number of candidate categories gradually decreases, making it easier to select the target category.
[0086] For example, if the user is given the question "Does it include external teachers?" and the user's response (i.e., the answer text) is "No", then the target attribute information can be determined to be "Does it not include external teachers". The academic affairs category does not match this, so the academic affairs category can be deleted, while the personnel category is retained. If only the academic affairs category remains in the candidate category set, then the academic affairs category can be used as the target category.
[0087] It is understandable that if the updated candidate caliber set still does not meet the above stopping conditions, it needs to be updated again, that is, steps a1 to a4 are executed again, and a suitable target caliber is gradually determined through interaction with the user. If the updated candidate caliber set meets the above stopping conditions, a suitable target caliber can be selected from it, and then the subsequent step S205 can be executed.
[0088] Step S205: Query the database according to the target caliber to determine the query results corresponding to the target indicators.
[0089] Once the target criteria are determined, the definitions and rules that need to be used when statistically analyzing and calculating the target indicator can be determined. Then, by querying the relevant database according to the target criteria, the query results corresponding to the target indicator can be obtained, and the query results will conform to the rules of the target criteria.
[0090] For example, continuing with the target indicator of "number of full-time teachers", if the target scope is personnel-based, then when calculating the number of full-time teachers based on the database, external teachers are not considered, so that the final number of full-time teachers also does not include external teachers. Finally, the final number of full-time teachers is used as the query result and returned to the user for viewing.
[0091] The indicator query method provided in this embodiment pre-constructs structured data containing the correspondence between indicators and definitions, as well as the attribute information of each definition. When a user needs to query a target indicator, a candidate definition set is determined based on this structured data, and the difference attributes between each candidate definition are identified. The attribute with the highest discriminative power is then selected as the optimal follow-up attribute. This is used to interact with the user, determining the required target attribute information based on the user's response text, and deleting unsuitable candidate definitions. The candidate definition set is updated progressively until a suitable target definition can be selected. Finally, the desired indicator result can be obtained based on this target definition. During the user interaction process, the optimal target difference attribute is selected for each query, which helps reduce the number of interactions, achieves rapid disambiguation, and effectively avoids wasting computational resources.
[0092] This embodiment provides an indicator query method, which can be used in the aforementioned terminal devices or servers. Figure 3 This is a flowchart of the index query method according to an embodiment of this application, such as... Figure 3 As shown, the process includes the following steps.
[0093] Step S301: Obtain the user query text in natural language.
[0094] Please see details Figure 2 Step S201 of the illustrated embodiment will not be described again here.
[0095] Step S302: Determine the target metric to be queried in the user's query text.
[0096] Please see details Figure 2 Step S202 of the illustrated embodiment will not be described again here.
[0097] In this embodiment, the user's intent information is determined by semantic understanding of the user's query text Q. The user intent information includes the target indicator to be queried and multi-dimensional features. The multi-dimensional features may specifically include: time dimension features, spatial dimension features and business domain dimension features.
[0098] An intent-interpreting agent can be set up. The intent-interpreting agent first performs structured dimensionality reduction processing on the user query text Q, mapping it from a high-dimensional natural language space to a low-dimensional standard query feature space, and then extracts the required user intent information. In this way, the user's unstructured natural language question can be transformed into a mathematical vector that can be accurately calculated by machines and knowledge graphs.
[0099] The intent parsing agent first preprocesses the input user query text Q by filtering stop words, correcting grammatical errors, and normalizing synonyms to remove noisy words that do not contribute semantically. Then, leveraging the semantic understanding capabilities of a large language model and combining it with the conversational context history, it extracts the target metrics (…). For example, the number of full-time teachers) and multidimensional implicit features; specifically, extracting multidimensional features such as time dimension features, spatial dimension features and business domain dimension features from the cleaned text.
[0100] Among them, the time dimension features ( ): This indicates the time granularity, such as academic year, semester, calendar year, or specific month. If not explicitly mentioned, a default value will be added based on the context (such as "current academic year").
[0101] Spatial dimensional features ( ): This represents spatial constraints related to the organizational structure, such as campus, faculty, college, and major.
[0102] Business domain dimension features ( ): This indicates the business line that the question is biased towards, such as human resources, academic affairs, finance, student affairs, or scientific research.
[0103] After the above processing, user intent information containing target metrics and multi-dimensional features can be obtained. For ease of subsequent processing, this user intent information can be encapsulated into a semi-structured intent feature vector. ,and .in, Other auxiliary filtering conditions, such as user role, default time range in session context, and optional historical query preferences, etc.
[0104] It is understandable that if the features of a certain dimension cannot be determined, such as the features of the business domain dimension, then the features of that dimension can be set to empty. If the user query text includes multiple target metrics, then corresponding intent feature vectors are generated for each target metric, which will not be elaborated here.
[0105] Among them, the intention feature vector It can be used as a standardized parameter and passed to subsequent processing modules via the A2A (Agent-to-Agent) protocol, such as the caliber governance agent, for use by subsequent processing modules.
[0106] Step S303: Determine the candidate calibers corresponding to the target indicators based on the preset structured data, and generate the corresponding candidate caliber set; the structured data includes the correspondence between indicators and calibers, as well as the attribute information of each caliber.
[0107] Please see details Figure 2 Step S203 of the illustrated embodiment will not be described again here.
[0108] In some optional implementations, the structured data is represented using graph-based knowledge or other structured knowledge carriers capable of expressing the relationship between indicators, definitions, attributes, and data sources. Specifically, the structured data can be a knowledge graph, with each indicator serving as a node in the knowledge graph, and definitions and their attributes serving as nodes or attribute edges. For example, definitions and their attributes can both serve as entities in the knowledge graph.
[0109] In this embodiment, the nodes in the knowledge graph may include at least: indicator nodes, definition nodes, attribute nodes, data table nodes, and field nodes; edges may represent relationships such as "belong to", "depend on", "limited", "mapped to", and "associated with". Using a knowledge graph is beneficial for expressing multi-hop relationships between nodes and also for subsequent verification based on the knowledge graph (explained later).
[0110] Figure 4 A partial schematic diagram of an education indicator knowledge graph is shown. For example... Figure 4 As shown, it includes indicator nodes: number of full-time teachers, number of students, and student-teacher ratio. Definition nodes: personnel definition and academic affairs definition. Attribute nodes: statistical time cutoff point, whether external hires are included, and the relevant department (personnel department, academic affairs department, etc.). Data table nodes: Data Table 1 (e.g., Data Table 1 is ADS_teacher_summary, representing the teacher summary table at the ADS layer), Data Table 2 (e.g., Data Table 2 is DWS_teacher_task, representing the teaching task statistics table at the DWS layer). Field node: number of teachers (teacher_count).
[0111] In this embodiment, a caliber governance agent can be set up. The caliber governance agent receives the intent feature vector. Then, based on this vector, preliminary addressing can be performed in the pre-constructed knowledge graph of educational indicators to generate a set of candidate standards, and then a suitable target standard can be selected from them.
[0112] Specifically, vector retrieval can be used to determine the relevant terms in the knowledge graph. The indicator node (which can be an atomic indicator node, a derived indicator node, etc.) that is semantically matched (e.g., the cosine similarity of vectors is greater than a preset value) can be used as the target indicator node.
[0113] Due to the complexity of university operations, a single indicator node often has multiple nodes or attribute edges representing different business functions attached to it. For example... Figure 4 As shown, when the "Number of Full-time Teachers" node is matched, the system detects that this node has divergent branches in the knowledge graph: Branch 1: Personnel scope (including tenured staff, excluding external hires, up to the end of the calendar year).
[0114] Branch 2: Academic Affairs Coverage (including all personnel undertaking teaching duties, including external hires, up to the beginning of the academic year).
[0115] If the target indicator node has multiple caliber nodes, it can be determined that there is a caliber conflict. All valid branch nodes are then packaged to generate a candidate caliber set. , , This represents the i-th candidate caliber.
[0116] In generating the candidate caliber set, preliminary screening can be performed based on user intent information, and the candidate caliber set is generated based on the filtered calibers. Specifically, the original calibers are filtered based on multi-dimensional features, and the original calibers retained after filtering are used as candidate calibers, thereby generating the candidate caliber set.
[0117] For example, based on business domain features in the intent feature vector The original statements are initially filtered a priori. For example, if the question clearly involves "course scheduling", the academic affairs statement is retained first and used as a candidate statement.
[0118] Figure 5 This diagram illustrates a method for generating a candidate caliber set based on a caliber agent. For example... Figure 5 As shown, after the intent parsing agent converts the user's input into an intent feature vector, the caliber governance agent can determine the candidate calibers corresponding to the target indicator "number of full-time teachers" by querying the knowledge graph, and then generate the corresponding candidate caliber set.
[0119] Step S304: If the candidate caliper set includes multiple candidate calipers, perform an update process for the candidate caliper set until the updated candidate caliper set includes a unique candidate caliper or the maximum hit probability of at least one candidate caliper in the updated candidate caliper set exceeds a preset hit rate threshold, and select the target caliper from the updated candidate caliper set.
[0120] Please see details Figure 2Step S204 of the illustrated embodiment will not be described again here.
[0121] In some optional implementations, step a2 above, "selecting the target difference attribute with the highest discriminative power from the various difference attributes", includes steps a21 to a24.
[0122] Step a21: Determine the initial information entropy of the candidate caliber set.
[0123] In this embodiment, if the current candidate aperture set include There are 1 candidate calibers, which can be represented as: Based on this structured data, the differential attributes that lead to caliber differentiation can be extracted, and the set of differential attributes is as follows. It can be represented as Among them This represents the j-th discrepancy attribute. For example, by performing subgraph extraction on an education indicator knowledge graph, various discrepancy attributes that lead to conflicts in indicator definitions can be identified along relevant paths.
[0124] For example, for the target indicator of "number of full-time teachers", three differential attributes are extracted, and the set of differential attributes is as follows: ,in Represents the "statistical cutoff point". This indicates whether or not external hiring is included. It represents the "affiliation of business".
[0125] Furthermore, candidate calibers and their corresponding difference attributes can be mapped to a state matrix, which can then be used as a prerequisite data structure for subsequent calculations.
[0126] For example, regarding "number of full-time teachers," there are two candidate definitions: personnel definition (including external hires = no, deadline = end of the calendar year, responsible department = personnel department) and academic affairs definition (including external hires = yes, deadline = beginning of the academic year, responsible department = academic affairs department). The resulting state matrix can be shown in Table 1 below, where rows represent candidate definitions and columns represent difference attributes; the matrix content represents the values of each definition for each attribute.
[0127] Table 1
[0128] In this embodiment, the candidate caliber set can be determined. Various candidate calibers Hit probability The hit probability is the probability that a candidate caliber is selected as the target caliber, and Initially, the various hit probabilities can be set. Set them to the same value. Alternatively, they can be based on the extracted intent feature vector. (such as user business domain characteristics, historical query preferences, etc.), for each candidate caliber Assign an initial prior probability of hitting, and use each prior probability as the hit probability. .
[0129] For example, if the user query text Q contains expressions such as "class scheduling" or "teaching tasks", the academic affairs perspective has a higher prior; if it contains expressions such as "staffed" or "on duty", the personnel perspective has a higher prior; if there are no obvious clues, a uniform distribution can be used.
[0130] Specifically, candidate caliber set Initial information entropy , can be represented as:
[0131] in, For the target candidate caliber set The i-th candidate caliber The prior probability is The number of candidate calibers. This can be understood as the initial information entropy. The larger the value, the greater the ambiguity in the current interpretation, and the more information is generally needed to determine the user's true intent.
[0132] Step a22: For any difference attribute, determine the conditional information entropy of the candidate caliber set under the condition that the difference attribute is known.
[0133] Step a23: Determine the information gain of the difference attribute based on the difference between the initial information entropy and the conditional information entropy of the candidate caliber set.
[0134] As shown above, in order to eliminate ambiguity with minimal system overhead and interaction rounds, a target difference attribute with the highest discriminative power can be found in the difference attribute set A, and a question can be posed to the user. In this embodiment, information gain is used to represent discriminative power, and dynamic optimization of the difference attribute is achieved.
[0135] Specifically, for any differentiated attribute (It has multiple possible values) ), can be calculated based on the assumed difference attribute Under known conditions, candidate aperture selection set Conditional information entropy That is, in terms of difference attributes Given the conditions, candidate caliber set The entropy of the conditional probability distribution for differential attributes The mathematical expectation of . It can be expressed in a random variable. Given the known conditions, the candidate caliber set Uncertainty.
[0136] This conditional information entropy Specifically:
[0137] in, For the j-th difference attribute The value of , i.e. For example, regarding whether or not external hire A2 is included in Table 1, its value can be... It can be either "yes" or "no". Indicates the difference attribute The value is The probability of; Indicates the difference attribute The value is At that time, candidate caliber set Information entropy.
[0138] For any difference attribute Based on the conditional information entropy of this difference attribute and the initial information entropy of the candidate caliber set. This will determine the difference attribute. Information gain from the content of the question It can be based on the initial information entropy. With conditional information entropy The difference is used to determine the information gain. Furthermore, there is a positive correlation between the two; for example, the information gain. Specifically, it can be the initial information entropy. With conditional information entropy The difference, i.e. Information gain Capable of representing differential attributes Discrimination level.
[0139] Step a24: Select the difference attribute with the largest information gain as the target difference attribute.
[0140] After determining the information gain of all difference attributes, the difference attribute with the largest information gain can be selected as the optimal question feature for the current round, i.e., the target difference attribute. .
[0141] After determining the target difference attributes, the intent resolution agent can then interact with the user by asking questions based on those attributes. Specifically, the intent resolution agent receives the target difference attributes... (e.g., target difference attributes) If the statistical time cutoff point is specified, the large language model can be used to transform it into a single-turn clarifying question that conforms to natural language habits, such as: Is the number of teachers you need to query counted at the end of the calendar year or at the beginning of the academic year? Afterwards, users can respond to the above questions to determine the target difference attributes. Specific numerical values, such as user replies like "end of the natural year", can be used to update the state matrix of the candidate caliber set and filter out candidate calibers that do not conform to user feedback.
[0142] Furthermore, if the number of candidate calipers in the updated candidate caliper set is still multiple (i.e., the number is greater than or equal to 2), then the next round of update processing can be performed, that is, the candidate caliper set can be updated again.
[0143] This allows for updating the hit probability of each candidate aperture. For example, the probabilities of the remaining candidate apertures can be normalized to obtain the posterior probability, or the posterior probability of the remaining candidate apertures can be updated using Bayes' theorem.
[0144] For the i-th candidate caliper, its updated hit probability is: Then the hit probability can be updated based on each candidate caliber. Recalculate the current initial information entropy of the candidate caliber set. That is, re-execute steps a1 to a3 until the updated candidate caliber set meets the caliber screening conditions.
[0145] Optionally, the caliper selection criteria can be set based on the number of candidate calipers in the candidate caliper set or the maximum hit probability. Accordingly, step S204, "selecting the target caliper from the updated candidate caliper set", can include: if the updated candidate caliper set includes a unique candidate caliper, the unique candidate caliper is selected as the target caliper; the hit probability of each candidate caliper in the updated candidate caliper set is determined, and if the maximum hit probability exceeds a preset hit rate threshold, the candidate caliper corresponding to the maximum hit probability is selected as the target caliper; the hit probability is the probability that a candidate caliper is selected as the target caliper.
[0146] In this embodiment, if only one candidate aperture remains in the candidate aperture set, that candidate aperture can be directly used as the target aperture. Alternatively, even if the updated candidate aperture set includes multiple candidate apertures, if the maximum hit probability exceeds a preset hit rate threshold after updating the hit probabilities of the remaining candidate apertures, it indicates that the user is very likely to be interested in the candidate aperture corresponding to the maximum hit probability, and therefore that candidate aperture can also be used as the target aperture.
[0147] In this embodiment, when there is a conflict in the statements, the target difference attribute with the largest information gain is selected as the question feature during each round of questioning interaction. This allows each questioning interaction to eliminate the uncertainty of the current candidate statement set to the greatest extent, find the most suitable target statement as soon as possible, effectively avoid invalid follow-up questioning paths, and achieve optimization with the fewest interaction rounds under the mathematical expectation dimension.
[0148] Step S305: Query the database according to the target caliber to determine the query results corresponding to the target indicators.
[0149] Specifically, step S305, "querying the database according to the target caliber," includes steps S3051 to S3052.
[0150] Step S3051: Generate a target query statement for querying target indicators based on the target criteria.
[0151] Step S3052: Query the corresponding database based on the target query statement.
[0152] After determining the target caliber, in order to adaptively query the database, a query statement for querying the target indicator is generated based on this target caliber; this is the target query statement, which can specifically be an SQL statement supported by the database. This target query statement is consistent with the actual business caliber. Therefore, even if multiple business systems correspond to different calibers, an accurate target query statement can be constructed based on the already resolved ambiguity target caliber. By querying the corresponding database using this target query statement, the user can obtain the desired query results from the database.
[0153] Among them, an SQL generation agent can be set up. After receiving the target caliber determined by the caliber governance agent, the target query statement is generated based on the SQL generation agent and the corresponding database is queried.
[0154] In some optional implementations, the database includes multiple data layers with priorities. Specifically, the underlying data warehouse of the system, following a standard data warehouse architecture, can be divided into multiple data layers such as the Application Data Service (ADS) layer, the Data Summarization (DWS) layer, and the Data Detail (DWD) layer. Furthermore, each data layer has an appropriate priority, and the higher the priority of a data layer, the higher its data aggregation degree, meaning fewer data tables, more refined fields, and clearer aggregation semantics. In this embodiment, the data layers are ordered by priority as follows: ADS, DWS, and DWD.
[0155] Furthermore, the aforementioned step S3051, "generating a target query statement for querying target indicators based on the target caliber," may include steps c1 to c3.
[0156] Step c1: Based on the target caliber's caliber metadata, probe each data layer in descending order of priority to determine the target data layer that matches the caliber metadata.
[0157] Step c2: Determine the context information based on the target data layer and generate prompt words containing the context information.
[0158] Step c3: Based on the prompt words, call the large language model to generate the target query statement for querying the target indicator.
[0159] In this embodiment, each caliber has certain caliber metadata, which comes from the caliber node itself and its associated mapping configuration. This caliber metadata can specifically include caliber attribute information, and can also include constraints corresponding to data queries. For example, the caliber metadata can include: target indicator identifier, caliber definition, statistical granularity (e.g., summarizing by college, summarizing by year and month), inclusion / exclusion rules (e.g., excluding external teachers, part-time teachers), target business domain, preferred data layer (e.g., ADS, DWS, DWD), required dimensions (indicating which dimensions the indicator can be analyzed), etc.
[0160] Once the target caliber is determined, each data layer can be probed sequentially based on its caliber metadata, from highest to lowest priority, to identify the data layer that matches the caliber metadata; this is the target data layer. Specifically, if a data layer meets the data query constraints of the target caliber, it can be considered a match and thus designated as the target data layer.
[0161] If a query statement is generated based on an SQL generation agent, after receiving the locked metadata, the agent does not rely on static global table structure hints but instead uses a standardized protocol for dynamic routing. Specifically, the SQL generation agent can initiate a state probe request to the data warehouse's MCP Server via the MCP (Model Context Protocol) and execute a fallback routing strategy: it prioritizes mounting the table structure context of the ADS layer; if the MCP Server reports that the ADS layer is missing a required dimension, it automatically falls back to probe and mount the DWS layer; and it only penetrates to the DWD layer in very specific detailed queries.
[0162] Once the appropriate target data layer is determined, context information for querying can be generated based on it. Specifically, this context information can be a database schema (a template for defining structured data, which can be used to guide model reasoning, define output formats, etc., to ensure that the output of the large model meets the expected structured requirements).
[0163] After generating the prompt words containing this contextual information, the prompt words can be input into the large language model to finally generate the target query statement that can query the target metric.
[0164] Among them, the metadata of the caliber can only indicate what the indicator query needs to query (for example, guiding which tables and fields to select when generating SQL statements, as well as what aggregation methods and filtering conditions to use). By introducing the context information of the data layer, the specific table names, field names, join keys, field types, etc. in the database can be specified, so that the SQL generation agent can rely on the schema of the target data layer to translate the target caliber of the business into an executable target query statement.
[0165] For example, after mounting the schema context of the target data layer, the SQL generation agent can automatically assign aliases with business semantics to tables and fields, and convert the calculation logic of the target caliber (such as: teacher-student ratio = number of students / number of teachers) into SQL statements in the corresponding dialect.
[0166] It is understandable that if a target query statement is generated based on the target data layer, then when querying the database based on the target query statement, only the data in the target data layer needs to be queried.
[0167] Because higher-priority data layers contain less data, directly querying the most detailed DWD layer typically requires more detailed tables, more joins, and more complex aggregation logic, significantly increasing prompt length and the probability of SQL generation errors. In this embodiment, a strategy of prioritizing higher-level access and then gradually moving down layers as needed is adopted. Appropriate data layers are attempted to be mounted sequentially in the order of ADS, DWS, and DWD. Only a small number of precisely relevant database schemas (table names, fields, data types) are loaded into the context window. This means that large models only need to load a smaller schema to generate queries, thus reducing the likelihood of context bloat and field confusion, effectively avoiding attention decay and field confusion caused by excessively long prompts.
[0168] Optionally, while the initial SQL query generated by the large model may be syntactically correct, it is highly susceptible to semantic illusions caused by forced cross-domain associations in the complex heterogeneous data environment of universities. For example, joining the transaction records of the financial database with the course schedule of the academic affairs database using IDs that have no business meaning. Based on this, this embodiment verifies the query statement by isomorphically comparing the AST of the statement with the knowledge graph.
[0169] Specifically, step S3051, "generating a target query statement for querying target indicators based on the target caliber," may include steps d1 to d5.
[0170] Step d1: Generate an initial query statement for querying the target indicators based on the target criteria.
[0171] Step d2: Determine the abstract syntax tree corresponding to the initial query statement.
[0172] Step d3: Determine the inter-table relationships between the data tables to be queried based on the abstract syntax tree.
[0173] In this embodiment, an initial query statement can be generated based on steps c1 to c3. In other words, the query statement generated by calling the large language model based on the prompt words in step c3 is the initial query statement to be corrected. Only when the query statement is free of problems can it be used as the target query statement required in the future.
[0174] For this initial query statement, a lexical and syntax analyzer can parse the SQL string in the initial query statement into a standard Abstract Syntax Tree (AST). From the AST, all FROM nodes (corresponding to entity data tables) and JOIN condition nodes (inter-table relationships) can be precisely extracted, thus constructing a second inter-table relationship. This second inter-table relationship can be specifically abstracted as a local query relationship subgraph, which can represent which data tables were actually used in this query and how these data tables are joined.
[0175] Step d4: In the event of a conflict between the inter-table relationships and the inter-table relationships, generate correction information based on the inter-table relationships.
[0176] Step d5: Modify the initial query statement according to the correction information to generate the target query statement; there is no conflict between the inter-table relationships in the target query statement and the inter-table relationships in the first table.
[0177] Furthermore, structured data also includes the allowed first-order inter-table relationships between various data tables. Specifically, if the structured data is a knowledge graph, the legal relationships between various data tables can be predefined, i.e., the first-order inter-table relationships. These first-order inter-table relationships are specifically a part of the knowledge graph and can serve as a semantic topology graph for business purposes.
[0178] Regarding the relationships between the second tables, if a valid path cannot be found in the knowledge graph, it indicates a conflict between the two tables, or in other words, an error exists in the relationship between the second tables. For example, the knowledge graph stipulates that the "Personnel Table" and the "Student Affairs Table" cannot be directly linked; they must be bridged through the "College Dimension Table." However, if the initial query directly links the "Personnel Table" and the "Student Affairs Table," then the initial query is considered to have a business violation issue and needs to be corrected.
[0179] If the comparison of the two table joins fails (i.e., a conflict exists), the correct join rule can be extracted from the first table join to generate corresponding correction information. Furthermore, error feedback information can be generated based on the error information in the second table join, such as a missing valid bridging path in the initial query, incorrect JOIN direction, direct cross-domain join, filtering conditions acting on incorrect entities, or mismatched aggregation granularity. Subsequently, the initial query can be corrected by combining this correction information and the error feedback information to regenerate a target query containing correct JOIN logic. In other words, there is no conflict between the table joins of the target query and the first table join. At this point, the query relationship subgraph corresponding to the table join of the target query and the semantic topology graph of the first table join pass isomorphism verification.
[0180] This allows for the configuration of a self-checking agent that works in conjunction with an SQL generation agent to generate target query statements that pass the validation.
[0181] Figure 6 This illustrates one method for generating a target query statement, such as... Figure 6 As shown, the SQL generation agent (i.e., the Structured Query Language (SCL) generation agent) probes the data layer layer by layer and generates an initial SQL statement based on a suitable data layer schema. The execution agent performs isomorphic comparison verification on this initial SQL statement. If the verification fails, the SQL generation agent regenerates a new SQL statement until it passes verification; if the verification succeeds, the target query statement can be directly output. Alternatively, as... Figure 6 As shown, the self-checking agent can also perform final physical robustness rewriting on the validated SQL statement at the AST level. For example, it can include automatic injection of zero-removal anomaly protection for educational statistics scenarios (such as encapsulating `NULLIF(number of teachers, 0)` in the teacher-student ratio calculation), null value agglomeration filling (`COALESCE`), and row / column level data permission filtering based on user roles. Finally, it outputs the target query statement, and can execute the target query statement to obtain the corresponding results in the database.
[0182] In this embodiment, the underlying table structure is dynamically mounted on demand based on the MCP protocol, and a dual verification mechanism of isomorphic comparison between the Abstract Syntax Tree (AST) and the knowledge graph is added. This ensures that the generated SQL query statement is both executable and faithful to the educational business logic, effectively solving the problem of context window overflow caused by the inability to fully load the large database table structure of universities, as well as the problem of semantic illusion caused by the generated JOIN logic not being valid in business.
[0183] Optionally, traditional question-and-answer systems often only deliver the final numerical value or chart to the user, lacking an explanation of the calculation logic. In this embodiment, after determining the query result, in addition to providing the user with the query result, the system also provides the user with traceability information involved in the query process, thus addressing the black-box problem of query results. Specifically, the method may further include: obtaining traceability information corresponding to the user's query text and outputting the traceability information; the traceability information includes at least one of the following: target indicator, determined target scope, data level of the queried database, and query statement used to query the database.
[0184] In this embodiment, after obtaining the raw query results returned by the database, the self-checking agent can transform the data stream into a user-friendly structured representation (such as a table or a multi-dimensional visualization). Furthermore, to ensure the transparency and verifiability of the query results, the system constructs a traceable delivery chain.
[0185] Specifically, the self-checking agent can reverse package the traceability certificate to generate corresponding traceability information, which may include the following metadata: (1) Intent parsing information, which may include extracted target indicators and features of various dimensions.
[0186] (2) Target caliber, which may include the definition and description of the final standard caliber locked after dynamic disambiguation of information gain, and may also include the attribute information of the target caliber.
[0187] (3) The data layer (ADS, DWS or DWD) actually mounted through the MCP protocol in this query may also include the name of the physical data table being called.
[0188] (4) The final SQL statement (i.e. the target query statement) output after AST double verification and robustness protection injection may also include the initial SQL statement (i.e. the initial query statement).
[0189] The self-checking agent can obtain relevant data from other agents, or it can record the structured results generated at each stage in the unified task context or system flow log. The self-checking agent reads these logs and status data uniformly during the result packaging stage to generate traceability information.
[0190] The aforementioned metadata is packaged into traceability information, which can serve as traceability credentials and be output to users along with the query results. This ensures that each query result is visible, explainable, and traceable, effectively eliminating the trust concerns of university administrators when making data-driven decisions.
[0191] In some optional implementations, the above step S303, "determine the candidate calibers corresponding to the target indicators based on preset structured data and generate the corresponding candidate caliber set", may include steps e1 to e2.
[0192] Step e1: Determine the undetermined caliber in the structured data that corresponds to the target indicator.
[0193] Step e2: Based on the semantic vectors of each pending caliber, filter each pending caliber to determine the candidate caliber; the candidate caliber is the pending caliber that matches the semantic vector of the user's query text.
[0194] When generating the candidate criteria set, a preliminary screening can be performed based on user query text that can represent user intent information. The candidate criteria set is then generated based on the preliminary screening criteria. Specifically, after determining the target indicator, the criteria in structured data (such as knowledge graphs) that correspond to the target indicator can be directly identified. For ease of description, these criteria are referred to as pending criteria. If there is only one pending criterion, it can be directly used as a candidate criterion and then as the target criterion; if there are multiple pending criteria, a preliminary screening will be performed.
[0195] For each caliber, including those to be determined, a corresponding semantic vector is provided. After determining the to-be-determined caliber, its semantic vector can be matched with the semantic vector of the user's query text, for example, determining the similarity between the two; for example, the semantic vector of the user's query text can specifically be the intent feature vector mentioned above. It includes business domain dimension features. At this point, the semantic vector of the undetermined caliber can be combined with the dimensional features of the business domain. Matching is performed to determine whether the pending caliber can be used as a candidate caliber.
[0196] If the semantic vector of a certain undetermined caliber matches the semantic vector of the user's query text, for example, if the similarity between the two is greater than a preset similarity threshold, then the undetermined caliber can be used as a candidate caliber.
[0197] In this embodiment, preliminary screening is performed using the semantic vector of the caliber, which can eliminate some calibers that do not meet the requirements in advance, thereby reducing the number of candidate calibers and helping to reduce the number of subsequent interactions.
[0198] Optionally, in education-related scenarios, there are frequent changes in the terminology used in university business. This typically requires manual tagging or maintenance of a thesaurus to adapt to these changes, but this approach is inefficient. In this embodiment, offset compensation is performed based on a high-dimensional vector space to achieve dynamic evolution of the semantic vector. Specifically, the method further includes steps f1 to f2.
[0199] Step f1: If the user's query text includes words not included in the index, after determining the target scope, convert the words not included in the index into a first semantic vector and determine a second semantic vector for the target scope; the first semantic vector and the second semantic vector are located in the same semantic vector space.
[0200] Step f2: Shift compensation is applied to the second semantic vector based on the first semantic vector to obtain the updated second semantic vector; the updated second semantic vector is the semantic vector updated for the target caliber.
[0201] In this embodiment, when the user's input query text Q includes words not included in the database... In cases such as new synonyms not included in the knowledge graph, business slang, or ambiguous expressions, dynamic disambiguation based on information entropy can be achieved. After determining the unique target caliber, the current semantic vector of that target caliber, i.e., the second semantic vector, can be further determined.
[0202] This involves pre-recording the semantic vectors for each caliber. Specifically, these semantic vectors are the vectors corresponding to the caliber's identifier text. Taking the target caliber as an example, the identifier text for the target caliber can be determined. For example, the standard name and definition text of the target caliber can be mapped to a high-dimensional semantic vector space using a semantic vector mapping model (such as the Embedding model). Furthermore, to ensure the vector spaces of both the unincluded words and the target caliber are identical, they can be mapped to the same high-dimensional semantic vector space, yielding the first semantic vectors of the unincluded words. The second semantic vector corresponding to the caliber node .
[0203] According to the first semantic vector It is possible to apply the second semantic vector After offset compensation, the updated second semantic vector is obtained. This makes the updated second semantic vector It is closer to words not included in the database; by updating the vector of the caliber node, the system can gradually learn that certain expressions usually correspond to a certain caliber, thereby reducing the number of times the user needs to be asked. For example, when the user's expression already implies "including external hire" or "teaching task", the system can locate the corresponding caliber more quickly.
[0204] The updated semantic vector (e.g., the updated second semantic vector) can be used to match the semantic vector of subsequent user-input query text to initially filter out suitable candidate semantic vectors. Specifically, when a user subsequently queries based on the unlisted term, a high-confidence nearest neighbor match can be directly performed in the semantic space, thus directly hitting the target semantic vector without further questioning, thereby reducing the number of multiple rounds of interaction. For example, if the target semantic vector is treated as a pending semantic vector during a subsequent user query, then when executing step e2, the updated semantic vector (i.e., the second semantic vector) can be used to more accurately determine whether the user-input query text matches the target semantic vector, which is beneficial for accurately completing the initial screening of semantic vectors.
[0205] Optionally, step f2, "to offset the second semantic vector according to the first semantic vector to obtain the updated second semantic vector", may specifically include steps f21 to f22.
[0206] Step f21: Determine the offset feature vector between the first semantic vector and the second semantic vector.
[0207] Step f22: Set a learning rate for the offset feature vector, and compensate the second semantic vector according to the offset feature vector with the set learning rate to obtain the updated second semantic vector.
[0208] In this embodiment, the offset feature vector It can be: The offset feature vector As a fine-tuning gradient, based on the set learning rate The second semantic vector of the caliber node in the knowledge graph Perform dynamic compensation and aggregation: .
[0209] After vector space offset compensation, the semantic coverage boundary of standard-caliber nodes in the knowledge graph can dynamically expand and adaptively shift to reflect new user questioning habits. When other users subsequently input similar but not identical ambiguous expressions, these non-standard words will directly fall within the updated vector matching tolerance range. The system relies on the updated vector... It can directly complete high-confidence nearest neighbor matching in the semantic space, enabling the system to achieve a self-evolutionary closed loop that continuously optimizes the matching recall rate as the number of interactions increases without retraining the underlying large language model.
[0210] This embodiment also provides an indicator query system, which implements the above-mentioned indicator query method through the collaborative work of multiple intelligent agents. Specifically, the system may include: an intent parsing intelligent agent, a caliber governance intelligent agent, and an execution intelligent agent, wherein the execution intelligent agent may specifically include: an SQL generation intelligent agent and an execution self-checking intelligent agent.
[0211] Figure 7 A schematic diagram illustrating the working principle of this system is shown. For example... Figure 7 As shown, the system comprises four instantiated core agents: an intent parsing agent, a caliber governance agent, an SQL generation agent, and a self-testing agent. Each agent is configured with a specific system prompt, an independent context window, and exclusive tool invocation permissions. The first protocol is the A2A protocol, and the second protocol is the MCP protocol.
[0212] Specifically, the intent parsing agent is used to receive the user's original input, extract implicit contextual features such as time, space (e.g., campus, college) and business domain, realize the structured dimensionality reduction of natural language, and finally output a semi-structured query intent containing indicator nouns and multi-dimensional feature vectors as the initial input for downstream computation.
[0213] The caliber governance agent is primarily responsible for knowledge graph addressing and information entropy calculation. Upon receiving a query intent, it maps nodes within the education indicator knowledge graph. When multi-caliber mapping conflicts occur, it extracts the difference attributes, calculates the initial and conditional information entropies, derives the difference attribute with the largest information gain (IG), and generates a dynamic clarification strategy until a suitable target caliber is selected.
[0214] SQL-generated agents (i.e., structured query language-generated agents) are primarily responsible for translating business logic into the database (i.e.,... Figure 7 In heterogeneous data warehouses, which can be specifically divided into multiple layers such as ADS, DWS, and DWD, the conversion of query languages is required. After the caliber governance agent locks in a unique target caliber, the SQL generation agent generates the initial SQL query statement based on the determined caliber metadata (such as aggregation logic and inter-table join rules).
[0215] The execution self-checking agent is used to perform executability verification and result shaping on the query statement. Specifically, the execution self-checking agent intercepts the initial query statement output by the SQL generation agent and performs dual verification based on AST and graph isomorphism. After confirming that it is correct and meets the permissions, it generates the final target query statement and executes the database query, ultimately generating a visual structure that includes query results, traceability links, and caliber descriptions.
[0216] like Figure 7As shown, agents can synchronize information through the A2A protocol (i.e., the first protocol). For example, an A2A message includes: `Sender_ID` (sender identifier), `Receiver_ID` (receiver identifier), `State_Vector` (current task state vector), and `Entropy_Value` (current information entropy value). `State_Vector` is used to transmit the structured state of the current task, such as identified metrics, time / organizational conditions, the current candidate caliber set, attributes to be confirmed, missing dimensions, and the current routing level; `Entropy_Value` is used to quantify the degree of ambiguity of the current caliber. Transmitting the former ensures that downstream agents receive a unified context, avoiding repeated parsing; transmitting the latter allows downstream agents to determine whether to continue automatic processing or trigger clarification. Both can be empty.
[0217] For example, when the SQL generation agent discovers a missing dimension field during the generation process, it does not directly report an error to the user. Instead, it sends a feedback message containing `State=Missing_Dimension` to the caliber governance agent via the A2A protocol, triggering the caliber governance agent's secondary graph inference and parameter compensation. This mechanism greatly improves the system's robustness and automated fault tolerance.
[0218] The indicator query method and system provided in this embodiment transform the multi-caliber conflict problem of educational indicators into an information uncertainty problem, and introduces an information theory model for quantitative solution. By locating the set of differentiated attributes leading to caliber differentiation in the knowledge graph, a candidate caliber state matrix is constructed, the initial information entropy is calculated, and the optimal clarifying feature is dynamically optimized based on conditional information entropy and information gain, achieving the disambiguation path selection with the fewest interaction rounds from a mathematical expectation perspective. Based on a multi-agent collaborative query mechanism, and with agents transmitting information through a standardized message structure, a cross-agent dynamic game and feedback correction mechanism can be realized, thereby overcoming the context decay and logical illusion problems of single large models in complex long-link reasoning.
[0219] Furthermore, by mounting data layer by layer in the order of ADS, DWS, and DWD, an on-demand loading and layer-by-layer routing data access strategy can be implemented, effectively avoiding the overflow problem of large model context windows. The initially generated query statements are subjected to isomorphic comparison. When illegal association paths exist, the A2A protocol can be used to feed back corrective parameters, triggering the SQL generation agent to self-correct and reconstruct, ensuring that the generation logic is completely consistent with the business rules. When a user inputs a new expression not yet included in the knowledge graph and it is ultimately mapped to a standard indicator node, the semantic offset between the new expression vector and the standard radial quantity can be calculated. Based on the set learning rate, the standard radial quantity is dynamically compensated and updated, enabling adaptive expansion of the knowledge graph's semantic boundaries and achieving zero-shot semantic generalization capability.
[0220] This embodiment also provides an index query device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0221] This embodiment provides an index query device, such as... Figure 8 As shown, the device includes: Module 801 is used to acquire user query text in natural language; The parsing module 802 is used to determine the target indicator to be queried in the user query text; The caliber management module 803 is used to determine the candidate calibers corresponding to the target indicator based on preset structured data, and generate a corresponding candidate caliber set; the structured data includes the correspondence between the indicator and the caliber and the attribute information of each caliber; when the candidate caliber set includes multiple candidate calibers, an update process is performed on the candidate caliber set until the updated candidate caliber set includes a unique candidate caliber or the maximum hit probability of at least one candidate caliber in the updated candidate caliber set exceeds a preset hit rate threshold, and the target caliber is selected from the updated candidate caliber set; Processing module 804 is used to query the database according to the target caliber and determine the query result corresponding to the target indicator; The update process for the candidate caliber set includes: For the current candidate caliper in the candidate caliper set, the difference attributes between the current candidate calipers are determined based on the attribute information of each current candidate caliper in the structured data. Select the target difference attribute with the highest discriminative power from all the difference attributes, and generate and output the question text based on the target difference attribute; Obtain the answer text corresponding to the question text, and determine the target attribute information of the target difference attribute based on the answer text; Delete the current candidate calipers in the candidate caliper set that do not match the target attribute information, so as to update the candidate caliper set.
[0222] In some optional implementations, selecting the target difference attribute with the highest discriminative power from the various difference attributes includes: Determine the initial information entropy of the candidate caliber set; For any difference attribute, determine the conditional information entropy of the candidate caliber set under the condition that the difference attribute is known; The information gain of the difference attribute is determined based on the difference between the initial information entropy and the conditional information entropy of the candidate caliber set. The difference attribute with the greatest information gain is taken as the target difference attribute.
[0223] In some optional implementations, selecting the target caliber from the updated candidate caliber set includes: If the updated candidate caliper set includes a unique candidate caliper, then the unique candidate caliper shall be used as the target caliper. Alternatively, determine the hit probability of each candidate aperture in the updated candidate aperture set, and if the maximum hit probability exceeds a preset hit rate threshold, use the candidate aperture corresponding to the maximum hit probability as the target aperture; the hit probability is the probability that a candidate aperture is selected as the target aperture.
[0224] In some optional implementations, determining the target metric to be queried in the user query text includes: The user query text is semantically understood to determine the user intent information; the user intent information includes the target indicator to be queried and multi-dimensional features. The step of determining the candidate caliber corresponding to the target indicator based on preset structured data includes: Based on the preset structured data, determine the original caliber that corresponds to the target indicator; The original aperture is filtered based on the multi-dimensional features, and the original aperture retained after filtering is used as the candidate aperture.
[0225] In some optional implementations, querying the database according to the target caliber includes: Generate a target query statement for querying the target indicator based on the target criteria; The corresponding database is queried based on the target query statement.
[0226] In some alternative implementations, the database includes multiple data layers with priorities; The step of generating a target query statement for querying the target indicator based on the target caliber includes: Based on the target caliber's caliber metadata, each data layer is probed sequentially in descending order of priority to determine the target data layer that matches the caliber metadata. Context information is determined based on the target data layer, and prompt words containing the context information are generated; Based on the prompt words, the large language model is invoked to generate a target query statement for querying the target indicator.
[0227] In some optional implementations, the structured data further includes: a first table association relationship allowed between the various data tables; The step of generating a target query statement for querying the target indicator based on the target caliber includes: Generate an initial query statement for querying the target indicator based on the target criteria; Determine the abstract syntax tree corresponding to the initial query statement; The second table relationship between the data tables to be queried is determined based on the abstract syntax tree; In the event of a conflict between the second inter-table association and the first inter-table association, correction information is generated based on the first inter-table association. The initial query statement is modified according to the correction information to generate a target query statement; there is no conflict between the inter-table relationships of the target query statement and the first inter-table relationships.
[0228] In some optional implementations, the processing module is further configured to: Obtain the source information corresponding to the user's query text and output the source information; the source information includes at least one of the following: the target indicator, the determined target caliber, the data level of the queried database, and the query statement used to query the database.
[0229] In some optional implementations, the step of determining the candidate criteria corresponding to the target indicator based on preset structured data and generating a corresponding candidate criterion set includes: Determine the undefined criteria in the structured data that correspond to the target indicator; Based on the semantic vectors of each of the undetermined criteria, each undetermined criterion is filtered to determine candidate criteria; the candidate criteria are the undetermined criteria that match the semantic vector of the user query text.
[0230] In some optional implementations, the processing module is further configured to: If the user query text includes unlisted words, after determining the target scope, the unlisted words are converted into a first semantic vector, and a second semantic vector of the target scope is determined; the first semantic vector and the second semantic vector are located in the same semantic vector space. The second semantic vector is offset and compensated based on the first semantic vector to obtain the updated second semantic vector; the updated second semantic vector is the semantic vector updated for the target caliber.
[0231] In some optional implementations, the step of offset compensation of the second semantic vector based on the first semantic vector to obtain the updated second semantic vector includes: Determine the offset feature vector between the first semantic vector and the second semantic vector; A learning rate is set for the offset feature vector, and the second semantic vector is compensated based on the offset feature vector with the learning rate to obtain the updated second semantic vector.
[0232] The index query device provided in this disclosure can execute the index query method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the method execution. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0233] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0234] The following is a detailed reference. Figure 9 This diagram illustrates a suitable structural schematic for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 901, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 902 or a program loaded from memory 908 into random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device. The processor 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output interface 905 is also connected to the bus 904.
[0235] Typically, the following devices can be connected to the input / output interface 905: input devices 906 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 907 including, for example, a liquid crystal display, speaker, vibrator, etc.; memory devices 908 including, for example, magnetic tape, hard disk, etc.; and communication devices 909. Communication devices 909 allow electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 9 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0236] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a memory 908, or installed from a ROM 902. When the computer program is executed by the processor 901, it performs the functions defined in the index query method of embodiments of this application.
[0237] Figure 9 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0238] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the index query method shown in the above embodiments is implemented.
[0239] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0240] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for querying indicators, characterized in that, The method includes: Obtain the user query text in natural language; Determine the target metric to be queried in the user's query text; Based on preset structured data, candidate calibers corresponding to the target indicators are determined, and a corresponding set of candidate calibers is generated; the structured data includes the correspondence between indicators and calibers, as well as the attribute information of each caliber. If the candidate aperture set includes multiple candidate apertures, perform an update process for the candidate aperture set until the updated candidate aperture set includes a unique candidate aperture or the maximum hit probability of at least one candidate aperture in the updated candidate aperture set exceeds a preset hit rate threshold, and select the target aperture from the updated candidate aperture set. Based on the target caliber, query the database to determine the query results corresponding to the target indicator; The update process for the candidate caliber set includes: For the current candidate caliper in the candidate caliper set, the difference attributes between the current candidate calipers are determined based on the attribute information of each current candidate caliper in the structured data. Select the target difference attribute with the highest discriminative power from all the difference attributes, and generate and output the question text based on the target difference attribute; Obtain the answer text corresponding to the question text, and determine the target attribute information of the target difference attribute based on the answer text; Delete the current candidate calipers in the candidate caliper set that do not match the target attribute information, so as to update the candidate caliper set.
2. The method according to claim 1, characterized in that, The step of selecting the target difference attribute with the highest discriminative power from the various difference attributes includes: Determine the initial information entropy of the candidate caliber set; For any difference attribute, determine the conditional information entropy of the candidate caliber set under the condition that the difference attribute is known; The information gain of the difference attribute is determined based on the difference between the initial information entropy and the conditional information entropy of the candidate caliber set. The difference attribute with the greatest information gain is taken as the target difference attribute.
3. The method according to claim 1 or 2, characterized in that, The step of selecting the target caliber from the updated candidate caliber set includes: If the updated candidate caliper set includes a unique candidate caliper, then the unique candidate caliper shall be used as the target caliper. Alternatively, determine the hit probability of each candidate aperture in the updated candidate aperture set, and if the maximum hit probability exceeds a preset hit rate threshold, use the candidate aperture corresponding to the maximum hit probability as the target aperture; the hit probability is the probability that a candidate aperture is selected as the target aperture.
4. The method according to claim 1, characterized in that, Determining the target metric to be queried in the user's query text includes: The user query text is semantically understood to determine the user intent information; the user intent information includes the target indicator to be queried and multi-dimensional features. The step of determining the candidate caliber corresponding to the target indicator based on preset structured data includes: Based on the preset structured data, determine the original caliber that corresponds to the target indicator; The original aperture is filtered based on the multi-dimensional features, and the original aperture retained after filtering is used as the candidate aperture.
5. The method according to claim 1, characterized in that, The step of querying the database according to the target caliber includes: Generate a target query statement for querying the target indicator based on the target criteria; The corresponding database is queried based on the target query statement.
6. The method according to claim 5, characterized in that, The database includes multiple data layers with priorities. The step of generating a target query statement for querying the target indicator based on the target caliber includes: Based on the target caliber's caliber metadata, each data layer is probed sequentially in descending order of priority to determine the target data layer that matches the caliber metadata. Context information is determined based on the target data layer, and prompt words containing the context information are generated; Based on the prompt words, the large language model is invoked to generate a target query statement for querying the target indicator.
7. The method according to claim 5, characterized in that, The structured data also includes: the allowed inter-table relationships between the various data tables; The step of generating a target query statement for querying the target indicator based on the target caliber includes: Generate an initial query statement for querying the target indicator based on the target criteria; Determine the abstract syntax tree corresponding to the initial query statement; The second table relationship between the data tables to be queried is determined based on the abstract syntax tree; In the event of a conflict between the second inter-table association and the first inter-table association, correction information is generated based on the first inter-table association. The initial query statement is modified according to the correction information to generate a target query statement; there is no conflict between the inter-table relationships of the target query statement and the first inter-table relationships.
8. The method according to claim 1, characterized in that, The method further includes: Obtain the source information corresponding to the user's query text and output the source information; the source information includes at least one of the following: the target indicator, the determined target caliber, the data level of the queried database, and the query statement used to query the database.
9. The method according to claim 1, characterized in that, The step of determining the candidate criteria corresponding to the target indicator based on preset structured data and generating a corresponding candidate criterion set includes: Determine the undefined criteria in the structured data that correspond to the target indicator; Based on the semantic vectors of each of the undetermined criteria, each undetermined criterion is filtered to determine candidate criteria; the candidate criteria are the undetermined criteria that match the semantic vector of the user query text.
10. The method according to claim 9, characterized in that, The method further includes: If the user query text includes unlisted words, after determining the target scope, the unlisted words are converted into a first semantic vector, and a second semantic vector of the target scope is determined; the first semantic vector and the second semantic vector are located in the same semantic vector space. The second semantic vector is offset and compensated based on the first semantic vector to obtain the updated second semantic vector; the updated second semantic vector is the semantic vector updated for the target caliber.
11. The method according to claim 10, characterized in that, The step of offset compensation of the second semantic vector based on the first semantic vector to obtain the updated second semantic vector includes: Determine the offset feature vector between the first semantic vector and the second semantic vector; A learning rate is set for the offset feature vector, and the second semantic vector is compensated based on the offset feature vector with the learning rate to obtain the updated second semantic vector.
12. An index query device, characterized in that, The device includes: The acquisition module is used to acquire the user's query text in natural language. The parsing module is used to determine the target indicator to be queried in the user query text; The caliber management module is used to determine the candidate calibers corresponding to the target indicator based on preset structured data and generate a corresponding candidate caliber set. The structured data includes the correspondence between the indicator and the caliber and the attribute information of each caliber. When the candidate caliber set includes multiple candidate calibers, the module performs an update process for the candidate caliber set until the updated candidate caliber set includes a unique candidate caliber or the maximum hit probability of at least one candidate caliber in the updated candidate caliber set exceeds a preset hit rate threshold, and then selects the target caliber from the updated candidate caliber set. The processing module is used to query the database according to the target caliber and determine the query result corresponding to the target indicator; The update process for the candidate caliber set includes: For the current candidate caliper in the candidate caliper set, the difference attributes between the current candidate calipers are determined based on the attribute information of each current candidate caliper in the structured data. Select the target difference attribute with the highest discriminative power from all the difference attributes, and generate and output the question text based on the target difference attribute; Obtain the answer text corresponding to the question text, and determine the target attribute information of the target difference attribute based on the answer text; Delete the current candidate calipers in the candidate caliper set that do not match the target attribute information, so as to update the candidate caliper set.
13. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the index query method according to any one of claims 1 to 11 by executing the computer instructions.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the index query method according to any one of claims 1 to 11.
15. A computer program product, characterized in that, Includes computer instructions for causing a computer to execute the index query method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Intelligent data query method based on natural language
CN121009157A
Query statement generation method and device, equipment, medium and program product
CN121524328A
