Natural Language Query Methods and Systems Based on Low-Code Platforms
By building a related thesaurus and using a large model to identify query intent in a low-code platform, generating and inspecting SQL query statements, the problem of business users having difficulty querying data efficiently is solved. It achieves accurate conversion and secure execution of natural language to SQL, improving the ease of use of data analysis and the intelligence of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU XUNKU TECH CO LTD
- Filing Date
- 2026-04-21
- Publication Date
- 2026-05-26
AI Technical Summary
In low-code platforms, business users without technical backgrounds find it difficult to query and analyze data efficiently and flexibly. Existing natural language to SQL technologies suffer from problems such as inaccurate semantic mapping, lack of metadata utilization, syntax errors, and security risks in real-world business scenarios.
By building a related thesaurus in a low-code platform, extracting query intent and performing semantic matching using a large model, generating and inspecting SQL query statements, and displaying the results with visualization components, accurate conversion and secure execution of natural language to SQL are achieved.
It improves the ease of use and efficiency of data analysis and querying, increases the success rate and logical correctness of the Text-to-SQL module, ensures system security and intelligence, and enhances accuracy to adapt to complex business scenarios.
Smart Images

Figure CN122086922A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information technology, specifically to a natural language query method and system based on a low-code platform. Background Technology
[0002] Low-code development platforms are widely used in building and iterating business systems due to their advantages such as visual modeling, rapid deployment, and lower technical barriers. In low-code platforms, users typically define data models through a graphical interface, which automatically generates the backend database structure and frontend interactive components. However, despite the increasing richness of data assets, business users without technical backgrounds still find it difficult to efficiently and flexibly query and analyze data. This is mainly because traditional SQL has a high learning curve, and existing reporting or filtering functions lack natural expressiveness and semantic understanding capabilities.
[0003] In recent years, Natural Language to SQL (Text-to-SQL) technology has made significant progress thanks to the development of large language models, but its implementation in real-world business scenarios still faces many challenges. First, general models lack understanding of domain-specific business terminology and data structures, leading to inaccurate semantic mapping. Second, low-code platforms often have rich contextual information in their tables and fields (such as comments, tags, and business mapping relationships), but existing methods have failed to effectively utilize this metadata to build context-aware lexicons. Third, directly generated SQL statements may contain syntax errors, security risks, or performance vulnerabilities, and lack deep integration with platform permission systems and database characteristics. Therefore, further research is needed to support technologies for natural language queries. Summary of the Invention
[0004] This specification describes a natural language query method and system based on a low-code platform through several embodiments.
[0005] Firstly, embodiments of this specification provide a natural language query method based on a low-code platform, including the following steps:
[0006] Read the creation context of the data table and fields in the low-code platform, and generate a related thesaurus of the data table and fields based on the creation context;
[0007] Receive the natural language query statement input by the user, extract the action words and predicate words of the natural language query statement using the pre-connected large model, and obtain the user's query intent based on the action words;
[0008] The predicate word is compared with the associated word database to obtain the matching associated words;
[0009] After replacing the corresponding predicate with the matched associated words, an SQL query statement is generated based on the pre-connected Text-to-SQL module;
[0010] After performing syntax and security checks on the SQL query statement, the SQL query statement is executed to obtain the query results;
[0011] Based on the user's query intent, a visualization component is selected to load and display the query results. The visualization component changes the display method of the query results in response to the user's operation.
[0012] Secondly, embodiments of this specification provide a natural language query system based on a low-code platform, including:
[0013] The reading module reads the creation context of the data table and fields in the low-code platform, and generates a related thesaurus of the data table and fields based on the creation context;
[0014] The receiving module receives the natural language query statement input by the user, extracts the action words and predicate words of the natural language query statement using a pre-accessed large model, and obtains the user's query intent based on the action words;
[0015] The matching module compares the predicate word with the associated word library to obtain the matching associated words;
[0016] The generation module replaces the corresponding predicate with the matched associated words and then generates an SQL query statement based on the pre-connected Text-to-SQL module.
[0017] The execution module performs syntax and security checks on the SQL query statement, executes the SQL query statement, and obtains the query results.
[0018] The visualization module selects a visualization component to load and display the query results based on the user's query intent. The visualization component changes the display method of the query results in response to the user's operation.
[0019] Thirdly, embodiments of this specification provide an electronic device, including a processor and a memory;
[0020] The processor is connected to the memory;
[0021] The memory is used to store executable program code;
[0022] The processor runs a program corresponding to the executable program code stored in the memory to perform the method described in any of the above aspects.
[0023] Fourthly, embodiments of this specification provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in any of the above aspects.
[0024] Fifthly, embodiments of this specification provide a computer program product, including a computer program that, when executed by a processor, implements the methods described in any of the above aspects.
[0025] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0026] In several embodiments of this specification, the provided natural language query method and system based on a low-code platform analyzes the creation context of data tables and fields in the low-code platform to construct a related thesaurus for specific business scenarios. This improves the semantic alignment accuracy from natural language to database fields, helping to solve the problem of insufficient accuracy of general Text-to-SQL models in vertical domains. By semantically matching and dynamically replacing predicates with business reference thesaurus, a reliable mapping is established between natural language expressions and underlying data structures, significantly improving the generation success rate and logical correctness of the Text-to-SQL module. Multiple security checks, including syntax verification, access control, and injection protection, are introduced before SQL execution to ensure enterprise-level security while opening the natural language interface. Combining the action word recognition and intent classification capabilities of a large language model, and introducing dependency parsing and zero-shot disambiguation mechanisms, the system can accurately capture the user's true query intent, providing structured guidance for subsequent SQL generation and visualization, and improving the intelligence and accuracy of the response.
[0027] Other features and advantages of various embodiments of this specification will be further revealed in the following detailed description and accompanying drawings. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a diagram illustrating the natural language query provided in this manual.
[0030] Figure 2 This is a flowchart illustrating the natural language query method provided in this manual.
[0031] Figure 3 This is a flowchart illustrating the method for generating data tables and fields associated with the thesaurus provided in this manual.
[0032] Figure 4 This is a flowchart illustrating the method for obtaining user query intent provided in this manual.
[0033] Figure 5 This is a flowchart illustrating the method for generating SQL query statements provided in this manual.
[0034] Figure 6 This is a flowchart illustrating the syntax and security check process provided in this manual.
[0035] Figure 7 This is a schematic diagram of the natural language query system provided in this specification.
[0036] Figure 8 This is a schematic diagram of the electronic device provided in this manual. Detailed Implementation
[0037] The technical solutions of the embodiments of this specification will be explained and described below with reference to the accompanying drawings. However, the following embodiments are only preferred embodiments of this specification and not all of them. Other embodiments obtained by those skilled in the art based on the embodiments in the implementation methods without creative effort are all within the protection scope of this specification.
[0038] The terms "first," "second," "third," etc., in the description, claims, and accompanying drawings are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0039] In the following description, terms such as “inner,” “outer,” “upper,” “lower,” “left,” and “right” are used only to facilitate the description of the embodiments and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this specification.
[0040] All data involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0041] Before introducing the technical solutions described in this manual, the application scenarios and related technologies of the technical solutions will be introduced.
[0042] Low-code platforms are software development environments that significantly reduce the need for traditional hand-written code through graphical interfaces, drag-and-drop components, and pre-built logic modules, thereby accelerating application development and reducing reliance on specialized programming skills. Low-code platforms are typically geared towards business users or junior developers, enabling them to quickly build application functionalities such as data forms, workflows, and reporting dashboards. In enterprise digital transformation, low-code platforms are widely used for internal tool development, process automation, and data management scenarios due to their agility, configurability, and integration capabilities. Especially in systems involving large amounts of structured data operations, low-code platforms often have built-in capabilities such as data modeling, access control, and visualization, providing support for upper-level business logic.
[0043] Text-to-SQL is a natural language processing technology designed to automatically convert user query intent expressed in natural language into Structured Query Language (SQL) statements. Text-to-SQL integrates semantic understanding, database schema awareness, and syntax generation, requiring the model to not only understand the user's expression but also accurately map it to the table structure, field names, and business meanings of a specific database. In recent years, with the development of large language models, the accuracy and generalization ability of Text-to-SQL have significantly improved, especially when combined with contextual information (such as table comments, field aliases, and historical query patterns), enabling more reliable generation of SQL that matches the user's actual needs. However, manual review and confirmation are still generally required before the SQL query can be submitted.
[0044] Therefore, this specification provides a data query method and system based on a low-code platform. By integrating Text-to-SQL capabilities into the low-code platform, non-technical personnel can directly interact with data through natural language, greatly improving the ease of use and efficiency of data analysis and querying. Please refer to the appendix. Figure 1 The platform receives query requests input by users in natural language, parses the natural language using its built-in semantic understanding module, and identifies key elements such as query intent, target fields, filtering conditions, and aggregation operations. Then, the low-code platform combines the metadata information of the currently connected database 40, including table structure, field types, primary and foreign key relationships, and business comments, to map the parsed results into a Structured Query Language (SQL) statement conforming to the syntax specifications of database 40. Based on this, the low-code platform executes the generated SQL statement, obtains the query results, and presents them to the user in a visual manner. The entire process requires no code writing or modification by the user, enabling business personnel without database 40 expertise to efficiently and accurately complete complex data query tasks, thereby improving the usability and intelligence of the low-code platform in data analysis and interaction scenarios.
[0045] This manual first provides a natural language query method based on a low-code platform; please refer to the appendix. Figure 2 The steps include:
[0046] Step S1) Read the creation context of the data table and fields on the low-code platform, and generate a related thesaurus 20 of the data table and fields based on the creation context.
[0047] The creation context of data tables and fields on a low-code platform includes the metadata information of the data table, the structured definition information of the fields, the mapping relationship between the fields and multiple business terms, and the user-defined custom tags.
[0048] Please see the appendix Figure 3 The method for generating the related thesaurus 20 of data tables and fields based on the created context includes:
[0049] Step S11) Semantic parsing is performed on the metadata information and structured definition information of the fields in the data table to extract keywords from the table name, field names, field comments, and default values as initial candidate words. The low-code platform performs deep semantic parsing on the metadata information and structured definition information of the fields in the data table to extract representative keywords as initial candidate words. For example, if a data table is named "sales_order" and contains a field "order_date" with the comment "customer order date", and the default value is the current date, the platform will include words such as "sales_order", "order", "date", "order", and "customer order" in the candidate word set to form preliminary semantic anchors.
[0050] Step S12) Based on the mapping relationship between the fields and multiple business terms, establish a synonym mapping between commonly used business expressions and fields to form a synonym set. Utilizing the pre-defined mapping relationship between fields and business terms, establish synonym associations between commonly used but non-technical expressions and underlying fields. For example, in a retail business scenario, business personnel are accustomed to using "transaction time" rather than "transaction_timestamp" to refer to the time field where a transaction occurs. The platform then uniformly maps expressions such as "transaction time," "transaction moment," and "order placement time" to the "transaction_timestamp" field, constructing a synonym set oriented towards business language, thereby bridging the gap between technical field naming and user language habits.
[0051] Step S13) Based on user-defined custom tags and historical query logs, high-frequency query patterns are identified through clustering. Common multi-table join patterns are then derived from these patterns, and the relevant fields are associated with each join pattern. Combining user-defined custom tags (such as "high-value customers," "quarterly active customers," etc.) and historical query logs, high-frequency query patterns are identified through clustering analysis. For example, if a large number of users frequently query "view the total order amount of high-value customers last quarter," the platform can identify that this pattern typically involves a join between the "customer" and "order" tables, and associates fields such as "customer_value_tag," "order_amount," and "order_date." Based on these patterns, the low-code platform derives commonly used multi-table join paths (such as associating the customer and order tables through customer_id), and incorporates these join logics and their involved fields into the association thesaurus 20. This ensures that the thesaurus not only contains single-field semantics but also reflects the contextual structure of cross-table queries. A dynamic thesaurus was constructed that integrates technical metadata, business terminology, user habits and query behavior20, providing accurate semantic support for subsequent natural language understanding and SQL generation, and significantly improving the accuracy and adaptability of Text-to-SQL in complex business scenarios.
[0052] Step S2) Receive the user's input natural language query statement 10, and use the pre-connected large model to extract the action words and predicate words 11 of the natural language query statement 10. Obtain the user's query intent 12 based on the action words. Parse the user's input natural language query statement 10 and identify the explicit query intent 12. Relying on the pre-connected large model, perform semantic understanding of the natural language, and extract the action words (such as "view", "statistics", "compare", "export", etc.) and predicate words 11 (such as "greater than", "equal to", "contains", etc.). The words directly reflect the type of operation the user wants to perform. When the user inputs "Which customers had sales exceeding 100,000 yuan last month?", the low-code platform extracts the action word "which" and the predicate word 11 "exceeds" through the large model, and initially judges that the user's intent may involve "filtering" or "listing" operations.
[0053] Please see the appendix Figure 4 The method for obtaining the user's query intent 12 based on the action words includes:
[0054] Step S21) Match the action word with a predefined intent classification library to obtain multiple candidate intents and their matching degrees.
[0055] The extracted action words are matched against a predefined intent classification library. This library typically includes standard intent categories such as "aggregation statistics," "conditional filtering," "sorting queries," and "multi-table joins." In this example, "which ones" might match both "conditional filtering" and "data enumeration" intents. Semantic similarity is calculated for each match, generating multiple candidate intents and their corresponding matching scores.
[0056] Step S22) Using the zero-shot capability of the pre-accessed large model, perform dependency parsing and semantic role labeling on the natural language query statement 10 input by the user. Based on the results of dependency parsing and semantic role labeling, perform intent ambiguity identification on multiple candidate intents and eliminate candidate intents with ambiguity.
[0057] Relying solely on keyword matching can easily lead to ambiguity. For example, if a user inputs "compare the sales of product A and product B," the action word "compare" could simultaneously point to two different intentions: "difference analysis" or "parallel display." To address this, in step S22), the low-code platform utilizes the zero-shot reasoning capabilities of the large model to perform dependency parsing and semantic role labeling on the original natural language query statement 10. Dependency parsing reveals the grammatical dependencies between sentence components (such as subject-verb, verb-object, and modifiers), while semantic role labeling identifies semantic roles such as initiator, receiver, time, place, and comparison object. Combining these two analyses, the platform can determine whether "compare" in this context involves numerical difference calculation or simply requires side-by-side presentation. If the analysis shows that the sentence structure emphasizes "differences between the two," the "difference analysis" intention is retained; if it's merely a parallel mention, "parallel display" is preferred. Through this context-aware semantic disambiguation mechanism, the platform eliminates unreasonable candidate intentions, effectively avoiding misjudgments.
[0058] Step S23) Obtain the user's query intent 12 based on the remaining candidate intents and their matching degrees.
[0059] After disambiguation, the remaining candidate intents and their matching degrees are selected, with the intent having the highest matching degree and the most semantic consistency being chosen as the user's final query intent 12. Taking the aforementioned question "Which customers had sales exceeding 100,000 yuan last month?" as an example, after disambiguation, the "conditional filtering" intent is confirmed as the final intent because it highly matches the syntactic structure (a question led by "which" + a conditional clause). This accurate intent recognition result lays a reliable foundation for subsequent field mapping, condition construction, and SQL generation, enabling the low-code platform to transform ambiguous natural language into clearly structured and semantically accurate data manipulation instructions without manual intervention.
[0060] Step S3) Compare the predicate word 11 with the associated word library 20 to obtain the matching associated word 13.
[0061] Specific methods include:
[0062] The semantic similarity between the predicate word 11 and the business reference words in the associated thesaurus 20 is calculated using a pre-accessed vectorized embedding model to obtain the semantic similarity.
[0063] Associate word 13 with a semantic similarity higher than a preset threshold is selected as the matched associate word 13.
[0064] The predicate word 11 extracted from the user's natural language query 10 is semantically aligned with the previously constructed related word library 20 to identify the field or condition expression corresponding to the predicate word 11 in the specific business data context. Semanticity is measured using pre-connected vectorized embedding models (such as Sentence-BERT, text2vec, etc.). First, the predicate word 11 in the user input (e.g., "higher than", "belongs to", "contains", "occurs in", etc.) is converted into a high-dimensional semantic vector using the embedding model; simultaneously, each business reference word stored in the related word library 20 (including field names, field comments, business terms, custom tags, etc.) has also been pre-encoded into a vector representation in the same semantic space. Then, the platform calculates the semantic similarity between the predicate word 11 vector and the business reference word vectors in the library, typically using cosine similarity as the metric.
[0065] When a user inputs "orders with sales exceeding 500,000", the predicate word 11 is "greater than". The low-code platform vectorizes "greater than" and compares its similarity with the vectors of business reference words in the related word library 20, such as "amount", "order_total", "transaction amount", "transaction volume", and "value exceeding". Although "greater than" itself is not a field name, its semantics are highly related to fields representing numerical comparisons (such as "order_total") and their business expressions (such as "transaction amount"). If the semantic similarity score between "greater than" and "order_total" is 0.82, and the preset threshold is 0.75, then this field is determined to be a matching related word 13.
[0066] When the related thesaurus 20 has already created context or recorded historical logs to include mapping clues between metaphorical expressions and related fields, it can also effectively handle synonyms, near-synonyms, and even metaphorical expressions. For example, if a user says "which customers owe money," where "owes money" is not a field name in database 40, the low-code platform can associate it with fields and conditions such as "outstanding_balance > 0" or "payment_status = 'outstanding'" through the semantic generalization capability of the embedding model.
[0067] Step S4) After replacing the corresponding predicate word 11 with the matched associated word 13, generate an SQL query statement 31 according to the pre-accessed Text-to-SQL module 30.
[0068] Please see the appendix Figure 5 Specifically, it includes:
[0069] Step S41) Input the natural language query statement 10 after the predicate 11 has been replaced, along with the creation context, into the Text-to-SQL module 30;
[0070] Step S42) Obtain the SQL query statement 31 based on the output of the Text-to-SQL module 30.
[0071] The accuracy of the natural language query statement 10 after the predicate 11 is replaced by the conjunction 13 can ultimately be converted into the accuracy of the SQL query statement 31. This conversion is performed through the pre-connected Text-to-SQL module 30.
[0072] The low-code platform takes the natural language query statement 10, which has already been matched and replaced with the business reference terms in the related thesaurus 20 (e.g., "departments with profits higher than 500,000 last quarter"), and replaces "higher than" with the field name of database 40 or a business concept such as "profit>500,000", and inputs it into the Text-to-SQL module 30 along with the necessary creation context. The creation context includes information such as the data table, field list, and time range selected by the user during the query. For example, the natural language query statement 10 entered by the user is "display all customers whose order amount exceeds 1,000 yuan in the past year", and "exceeds" has been replaced with the corresponding database 40 operator ">", while the context specifies that the tables involved are "orders" and "customers", and this information will be used as input.
[0073] The Text-to-SQL module 30 generates corresponding SQL query statements 31 based on the optimized natural language query input and the creation of context. The Text-to-SQL model can be implemented using techniques already disclosed in the art. As a recommended approach, it utilizes publicly available Large Language Model (LLM) + Prompting techniques, specifically leveraging LLMs such as GPT, Claude, Qwen, and CodeLlama to generate SQL using prompting techniques like Few-shot, Chain-of-Thought (CoT), and Self-Consistency. High performance is achieved without training, relying solely on contextual examples. This is currently the mainstream solution in the industry, particularly suitable for rapid deployment. While the accuracy is high, manual correction is still generally required before submitting the SQL. The technical solution provided in this embodiment, by combining relevant information from low-code platforms, further enhances the accuracy of the generated SQL, achieving high accuracy with virtually no need for manual correction.
[0074] When there are multiple matching related terms 13, the SQL query statement 31 is executed, and the method to obtain the query results includes:
[0075] The predicate 11 is replaced with multiple related terms 13 respectively, and multiple corresponding SQL query statements 31 are obtained;
[0076] After adding the instruction to limit the number of query results, multiple SQL query statements 31 are executed to obtain multiple query results, which are then sorted in descending order of semantic similarity of the related words 13 and displayed to the user.
[0077] Based on the user's selected operation, select one of the SQL query statements 31 for complete execution.
[0078] When multiple matching related words 13 are identified (i.e., the semantic similarity between predicate word 11 and multiple business reference words in the thesaurus all exceed the preset threshold), in order to avoid query deviations caused by field ambiguity, the platform will adopt a multi-path generation and interactive confirmation mechanism to ensure that the final executed SQL statement best matches the user's true intent.
[0079] The low-code platform first replaces the predicate word 11 in the original natural language query statement 10 with each matching related word 13, thereby generating multiple natural language variants with slightly different semantics but reasonable structures. Based on each variant, it calls the Text-to-SQL module 30 to generate the corresponding SQL query statement 31. For example, when a user enters "Which products had high sales last month?", "high" as the predicate word 11 may simultaneously match the three fields "sales_amount" (sales amount), "profit_margin" (profit margin), and "order_count" (order quantity), because they have all been described as "high" in historical business contexts. Thus, three candidate SQL statements are generated:
[0080] Query based on "sales_amount": SELECT product_name FROM products JOIN salesON ... WHERE sales_amount > [threshold];
[0081] Query based on "profit_margin": SELECT product_name FROM products JOIN sales ON ... WHERE profit_margin > [threshold];
[0082] And, a query based on "order_count": SELECT product_name FROM products JOIN sales ON ... WHERE order_count > [threshold].
[0083] To control computational overhead and provide rapid feedback, the low-code platform automatically adds a command to the end of each SQL statement to limit the number of query results (e.g., LIMIT 5). These lightweight queries are then executed in parallel to obtain the results after adding the command to limit the number of query results. The results are then sorted in descending order of semantic similarity based on the related term 13 and displayed to the user. Users can intuitively compare the example data returned by different related terms 13 to select the SQL statement corresponding to the result that best matches their query intent 12. When a user selects "sales_amount" as the query condition, the SQL query statement 31 generated based on "sales_amount" is executed in its entirety. This ensures both the flexibility of semantic matching and enhances the accuracy and controllability of the query through pre-execution and user confirmation.
[0084] Step S5) After performing a syntax and security check on the SQL query statement 31, execute the SQL query statement 31 to obtain the query result.
[0085] Please see the appendix Figure 6 The method for performing syntax and security checks on the SQL query statement 31 includes:
[0086] Step S51) The SQL parser of the target database 40 is invoked to perform syntax tree parsing on the generated SQL query statement 31, verifying whether it conforms to the syntax rules of the database 40. Verifying whether the statement conforms to the syntax rules of the target database 40 (e.g., keyword spelling, clause order, bracket matching, etc.) can also expose structural errors caused by natural language translation deviations in advance. For example, if the Text-to-SQL module 30 mistakenly converts "summarize sales by month" into SELECT SUM(sales) GROUP BY month and omits the FROM clause, the syntax tree parsing will immediately fail, the platform will then interrupt execution and prompt the user to correct the intent, preventing invalid queries from being sent to the database 40.
[0087] Step S52) Based on the preset access control policy, check whether the data tables and fields involved in the SQL query statement 31 are within the current user's authorized access scope. According to the preset access control policy, strictly verify whether the current user has the right to access all data tables and fields involved in the SQL statement. This mechanism is usually integrated with the enterprise's identity authentication system and fine-grained data permission model. For example, if a sales manager is only authorized to view customer data in their local area, and their natural language query unexpectedly triggers a full scan of the cross-regional customer table, the platform will intercept the statement during the access control check phase. Even if the syntax is completely correct, it will not be executed, thus preventing unauthorized access.
[0088] Step S53) Scan the SQL statement for high-risk operations or stored procedure calls; if any are found, refuse to execute.
[0089] The platform performs sensitive operation scans on SQL statements, focusing on identifying high-risk commands such as write operations like DROP, DELETE, UPDATE, and INSERT, as well as calls to stored procedures, user-defined functions, or dynamic SQL. Even if these statements are syntactically valid and authorized, the low-code platform treats them as unacceptable operations by default and rejects them. For example, while a user entering "clear test order data" might be misinterpreted as a delete request by the large model, the platform effectively blocks such dangerous operations through dual detection of keywords and AST node types, ensuring that the platform only supports read-only queries.
[0090] Step S54) Detect whether there is a potential injection risk, and perform resource consumption estimation for complex statements containing aggregation, grouping or subqueries. If the resource consumption estimation exceeds the configured query complexity threshold, trigger an alarm or restrict execution.
[0091] The platform detects potential SQL injection risks through parameterized query templates and lexical analysis. If malicious strings such as "' OR '1'='1" are mixed into natural language, the platform will identify unconventional nested quotes or logically true patterns and refuse execution. For complex statements containing GROUP BY, HAVING, multi-level nested subqueries, or window functions, the platform uses query plan simulation or historical execution statistics to assess resource consumption, such as estimating the number of rows scanned, memory usage, and CPU time. If the estimated value exceeds the query complexity threshold configured by the administrator, such as a single query not scanning more than 1 million rows, the platform will trigger an alert or directly restrict execution and suggest the user add more precise filtering conditions. For example, when a user asks "list all historical order details for all products" without specifying a time range, the platform may predict that the query will scan tens of millions of records and will proactively prompt the user to "add a time or product range to optimize performance," guiding the user to adjust their query intent.
[0092] Step S6) Based on the user's query intent 12, select the visualization component 50 to load and display the query results. The visualization component 50 changes the display method of the query results in response to the user's operation.
[0093] After the SQL query is executed, the low-code platform first analyzes the user's query intent 12. For example, query intent 12 might be "comparing sales figures across different regions," "viewing order trends over time," or "compiling a list of high-value customers," and automatically selects the most suitable visualization component 50 accordingly. If the intent is aggregation and comparison, such as "comparing quarterly sales across product categories," the platform tends to load bar charts or stacked area charts; if time series analysis is involved, such as "average daily active users over the past 12 months," a line chart is preferred; and for simple detailed list queries, such as "unpaid orders from last month," a table component is used by default. This intent-driven visualization recommendation mechanism ensures a high degree of consistency between data representation and user goals.
[0094] For example, when a user enters "show a comparison of monthly revenue in East China and South China for the past three months," the low-code platform recognizes this intent as a multi-dimensional time series comparison and automatically loads a grouped bar chart. The horizontal axis represents months, the vertical axis represents revenue amount, and different colors represent different regions. After the query results are returned, the chart is rendered instantly, allowing users to clearly observe the differences between regions.
[0095] Low-code platforms typically offer 50-way switching functionality for visualization components. If a user deems the current chart unsuitable for representing data, they can manually switch from a bar chart to a pie chart, heatmap, or pivot table. Through intent-aware, component-adaptive, and interaction-driven mechanisms, low-code platforms automate the querying and loading of data from natural language to visual representations. Non-technical users can also complete the entire data operation process, from asking questions and querying to data analysis, without writing any code.
[0096] On the other hand, this specification provides a natural language query system based on a low-code platform; please refer to the appendix. Figure 7 ,include:
[0097] The reading module 100 reads the creation context of the data table and fields in the low-code platform, and generates a related thesaurus 20 of the data table and fields based on the creation context;
[0098] The receiving module 200 receives the natural language query statement 10 input by the user, extracts the action words and predicate words 11 of the natural language query statement 10 using a pre-accessed large model, and obtains the user's query intent 12 based on the action words;
[0099] The matching module 300 compares the predicate word 11 with the associated word library 20 to obtain the matching associated word 13;
[0100] The generation module 400 replaces the corresponding predicate word 11 with the matched associated word 13, and then generates an SQL query statement 31 according to the pre-accessed Text-to-SQL module 30.
[0101] The execution module 500 performs syntax and security checks on the SQL query statement 31, and then executes the SQL query statement 31 to obtain the query results.
[0102] The visualization module 600 selects the visualization component 50 to load and display the query results based on the user's query intent 12. The visualization component 50 changes the display method of the query results in response to the user's operation.
[0103] Please see Figure 8 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this specification.
[0104] like Figure 8As shown, the electronic device 1100 may include: at least one processor 1101, at least one network interface 1104, a user interface 1103, a memory 1105, and at least one communication bus 1102. The communication bus 1102 can be used to connect and communicate with the various components mentioned above. The user interface 1103 may include buttons, and optionally may include standard wired or wireless interfaces. The network interface 1104 may include, but is not limited to, a Bluetooth module, an NFC module, or a Wi-Fi module. The processor 1101 may include one or more processing cores. The processor 1101 connects to various parts within the electronic device 1100 using various interfaces and lines, and performs various functions of the routing device and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1105, and by calling data stored in the memory 1105. Optionally, the processor 1101 may be implemented using at least one hardware form of DSP, FPGA, or PLA. The processor 1101 may integrate one or more combinations of CPU, GPU, and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content that the display screen needs to show; and the modem is used for wireless communication.
[0105] It is understandable that the aforementioned modem may not be integrated into the processor 1101, but may be implemented using a separate chip.
[0106] The memory 1105 may include RAM or ROM. Optionally, the memory 1105 may include a non-transitory computer-readable medium. The memory 1105 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 1105 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 1105 may also be at least one storage device located remotely from the aforementioned processor 1101. As a computer storage medium, the memory 1105 may include an operating system, a network communication module, a user interface module, and application programs. The processor 1101 may be used to call the application programs stored in the memory 1105 and execute the methods in the above-described embodiments.
[0107] This specification also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform multiple steps as described in the above embodiments. If the constituent modules of the above-described electronic device are implemented as software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.
[0108] This specification also provides a computer program product, including a computer program that, when executed by a processor, implements the multiple steps described in the above embodiments.
[0109] Where there is no conflict, the technical features in this embodiment and implementation scheme can be combined arbitrarily.
[0110] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes multiple computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center integrating multiple available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state drives (SSDs)).
[0111] When implemented through hardware or firmware, the aforementioned method flow is programmed into the hardware circuit to obtain the corresponding hardware circuit structure and achieve the corresponding function. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit, whose logic function is determined by the user programming the device. Designers can program a digital system onto a PLD themselves, eliminating the need for chip manufacturers to design and fabricate dedicated integrated circuit chips. Furthermore, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, similar to the software compiler used in program development. The original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There is not just one HDL, but many. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of the aforementioned hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logic method flow can be easily obtained.
[0112] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims of this specification.
Claims
1. A natural language query method based on a low-code platform, characterized in that, Including the following steps: Read the creation context of the data table and fields in the low-code platform, and generate a related thesaurus of the data table and fields based on the creation context; Receive natural language query statements input by users, extract the action words and predicate words of the natural language query statements using a pre-connected large model, and obtain the user's query intent based on the action words; The predicate word is compared with the associated word database to obtain the matching associated words; After replacing the corresponding predicate with the matched associated words, an SQL query statement is generated based on the pre-connected Text-to-SQL module; After performing syntax and security checks on the SQL query statement, the SQL query statement is executed to obtain the query results; Based on the user's query intent, a visualization component is selected to load and display the query results. The visualization component changes the display method of the query results in response to the user's operation.
2. The natural language query method based on a low-code platform according to claim 1, characterized in that, The creation context of data tables and fields on a low-code platform includes the metadata information of the data table, the structured definition information of the fields, the mapping relationship between the fields and multiple business terms, and the user-defined custom tags.
3. The natural language query method based on a low-code platform according to claim 2, characterized in that, The method for generating a related thesaurus of data tables and fields based on the aforementioned context creation includes: Semantic parsing is performed on the metadata information and structured definition information of the fields of the data table to extract keywords from the table name, field name, field comments and default values as initial candidate words; Based on the mapping relationship between the fields and multiple business terms, a synonym mapping is established between commonly used expressions on the business side and the fields to form a synonym set; Based on user-defined custom tags and historical query logs, high-frequency query patterns are identified through clustering. Commonly used multi-table join patterns are then derived from these high-frequency query patterns, and the fields involved in these multi-table join patterns are associated with them.
4. The natural language query method based on a low-code platform according to claim 1, characterized in that, Methods for obtaining a user's query intent based on the action words include: The action words are matched with a predefined intent classification library to obtain multiple candidate intents and their matching degrees; Using the zero-shot capability of a pre-connected large model, dependency parsing and semantic role labeling are performed on the natural language query statement input by the user. Based on the results of dependency parsing and semantic role labeling, intent ambiguity is identified for multiple candidate intents, and ambiguous candidate intents are eliminated. Based on the remaining candidate intents and their matching degrees, the user's query intent is obtained.
5. The natural language query method based on a low-code platform according to claim 1, characterized in that, The method for comparing the predicate word with the associated word database to obtain matching associated words includes: The semantic similarity between the predicate word and the business reference words in the associated thesaurus is calculated using a pre-accessed vectorized embedding model to obtain the semantic similarity. Related words with semantic similarity higher than a preset threshold are used as the matched related words.
6. The natural language query method based on a low-code platform according to claim 5, characterized in that, The method for generating an SQL query statement based on the pre-connected Text-to-SQL module after replacing the corresponding predicate with the matched associated words includes: The natural language query statement with the predicate replaced, along with the creation context, is entered into the Text-to-SQL module; Based on the output of the Text-to-SQL module, obtain the SQL query statement; When there are multiple matching related terms, the methods for executing the SQL query statement and obtaining the query results include: The predicate is replaced with multiple related words, and multiple corresponding SQL query statements are obtained. After adding the instruction to limit the number of query results, multiple SQL query statements are executed to obtain multiple query results, which are then sorted in descending order of semantic similarity of the related words and displayed to the user. Based on the user's selected action, choose one of the SQL query statements to execute completely.
7. The natural language query method based on a low-code platform according to claim 1, characterized in that, The methods for performing syntax and security checks on the SQL query statement include: The SQL parser of the target database is invoked to perform syntax tree parsing on the generated SQL query statement and verify whether it conforms to the syntax rules of the database. Based on the preset access control policy, check whether the data tables and fields involved in the SQL query statement are within the current user's authorized access range; Scan SQL statements for high-risk operations or stored procedure calls; if found, refuse to execute. The system detects potential injection risks and estimates resource consumption for complex statements containing aggregations, groupings, or subqueries. If the estimated resource consumption exceeds the configured query complexity threshold, an alert is triggered or execution is restricted.
8. A natural language query system based on a low-code platform, characterized in that, include: The reading module reads the creation context of the data table and fields in the low-code platform, and generates a related thesaurus of the data table and fields based on the creation context; The receiving module receives the natural language query statement input by the user, extracts the action words and predicate words of the natural language query statement using a pre-accessed large model, and obtains the user's query intent based on the action words; The matching module compares the predicate word with the associated word library to obtain the matching associated words; The generation module replaces the corresponding predicate with the matched associated words and then generates an SQL query statement based on the pre-connected Text-to-SQL module. The execution module performs syntax and security checks on the SQL query statement, executes the SQL query statement, and obtains the query results. The visualization module selects a visualization component to load and display the query results based on the user's query intent. The visualization component changes the display method of the query results in response to the user's operation.
9. An electronic device, characterized in that, Including the processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code stored in the memory to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.