Data query method and device, vehicle, program product and storage medium
Patent Information
- Application Number
- CN202611131396.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]然而,大语言模型固有的概率生成机制导致其输出的查询指令具有非确定性,极易生成破坏性指令(如数据删除、表结构篡改等),严重威胁数据库的完整性与高可用性,并且可能导致底层明细数据面临直接泄露的风险
[0027]本申请提供的数据查询方法,通过将目标查询数据转化为对数据特征的描述性呈现,降低用户解读数据的门槛,使数据查询方法在完成数据检索和安全保护的基础上进一步实现了数据特征的直观呈现,提升查询结果对用户的实际价值。
Smart Images

Figure CN123013157A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of database technology, specifically to the field of database security technology, and in particular to data query methods, devices, vehicles, program products, and storage media. Background Technology
[0002] As enterprises deepen their digital transformation, Text-to-Structured Query Language (Text-to-SQL) technology based on large language models is gradually becoming the core paradigm for building natural language interfaces for databases, aiming to lower the entry barrier for data interaction.
[0003] However, the inherent probabilistic generation mechanism of large language models leads to the non-deterministic nature of their output query commands, making them highly susceptible to generating destructive commands (such as data deletion and table structure tampering). This seriously threatens the integrity and high availability of the database and may even lead to the direct leakage of underlying detailed data. Therefore, ensuring data security during data queries has become a pressing technical challenge. Summary of the Invention
[0004] This disclosure provides data query methods, apparatus, vehicles, program products, and storage media that can ensure data security during data querying.
[0005] In a first aspect, this application provides a data query method, comprising: responding to a user's query request, generating global context information corresponding to the query request; wherein, the query request is used to request querying target data from a target database; the global context information does not contain field information corresponding to fields other than the target field; the target field is a data field corresponding to the table structure metadata of the target database; determining a target query statement based on the global context information; using the target query statement to perform data querying on the target database to obtain the target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; dangerous query statements include query statements that directly retrieve the underlying detail list.
[0006] The data query method provided in this application, by constructing global contextual information that does not include field information other than table structure metadata, can block the possibility of obtaining underlying detailed data during the query request processing stage of the large language model, thus eliminating the risk of privacy data exposure at the source. Simultaneously, it intercepts dangerous query statements that directly retrieve the underlying detailed list during data query execution, ensuring that the target query data returned for the user's query request only contains aggregated statistical results rather than the original detailed records. This establishes a two-layer security defense from query command generation to database execution, effectively preventing malicious commands from threatening the database and unauthorized disclosure of sensitive information, thereby improving the security of the data query process.
[0007] In some possible implementations, the target query statement is determined based on global contextual information, including: determining the target query scenario corresponding to the global contextual information; and rewriting the global contextual information using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement.
[0008] The data query method provided in this application first determines the target query scenario corresponding to the global context information, and then rewrites the global context information using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement. This ensures that the generation of the query statement no longer relies on open-ended reasoning from scratch using a large language model, but is rewritten based on a pre-defined structured format. This avoids the large language model generating invalid query statements containing forged fields or non-closed-loop logic due to illusion phenomena. Furthermore, since the rewriting is based on the structured format corresponding to the target query scenario, isomorphic query requests under the same query scenario can generate structurally consistent target query statements, ensuring the logical consistency and reproducibility of multiple query results, and reducing the computational overhead caused by repeatedly performing complete semantic parsing and reasoning for each query.
[0009] In some possible implementations, determining the target query scenario corresponding to the global context information includes: performing intent parsing on the global context information to obtain a first query scenario; performing scenario feature matching between the first query scenario and query scenarios in a preset query scenario library to obtain a second query scenario that matches the first query scenario; and determining the second query scenario as the target query scenario.
[0010] The data query method provided in this application first performs intent parsing on the global contextual information to obtain a first query scenario. Then, it matches the first query scenario with query scenarios in a pre-defined query scenario library based on scenario features. The resulting second query scenario is then identified as the target query scenario. This ensures that the user's natural language query intent is constrained by a pre-defined structured format during the matching stage, avoiding potential intent comprehension biases and uncontrollable structure issues that may occur when a large language model directly generates query statements based on open contexts. Therefore, it improves the accuracy of target query scenario determination and provides a reliable format constraint foundation for subsequent query statement generation.
[0011] In some possible implementations, the first query scenario is matched with the query scenarios in the preset query scenario library to obtain a second query scenario that matches the first query scenario. This includes: determining the query scenario in the preset query scenario library with the highest scene feature similarity to the first query scenario as the second query scenario; wherein, scene feature similarity includes feature semantic similarity or feature cosine similarity.
[0012] The data query method provided in this application calculates the similarity of scene features between a first query scenario and each query scenario in a preset query scenario library, and determines the query scenario with the highest similarity as the second query scenario, thus providing a quantifiable basis for determining the target query scenario. Compared to matching methods that rely on experience, this method can more accurately select the query scenario that best matches the user's query intent from the preset query scenario library, avoiding the use of incorrect structured formats to generate query statements due to inaccurate matching.
[0013] In some possible implementations, determining the target query scenario corresponding to the global context information further includes: if there is no second query scenario matching the first query scenario in the preset query scenario library, determining the first query scenario as the target query scenario; wherein the structured format of the query statement of the first query scenario is unstructured.
[0014] The data query method provided in this application directly determines the first query scenario as the target query scenario when there is no second query scenario matching the first query scenario in the preset query scenario library. This allows the user's query request to continue the subsequent query process normally even if it cannot match any scenario in the preset query scenario library, avoiding the interruption of the query or the return of invalid results due to matching failure, and improving the integrity and adaptability of the query process.
[0015] In some possible implementations, the first query scenario and the query scenarios in the preset query scenario library include query type, query dimension and query core indicators.
[0016] The data query method provided in this application can determine the feature similarity between the first query scenario and the query scenarios in the preset query scenario library based on three dimensions: query type, query dimension, and query core indicators. This improves the accuracy and reliability of scenario feature matching, thereby ensuring the reliability of the target query scenario determination.
[0017] In some possible implementations, the process of determining the query statement that directly retrieves the underlying detail list includes: if the query statement does not include aggregate functions from the preset list of aggregate functions, the query statement is identified as a dangerous query statement; wherein, the aggregate function is a function that performs statistical summarization on the data in the underlying detail list.
[0018] The data query method provided in this application identifies and intercepts query statements that do not include aggregate functions in the preset aggregate function list as dangerous query statements. This can block the channel for transmitting underlying detailed data to the outside from the query command level, ensuring that the underlying detailed data is not directly exposed during the data query process.
[0019] In some possible implementations, the dangerous query statement also includes a query statement containing preset dangerous keywords; the process of determining the query statement containing preset dangerous keywords includes: retrieving a list of preset dangerous keywords; and determining the query statement as a dangerous query statement if the query statement contains any preset dangerous keyword from the list of preset dangerous keywords.
[0020] The data query method provided in this application retrieves a preset list of dangerous keywords and identifies queries containing any preset dangerous keyword from this list as dangerous queries, thus providing a clear keyword matching basis for determining dangerous queries. This accurately identifies and intercepts queries containing intents to delete or update data, preventing such queries from being sent to the target database and causing damage to the underlying data.
[0021] In some possible implementations, the target database is queried using a target query statement to obtain target query data, including: querying the target database using a target query statement to obtain initial query data; and performing privacy filtering on the initial query data to obtain target query data; wherein the privacy filtering is used to prevent the derivation of privacy information from the initial query data.
[0022] The data query method provided in this application, after obtaining initial query data by querying the target database using the target query statement, can perform privacy filtering on the initial query data and use the privacy-filtered data as the final target query data. This avoids relying solely on security checks at the query statement level while ignoring the potential privacy leakage risks of the query results themselves, further reducing the possibility of privacy information leakage.
[0023] In some possible implementations, the target query statement includes at least one aggregate function; the aggregate function is a function that statistically summarizes the data in the underlying detail list; privacy filtering is performed on the initial query data to obtain the target query data, including: determining the aggregate count value corresponding to each aggregate function in the initial query data; filtering out the query data corresponding to aggregate functions whose aggregate count values are lower than a preset count threshold from the initial query data to obtain the target query data; wherein, the lower the aggregate count value, the higher the probability of deriving the data in the underlying detail list, and the higher the probability of privacy information leakage.
[0024] The data query method provided in this application determines the aggregation count value corresponding to each aggregation function in the initial query data, and filters out the query data corresponding to aggregation functions with aggregation count values lower than a preset counting threshold from the initial query data. This prevents malicious inference of individual privacy information from query data with low aggregation count values. Therefore, it further eliminates the risk of small sample statistical results exposing individual characteristics and enhances the security and privacy protection of data query results.
[0025] In some possible implementations, table structure metadata includes, but is not limited to: column names, data types, and non-sensitive enumeration values.
[0026] The data query method provided in this application constructs a global contextual information based on three types of table structure metadata: column names, data types, and non-sensitive enumeration values. This provides a complete structural reference for generating the target query statement. Furthermore, since the table structure metadata does not contain any specific data rows, the subsequent query statement generation process is always completed within an environment that only contains structural information. This avoids the risk of exposing underlying detailed data during the query statement generation stage from the information source level. In some possible implementations, the method further includes: outputting a data analysis report based on the target query data; wherein the data analysis report is used to present the data characteristics of the target query data to the user.
[0027] The data query method provided in this application lowers the threshold for users to interpret data by transforming the target query data into a descriptive presentation of data characteristics. This enables the data query method to further realize the intuitive presentation of data characteristics on the basis of completing data retrieval and security protection, thereby enhancing the actual value of query results to users.
[0028] In some possible implementations, a data analysis report is output based on the target query data, including: parsing the target query data to obtain text parsing results and visualization charts; and merging the text parsing results with the visualization charts to output a data analysis report.
[0029] The data query method provided in this application parses the target query data to obtain text parsing results and visualization charts, and then merges the text parsing results with the visualization charts to output a data analysis report. This lowers the barrier for users to interpret data, and, in addition to completing data retrieval and security protection, further realizes the intuitive presentation of data characteristics, enhancing the practical value of the query results to users.
[0030] Secondly, this application provides a data query apparatus, comprising: a generation module, a determination module, and a processing module; the generation module is used to generate global context information corresponding to the query request in response to a user's query request; wherein, the query request is used to request to query target data from a target database; the global context information does not contain field information corresponding to fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database; the determination module is used to determine the target query statement based on the global context information; the processing module is used to perform data query on the target database using the target query statement to obtain the target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; dangerous query statements include query statements that directly retrieve the underlying detail list.
[0031] In some possible implementations, the determining module is specifically used to: determine the target query scenario corresponding to the global context information; and rewrite the global context information using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement.
[0032] In some possible implementations, the determining module is specifically used for: performing intent parsing on global contextual information to obtain a first query scenario; matching the first query scenario with query scenarios in a preset query scenario library to obtain a second query scenario that matches the first query scenario; and determining the second query scenario as the target query scenario.
[0033] In some possible implementations, the determining module is specifically used to: determine the query scenario with the highest scene feature similarity to the first query scenario in the preset query scenario library as the second query scenario; wherein, scene feature similarity includes feature semantic similarity or feature cosine similarity.
[0034] In some possible implementations, the determining module is specifically used to: determine the first query scenario as the target query scenario when there is no second query scenario matching the first query scenario in the preset query scenario library; wherein the structured format of the query statement of the first query scenario is unstructured.
[0035] In some possible implementations, the first query scenario and the query scenarios in the preset query scenario library include query type, query dimension and query core indicators.
[0036] In some possible implementations, the processing module is specifically used to: identify a query statement as a dangerous query statement if the query statement does not include aggregate functions from a preset list of aggregate functions; wherein, the aggregate function is a function that performs statistical summarization on the data in the underlying detail list.
[0037] In some possible implementations, the processing module is specifically configured to: retrieve a preset list of dangerous keywords; and determine the query statement as a dangerous query statement if the query statement includes any preset dangerous keyword from the preset list of dangerous keywords.
[0038] In some possible implementations, the processing module is specifically used to: query the target database using the target query statement to obtain initial query data; and perform privacy filtering on the initial query data to obtain target query data; wherein the privacy filtering is used to prevent the derivation of privacy information from the initial query data.
[0039] In some possible implementations, the target query statement includes at least one aggregate function; the aggregate function is a function that performs statistical summarization on the data in the underlying detail list; the processing module is specifically used to: determine the aggregate count value corresponding to each aggregate function in the initial query data; filter out the query data corresponding to the aggregate functions whose aggregate count values are lower than a preset count threshold from the initial query data to obtain the target query data; wherein, the lower the aggregate count value, the higher the probability of deriving the data in the underlying detail list, and the higher the probability of privacy information leakage.
[0040] In some possible implementations, table structure metadata includes, but is not limited to: column names, data types, and non-sensitive enumeration values.
[0041] In some possible implementations, the processing module is also used to output a data analysis report based on the target query data; wherein the data analysis report is used to present the data characteristics of the target query data to the user.
[0042] In some possible implementations, the processing module is specifically used to: parse the target query data to obtain text parsing results and visualization charts; and merge the text parsing results and visualization charts to output a data analysis report.
[0043] Thirdly, this application provides a vehicle, which includes a data query system. The data query system includes a data query device and a target database. The data query device is configured to: generate global context information corresponding to a query request in response to a user's query request; wherein the query request is used to request to query target data from the target database; the global context information does not contain field information corresponding to fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database; determine the target query statement based on the global context information; use the target query statement to perform data query on the target database to obtain the target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; dangerous query statements include query statements that directly retrieve the underlying detailed list.
[0044] Fourthly, this application provides a control device, including: a memory and a processor; the memory and the processor are coupled; the memory is used to store a computer program; the processor executes the computer program to implement the data query method of any of the above embodiments.
[0045] Fifthly, this application provides a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the data query method of any of the above embodiments.
[0046] Sixthly, this application provides a computer program product including computer program instructions that, when executed by a processor, implement the data query method of any of the above embodiments. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in this disclosure, the accompanying drawings used in some embodiments of this disclosure will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings.
[0048] Figure 1 This is a schematic diagram of the architecture of a data query system provided in some embodiments of this disclosure; Figure 2 A flowchart illustrating a data query method provided in some embodiments of this disclosure; Figure 3 This is a schematic diagram of a data query process provided for some embodiments of this disclosure; Figure 4 A schematic diagram of the structure of a data query device provided in some embodiments of this disclosure. Figure 1 ; Figure 5 This is a schematic diagram of a data query process provided for some embodiments of this disclosure; Figure 6 This is a schematic diagram of a data query process provided for some embodiments of this disclosure; Figure 7 A schematic diagram of the structure of a data query device provided in some embodiments of this disclosure. Figure 2 ; Figure 8 This is a schematic diagram of the structure of a control device provided in some embodiments of this disclosure. Detailed Implementation
[0049] The technical solutions of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0050] It should be noted that, in this disclosure, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this disclosure should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0051] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0052] In the description of this disclosure, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "more than one" means two or more.
[0053] The data query system provided in the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0054] The data query method provided in this application embodiment can be applied to... Figure 1 The data query system shown. Please refer to [link / reference]. Figure 1 The data query system includes a data query device 101 and a target database 102. The data query device 101 and the target database 102 can communicate with each other in various ways, and this embodiment does not impose any limitations on this. The data query system can be deployed in a vehicle.
[0055] It should be understood that the specific type of the target database 102 is not limited in this application embodiment. The target database 102 includes relational databases, non-relational databases, and data warehouses, etc. The data query device 101 can query and obtain target data through these target databases 102.
[0056] In some embodiments, directly exposing the raw data of the underlying database to end users poses a high security risk, and the query statements generated by the large language model are non-deterministic, which can easily lead to data leakage or system damage. Therefore, as a feasible implementation method, in order to ensure the security and compliance of the data query process, the data query device 101 and the target database 102 communicate through a secure middleware layer.
[0057] For example, when a security middle layer is set between the data query device 101 and the target database 102, the security middle layer can be a separately deployed security gateway device, a software security module running inside the data query device 101, or a database firewall deployed on the target database 102. This application embodiment does not limit this.
[0058] In this embodiment of the application, when the data query device 101 receives a user's query request, it can generate global context information corresponding to the query request.
[0059] The query request is used to request the retrieval of target data from target database 102. The global context information does not include field information for fields other than the target field; the target field is the data field corresponding to the table structure metadata of target database 102.
[0060] For example, the global context information may include the column names and data types of each table in the target database 102, but not the specific data content corresponding to each column. The data query device 101 can then determine the target query statement based on this global context information. Furthermore, the data query device 101 uses this target query statement to perform a data query on the target database 102 to obtain the target query data.
[0061] During the data query process, when the data query device 101 detects that the target query statement is a dangerous query statement, it intercepts the target query statement. Dangerous query statements include those that directly retrieve the underlying detailed list. For example, a query statement that does not contain aggregate functions is considered a dangerous query statement because it attempts to directly retrieve underlying detailed data; the data query device 101 will intercept such a query statement and will not send it to the target database 102 for execution.
[0062] For example, after receiving a user's query request, the data query device 101 first generates global context information. The data query device 101 calls the metadata interface of the target database 102, extracting only the column names and data types of each table in the target database 102, blocking access to the original plaintext data in the target database 102. Then, based on the user's query request and the extracted column names and data types, the data query device 101 generates global context information. Subsequently, the data query device 101 determines the target query statement based on the global context information and performs security checks on the target query statement. When the target query statement is detected as a query statement that directly retrieves the underlying detailed list, the data query device 101 intercepts the target query statement and does not send it to the target database 102 for execution; when the target query statement is detected as a non-dangerous query statement, the data query device 101 sends the target query statement to the target database 102 for execution, obtains the target query data, and returns it.
[0063] It should be pointed out that, Figure 1 The structure shown does not constitute a limitation on the data query system. The data query system may include fewer or more components than shown, or combine certain components, or have different component arrangements. This application embodiment does not impose any limitations in this regard.
[0064] The data query method provided in this application embodiment can be applied to... Figure 1 The data query device 101 shown can also be applied to Figure 1 Other electronic devices shown, such as the query engine of the target database 102, are not limited in this embodiment. For ease of description, this embodiment uses a data query method applied to... Figure 1 The data query device 101 shown is used as an example for explanation.
[0065] It is understood that the application scenarios of the embodiments of this disclosure are not limited. The system architecture and business scenarios described in the embodiments of this disclosure are for the purpose of more clearly illustrating the technical solutions of the embodiments of this disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of this disclosure. As those skilled in the art will know, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this disclosure are also applicable to similar technical problems.
[0066] The data query method provided in the embodiments of this disclosure will be described in detail below.
[0067] This disclosure provides a data query method, such as Figure 2 As shown, the method includes the following steps: S201-S203.
[0068] S201. In response to the user's query request, generate the global context information corresponding to the query request.
[0069] The query request is used to request the retrieval of target data from the target database. The global context information does not include field information for fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database.
[0070] For example, a user inputs a natural language query request through a front-end interactive interface. For instance, in an enterprise after-sales service scenario, an after-sales manager might want to analyze the work order processing efficiency for each vehicle model last month, so they input the query request: "Please analyze the work order processing efficiency and any anomalies for each vehicle model last month." Upon receiving this query request, the data query device can trigger a table structure extraction algorithm to extract the table structure metadata of the target database.
[0071] It should be understood that table structure metadata describes the column names, data types, and relationships between columns in each table of the target database; it does not contain the actual data content of each column. Table structure metadata includes, but is not limited to: column names, data types, and non-sensitive enumeration values.
[0072] Here, column names refer to the field names of each data table in the target database. For example, the work order table contains the following names: work order identifier, vehicle model, processing status, processing time, responsible person, customer name, license plate number, and contact number.
[0073] Data type refers to the data storage format corresponding to each column name. For example, the work order identifier column is an integer type, used to store the unique number of the work order. The vehicle model column is a text type, used to store the vehicle model name. The processing status column is a text type, used to store the current processing status of the work order. The processing time column is an integer type, in hours, used to store the time spent from work order creation to closure.
[0074] Non-sensitive enumeration values refer to the optional values corresponding to columns with a text data type and a limited set of values. These optional values themselves do not contain privacy information. For example, the non-sensitive enumeration values for the processing status column are: resolved, processing, and rejected. These three values only indicate the processing stage of the work order and do not involve any personal privacy or trade secret information.
[0075] In one possible implementation, the data query device can determine the field binding relationships in the query request corresponding to the table structure metadata. These field binding relationships indicate the correspondence between each natural language description in the query request and each data table column in the table structure metadata. Then, based on these field binding relationships, the data query device replaces the natural language descriptions in the query request with the corresponding data table column names, generating global contextual information.
[0076] For example, the data query device can identify that in the query request "Help me analyze the work order processing efficiency and anomalies for each vehicle model last month," the natural language description "vehicle model" corresponds to the vehicle model column in the table structure metadata, and "work order processing efficiency" corresponds to the processing time column and status column. Therefore, the data query device can replace the natural language description in the query request with the corresponding data table column names, and combine this with the extracted table structure metadata to generate global contextual information that conforms to the input format of the large language model.
[0077] Furthermore, the global contextual information can also include historical multi-turn dialogue records. For example, if a user has previously asked about "the efficiency of work order processing in the same period last year," the data query device can also include this historical dialogue record in the global contextual information to support the semantic coherence of context in multiple consecutive query interactions. This allows the large language model to understand that "that" refers to work order processing efficiency when the user subsequently asks "What about the other regions?"
[0078] As a feasible implementation method, the global context information generated by the data query device 101 can contain all the information required by the large language model to generate structured query statements. For example, it can include what the user needs to query, which fields are available, and what type each field is, but it cannot contain any specific work order details (such as customer name, license plate number, specific work order content, etc.), thereby ensuring that the large language model does not come into contact with any original plaintext data in subsequent processing, achieving physical isolation.
[0079] S202. Determine the target query statement based on global contextual information.
[0080] The target query statement refers to the structured query instruction used to retrieve target data from the target database.
[0081] For example, if a user inputs a query request of "help me analyze the work order processing efficiency and abnormal situations of each vehicle model last month", the target query statement may include: grouping and calculating the average processing time of each vehicle model, and grouping and calculating the number of abnormal work orders of each vehicle model.
[0082] In one possible implementation, the data query device can determine the target query scenario corresponding to the global context information. Then, using the structured format of the target query statement corresponding to the target query scenario, the global context information is rewritten to obtain the target query statement. The implementation method of the data query device determining the target query statement based on the global context information can be referred to S301-S302 below. It will not be elaborated further here.
[0083] S203. Use the target query statement to query the target database and obtain the target query data.
[0084] During the data query process, if a target query is detected as a dangerous query, the query will be intercepted. Dangerous queries can include those that directly retrieve the underlying detail list.
[0085] In one possible implementation, the process of determining the query statement that directly retrieves the underlying detail list includes: the data query device can detect whether the target query statement includes aggregate functions from the preset aggregate function list; if the target query statement does not include aggregate functions from the preset aggregate function list, the target query statement is determined to be a dangerous query statement.
[0086] Aggregate functions are functions used to statistically summarize data in the underlying detail list. For example, a preset list of aggregate functions may include at least one of the following: summation function, counting function, average function, maximum value function, and minimum value function. This application does not impose specific limitations on this.
[0087] For example, the data query device can use abstract syntax tree parsing or regular expression filtering algorithms to parse the target query statement. If the query clause of the target query statement does not contain any aggregate functions, then the target query statement is a query statement that directly retrieves the underlying detailed list. The data query device can identify it as a dangerous query statement and intercept it, while triggering the regeneration of a safe query statement.
[0088] In one possible implementation, the dangerous query statement also includes a query statement containing preset dangerous keywords. The process of determining the query statement containing preset dangerous keywords includes: the data query device can retrieve a list of preset dangerous keywords, and if the query statement contains any preset dangerous keyword from the list, the query statement is determined to be a dangerous query statement.
[0089] Optionally, the preset list of dangerous keywords includes at least one of the following: keywords corresponding to data definition language operations or data manipulation operations such as delete table keywords, delete data keywords, update data keywords, and insert data keywords. This application does not impose specific limitations on this.
[0090] For example, if the target query statement contains preset dangerous keywords, the data query device will identify the query statement as a dangerous query statement and block it.
[0091] If the target query statement passes the security check (i.e., it does not contain preset dangerous keywords and contains aggregate functions), the data query device can allow the target query statement and send it to the target database for execution.
[0092] In one possible implementation, the data query device uses a target query statement to query the target database and obtain the target query data.
[0093] Specifically, the data query device 101 first uses a target query statement to query the target database 102 to obtain initial query data. Then, it performs privacy filtering on the initial query data to obtain the target query data.
[0094] Privacy filtering is used to prevent privacy information from being derived from the initial query data.
[0095] In one possible implementation, in order to perform privacy filtering on the initial query data to obtain the target query data, the data query device determines the aggregation count value corresponding to each aggregation function in at least one aggregation function in the initial query data, and then filters out the query data corresponding to the aggregation functions whose aggregation count values are lower than a preset counting threshold from the initial query data to obtain the target query data.
[0096] The lower the aggregate count value, the higher the probability of deriving data from the underlying detailed list, and the higher the probability of privacy information leakage.
[0097] For example, the data query device can send a target query statement to the target database 102 for execution. This target query statement includes aggregation logic that groups the average processing time and the number of work orders by vehicle model. The data query device receives the initial query data returned by the target database, which includes the average processing time and the corresponding number of work orders for each vehicle model.
[0098] Then, the data query device iterates through each data record in the initial query data, with a preset counting threshold of 5. For data records with fewer than 5 work orders, the data query device determines that the data sample size is too small, posing a risk of reverse engineering to identify the vehicle owner or the privacy of the responsible party. Therefore, the data query device can filter out this data record from the initial query data and use the processed data as the target query data.
[0099] Through the above privacy filtering process, the embodiments of this application can effectively prevent the reverse derivation of individual privacy information through small sample aggregation results, and ensure the compliance of data query results.
[0100] Based on the above technical solution, this application can construct global contextual information that does not include field information other than table structure metadata. This allows it to block the possibility of obtaining underlying detailed data during the query request processing stage of the large language model, eliminating the risk of privacy data exposure at the source. Simultaneously, it intercepts dangerous query statements that directly retrieve the underlying detailed list during data query execution, ensuring that the target query data returned for the user's query request only contains aggregated statistical results rather than the original detailed records. This establishes a two-layer security defense from query command generation to database execution, effectively preventing malicious commands from threatening the database and unauthorized disclosure of sensitive information, thus improving the security of the data query process.
[0101] In some embodiments, in order to determine the target query statement based on global contextual information, the data query method provided in this application embodiment may include the following steps: S301. Determine the target query scenario corresponding to the global context information.
[0102] In one possible implementation, the data query device can perform intent parsing on global contextual information to obtain the first query scenario.
[0103] Intent parsing involves using a large language model to semantically understand and analyze global contextual information, identifying the user's query intent (e.g., whether the user wants efficiency analysis or trend prediction), analysis dimensions (e.g., analysis by vehicle type or by region), and core metrics (e.g., average processing time, number of abnormal work orders, etc.), and generating structured descriptive information containing the key elements of the aforementioned analysis task as the first query scenario. Next, the data query device can perform scenario feature matching between the first query scenario and query scenarios in a preset query scenario library to obtain a second query scenario that matches the first query scenario. Then, the second query scenario is determined as the target query scenario.
[0104] The preset query scenario library stores multiple high-frequency standard analysis scenarios for enterprises, and each query scenario corresponds to a pre-written benchmark query statement template.
[0105] For example, taking a user's query request as "Help me analyze the work order processing efficiency and abnormal situations of each car model last month", the data query device can perform intent parsing on the global context information and obtain the first query scenario, which includes: query type as "efficiency analysis", query dimension as "car model", and query core indicators as "average processing time" and "abnormal work order volume".
[0106] Understandably, both the first query scenario and the preset query scenario library include query type, query dimension, and core query metrics. Query type indicates the type of analysis the user is querying, such as efficiency analysis, trend analysis, or distribution analysis. Query dimension indicates the field used for data grouping and statistics, such as vehicle model, region, or time. Core query metrics indicate the specific numerical fields that need to be calculated, such as average processing time, number of abnormal work orders, or total sales revenue.
[0107] As a feasible implementation method, the data query device can identify the query scenario with the highest similarity in scene features to the first query scenario from the preset query scenario library as the second query scenario.
[0108] Scene feature similarity includes feature semantic similarity or feature cosine similarity. Feature semantic similarity refers to calculating the semantic similarity between two query scenarios based on natural language understanding technology, considering the query type, query dimension, and core query metrics. Feature cosine similarity involves converting the query type, query dimension, and core query metrics into feature vectors, and then calculating the cosine value between two feature vectors to measure the similarity between the two query scenarios in the feature space.
[0109] For example, the data query device 101 calculates the cosine similarity of the scenario features between the first query scenario (query type: "efficiency analysis", query dimension: "vehicle type", and core query indicators: "average processing time" and "abnormal work order volume") and each query scenario in the preset query scenario library. The query scenario with the highest cosine similarity of scenario features is then determined as the second query scenario. For instance, the preset query scenario library contains the scenario "work order processing efficiency analysis", which has the query type "efficiency analysis", the query dimension "vehicle type", and the core query indicators "average processing time" and "abnormal work order volume". Its cosine similarity of scenario features with the first query scenario is 0.95, which is higher than the preset similarity threshold (e.g., 0.8). Therefore, the data query device can determine the "work order processing efficiency analysis" scenario as the second query scenario.
[0110] In another possible implementation, if there is no second query scenario in the preset query scenario library that matches the first query scenario, the data query device can determine the first query scenario as the target query scenario.
[0111] In the first query scenario, the structured format of the query statement is not fixed. That is, when the analysis scenario corresponding to the user's query request does not belong to the enterprise's high-frequency standard analysis scenario, the data query device cannot match the corresponding pre-written benchmark query statement template from the preset query scenario library. In this case, the first query scenario itself is used as the target query scenario, and the query statement is subsequently dynamically generated by the large language model.
[0112] For example, if a user queries "Analyze the changing trend of work order processing efficiency in each quarter of the past three years and compare it with the same period last year", this query involves time series trend analysis and year-on-year comparison analysis, which does not belong to any scenario in the preset query scenario library. The data query device can determine the first query scenario as the target query scenario.
[0113] S302. Using the structured format of the target query statement corresponding to the target query scenario, rewrite the global context information to obtain the target query statement.
[0114] In one possible implementation, after the data query device determines the target query scenario, it uses the structured format of the target query statement corresponding to the target query scenario to rewrite the natural language description in the global context information to generate the target query statement.
[0115] It is understandable that the structured format of the target query statement refers to a structured query statement template corresponding to the target query scenario. The structured query statement template includes a fixed query framework (such as the data source table, grouping and statistical logic, aggregate functions, etc.) and replaceable parameters (such as time conditions, filtering conditions, etc.). The data query device can dynamically populate the replaceable parameters based on the table structure metadata (such as column names, data types, etc.) in the global context information, thereby generating a complete target query statement.
[0116] For example, in the scenario where the target query is "work order processing efficiency analysis", the structured format of the target query statement is: grouped by vehicle model, the average processing time and number of abnormal work orders for each vehicle model are calculated, where the time condition is a replaceable parameter. The data query device can generate the target query statement by replacing the time parameter with the corresponding date range based on the time condition "last month" in the global context information.
[0117] When the target query scenario is the first query scenario without a fixed format (i.e., the preset query scenario library is not hit), the data query device can trigger an adaptive exploration mode, input global contextual information into the large language model, and the large language model performs semantic parsing on the global contextual information and dynamically generates a structured query statement as the target query statement based on the parsing results.
[0118] Based on the above technical solution, this application can first determine the target query scenario corresponding to the global context information, and then rewrite the global context information using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement. This ensures that the generation of the query statement no longer relies on open-ended reasoning from scratch using a large language model, but is rewritten based on a pre-defined structured format. This avoids the large language model generating invalid query statements containing forged fields or non-closed-loop logic due to illusion phenomena. Furthermore, since the rewriting is based on the structured format corresponding to the target query scenario, isomorphic query requests under the same query scenario can generate structurally consistent target query statements, ensuring the logical consistency and reproducibility of multiple query results, and reducing the computational overhead caused by repeatedly performing complete semantic parsing and reasoning for each query.
[0119] In some embodiments, after obtaining the target query data, the data query device can also output a data analysis report based on the target query data. The process of outputting the data analysis report is described in detail below: S401. Perform data parsing on the target query data to obtain text parsing results and visualization charts.
[0120] In one possible implementation, the data query device can initiate multi-threaded concurrent scheduling after obtaining the target query data, simultaneously executing the text parsing branch and the chart generation branch.
[0121] In the text parsing branch, the data query device can input the target query data into the insight engine. The insight engine can then use a large language model to execute deep business analysis algorithms, parse the target query data, extract data features, and generate text parsing results.
[0122] For example, the insight engine can perform statistical analysis on the target query data mentioned above, calculate the overall average processing time for each vehicle model, and identify anomalies where the average processing time for a specific vehicle model is higher than the overall average. The insight engine further combines time series data to generate trend inferences, and finally generates text parsing results, including the average processing time for each vehicle model, the number of processed work orders, as well as anomaly detection and optimization suggestions.
[0123] In the chart generation branch, the data query device can synchronously input the target query data into the chart generator. The chart generator automatically parses the mapping relationship between data dimensions and indicators, selects an appropriate visualization chart template, and dynamically renders and generates a visualization chart.
[0124] For example, the chart generator can determine that the current target query data is categorical comparison data (vehicle type is the categorical dimension, and average processing time and number of work orders are numerical indicators), automatically select a bar chart template, and dynamically render and generate a bar chart using the underlying visualization graphics library. The horizontal axis of this bar chart represents vehicle type, the vertical axis represents average processing time, and the corresponding number of work orders is labeled above each bar.
[0125] S402. Integrate the text parsing results with the visualization charts to output a data analysis report.
[0126] In some embodiments, after the text parsing branch and the chart generation branch have completed their tasks, the data query device can merge the text parsing results with the visualization chart to generate and output a structured data analysis report.
[0127] For example, the data query device can structurally integrate text parsing results and bar charts to generate a panoramic data analysis report with rich graphics and text, and output it to the user.
[0128] Based on the above technical solution, this application can obtain text parsing results and visualization charts by parsing the target query data, and then output a data analysis report by merging the text parsing results and visualization charts. This lowers the barrier for users to interpret data, and further enhances the intuitive presentation of data characteristics on the basis of data retrieval and security protection, thereby increasing the practical value of the query results to users.
[0129] In some embodiments, such as Figure 3 As shown, Figure 3 This is a schematic diagram of a data query process provided in an embodiment of this application.
[0130] S1. Obtain the user's query request and generate global context information based on the query request and the target table structure of the target database.
[0131] S2. Determine the target query scenario corresponding to the global context information; S3. Perform intent parsing on the global contextual information to obtain the first query scenario.
[0132] S4. Match the first query scenario with the query scenarios in the preset query scenario library based on scenario features, and determine the target query scenario based on the matching results.
[0133] S5. Using the structured format of the target query statement corresponding to the target query scenario, rewrite the global context information to obtain the target query statement.
[0134] S6. The target query statement is subjected to syntax-level interception and forced aggregation verification through the security sandbox executor.
[0135] S7. Send the target query statement that has passed the verification to the target database for execution, obtain the initial query result returned by the target database, perform privacy filtering on the initial query result, and obtain the target query result; S8. Based on the target query data, output a data analysis report.
[0136] In some embodiments, such as Figure 4 As shown, Figure 4 The data query device includes: a context management and planning module, a hybrid script matching module, an adaptive exploration module, a deep insight generation module, and a secure sandbox execution module.
[0137] The context management and planning module can be used to respond to user query requests and generate global context information corresponding to the query request.
[0138] Specifically, the context management and planning module obtains the query request input by the user, extracts the table structure metadata of the target database, establishes a field binding relationship between the natural language description in the query request and the column names in the table structure metadata, replaces the natural language description with the corresponding data table column names, and generates global context information by combining historical multi-turn dialogue records.
[0139] The hybrid script matching module is used to determine the target query statement based on global contextual information.
[0140] Specifically, the hybrid script matching module can determine the target query scenario corresponding to the global context information, and rewrite the global context information using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement.
[0141] The hybrid script matching module can determine the first query scenario as the target query scenario if there is no second query scenario that matches the first query scenario in the preset query scenario library. The structured format of the query statement of the first query scenario is not fixed.
[0142] The adaptive exploration module can be used to query the target database using the target query statement to obtain the target query data.
[0143] The adaptive exploration module can use the target query statement to query the target database and obtain initial query data. Then, it performs privacy filtering on the initial query data to obtain the target query data.
[0144] The Deep Insights generation module can be used to generate data analysis reports based on target query data.
[0145] Specifically, the deep insight generation module parses the target query data to obtain text parsing results and visualization charts. Then, the text parsing results and visualization charts are merged to output a data analysis report.
[0146] The security sandbox execution module can be used to perform security checks on target query statements and detect whether the target query statement is a dangerous query statement.
[0147] Specifically, the security sandbox execution module can use abstract syntax tree parsing or regular expression filtering algorithms to parse the target query statement, detecting whether the target query statement contains preset dangerous keywords (such as data deletion keywords, data update keywords, data insertion keywords, data definition keywords, etc.) from a preset dangerous keyword list. If it does, the target query statement is intercepted. The security sandbox execution module can also detect whether the query clause of the target query statement contains aggregate functions (such as summation functions, counting functions, average functions, maximum functions, minimum functions, etc.) from a preset aggregate function list. If it does not, the target query statement is intercepted.
[0148] In some embodiments, such as Figure 5 As shown, Figure 5 The data query process in the middle includes: In one possible implementation, the data query device can receive global contextual information. The data query device can then perform intent parsing on the global contextual information to obtain a first query scenario. The data query device can then perform scenario feature matching between the first query scenario and query scenarios in a preset query scenario library to determine whether a second query scenario matching the first query scenario exists in the preset query scenario library.
[0149] Then, if a second query scenario matching the first query scenario exists in the preset query scenario database, the data query device determines the second query scenario as the target query scenario. Next, using the structured format of the target query statement corresponding to the target query scenario, the global context information is rewritten to obtain the target query statement. Using the target query statement, data is queried from the target database to obtain the target query data, which is then output.
[0150] Alternatively, if the data query device does not have a second query scenario that matches the first query scenario in the preset query scenario library, it can determine the first query scenario as the target query scenario, trigger the adaptive exploration mode, obtain the target query data, and output the target query data.
[0151] In some embodiments, such as Figure 6 As shown, Figure 6 The data query process in the middle includes: In one possible implementation, the data query device can receive a target query statement to be executed and then determine whether the target query statement contains preset dangerous keywords from a preset list of dangerous keywords.
[0152] If the target query contains a preset dangerous keyword from the preset dangerous keyword list, the target query will be denied access.
[0153] If the target query does not contain any of the preset dangerous keywords in the preset dangerous keyword list, then check whether the target query contains any of the aggregate functions in the preset aggregate function list.
[0154] If the target query does not contain any aggregate functions from the predefined list of aggregate functions, then the target query will be denied.
[0155] If the target query statement contains aggregate functions from the preset list of aggregate functions, then after security verification, the target query statement will be sent to the target database for execution.
[0156] Then, the data query device can receive the initial query data returned by the target database and detect whether the aggregate count value corresponding to each data record in the initial query data is lower than the preset count threshold.
[0157] If the aggregate count value corresponding to each data record in the initial query data is lower than the preset count threshold, privacy filtering is triggered to filter out that data record.
[0158] If the aggregate count value corresponding to each data record in the initial query data is not lower than the preset count threshold, then the target query data will be output.
[0159] The foregoing primarily describes the solutions of the embodiments of this disclosure from a methodological perspective. It is understood that, in order to achieve the above functions, the data query device includes at least one of the hardware structures and software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure.
[0160] This disclosure embodiment can divide the data query device into functional modules according to the above method embodiment. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one functional module. The integrated module can be implemented in hardware or software. It should be noted that the module division in this disclosure embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods. The following description uses the example of dividing each functional module according to each function.
[0161] Figure 7This is a schematic diagram of a data query device provided in an embodiment of this disclosure, which can execute the data query method provided in the above method embodiments. For example... Figure 7 As shown, the data query device 700 includes: a generation module 701, a determination module 702, and a processing module 703.
[0162] In some possible implementations, the generation module 701 is used to generate global context information corresponding to the query request in response to the user's query request; wherein, the query request is used to request to query target data from the target database; the global context information does not contain field information corresponding to fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database; the determination module 702 is used to determine the target query statement based on the global context information; the processing module 703 is used to perform data query on the target database using the target query statement to obtain the target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; dangerous query statements include query statements that directly retrieve the underlying detail list.
[0163] In some possible implementations, the determining module 702 is specifically used to: determine the target query scenario corresponding to the global context information; and rewrite the global context information using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement.
[0164] In some possible implementations, the determining module 702 is specifically used for: performing intent parsing on global contextual information to obtain a first query scenario; matching the first query scenario with query scenarios in a preset query scenario library to obtain a second query scenario that matches the first query scenario; and determining the second query scenario as the target query scenario.
[0165] In some possible implementations, the determining module 702 is specifically used to: determine the query scenario with the highest scene feature similarity to the first query scenario in the preset query scenario library as the second query scenario; wherein, scene feature similarity includes feature semantic similarity or feature cosine similarity.
[0166] In some possible implementations, the determining module 702 is specifically used to: determine the first query scenario as the target query scenario when there is no second query scenario matching the first query scenario in the preset query scenario library; wherein the structured format of the query statement of the first query scenario is unstructured.
[0167] In some possible implementations, the first query scenario and the query scenarios in the preset query scenario library include query type, query dimension and query core indicators.
[0168] In some possible implementations, the processing module 703 is specifically used to: determine the query statement as a dangerous query statement if the query statement does not include aggregate functions from the preset list of aggregate functions; wherein, the aggregate function is a function that performs statistical summarization on the data in the underlying detail list.
[0169] In some possible implementations, the processing module 703 is specifically configured to: retrieve a preset list of dangerous keywords; and determine the query statement as a dangerous query statement if the query statement includes any preset dangerous keyword from the preset list of dangerous keywords.
[0170] In some possible implementations, the processing module 703 is specifically used to: use the target query statement to perform a data query on the target database to obtain initial query data; perform privacy filtering on the initial query data to obtain target query data; wherein, the privacy filtering is used to prevent privacy information from being derived from the initial query data.
[0171] In some possible implementations, the target query statement includes at least one aggregate function; the aggregate function is a function that performs statistical summarization on the data in the underlying detail list; the processing module 703 is specifically used to: determine the aggregate count value corresponding to each aggregate function in the initial query data; filter out the query data corresponding to the aggregate functions whose aggregate count values are lower than a preset count threshold from the initial query data to obtain the target query data; wherein, the lower the aggregate count value, the higher the probability of deriving the data in the underlying detail list, and the higher the probability of privacy information leakage.
[0172] In some possible implementations, table structure metadata includes, but is not limited to: column names, data types, and non-sensitive enumeration values.
[0173] In some possible implementations, the processing module 703 is also configured to output a data analysis report based on the target query data; wherein the data analysis report is used to present the data characteristics of the target query data to the user.
[0174] In some possible implementations, the processing module 703 is specifically used to: perform data parsing on the target query data to obtain text parsing results and visualization charts; and merge the text parsing results with the visualization charts to output a data analysis report.
[0175] When implementing the functions of the integrated modules described above in hardware, this disclosure provides a possible structure for the control device involved in the above embodiments. For example... Figure 8As shown, the control device 800 includes a processor 802 and a bus 804. Optionally, the control device may also include a memory 801; optionally, the control device 800 may also include a communication interface 803.
[0176] Processor 802 may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with embodiments of this disclosure. Processor 802 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with embodiments of this disclosure. Processor 802 may also be a combination of functions implementing computational capabilities, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0177] The communication interface 803 is used to connect to other devices via a communication network. This communication network can be Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0178] The memory 801 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0179] In one possible implementation, the memory 801 can exist independently of the processor 802. The memory 801 can be connected to the processor 802 via a bus 804 and is used to store instructions or program code. When the processor 802 calls and executes the instructions or program code stored in the memory 801, it can implement the data query method provided in this embodiment. In another possible implementation, the memory 801 can also be integrated with the processor 802.
[0180] The 804 bus can be an extended industry standard architecture (EISA) bus, etc. The 804 bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0181] Some embodiments of this disclosure provide a computer-readable storage medium (e.g., a non-transitory computer-readable storage medium) storing computer program instructions that, when executed on a processor, cause the processor to perform a data query method as described in any of the above embodiments.
[0182] Exemplary examples of computer-readable storage media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks, or magnetic tapes), optical discs (e.g., compact disks (CDs), digital versatile disks (DVDs), etc.), smart cards, and flash memory devices (e.g., erasable programmable read-only memory (EPROMs), cards, sticks, or key drives, etc.). The various computer-readable storage media described in this disclosure may represent one or more devices and / or other machine-readable storage media for storing information. The term "machine-readable storage medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing, and / or carrying instructions and / or data.
[0183] This disclosure provides a computer program product containing instructions that, when run on a processor, cause the processor to execute the data query method of any of the above embodiments.
[0184] This disclosure provides a vehicle including the control device of any of the preceding embodiments; or the computer-readable storage medium of any of the preceding embodiments; or the computer program product of any of the preceding embodiments.
[0185] The vehicle provided in this application may be a passenger vehicle or a freight vehicle, and may also be an electric vehicle or a hybrid vehicle. This application does not limit the specific purpose or power type of the vehicle, and the choice can be made according to actual needs.
[0186] A vehicle consists of a body and wheels. The body is used for passengers and for carrying goods, while the wheels are mounted underneath the body to support it and allow it to roll on the road, thus enabling the vehicle to move.
[0187] In some possible examples, the vehicle is equipped with a control system, which typically adopts a layered distributed architecture. From the bottom layer to the top layer, it can be roughly divided into a perception layer, a control layer, a coordination layer, and an interaction layer. The layers communicate with each other through an in-vehicle network.
[0188] The perception layer mainly consists of various sensors distributed inside and outside the vehicle, including but not limited to external environment cameras, millimeter-wave radar, lidar, ultrasonic sensors, in-vehicle driver monitoring cameras, microphone arrays, and various vehicle status sensors (such as wheel speed sensors, inertial measurement units, temperature sensors, etc.). The perception layer is responsible for collecting multi-dimensional data such as the vehicle's own operating status, driver behavior, and external driving environment in real time.
[0189] The control layer consists of dozens to hundreds of electronic control units (ECUs), distributed across multiple functional domains including powertrain, chassis, body, intelligent driving, and infotainment. Each ECU embeds real-time control software that performs closed-loop control of the vehicle's actuators based on preset control strategies or upper-level commands, and generates corresponding alarm signals when abnormal conditions are detected. Typical ECUs include the engine control unit, transmission control unit, brake control unit, steering control unit, vehicle stability control unit, airbag control unit, intelligent driving domain controller, and in-vehicle infotainment unit.
[0190] The coordination layer typically exists in the form of a domain controller or a central computing platform, responsible for cross-domain data fusion, global state management, and collaborative decision-making. The coordination layer centrally processes and schedules the sensing data and control commands that were originally scattered across various functional domains, connecting downwards to various electronic control units and supporting human-machine interaction functions upwards.
[0191] The interaction layer mainly includes in-cabin display devices (such as instrument panel, central control screen, head-up display), voice interaction system, haptic feedback device, etc., which are responsible for presenting vehicle status, warning information and driving suggestions to the driver in the form of visual, auditory or tactile, while receiving the driver's touch, voice and other input commands.
[0192] Data transmission and interaction between different layers are achieved through the vehicle bus network. Common vehicle bus protocols include CAN (Controller Area Network), CAN FD (CAN with Flexible Data-Rate), LIN (Local Interconnect Network), FlexRay, and vehicle Ethernet, which supports high-bandwidth data transmission. Among these, CAN and CAN FD buses are widely used for communication in real-time control domains such as powertrain and chassis, while vehicle Ethernet is gradually being applied to high-bandwidth sensor data transmission in the intelligent driving domain and multimedia interaction scenarios in the cockpit domain.
[0193] The above are merely specific embodiments of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any changes or substitutions within the technical scope disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A data query method, characterized in that, The method includes: In response to a user's query request, global context information corresponding to the query request is generated; wherein, the query request is used to request to query target data from the target database; the global context information does not include field information corresponding to fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database; Based on the global context information, the target query statement is determined; Using the target query statement, data is queried in the target database to obtain the target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; the dangerous query statement includes query statements that directly retrieve the underlying detailed list.
2. The data query method according to claim 1, characterized in that, The step of determining the target query statement based on the global context information includes: Determine the target query scenario corresponding to the global context information; The global context information is rewritten using the structured format of the target query statement corresponding to the target query scenario to obtain the target query statement.
3. The data query method according to claim 2, characterized in that, Determining the target query scenario corresponding to the global context information includes: The global context information is parsed to obtain the first query scenario; The first query scenario is matched with the query scenarios in the preset query scenario library by scenario feature matching to obtain a second query scenario that matches the first query scenario. The second query scenario is determined as the target query scenario.
4. The data query method according to claim 3, characterized in that, The step of matching the first query scenario with query scenarios in a preset query scenario library to obtain a second query scenario that matches the first query scenario includes: The query scenario with the highest scene feature similarity to the first query scenario in the preset query scenario library is determined as the second query scenario; wherein, the scene feature similarity includes feature semantic similarity or feature cosine similarity.
5. The data query method according to claim 3, characterized in that, The step of determining the target query scenario corresponding to the global context information further includes: If no second query scenario matching the first query scenario exists in the preset query scenario library, the first query scenario is determined as the target query scenario; wherein, the structured format of the query statement of the first query scenario is unstructured.
6. The data query method according to any one of claims 3-5, characterized in that, The first query scenario and the query scenarios in the preset query scenario library include query type, query dimension and query core indicators.
7. The data query method according to claim 1, characterized in that, The process of determining the query statement to directly retrieve the underlying detail list includes: If a query statement does not include any of the aggregate functions in the preset list of aggregate functions, the query statement is identified as a dangerous query statement; wherein, the aggregate function is a function that performs statistical summarization on the data in the underlying detail list.
8. The data query method according to claim 1 or 7, characterized in that, The dangerous query statement also includes a query statement containing preset dangerous keywords; the process of determining the query statement containing preset dangerous keywords includes: Retrieve a pre-defined list of dangerous keywords; If a query statement includes any of the preset dangerous keywords from the preset dangerous keyword list, the query statement will be identified as a dangerous query statement.
9. The data query method according to claim 1, characterized in that, The step of using the target query statement to query the target database and obtain the target query data includes: Using the target query statement, data is queried in the target database to obtain initial query data; The initial query data is subjected to privacy filtering to obtain the target query data; wherein, the privacy filtering is used to prevent privacy information from being derived from the initial query data.
10. The data query method according to claim 9, characterized in that, The target query statement includes at least one aggregate function; the aggregate function is a function that performs statistical summarization on the data in the underlying detail list; the privacy filtering process on the initial query data to obtain the target query data includes: Determine the aggregation count value in the initial query data corresponding to each of the at least one aggregation function; The target query data is obtained by filtering out the query data corresponding to the aggregation function whose aggregation count value is lower than the preset count threshold from the initial query data; wherein, the lower the aggregation count value, the higher the probability of deriving the data in the underlying detail list, and the higher the probability of privacy information leakage.
11. The data query method according to claim 1, characterized in that, The table structure metadata includes, but is not limited to: column names, data types, and non-sensitive enumeration values.
12. The data query method according to claim 1, characterized in that, The method further includes: Based on the target query data, a data analysis report is output; wherein, the data analysis report is used to present the data characteristics of the target query data to the user.
13. The data query method according to claim 12, characterized in that, The process of outputting a data analysis report based on the target query data includes: The target query data is parsed to obtain text parsing results and visualization charts; The text parsing results are combined with the visualization charts to output the data analysis report.
14. A data query device, characterized in that, The data query device includes: a generation module, a determination module, and a processing module; The generation module is used to generate global context information corresponding to the user's query request in response to the query request; wherein, the query request is used to request to query target data from the target database; the global context information does not include field information corresponding to fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database; The determining module is used to determine the target query statement based on the global context information; The processing module is used to perform data query on the target database using the target query statement to obtain target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; the dangerous query statement includes a query statement that directly retrieves the underlying detailed list.
15. A vehicle, characterized in that, The vehicle includes a data query system, which includes: the data query device as described in claim 14 and a target database; The data query device is configured as follows: In response to a user's query request, global context information corresponding to the query request is generated; wherein, the query request is used to request to query target data from the target database; the global context information does not include field information corresponding to fields other than the target field; the target field is the data field corresponding to the table structure metadata of the target database; Based on the global context information, the target query statement is determined; Using the target query statement, data is queried in the target database to obtain the target query data; wherein, during the data query process, if the target query statement is detected as a dangerous query statement, the target query statement is intercepted; the dangerous query statement includes query statements that directly retrieve the underlying detailed list.
16. A control device, characterized in that, The control device includes: a memory and a processor; the memory and the processor are coupled; the memory is used to store instructions executable by the processor; when the processor executes the instructions, it performs the data query method as described in any one of claims 1 to 13.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on a processor, cause the processor to perform the data query method as described in any one of claims 1 to 13.
18. A computer program product, characterized in that, It includes a computer program; when the computer program is executed, it is capable of implementing the data query method as described in any one of claims 1 to 13.
