Intelligent number asking method, device and system based on semantic data model and large model

By using an intelligent query method based on semantic data models and large models, the problem of training relying on a large amount of labeled data and the need to retrain the logic of newly added tables in existing technologies is solved. This achieves efficient and accurate SQL query generation, improving the accuracy of user intent recognition and data response.

CN121365080AActive Publication Date: 2026-01-20BEIJING DIPU TECH CO LTD

Patent Information

Application Number
CN202511884495.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-01-20
Estimated Expiration
2045-12-15

AI Technical Summary

Technical Problem

Existing intelligent query methods based on Text2SQL technology require a large amount of labeled data for training, and new data and model training are required for new table logic. This results in many defects in the model when in use, making it unable to accurately identify user intent and generate efficient and accurate SQL queries.

Method used

We employ an intelligent query method based on semantic data models and large models. The large model identifies user intent and generates task plans, while MQL information extraction and semantic data models are used to convert the data into SQL queries. This reduces the reliance on data training and improves the accuracy and efficiency of the model.

Benefits of technology

It achieves the ability to accurately identify user intent and generate efficient and accurate SQL queries without retraining the model for newly added table logic, thus improving the accuracy and timeliness of response data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121365080A_ABST
    Figure CN121365080A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent number asking method, device and system based on a semantic data model and a large model, and belongs to the field of artificial intelligence. After a current question of a user is received, a task plan corresponding to the current question of the user is obtained based on the large model, then MQL information extraction is performed based on the task plan to obtain a target MQL, then a word semantic data model converts the target MQL to obtain an SQL query statement, query is performed based on the SQL query statement to obtain reply data, and the reply data is sent to the user. And finally, returning the reply data to the user. According to the technical scheme, the natural language is converted into the MQL through the large model, then the MQL is converted into the SQL through the semantic data model, and compared with a traditional scheme that the natural language is directly converted into the SQL, data training does not need to be carried out; and the large model can accurately identify the user intention, so that the obtained MQL unified semantic layer provides a standard caliber, and the reply accuracy is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular, to an intelligent questioning method, apparatus and system based on semantic data models and large models. Background Technology

[0002] In today's era of rapid internet development, big data analytics has become a trend, adopted by various industries to extract valuable information and assist businesses in making business decisions. However, in daily work, big data analytics faces two major challenges: first, it has a high barrier to entry, requiring both professional development and data analysis skills; second, it suffers from low timeliness and high personalization costs, necessitating professional analysis to generate specific reports. Therefore, with the development of artificial intelligence technology, the research and development direction of semantic analysis based on large models and retrieval technology and transformed into SQL and chart forms for data queries has received attention and development.

[0003] Existing intelligent query methods all generate query SQL directly based on Text2SQL technology. However, this approach requires a large amount of labeled data for training, and for cases involving new table logic, the data needs to be re-labeled and the model retrained. Furthermore, the resulting model has many defects when used. Summary of the Invention

[0004] To overcome the shortcomings of existing technologies, this application provides an intelligent query method, device, and system based on semantic data models and large models. This addresses the problem that existing intelligent query methods directly generate query SQL based on Text2SQL technology, but this approach requires a large amount of labeled data for training. Furthermore, for cases involving new table logic, data needs to be re-labeled and the model needs to be retrained, and the resulting model has many defects when used.

[0005] The technical solution adopted by this application to solve its technical problem is: Firstly, a smart data retrieval method based on semantic data models and large models is provided, including: Receive the user's current question; Based on the large model, the task plan corresponding to the user's current question is obtained; Based on the task planning, MQL information is extracted to obtain the target MQL; The target MQL is transformed into an SQL query statement using a semantic data model; The SQL query statement is used to retrieve the response data, which is then returned to the user.

[0006] As an optional implementation of this application, the step of obtaining the task planning corresponding to the user's current question based on a large model includes: processing the current question of the user, so that the large model identifies the user intent; determining a task type based on the user intent; obtaining a task plan based on the task type, the task plan being a structured task list, each task in the task list specifying a specific processing target and scope.

[0007] As an optional implementation manner of the present application, the processing the current question of the user comprises: replacing the natural language expression of the current question of the user with a standardized equivalent question based on the business knowledge base of the user and the pattern matching library.

[0008] As an optional implementation manner of the present application, the processing the current question of the user comprises: judging whether there is a time element in the current question of the user; if not, obtaining a candidate previous question containing a time element and its corresponding receiving time; supplementing the time value of the candidate previous question with the latest receiving time to the current question of the user.

[0009] As an optional implementation manner of the present application, the processing the current question of the user comprises: obtaining a dimension value in the current question of the user; if there are at least two dimensions corresponding to the target dimension value, retrieving the target dimension value and assembling a complete sentence list to return to the user for confirmation.

[0010] As an optional implementation manner of the present application, the obtaining the target MQL based on the task plan comprises: performing metadata retrieval on each task in the task plan to obtain metadata retrieval information; providing prompt words, MQL field description definitions, metadata retrieval information and examples to the large model to obtain MQL information of the current round in a preset structure; obtaining the target MQL based on the MQL information of the current round.

[0011] As an optional implementation manner of the present application, the obtaining the target MQL based on the MQL information of the current round comprises: judging whether the MQL information of the current round simultaneously includes a time element and an index element; If the time element and the index element are included at the same time, a target MQL is obtained based on the MQL information of the current round; if the time element and the index element are not included at the same time, a corresponding time element or index element in a historical MQL is taken as a time element or index element in the MQL information of the current round, and dimensions included in the current round are compared with dimensions in the historical MQL; If there is the same dimension, the historical dimension value is replaced with the current dimension value; if it is a new dimension, a current dimension value filtering condition is added to the historical MQL to obtain a target MQL.

[0012] As an optional implementation of the application, the method further comprises: After each task is processed, result state information of the task is obtained, the result state information including: completion progress of the task, processing result details, and whether an exception occurs; Based on the result state information, it is determined whether a new task needs to be added; If not, the task execution result is integrated to obtain reply data, which is returned to the user; if yes, a new supplementary task is generated and added to the task list.

[0013] In a second aspect, an intelligent question answering device based on a semantic data model and a large model is provided, comprising: A user question receiving module is configured to receive a current user question; A task planning obtaining module is configured to obtain a task planning corresponding to the current user question based on a large model; An MQL information extracting module is configured to extract MQL information based on the task planning to obtain a target MQL; An SQL statement converting module is configured to convert the target MQL into an SQL query statement using a semantic data model; An SQL query executing module is configured to perform a query based on the SQL query statement to obtain reply data, and return the reply data to the user.

[0014] In a third aspect, an intelligent question answering system based on a semantic data model and a large model is provided, comprising: At least one processor and at least one memory; The memory stores executable instructions of the processor; The processor is configured to execute the intelligent question answering method based on the semantic data model and the large model.

[0015] Advantages: The technical scheme of the application provides an intelligent query method, device and system based on a semantic data model and a large model. After receiving a current query sentence of a user, a task plan corresponding to the current query sentence of the user is obtained based on a large model, then MQL information extraction is performed based on the task plan to obtain a target MQL, and then the target MQL is converted to obtain an SQL query statement based on a word semantic data model, query is performed based on the SQL query statement to obtain reply data, and finally the reply data is returned to the user. The technical scheme of the application converts natural language into MQL by using a large model, and then converts the MQL into SQL by using a semantic data model. Compared with the traditional scheme of directly converting natural language into SQL, the technical scheme of the application does not need to train data, and the large model can accurately identify the user's intention, so that the MQL unified semantic layer provides a standard caliber, greatly improving the reply accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0017] Figure 1 It is a flow chart of an intelligent query method based on a semantic data model and a large model provided by the embodiment of the present application. Figure 2 It is a structural schematic diagram of an intelligent query device based on a semantic data model and a large model provided by the embodiment of the present application. Figure 3 It is a flow implementation schematic diagram of an intelligent query system based on a semantic data model and a large model provided by the embodiment of the present application. Figure 4 It is a flow chart of MQL slot updating provided by the embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical scheme and advantages of the present application more clear, the technical scheme of the present application will be described in detail below in combination with the drawings and embodiments. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor belong to the scope of protection of the present application.

[0019] The existing intelligent query scheme has obvious defects that cannot be solved: 1. The ambiguity and diversity of natural language have no standard caliber definition, and the user's intention cannot be correctly understood.

[0020] 2. Cannot guarantee the performance of SQL generation, especially when querying on large-scale databases, performance may become a bottleneck, and query generation and execution efficiency need to be optimized.

[0021] 3. Performance decreases significantly in multiple rounds, and cannot continuously track user intent.

[0022] 4. The generated SQL cannot guarantee accuracy and performance requirements, and cannot be directly used by business users.

[0023] To solve the above problems, with reference to Figure 1 The embodiments of the present application provide an intelligent question method based on a semantic data model and a large model, comprising: S11: receiving a user current question. The user current question is a question input in natural language. It should be noted that the present application pre-stores user-defined indicators and dimensions.

[0024] S12: obtaining a task plan corresponding to the user current question based on a large model; specifically as follows: processing the user current question so that the large model can identify the user intent; determining the task type based on the user intent; wherein the task type is pre-defined based on the business, and can be set according to the business requirements. For example: indicator question type task: asking for indicators and dimensions within a specified time range, such as "today's sales" and "yesterday's sales of Nanshan store". Attributive analysis task: a task of attributive analysis of indicators and dimensions, such as "why did the sales decrease this quarter".

[0025] obtaining a task plan based on the task type, the task plan being a structured task list, each task in the task list specifying a specific processing target and range. Each task type is generally divided in the same way, and the task plan can be obtained in combination with the specific data involved in the question.

[0026] It can be understood that the question input by the user may be expressed in different words due to personal habits, etc., although the large model can recognize it, but it may be different from the data stored in the database. Therefore, in order to facilitate the identification of the large model and the accuracy of the subsequent results, the user current question needs to be processed.

[0027] For example, the natural language expression of the user current question is replaced by a standardized equivalent question based on the user's business knowledge base and pattern matching library.

[0028] Or, it is judged whether there is a time element in the current question of the user; if not, the candidate previous question containing the time element and the corresponding receiving time are obtained; and the time value of the candidate previous question with the latest receiving time is supplemented to the current question of the user. Because in intelligent questioning, the user will conduct multiple rounds of questioning and answering, for example, the user first asks: How many men's shoes were sold in June this year? After replying to the user's question, the user may directly input "which women's shoes", which implies the sales volume of women's shoes in June this year. If only "which women's shoes" is used for subsequent processing, the result obtained is actually not what the user wants. Therefore, the context of the present application rewrites the current user query time to make the question more in line with the user's current real intention.

[0029] Or, the dimension value in the current question of the user is obtained; if there are at least two dimensions corresponding to the target dimension value, the target dimension value is retrieved and recalled to assemble a complete sentence list returned to the user for confirmation. When there are at least two dimensions corresponding to the target dimension value, it means that there are multiple mappings of the target dimension value, so the user's intention is also multiple. For example, the question "B's sales volume", there is B store in the preset dimension of the present application, and there is also a salesperson called B. At this time, two dimensions are corresponded. At this time, the query question of the two dimensions can be returned to the user for confirmation.

[0030] S13: obtaining a target MQL based on the task planning for MQL information extraction; specifically, metadata retrieval information is obtained by performing metadata retrieval on each task in the task planning; for example, through full matching and substring matching algorithm, the basic indicators involved in the current problem are found, such as same period yesterday sales, sales volume, the same period sales and sales volume indicators configured by the system are found. Then find the corresponding dimension and dimension value sample of the index configuration.

[0031] It should be noted that MQL (Metrics Query Language, Metrics Query Language) is a special language specially used for querying, retrieving, analyzing and aggregating monitoring index data. It is structured semantics, which converts natural semantics into MQL for easy verification. In addition, the data in MQL is divided into time elements, dimension elements and index elements. And for each index, the calculation method is defined in advance, so it can be applied to different business scenarios.

[0032] The prompt word, MQL field description definition, metadata retrieval information and sample are provided to the large model to obtain the MQL information of the current round of the preset structure; that is, a unified MQL query structure is defined, and then the definition of each field description in the MQL, as well as the prompt word, source data retrieval information and sample are provided to the large model, and the large model can obtain the MQL information of the current round. Exemplarily, the unified MQL query structure includes: a list of indicators to be queried, analysis dimension configuration, result sorting configuration, result set quantity limit, dimension filtering configuration and date dimension special configuration.

[0033] Among them, the prompt word adopts different pre-defined prompt words based on specific task types.

[0034] MQL field description defines the role of each field in the MQL query structure and the extraction / configuration rules. For example, the role of the MQL query structure is to define the core business indicators (such as sales, order quantity) that need to be calculated and analyzed, which is the query target of MQL. The extraction rule is in list format, with elements as "uniform semantic indicator name" (which needs to be predefined in the underlying metadata, such as "sales" corresponding to the SUM(sale_amount) calculation logic of the underlying data source); the role of the analysis dimension configuration is to define "how to split the data from which angle", the configuration rule is in list format, with elements as "uniform semantic dimension name" (such as "city", "month", "product category"); multi-dimensional combination is supported to realize multi-level analysis, such as ["province", "city", "store"] dimensions need to be associated with data types (defined in the semantic dictionary, such as "city" is a string type and "month" is a date type). The role of the result sorting configuration is to define the sorting rule of the query result to control the data display order. The configuration rule is in array format, with each element as a single sorting condition, supporting multi-condition sorting; a single condition includes: col: sorting field (which needs to be metrics or dimensions field, such as "sales" "city"); orderBy: sorting direction (ASC ascending, DESC descending). The role of the result set quantity limit is to control the number of returned results to avoid large data volume leading to query performance degradation or front-end rendering lag. The configuration rule is numerical, with default value configurable in the system (such as default 100); value range: 0 < limit ≤ 1000 (exceeding the upper limit needs special application to prevent large data volume query from crashing the system); commonly used in "TopN" scenarios (such as "Top 10 cities with the highest sales"). The role of the dimension filtering configuration is to filter data based on the specific values of the dimensions in the analysis dimension configuration, with the configuration rule as a list format, each element as a single filtering condition, supporting multi-condition logical combination; a single condition includes: col: filtering dimension (which needs to be in the analysis dimension configuration, such as "city" "product category"); operator: operator (common: IN contains, NOT IN does not contain, EQ equals, NEQ not equal, LIKE fuzzy match, etc.); value: filtering value (needs to match the dimension data type, such as string type uses ["Beijing", "Shanghai"], numerical type uses [100, 200]). The role of the date dimension exclusive configuration is to separately configure date-related filtering and granularity, as date is the most commonly used analysis dimension, which needs special handling to support flexible time range query.Configuration rule: contains two subfields: granularity: date granularity (time split unit), optional values: ALL (not split, take the full amount), YEAR (year), QUARTER (quarter), MONTH (month), WEEK (week), DAY (day), HOUR (hour); range: date range (filter time interval), such as ["2024-06-25 00:00:00", "2024-07-01 23:59:59"].

[0035] The sample is an MQL extraction example preset in advance for each scenario.

[0036] Obtain a target MQL based on the MQL information of the current round.

[0037] As a preferred implementation manner of an embodiment of the present application, the obtaining of the target MQL based on the MQL information of the current round comprises: It is judged whether the MQL information of the current round simultaneously includes a time element and an index element; that is, the elements in the MQL information in the embodiment of the present application are divided into three kinds: time, index (a parameter used for final calculation), and dimension (a parameter used for describing the index); of course, time can also be used as a dimension, but since time is the most commonly used analysis dimension in intelligent questions, it is separately set.

[0038] If the time element and the index element are simultaneously included, the target MQL is obtained based on the MQL information of the current round; the simultaneous inclusion of the time element and the index element indicates that the current MQL structure is complete, and the MQL can be directly returned. If the time element and the index element are not simultaneously included, for example, the index element is missing, the target to be finally queried is missing, and the MQL cannot be returned; if the time element is missing, the MQL information returned may be too much.

[0039] Therefore, if the time element and the index element are not included at the same time, the corresponding time element or index element in the historical MQL is taken as the time element or index element in the MQL information of the current round, and the dimensions included in the current round are compared with the dimensions in the historical MQL; because the time element or the index element is not included at the same time, it is indicated that the previous question or the previous question has included the missing time element or the index element, so the corresponding element in the historical MQL can be directly taken as the element of the current round. It can be understood that the historical MQL refers to the MQL closest to the current round and containing the corresponding missing element (the missing time element and / or index element of the current round). And the comparison dimension is because a new dimension may be added. For example, the historical question of the user is "sales in Shenzhen in June (time element) is how much", and the current question is "what about May", at this time, the index is missing, but the dimension has no new dimension. And if the current question is "what about Guangzhou", at this time, the time and the index are missing, but the dimension is a new dimension. Therefore, it is necessary to determine whether the dimensions are the same.

[0040] If there is the same dimension, the historical dimension value is replaced with the current dimension value; if it is a new dimension, the current dimension value is added to the historical MQL to obtain the target MQL.

[0041] In addition, after each task processing is completed, the result state information of the task is obtained, and the result state information includes: the completion progress of the task, the processing result details, whether an exception occurs; Based on the result state information, it is determined whether a new task needs to be added; If not, the task execution result is integrated to obtain the reply data and returned to the user; if needed, a new supplementary task is generated and added to the task list.

[0042] S14: The target MQL is converted to obtain an SQL query statement by using a semantic data model; the semantic data model is pre-trained, but because the MQL is structured and unified semantic data, it is more convenient to train than natural semantics.

[0043] S15: The reply data is obtained based on the SQL query statement, and the reply data is returned to the user.

[0044] It is to be understood that any process or method described in flow diagrams or otherwise described herein can be understood as representing code modules, segments, or portions of code that include one or more executable instructions for implementing specific logic functions (or steps) in the process, and alternate implementations are possible. The description herein of the preferred implementation of the application should not be interpreted as a limitation on the scope of the application. The spirit and scope of the application are defined solely by the appended claims.

[0045] Moreover, in the description herein, any use of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that a particular feature, structure, material, or characteristic is included in at least one embodiment or example of the present application, and the appearances of such phrases in various places in the specification are not necessarily referring to the same embodiment or example. Furthermore, the described specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0046] The intelligent question and number method based on the semantic data model and the large model provided by the embodiments of the present application, after receiving the current question of the user, obtains the task planning corresponding to the current question of the user based on the large model, then performs MQL information extraction based on the task planning to obtain the target MQL, and then the semantic data model converts the target MQL to obtain the SQL query statement, performs query based on the SQL query statement to obtain the reply data, and finally returns the reply data to the user. The technical scheme of the present application converts natural language into MQL by using a large model, and then converts MQL into SQL by using a semantic data model. Compared with the traditional scheme of directly converting natural language into SQL, it is not necessary to train the data; and the large model can accurately identify the user's intention, so that the MQL unified semantic layer provides a standard caliber, which greatly improves the reply accuracy.

[0047] Based on the same inventive concept, as Figure 2 The present application provides an intelligent question and number device 20 based on a semantic data model and a large model, comprising: A user question receiving module 21 is configured to receive a current question of a user.

[0048] A task planning obtaining module 22 is configured to obtain a task planning corresponding to the current question of the user based on a large model. The task planning corresponding to the current question of the user is obtained based on the large model, comprising: processing the current question of the user, so that the large model identifies the user's intention; determining the task type based on the user's intention; obtaining a task plan based on the task type, the task plan being a structured task list, each task in the task list specifying a specific processing target and scope.

[0049] The processing of the current question of the user includes: Based on the user's business knowledge base and pattern matching library, the natural language expression of the current question of the user is replaced by a standardized equivalent question.

[0050] And / or, determining whether there is a time element in the current question of the user; if not, obtaining candidate previous questions containing time elements and their corresponding receiving times; supplementing the time value of the candidate previous question with the latest receiving time to the current question of the user.

[0051] And / or, obtaining the dimension value in the current question of the user; if there are at least two dimensions corresponding to the target dimension value, retrieving the target dimension value and assembling it into a complete sentence list to return to the user for confirmation.

[0052] Further comprising: After each task is processed, obtaining the result state information of the task, the result state information including: the completion progress of the task, the processing result details, whether an exception occurs; Determining whether a new task needs to be added based on the result state information; If not, integrating the task execution results to obtain reply data and returning the reply data to the user; if so, generating a new supplementary task and adding it to the task list.

[0053] The MQL information extraction module 23 is configured to extract target MQL based on the task plan. The MQL information extraction module 23 is configured to extract target MQL based on the task plan. Retrieving metadata for each task in the task plan to obtain metadata retrieval information; providing prompt words, MQL field description definitions, metadata retrieval information and examples to the large model to obtain MQL information of the current round in a preset structure; obtaining target MQL based on the MQL information of the current round.

[0054] Specifically, determining whether the MQL information of the current round includes time elements and index elements at the same time; If the time element and the index element are included at the same time, a target MQL is obtained based on the MQL information of the current round; if the time element and the index element are not included at the same time, a corresponding time element or index element in a historical MQL is taken as a time element or index element in the MQL information of the current round, and dimensions included in the current round are compared with dimensions in the historical MQL; if there is a same dimension, a historical dimension value is replaced with a current dimension value; if it is a new dimension, a current dimension value filtering condition is added to the historical MQL to obtain the target MQL.

[0055] The SQL statement conversion module 24 is configured to convert the target MQL into an SQL query statement by using a semantic data model.

[0056] The SQL query execution module 25 is configured to perform a query based on the SQL query statement to obtain reply data, and return the reply data to the user.

[0057] Based on the same inventive concept, the embodiments of the present application provide a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program is executed by a processor to implement the steps of the intelligent query method based on a semantic data model and a large model according to any one of the above embodiments.

[0058] It should be understood that parts of the present application can be realized by hardware, software, firmware or a combination thereof. In the above embodiments, a plurality of steps or methods can be realized by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if realized by hardware, and as in another embodiment, any one or a combination of the following technologies known in the art can be used: discrete logic circuit with logic gate circuit for implementing logic function on data signals, application specific integrated circuit with suitable combination logic gate circuit, programmable gate array (PGA), field programmable gate array (FPGA), etc.

[0059] Those skilled in the art of the present technology can understand that all or part of the steps carried out by the above-mentioned embodiment methods can be completed by a program instructing related hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it includes one of the steps of the method embodiment or a combination thereof.

[0060] In addition, each of the functional units in each of the embodiments of the present application can be integrated in one processing module, or each unit can be physically present separately, or two or more units can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software functional module. When the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium.

[0061] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0062] The computer readable storage medium provided by the embodiments of the present application stores a computer program, and the computer program is executed by a processor to implement the steps of the intelligent query method based on the semantic data model and the large model provided by any of the above embodiments. Thus, after receiving the current question of the user, the task planning corresponding to the current question of the user is obtained based on the large model, then the target MQL is obtained by MQL information extraction based on the task planning, then the SQL query statement is obtained by converting the target MQL by the word semantic data model, the reply data is obtained by querying based on the SQL query statement, and finally the reply data is returned to the user. The technical scheme of the present application converts natural language into MQL by using a large model, and then converts MQL into SQL by using a semantic data model. Compared with the traditional scheme of directly converting natural language into SQL, it does not need to train the data; and the large model can accurately identify the user's intention, so that the MQL obtained by the unified semantic layer provides a standard caliber, which greatly improves the reply accuracy.

[0063] Based on the same inventive concept, the present application also provides an intelligent query system based on a semantic data model and a large model, comprising: at least one processor and at least one memory; The memory stores executable instructions of the processor; The processor is configured to execute the intelligent query method based on the semantic data model and the large model provided by the above embodiments.

[0064] The overall technical scheme of the system is shown in the schematic diagram as Figure 3 As shown, it mainly includes three modules, namely, an intention recognition layer, an MQL information extraction layer and a data query layer.

[0065] I. Intention recognition layer The intention recognition layer mainly includes an intention enhancement module, a time rewriting module, a retrieval recall module and a task planning module.

[0066] Intention enhancement module: based on the user's business knowledge base, pattern matching library, the natural language expression of the input question is replaced by the standardized equivalent question, the expression form of the demand intention is unified, and the influence of expression difference on subsequent recognition is reduced.

[0067] Time rewriting module: rewrite the current user query time combined with the context, which is more in line with the user's current real intention. The reasons for setting the time rewriting module are as follows: 1. Different enterprises have different requirements for time range, such as this week is Monday to Sunday, or Monday to Friday, so a specific module is needed to handle time uniformly. 2. Model understanding ability best practice, especially mixing multiple rounds of time recognition with other content together is easy to make mistakes. Unlike traditional question and answer systems, intelligent questions usually have multiple rounds of questions and answers, so users usually change indicators or dimensions to omit time in the next round after the input of the previous round of inquiry with time, indicators and dimensions. If there is no time question, the data retrieval will increase, and the final result may not be accurate. Therefore, the time rewriting module is introduced.

[0068] Through the time rewriting module and the intention increasing module, the natural language question input by the user can be converted into a standard structure question.

[0069] Retrieval recall module: use built-in matching algorithms to recall the dimension values involved in the user's question to clarify the user's intention.

[0070] For example, use the built-in matching algorithm of es, the steps are as follows: 1. Initialize the detected dimension values that may conflict with the dimension to store in es, such as asking for the sales of brand A in Shenzhen today, where Shenzhen can be both a district dimension and a city dimension in user definition, so the user's intention is not clear.

[0071] 2. es retrieves the conflicting dimension values and assembles them into a complete sentence list for the user to clarify, such as

today the sales of brand A in the district of Shenzhen, today the sales of brand A in the city of Shenzhen

[0072] 3. User confirmation selection, if you choose "today the sales of brand A in the city of Shenzhen", the dimension intention is confirmed as: city is Shenzhen.

[0073] 4. Crop the question, continue to provide the unconfirmed intention question for downstream recognition, such as "today the sales of brand A". At this time, both intentions are considered as user intentions for subsequent operation.

[0074] Task planning module: combined with large model task planning, ReAct and function calling technology, identify the user's real intention, select the appropriate tool and extract the corresponding parameters for subsequent use; 1. Initialize the following multiple intent tasks (i.e. identify task types) a. Index question: Ask questions about the specified time range index and dimension, such as "Today's sales" and "What percentage of sales did the Nanshan store make yesterday?"

[0075] b. Causality analysis: Conduct causality analysis on the index and dimension, identify fluctuation reasons, change trends and influencing factors.

[0076] c. System asset information query: Ask about system configuration index, dimension and other asset information.

[0077] d. Index recommendation: For the a scene, if there is no clear index, recommend the most relevant index.

[0078] d. Refusal: All other questions unrelated to index questions.

[0079] 2. Adopt Plan-and-Execute ReAct technology, which can complete the decomposition of complex tasks by optimizing planning and task execution processes.

[0080] a. The Plan phase first receives the user's input query requirements or instructions, and at the same time obtains the unified semantic metadata information already sorted in the system — this part of metadata specifically includes various types of indicators (such as sales, sales volume, etc.) and dimension data (such as city dimension, commodity dimension, etc.) defined by the user in advance. These information will serve as the basis data support for subsequent task processing, ensuring the consistency of the entire process in understanding and processing user requirements.

[0081] b. After obtaining user input and metadata, the system will analyze the user's true intent (including the user's explicit requirements and potential implicit requirements), and decompose complex requirements into a series of executable specific tasks, forming a structured task list, each task clearly defines the specific processing target and scope.

[0082] c. For different tasks in the task list, the system will distribute them to the corresponding special processing logic modules in the MQL (Metadata Query Language) information extraction layer according to the nature of the tasks (such as data query, index calculation, dimension analysis, etc.) — different processing logic modules are optimized for specific types of tasks to ensure the accuracy and efficiency of task processing.

[0083] d. After each task is completed in the MQL information extraction layer, the Single-task agent updates the task's result status information in real time, including but not limited to the task's completion progress, processing result details, whether an exception occurs, etc. The updated status information will be synchronized to the system's global state management module, providing the latest and most accurate decision-making basis for task re-planning in the next stage (Replan stage).

[0084] e. The Replan stage mainly decides the subsequent operation based on the real-time status of task processing, which can be divided into two cases: The first case: If the system determines that there is no need to add new tasks based on the completion status and results of the current task list (i.e., the processing results of existing tasks have completely covered and met the user's needs), the integrated final results will be directly fed back to the user.

[0085] The second case: If the analysis of the execution of the task list and the returned result status shows that the processing results of existing tasks have not fully met the user's needs (e.g., there is missing information, incomplete data, or the need for further in-depth analysis, etc.), the system will automatically generate new supplementary tasks and add them to the task list. Then, the entire process will re-enter the cycle of task distribution, processing, and status updating until all task processing results fully meet the user's needs.

[0086] II. MQL Information Extraction Layer Mainly includes the following modules: Metadata Retrieval: 1. Find the basic indicators involved in the current problem through full matching and substring matching algorithms, such as: same period yesterday sales, sales volume, find the system configured same period sales, same period sales volume indicators.

[0087] 2. Find the corresponding dimensions and dimension value samples of the indicator configuration.

[0088] Dynamic Prompt and MQL Extraction: The unified semantic MQL query structure design and different field description examples are as follows: The definitions and functions of each field are as follows: metrics: list of indicators to be queried a. Function: Define the core business indicators (such as sales, order volume) that need to be calculated and analyzed, which are the query targets of MQL. b. Extraction rule: list format, elements are "uniform semantic indicator names" (need to be predefined in underlying metadata, such as "sales" corresponding to SUM(sale_amount) calculation logic of underlying data source); support multi-indicator parallel query, such as ["sales", "order quantity", "single order value"]; dimensions: analysis dimension configuration a. Role: define "how to split data from which angle", similar to SQL GROUP BY, such as "split sales by city" "split order quantity by month". b. Configuration rule: list format, elements are "uniform semantic dimension names" (such as "city", "month", "product category"); support multi-dimension combination, realize multi-level analysis, such as ["province", "city", "store"] dimension needs to be associated with data type (defined in semantic dictionary, such as "city" is string type, "month" is date type).

[0089] order: result sorting configuration a. Role: define the sorting rule of query results, control the display order of data. b. Configuration rule: array format, each element is a single sorting condition, support multi-condition sorting; single condition contains: col: sorting field (need to be metrics or dimensions field, such as "sales", "city"); orderBy: sorting direction (ASC ascending, DESC descending); limit: result set quantity limit a. Role: control the number of returned results, avoid large data volume leading to query performance degradation or front-end rendering lag. b. Configuration rule: numerical type, default value can be configured in the system (such as default 100); value range: 0 < limit≤ 1000 (exceeding the upper limit needs special application, to prevent large data volume query from crashing the system); commonly used in "take Top N" scenarios (such as "take Top 10 cities of sales").

[0090] filters: dimension filtering configuration a. Role: filter data based on specific values of dimensions field, similar to SQL WHERE (filter dimension conditions). b. Configuration rules: list format, each element is a single filtering condition, supporting multi-condition logical combination; a single condition contains: col: filtering dimension (must be a field in dimensions, such as "city" and "product category"); operator: operator (common: IN contains, NOT IN does not contain, EQ equals, NEQ not equal, LIKE fuzzy match, etc.); value: filtering value (must match the dimension data type, such as string type using ["Beijing", "Shanghai"], numerical type using [100, 200]); date: date dimension specific configuration a. Function: individually configure date-related filtering and granularity, as date is the most commonly used analysis dimension, it needs to be specially processed to support flexible time range queries. b. Configuration rules: contains two subfields: granularity: date granularity (time splitting unit), optional values: ALL (not split, take the full amount), YEAR (year), QUARTER (quarter), MONTH (month), WEEK (week), DAY (day), HOUR (hour); range: date range (filtering time interval), such as ["2024-06-25 00:00:00", "2024-07-01 23:59:59"] 2. Dynamically combine system prompt words, MQL field description definitions, metadata retrieval information, and few show examples for MQL information extraction, as follows: System prompt: "## Task You are currently an original information extraction expert, according to the given current candidate indicators and current candidate dimensions, extract the input question according to the specified format." MQL field description definition: the above field definition information Metadata retrieval information: retrieve alternative indicators, dimensions, and dimension value information Few show: pre-design multiple scenario MQL extraction examples.

[0091] 3. MQL slot updating strategy In multi-round dialogue scenarios, combined with user question usage habits, task-oriented dialogue slot updating technology is adopted to effectively solve the problem of significant decline in intent and extraction performance caused by excessive historical context.

[0092] The intelligent question scenario is different from the general question and answer, and the context inheritance mainly revolves around the three core elements of time, dimension, and index. Therefore, when dealing with multi-round interaction scenarios, it is not necessary to rely on complete historical context, but only to update the abstract multi-round query language (MQL) in a targeted manner by combining the elements extracted in the current round. This approach can effectively avoid the problem of reduced accuracy of element extraction due to the overload of historical context information. The specific MQL update strategy is as shown in Figure 4 1. First, determine whether the elements extracted in the current round contain the combination of "time + index". If this condition is met, the MQL information extracted in the current round is directly used as the final effective MQL information.

[0093] 2. If the elements extracted in the current round do not meet the "time + index" combination, the MQL information extracted in the current round is traversed. For "non-dimension value filtering" elements (such as index, time, etc.), the corresponding content in the historical MQL is directly replaced with the information extracted in the current round.

[0094] 3. If the "dimension value filtering condition" is extracted in the current round, it is further compared with the dimensions in the historical MQL. If there is the same dimension, the historical dimension value is replaced with the current dimension value; if it is a new dimension, the current dimension value filtering condition is appended to the historical MQL.

[0095] III. Data query layer The core capability is to convert the extracted MQL into a final high-performance query SQL through the SDM model, ensuring data accuracy and timeliness.

[0096] MQL to SQL conversion Semantic Data Model (SDM) is a conceptual model used to represent data and its relationships, making full use of semantic information (i.e., the meaning of data) to better organize and understand data. The core concepts of semantic data model include entities, attributes, and relationships.

[0097] Model (Model) is used to describe entities and dimensions in SDM, presenting a logical view mapping to entity tables, SQL, or table files. It mainly includes data columns, entity dimensions, and relationship definitions between entities. Through it, users can define complex data models, including joining multiple data tables, filtering data, and adding calculation fields, providing powerful support for data analysis.

[0098] ​Metrics describes the metrics in the SDM, including the calculation of the (computational) aggregation based on the model data column or multiple metrics, such as sales, profits, or the number of visitors, etc., through which users can quickly build an enterprise-level metrics system.

[0099] Compared with the traditional natural language to SQL, the scheme of the present application introduces MQL, which can more accurately understand the user's intention through a large model, and then convert it into a relatively simple MQL. Although MQL is relatively simple in form compared with SQL, it is also standard structured data, so the SQL obtained by converting MQL using a semantic data model is more accurate, and it is easier to implement than directly converting SQL from natural language.

[0100] It can be understood that the same or similar parts in the above embodiments can be mutually referred to, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.

[0101] It should be noted that in the description of the present application, the terms "first", "second" and the like are only for the purpose of description, and cannot be understood as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality of" is at least two.

[0102] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.

Claims

1. An intelligent question-and-answer method based on semantic data models and large models, characterized in that, include: Receive the user's current question; Based on the large model, the task plan corresponding to the user's current question is obtained; Based on the task planning, MQL information is extracted to obtain the target MQL; The target MQL is transformed into an SQL query statement using a semantic data model; The SQL query statement is used to retrieve the response data, which is then returned to the user.

2. The method according to claim 1, characterized in that: The task planning based on the large model to obtain the user's current question includes: The user's current question is processed so that the large model can identify the user's intent; The task type is determined based on the user's intent; Based on the task type, a task plan is obtained. The task plan is a structured task list, and each task in the task list specifies the specific processing goal and scope.

3. The method according to claim 2, characterized in that: The processing of the user's current question includes: Based on the user's business knowledge base and pattern matching library, the natural language expression of the user's current question is replaced with a standardized equivalent question.

4. The method according to claim 2, characterized in that: The processing of the user's current question includes: Determine whether there is a time element in the user's current question; If it does not exist, then obtain the candidate preceding question containing time elements and its corresponding receiving time; The time value of the candidate preceding question that was received latest is added to the user's current question.

5. The method according to claim 2, characterized in that: The processing of the user's current question includes: Obtain the dimension values ​​from the user's current question; If a target dimension value corresponds to at least two dimensions, then the target dimension value is retrieved and assembled into a complete sentence list, which is then returned to the user for confirmation.

6. The method according to claim 2, characterized in that: The step of extracting MQL information based on the task planning to obtain the target MQL includes: Metadata retrieval information is obtained by performing metadata retrieval on each task in the task plan; Provide the prompt words, MQL field descriptions and definitions, metadata retrieval information and samples to the large model to obtain the MQL information for the current round with a preset structure; The target MQL is obtained based on the MQL information of the current round.

7. The method according to claim 6, characterized in that: Obtaining the target MQL based on the MQL information of the current round includes: Determine whether the MQL information of the current round includes both time and indicator elements; If both time and indicator elements are included, the target MQL is obtained based on the MQL information of the current round; if neither time nor indicator elements are included, the corresponding time or indicator elements in the historical MQL are used as the time or indicator elements in the MQL information of the current round, and the dimensions included in the current round are compared with the dimensions in the historical MQL. If the same dimension exists, replace the historical dimension value with the current dimension value; if it is a new dimension, append the current dimension value as a filter condition to the historical MQL to obtain the target MQL.

8. The method according to claim 2, characterized in that, Also includes: After each task is completed, the result status information of the task is obtained. The result status information includes: the completion progress of the task, the details of the processing result, and whether any abnormalities have occurred. Based on the result status information, determine whether a new task needs to be added; If not needed, the task execution results will be integrated to obtain the response data and returned to the user; if needed, a new supplementary task will be generated and added to the task list.

9. An intelligent data query device based on semantic data models and large models, characterized in that, include: The user question receiving module is used to receive the user's current question. The task planning acquisition module is used to obtain the task plan corresponding to the user's current question based on the large model. The MQL information extraction module is used to extract MQL information based on the task planning to obtain the target MQL; The SQL statement conversion module is used to convert the target MQL into an SQL query statement using a semantic data model. The SQL query execution module is used to perform a query based on the SQL query statement to obtain response data and return the response data to the user.

10. An intelligent data query system based on semantic data models and large models, characterized in that, include: At least one processor and at least one memory; The memory stores the executable instructions of the processor; The processor is configured to perform the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Analytical processing system supporting natural language analytic questions

    CN111382171A

  • Query statement generation method, related methods, and related devices

    CN113918589A

  • Data query method and device, electronic equipment and storage medium

    CN118861077A

  • Natural language intelligent number asking method and device and storage medium

    CN119025552A

  • Data query method and device based on large language model and medium

    CN119807233A

Cited By

  • Report number asking method and device based on PLM dimension index self-sensing and multi-layer alignment

    CN121786090A

  • A man-machine collaborative analysis method and platform for intelligent question answering in an industrial scene

    CN122240799A