Construction method of business meta-knowledge base and local data analysis method based on business meta-knowledge base
By constructing a business meta-knowledge base and local data analysis methods, and using a large language model to generate structured data manipulation statements, the problems of data leakage risk and insufficient analysis accuracy were solved, achieving high-quality local data analysis services and ensuring data security and user experience.
Patent Information
- Application Number
- CN202511478984.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2026-01-09
AI Technical Summary
Existing natural language data analysis technologies based on large language models suffer from data leakage risks and insufficient accuracy in complex data analysis tasks, especially in cloud-based analysis solutions. Furthermore, local analysis solutions lack sufficient understanding of open-source models and knowledge reserves.
A business meta-knowledge base is constructed, including table structure definitions, business rule documents, and analysis templates. Structured data operation statements are generated through a large language model, and analysis is performed in combination with local data. The generation process is trained using historical cases to achieve local data analysis, and data security is protected through data identification mapping and de-identification processing.
While ensuring data security, we provide high-quality natural language data analysis services, lowering the technical threshold and improving analysis accuracy and user experience.
Smart Images

Figure CN121301583A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data analysis technology, and more specifically to a method for constructing a business element knowledge base and a local data analysis method based on the business element knowledge base. Background Technology
[0002] Data analysis refers to the process of processing, analyzing, and mining collected data to extract valuable information, patterns, or conclusions, ultimately providing support for decision-making. Traditional data analysis requires users to have SQL programming skills or be familiar with complex BI tools, which greatly limits its accessibility. With the rapid development of large language model technology and the deepening of enterprise digital transformation, natural language data analysis has become an important development direction for enterprise data applications. Natural language data analysis technology based on large language models allows users to describe their analysis needs using everyday language, and the intelligent system automatically generates query statements, executes analysis tasks, and generates insight reports, greatly lowering the technical threshold for data analysis. Existing technologies for natural language data analysis based on large language models mainly include cloud-based analysis solutions based on commercial models and local analysis solutions based on private open-source models. Cloud-based analysis solutions based on commercial models require sensitive data to be transmitted to third-party cloud service providers, posing risks of data leakage and misuse. Local analysis solutions based on private open-source models suffer from insufficient accuracy and depth in complex data analysis tasks due to the significant gap in understanding, reasoning, and knowledge reserves compared to commercial models, resulting in a poor user experience. To address the aforementioned technical issues, a method for constructing a business meta-knowledge base and a local data analysis method based on the business meta-knowledge base are provided. Summary of the Invention
[0003] The following provides a brief overview of one or more aspects to offer a basic understanding of them. This overview is not an exhaustive summary of all conceived aspects, nor is it intended to identify key or decisive elements of all aspects, nor to define the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form to prepare for the more detailed descriptions that follow.
[0004] To overcome the above-mentioned shortcomings, the present invention aims to provide a method for constructing a business meta-knowledge base and a local data analysis method based on the business meta-knowledge base.
[0005] According to one aspect of the present invention, a method for constructing a business meta-knowledge base is provided. The business meta-knowledge base includes table structure definitions for several business scenarios, business rule documents, and analysis templates. The construction method includes:
[0006] Table structure, business rules, and analysis process in business scenarios that receive user input;
[0007] Establish table structure definitions for each business scenario based on the table structure of each business scenario.
[0008] Develop business rule documents tailored to each business scenario based on the business rules for that specific scenario; and
[0009] Based on the analysis process for each business scenario, an analysis template is established for that business scenario. The business meta-knowledge for each business scenario includes the table structure definition, business rule document, and analysis template. The business meta-knowledge is used to guide the big oracle model to generate structured data operation statements for the business scenario.
[0010] Furthermore, the business metadata for each business scenario also includes user requirements - examples of structured data manipulation statements, and the construction methods also include:
[0011] Obtain historical cases of successful matching between user requirements and structured data manipulation statements;
[0012] An index of user requirements to structured data manipulation statements is generated based on each historical case to construct user requirement-structured data manipulation statement examples. These user requirement-structured data manipulation statement examples are used to guide the large language model to imitate historical cases and generate structured data manipulation statements.
[0013] Furthermore, by using historical cases to train the generation process of structured data manipulation statements for corresponding business scenarios, an analysis template for business rules that conforms to the business scenarios is established. The analysis template is used to guide the process of large language models analyzing business requirements corresponding to business meta-knowledge.
[0014] According to another aspect of the present invention, a local data analysis method based on a business meta-knowledge base is provided, comprising:
[0015] Receive user requests;
[0016] Based on user needs and the business metadata involved in user needs, prompt instructions are generated corresponding to user needs. The prompt instructions include instruction statements generated by the command language model that correspond to the structured data operation statements of user needs, as well as prompt information containing the business metadata involved in user needs.
[0017] Send prompts to the large language model and receive structured data manipulation statements generated based on the prompts from the large language model; and
[0018] Locally, using raw data as the object of manipulation, structured data manipulation statements are executed to obtain answers tailored to user needs.
[0019] Furthermore, based on user needs and the business metadata involved in those needs, the system generates prompts corresponding to the user's needs, including:
[0020] Extract several keywords from user needs;
[0021] Based on several keywords, business metadata corresponding to user needs is retrieved to determine the prompt information; and
[0022] Replace the variables in the prompt instruction template with business metadata corresponding to the user's requirements to determine the instruction statements.
[0023] Furthermore, business metadata includes table structure definitions, business rules, and analysis processes. Locally, using raw data as the object of manipulation, structured data manipulation statements are executed to obtain answers tailored to user needs, including:
[0024] Establish a connection between structured operation statements and locally stored raw data based on business metadata corresponding to user needs;
[0025] Based on the connection, structured data manipulation statements are executed on the original data to obtain an answer that meets the user's needs. The answer is the execution result of the structured data manipulation statements that satisfy the user's needs; and
[0026] Output the answer to the user's input window.
[0027] Furthermore, the response output to the user's input window includes:
[0028] Perform data type conversion and format standardization on the execution results of structured data manipulation statements; and
[0029] Output the answer in a standardized format.
[0030] Furthermore, in response to user needs, including chart generation requirements, local data analysis methods also include:
[0031] A data identifier mapping table is established locally. The data identifier mapping table includes data identifiers and the mapping relationship between data identifiers and field names of the original data. The data identifier is the code of the original data.
[0032] Send the data identifier to the large language model;
[0033] Receive the chart configuration output by the large language model. The chart configuration shall include at least the chart type and the presentation method of the data identifier.
[0034] The chart configuration is parsed in the local chart generator, and the original data corresponding to the data identifier is obtained based on the data identifier mapping table.
[0035] Charts are generated based on the original data corresponding to the chart configuration and data identifiers. The charts are the answers to the chart generation requirements.
[0036] Furthermore, in response to user needs, including in-depth analysis needs, structured data manipulation statements, including data query commands, are executed locally using raw data as the object of manipulation to obtain answers to user needs, including:
[0037] Execute data query commands locally to determine the range of raw data corresponding to in-depth analysis requirements;
[0038] Determine the sensitive data within the original data range based on the sensitive data range;
[0039] The sensitive data fields in the original data range are replaced with the corresponding code fields, and the sensitive data values in the original data range are replaced with the corresponding code values to generate desensitized data corresponding to the original data range, and a mapping relationship between the sensitive data and the replaced original data is established locally.
[0040] Send the anonymized data to the large language model;
[0041] Receive in-depth analysis reports generated by a large language model based on anonymized data, corresponding to user needs, and reconstruct the true business descriptions in the in-depth analysis reports based on mapping relationships; and
[0042] Output a detailed analysis report after restoration.
[0043] According to another aspect of the present invention, a computer device is provided, the computer device including a memory and a processor, the memory storing computer-readable instructions, which, when executed by the processor, cause the processor to perform the above-described method for constructing a business element knowledge base or a local data analysis method.
[0044] According to another aspect of the present invention, one or more non-volatile computer-readable storage media containing computer-executable instructions are provided, which, when executed by one or more processors, cause the processors to perform the above-described method for constructing a business element knowledge base or a local data analysis method.
[0045] This invention systematically integrates multiple technologies, including knowledge base metadata-driven approach, local data isolation execution, memory abstraction and mapping, and dynamic desensitization and intelligent restoration, to construct a complete data security protection system. This system enables large language models to provide high-quality natural language data analysis services without touching any original sensitive data, thereby achieving ideal analysis results while ensuring data security. Attached Figure Description
[0046] The above-described features and advantages of the present invention will be better understood after reading the detailed description of the embodiments of this disclosure in conjunction with the following accompanying drawings.
[0047] Figure 1 A flowchart illustrating the construction method of a business element knowledge base in a specific embodiment is shown.
[0048] Figure 2 A flowchart illustrating an example of forming user requirements-structured data manipulation statements is shown in a specific embodiment.
[0049] Figure 3 A flowchart illustrating the process of constructing an analysis template is shown in a specific embodiment.
[0050] Figure 4 A flowchart illustrating a local data analysis method based on a large language model is shown in a specific embodiment.
[0051] Figure 5 The diagram illustrates a flowchart of generating prompt instructions in a specific embodiment.
[0052] Figure 6 A schematic diagram of the process for generating answers to user needs is shown in a specific embodiment.
[0053] Figure 7 A schematic diagram of the process for generating standardized responses to user needs is shown in a specific embodiment.
[0054] Figure 8 A schematic diagram of the chart generation process in a specific embodiment is shown.
[0055] Figure 9 A schematic diagram of the desensitization process in a specific embodiment is shown. Detailed Implementation
[0056] The following description is provided to enable those skilled in the art to implement and use the invention and adapt it to specific application contexts. Various modifications and uses in different applications will be readily apparent to those skilled in the art, and the general principles defined herein are applicable to a wide range of embodiments. Therefore, the invention is not limited to the embodiments given herein, but should be granted the broadest scope consistent with the principles and novel features disclosed herein.
[0057] In the following detailed description, numerous specific details are set forth to provide a more thorough understanding of the invention. However, it will be apparent to those skilled in the art that practice of the invention is not necessarily limited to these specific details. In other words, well-known structures and devices are shown in block diagram form without being depicted in detail to avoid obscuring the invention.
[0058] Readers should note all documents and references submitted concurrently with this specification and open to public inspection, the contents of which are incorporated herein by reference. Unless otherwise expressly stated, all features disclosed in this specification (including any appended claims, abstracts, and drawings) may be replaced by alternative features for the same, equivalent, or similar purposes. Therefore, unless explicitly stated otherwise, each disclosed feature is merely one example of a set of equivalent or similar features.
[0059] Note that, where used, the markings left, right, front, back, top, bottom, front, back, clockwise, and counterclockwise are merely for convenience and do not imply any specific fixed direction. In fact, they are used to reflect the relative position and / or orientation between different parts of an object. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0060] Note that, in practice, "further," "preferably," "even further," and "more preferably" are simply starting points for describing another embodiment based on the foregoing embodiments. The combination of the content following "further," "preferably," "even further," or "more preferably" with the foregoing embodiments constitutes the complete configuration of another embodiment. Any combination of several "further," "preferably," "even further," or "more preferably" settings following the same embodiment can form yet another embodiment.
[0061] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. It should be noted that the aspects described below with reference to the accompanying drawings and specific embodiments are merely exemplary and should not be construed as limiting the scope of protection of the present invention in any way.
[0062] According to one aspect of the present invention, a method for constructing a business meta-knowledge base is provided, wherein the business meta-knowledge base refers to a database that stores business meta-knowledge in a structured form.
[0063] As an example, Figure 1 A flowchart illustrating the construction method of a business element knowledge base in a specific embodiment is shown below. Figure 1 The method for constructing the business element knowledge base in this embodiment includes steps S101 to S104.
[0064] Step S101 is: receiving user input of the table structure, business rules, and analysis process under the business scenario.
[0065] Table structure refers to the structural description of the data table's composition under a specific business scenario. Table structure may include database name, table name, field list, or field types. Business rules refer to the structured description of business logic under a specific business scenario. For example, business logic may include: calculation criteria, filtering conditions, aggregation methods, or time windows.
[0066] An analysis process is a set of sequential operational steps designed to achieve a predetermined analytical objective. As a non-restrictive example, if the analytical objective is: "How to analyze a declining growth trend?", the analysis process would be as follows: "Step 1 - Construct the basic dataset; Step 2 - Perform linear regression trend calculation; Step 3 - Trend classification and filtering; Step 4 - Query and analyze related indicators; Step 5 - Interpret and output the comprehensive results."
[0067] The business scenario refers to the specific vertical domain in which the business metadata knowledge base is applied. For example, if the business scenario is the e-commerce industry, then the table structure for products, orders, and user behavior, as well as e-commerce business rules, will be configured. If the business scenario is the financial industry, then the table structure for transactions, risk control, and customers, as well as financial compliance rules, will be configured. If the business scenario is the manufacturing industry, then the table structure for production, equipment, and quality, as well as manufacturing business rules, will be configured. If the business scenario is the healthcare industry, then the table structure for patients, treatment, and pharmaceuticals, as well as healthcare business rules, will be configured.
[0068] Step S102 is: to establish a table structure definition for each business scenario based on the table structure of each business scenario.
[0069] Table structure definition refers to the readable meta-knowledge entries of the large language model formed by the table structure. For example, table structure definition can include: table name, field names, and field comments. Among them, the table name is the name that represents the data table type, the field names are the identifier symbols of the data that make up the data table, and the field comments are the natural language descriptions of the data that make up the data table.
[0070] Step S103 is: to establish a business rule document for each business scenario based on the business rules of each business scenario.
[0071] Business rule documents refer to the meta-knowledge entries formed by structuring business rules. Business rule documents can include structured text describing specific business content, such as explanations of business terminology, business conditions, and output format specifications. Specifically, explanations of business terminology refer to the definitions of terms with business meaning. Business conditions refer to executable logical assertions that unify calculation processes, business systems, and statistical standards. Output format specifications refer to the formal constraints upon which data standardization is based.
[0072] Step S104 is: to establish an analysis template for each business scenario based on the analysis process of each business scenario.
[0073] Analysis templates refer to meta-knowledge entries formed by parameterizing, standardizing, and reusable encapsulation of the analysis process. Analysis templates are used to guide large language models in generating structured data manipulation statements.
[0074] Those skilled in the art will understand that business metadata is used to guide the big oracle model in generating structured data manipulation statements for specific business scenarios. These structured statements are then executed in the local environment to achieve data analysis. The business metadata for each business scenario may include table structure definitions, business rule documents, and analysis templates, as well as other existing or future business metadata describing specific business content. Those skilled in the art can arbitrarily add, delete, adjust, or reconstruct the above examples in terms of content, scope, form, or combination, based on actual business scenarios, compliance requirements, and technological evolution, to achieve equivalent or better technical results.
[0075] The aforementioned table structure definitions, business rule documents, and analysis templates, as well as other meta-knowledge entries, can be stored in common machine-readable formats such as JSON, Protocol Buffers, YAML, Markdown, or CSV.
[0076] For example, the business metadata for each business scenario also includes examples of user requirements-structured data manipulation statements. As a non-limiting example, Figure 2 A flowchart illustrating an example of forming user requirements-structured data manipulation statements is shown in a specific embodiment. (Refer to...) Figure 2 The method for constructing this business meta-knowledge base also includes steps S201 and S202.
[0077] Step S201 is to obtain historical cases of successful matching between user requirements and structured data operation statements.
[0078] User requirements refer to questions posed by users in the form of natural language, structured language, or serialized text. Structured data manipulation statements refer to code snippets that can be directly executed by the parser and used for formal operations such as adding, deleting, modifying, querying, aggregating, and sorting datasets. These include, but are not limited to, SQL, DAX, MDX, Flink SQL, and MongoDB Aggregation Pipeline statements. Historical cases where user requirements and structured data manipulation statements successfully match can be annotated in a historical case library using existing or future annotation methods, such as manual annotation, algorithmic annotation, or a hybrid annotation approach.
[0079] Step S202 is: to generate an index of user requirements to structured data operation statements based on each historical case, so as to construct a user requirement-structured data operation statement example.
[0080] Step S202 is used to break down historical cases that successfully match user requirements with structured data manipulation statements into structured meta-knowledge entries with clearly defined fields, fixed types, and programmable parsing capabilities. The user requirement-structured data manipulation statement example can be presented in structured formats such as YAML, CSV / TSV with attached metadata tables, Markdown, and XML. This user requirement-structured data manipulation statement example guides the large language model to mimic historical cases and generate structured data manipulation statements based on user requirements.
[0081] As a non-restrictive example, Figure 3 A flowchart illustrating the construction of an analysis template in a specific embodiment is shown below. Figure 3 The method for constructing the analysis template includes step S301, which is a historical case in which user requirements and structured data operation statements are successfully matched, after step 201.
[0082] Step S301 is: using historical cases to train the generation process of structured data operation statements for corresponding business scenarios, so as to establish an analysis template that conforms to the business rules of the business scenario.
[0083] In step S21, historical success cases are labeled and generated. Step S301 uses these historical cases, including examples of user requirements and structured data manipulation statements, as supervised corpus to extract reusable skeletons and variable slots, thereby training analysis templates for specific business scenarios. These analysis templates guide the large language model in analyzing the business requirements corresponding to business metadata.
[0084] Those skilled in the art will understand that the above examples are intended to help understand the composition and application scenarios of the business meta knowledge base, and should not be taken as specific limitations of the business meta knowledge base. Those skilled in the art can arbitrarily add, delete, adjust or reconstruct the content, scope, form or combination of the examples according to actual business scenarios, compliance requirements and technological evolution, in order to achieve the same or better technical effects.
[0085] To leverage large language models for data analysis, a business meta-knowledge base was constructed as described above. This knowledge base is established between the local machine and the large language model, and then interacts between them via this knowledge base. This approach achieves efficient data analysis using the large language model while protecting local data privacy and security. Therefore, according to another aspect of the present invention, a local data analysis method based on a large language model is provided as a non-limiting example. Figure 4 A flowchart illustrating a local data analysis method based on a large language model in a specific embodiment is shown below. Figure 4 The local data analysis method includes steps S401 to S404.
[0086] Step S401 is: receiving user requests.
[0087] The user requirement can be a natural language requirement, or it can be a requirement expressed in the form of a structured language requirement, a serialized text requirement, or other similar forms.
[0088] Step S402 is: generating prompt instructions corresponding to user needs based on user needs and the business metadata involved in user needs.
[0089] Those skilled in the art will understand that a prompt instruction refers to text used to drive a large language model to complete a specific data operation task. This prompt instruction is assembled based on user needs and business metadata. Specifically, the prompt instruction may include command statements instructing the large language model to generate structured data operation statements corresponding to user needs, as well as prompt information containing business metadata related to the user needs.
[0090] The instruction statements are task-driven natural language statements directly addressed to the large language model, used to clarify the specific task type, output format, and constraints that the model needs to complete. The prompt information is structured text containing business metadata within the prompt instructions, used to provide the large language model with background data on the relevant business scenario necessary for understanding user needs.
[0091] As a non-restrictive example, the following is a specific example of generating prompts corresponding to user needs based on user requirements and the business metadata involved in those requirements:
[0092] If the user request received is: "Check the status of new offers in May";
[0093] The generated user request corresponds to the instruction statement: "You are an SQL generation expert, generating accurate SQL queries based on the provided table structure and business rules."
[0094] The prompt messages corresponding to the generated user requests are as follows:
[0095] ##Table structure definition:
[0096] CREATE TABLE offer (
[0097] statistical_period date NOT NULL COMMENT 'statistical period',
[0098] operator varchar(255) NOT NULL COMMENT'Operations Manager',
[0099] advertiser varchar(255) NOT NULL COMMENT 'Advertiser';
[0100] ##Business Rules:
[0101] - New Offers: Offers with data available at the specified time but no data available in the past 6 months.
[0102] - Time processing: Defaults to querying data from the most recent week.
[0103] - Output rules: Decimal fields should be rounded to two decimal places.
[0104] ##SQL Example:
[0105] Question: "New offers in May"
[0106] SQL: WITH may_packages AS (
[0107] SELECT DISTINCT package_name, MIN(statistical_period) AS first_active_date FROM offer
[0108] WHERE statistical_period BETWEEN '2025-05-01' AND '2025-05-31' GROUPBY package_name
[0109] )SELECT package_name FROM may_packages WHERE NOT EXISTS(...)”
[0110] The above example is a specific example of generating prompt instructions corresponding to user needs based on specific user needs and the business meta-knowledge involved in user needs in a specific business scenario. It should not be interpreted as a mandatory limitation on the content, form, order or generation method of the prompt instructions, nor does it constitute an exclusive constraint on the scope of business meta-knowledge, the selection of large language models or the prompt instructions generation process. Those skilled in the art can add, delete, adjust or recombine the examples according to actual business needs, model capabilities and compliance requirements to achieve the same or better technical effects.
[0111] Step S403 is: sending the prompt instruction to the large language model and receiving the structured data operation statement generated based on the prompt instruction returned by the large language model.
[0112] Among them, the large language model can be a text-code large language model such as OpenAI GPT-4, Claude-3-Opus or Gemini-1.5-Pro. The text-code large language model refers to a large language model that takes natural language or semi-structured text as input and directly generates executable code or scripts.
[0113] Structured data manipulation statements refer to statements that can perform data operations on a specific database. In this invention, structured data manipulation statements can be SQL statements, DAX statements, or MDX statements, which can be directly executed by the parser or generate an execution plan.
[0114] Step S404 is: using the original data as the operation object locally, execute structured data operation statements to obtain answers tailored to the user's needs.
[0115] In this context, "local" refers to the entire set of computing and storage resources that are directly controlled by the user and physically or virtualized and deployed in the user's operating environment. This includes, but is not limited to: privately deployed data center servers, private cloud virtual machines, or container cluster private environments; single-machine databases within local processes (such as SQLite, DuckDB, or ClickHouse local); and dedicated cloud hosts, dedicated data warehouses, or dedicated Hadoop clusters, etc., that are accessed via intranet dedicated lines or VPNs and whose data does not leave the country.
[0116] Raw data refers to data stored locally on the user's computer, typically in the form of databases, tables, or data streams. The answer to the user's question refers to the final result set or conclusion obtained after performing structured data manipulation statements on the raw data locally, which can be directly mapped back to the user's initial question intent; it can be in the form of numerical values, lists, charts, or natural language.
[0117] As a non-restrictive example, to generate accurate prompts, Figure 5 This diagram illustrates a flowchart of generating prompt instructions in a specific embodiment. (Refer to...) Figure 5 Step S402 may also include steps S501 to S503.
[0118] Step S501 involves extracting several keywords from the user's requirements.
[0119] Keywords refer to word-level units extracted from user requirement text that have a high degree of similarity to business metadata in the business metadata knowledge base, and are used to match user requirements with business metadata. Existing or future keyword extraction techniques, such as rule dictionary methods, statistical-unsupervised methods, or sequence labeling-deep learning methods, can be used to extract keywords from user requirements.
[0120] Step S502 is: based on several keywords, retrieve the business metadata corresponding to the user's needs to determine the prompt information.
[0121] Among these methods, retrieving business metadata corresponding to user needs based on keywords can be achieved through intelligent retrieval based on semantic similarity using a vector retrieval engine, or through precise literal matching using a pre-built thesaurus. As a non-restrictive example, if the user need is to view "new offers added in May," the extracted keywords could be: "new," "offer," and "May." Retrieving business metadata corresponding to user needs based on several keywords can be done as follows:
[0122] Table structure definition: offer table structure definition
[0123] Business Rules Documentation: New Offer Business Rules and Analysis Methods
[0124] User Requirements - Example of Structured Data Manipulation Statements: Query similar structured data manipulation statements.
[0125] The above example is a specific example of retrieving business metadata corresponding to user needs based on several keywords. Those skilled in the art can add, delete, adjust or recombine the data according to actual business needs, model capabilities and compliance requirements to achieve the same or better technical results.
[0126] Step S503 is to replace the variables in the prompt instruction template with the business metadata corresponding to the user's requirements in order to determine the instruction statement.
[0127] A prompt instruction template is a reusable, editable semi-structured text skeleton with placeholders, used to uniformly describe instruction statements and prompt information. The prompt instruction template reserves replaceable variables through variable placeholders (e.g., {business_glossary}, {calc_rule}, or {output_format}, etc.), and then injects business meta-knowledge matched with keywords into the variable placeholders, thereby instantly assembling a complete, semantically accurate instruction statement aligned with the current user's needs to guide the subsequent generation of structured operation statements by the large language model. As a non-restrictive example, the following is a prompt instruction template written in Python: "# Using a template system to build system prompt words"
[0128] template_state = { "dialect": "MySQL8", # Database dialect
[0129] "ddl_list": ddl_context,
[0130] "doc_list": doc_context,
[0131] "question_sql_list": sql_examples}
[0132] system_message = apply_prompt_template("vanna", template_state)".
[0133] The above example is a specific example of a prompt instruction template. Those skilled in the art can add, delete, adjust or recombine it according to actual business needs to achieve the same or better technical effect.
[0134] As a non-restrictive example, to generate accurate answers tailored to user needs, Figure 6 A flowchart illustrating the process of generating answers tailored to user needs is shown in a specific embodiment. Figure 6 Step S404 may also include steps S601 to S603.
[0135] Step S601 is: establishing a connection between structured operation statements and locally stored raw data based on the business metadata corresponding to user needs.
[0136] Specifically, a security sandbox can be established between the large language model and the local machine to ensure a secure connection between structured operation statements and the local machine. Alternatively, a secure connection between structured operation statements and the local machine can be established through encrypted transmission and two-way certificate authentication, proxy gateways and secondary authentication, read-only accounts and fine-grained authorization, etc.
[0137] Step S602 is: Execute structured data manipulation statements on the original data based on the connection to obtain an answer that meets the user's needs.
[0138] This answer is the result of executing structured data manipulation statements that meet the user's needs. An answer that meets the user's needs refers to the final result or conclusion obtained after executing structured data manipulation statements on the original data locally, which directly satisfies the user's initial question intent without secondary processing. Its business semantics, calculation scope, time range, granularity, and presentation format all correspond one-to-one with the user's needs. Its presentation format can be numerical, list, chart configuration, or natural language summary, etc.
[0139] Step S603 is: Output the answer to the user's input window.
[0140] Step S603 is used to encapsulate the answer obtained in step S32 that meets the user's needs in a certain form (e.g., JSON, table, chart configuration or natural language summary, etc.) and present it to the user, which can be read or downloaded directly by the user.
[0141] As a non-restrictive example, to generate standardized answers tailored to user needs, Figure 7 A flowchart illustrating the process of generating standardized responses to user needs is shown in a specific embodiment. Step S603 may further include steps S701 and S702.
[0142] Step S701 is to convert the data type and standardize the format of the execution result of the structured data manipulation statement.
[0143] The execution result of a structured data manipulation statement refers to the collection containing the original data returned after the structured data manipulation statement is completed locally. Data type conversion and format standardization refer to the process of converting the execution result of a structured data manipulation statement into the data type and format specified in the output specifications of the business rules. As a non-restrictive example:
[0144] The execution result of the SQL statement is as follows:
[0145] “gmvnumeric date country
[0146] 12345.6789 2025-06-01 US”
[0147] The output format specifications are as follows:
[0148] "GMV is rounded to two decimal places."
[0149] Date format: yyyy-MM-dd
[0150] Convert ratio field to percentage
[0151] Listing Chinese Alias
[0152] The data type conversion and format standardization process is as follows:
[0153] "{"GMV (USD)": 12345.68, / / Type: FLOAT → Keep 2 digits
[0154] "Statistical Date": "2025-06-01", / / Type: DATE → String
[0155] "Country / Region": "United States" / / Enumeration code US → Chinese mapping
[0156] }”
[0157] Step S702 is: Output the standardized answer.
[0158] Step S702 is used to encapsulate, label, and transmit the final data after data type conversion and format standardization according to the user's or system's preset presentation protocol (JSON table, CSV, chart configuration, or natural language summary) to form a directly readable answer.
[0159] As a non-restrictive example, to meet user needs, including the need for in-depth analysis, Figure 8 A flowchart illustrating the chart generation process in a specific embodiment is shown below. Figure 8 In response to user needs, including chart generation requirements, this data analysis method also includes steps S801 to S805.
[0160] Step S801 involves establishing a data identifier mapping table locally. This data identifier mapping table includes data identifiers and the mapping relationship between data identifiers and field names of the original data. The data identifiers are the codes of the original data.
[0161] A data identifier is a unique, non-business-meaning code assigned to raw data. There is a one-to-one correspondence between data identifiers and field names in the raw data. This correspondence is documented in a table, known as the data identifier mapping table, which maps data identifiers to field names in the raw data. Data identifiers, short, non-business-meaning codes, replace actual field names and are passed between the local machine and the model. This prevents information leakage and ensures that field mappings are unique, deterministic, and updatable. It allows the model to generate chart configurations using a unified interface without accessing the actual data, thus protecting local data security.
[0162] Step S802 is: Send the data identifier to the large language model.
[0163] After accepting data identifiers, the large language model determines the chart configuration based on the data identifiers and user requirements.
[0164] Step S803 is: receiving the chart configuration output by the large language model. The chart configuration includes at least the chart type and the presentation method of the data identifier.
[0165] Chart configuration refers to the set of graphical instructions provided by the chart rendering engine. Its contents can include chart elements such as chart type, title, and axis field mapping, which are used to drive the visualization component to generate charts that meet the user's needs.
[0166] Chart type is a category of visualization graphics determined by data characteristics and user needs, and can be existing or future chart types such as bar charts, line charts, pie charts, or histograms. The presentation of data identifiers in the chart specifies the mapping of the data identifier to the chart's axis position, color, size, and other presentation information. Step S804 involves parsing the chart configuration in the local chart generator and obtaining the original data corresponding to the data identifiers based on the data identifier mapping table.
[0167] The local chart generator is a lightweight visualization engine deployed in the user-side runtime environment (single machine, private server, or container). It is responsible for parsing the chart configuration into graphical syntax and restoring the data identifiers into real field names and original data in real time through the data identifier mapping table. Then, it retrieves the results in local memory or database and can render the chart without relying on the public network.
[0168] Step S805 is: Based on the original data corresponding to the chart configuration and data identifier, generate a chart, which is the answer to the chart generation requirement.
[0169] The local chart generator combines the chart type, axis mapping, and style parameters specified in the chart configuration with the original data restored by the data identifier through the mapping table, executes the rendering engine (such as ECharts or Vega-Lite), and outputs a visual chart. This chart constitutes the final answer to the "chart generation requirement" and can be directly presented, downloaded, or embedded in the report.
[0170] As a non-restrictive example, to meet user needs, including the need for in-depth analysis, Figure 9 A flowchart illustrating the desensitization process in a specific embodiment is shown below. Figure 9 In response to user needs, including in-depth analysis needs, structured data manipulation statements include data query instructions. Locally, using raw data as the operation object, the structured data manipulation statements are executed to obtain answers to user needs, and steps S901 to S906 are also included.
[0171] Step S901 involves executing a data query command locally to determine the range of raw data corresponding to the in-depth analysis requirements.
[0172] Data query commands refer to the query statements used to read data in the structured data manipulation statements returned by the large language model. These data query commands can be SQL statements, DQL statements, or AST statements, etc.
[0173] The scope of raw data required for in-depth analysis refers to the set of all raw data for which in-depth analysis is needed. By executing data query commands locally, the minimum data set required for subsequent in-depth analysis is determined, avoiding full table scans and reducing resource overhead.
[0174] Step S902 is: Determine the sensitive data in the original data range based on the sensitive data range.
[0175] The scope of sensitive data refers to the set of fields in the original database that contain personal privacy, trade secrets, or sensitive data as explicitly defined by national regulations, along with their corresponding data rows. The scope of sensitive data can be determined using existing or future methods commonly employed by those skilled in the art, such as manual annotation, semantic recognition annotation, or active learning annotation. Preferably, the scope of sensitive data is determined by establishing a sensitive database and comparing the data within the scope of the original data with the data in the sensitive database.
[0176] Sensitive data refers to data that appears both within the original data range corresponding to the in-depth analysis requirements and within the sensitive data range.
[0177] Step S903 is as follows: replace the fields of sensitive data in the original data range with the corresponding code fields, and replace the values of sensitive data in the original data range with the corresponding code values, so as to generate desensitized data corresponding to the original data range, and establish a mapping relationship between sensitive data and the replaced original data locally.
[0178] A code field refers to an anonymous identifier (e.g., C037 or field_01) assigned to a field of sensitive data, without any business meaning. Code fields can be implemented using existing or future desensitization mapping methods such as string replacement or prefix masking. The code value can be a numerical value generated by numerical offset and having the same relative size relationship as the sensitive data, or it can be a randomly generated sequential number or a random UUID.
[0179] The mapping relationship between locally established sensitive data and the original data being replaced is a table that includes the relationship between all the replaced sensitive data and the code fields and code values of the replacing sensitive data.
[0180] Desensitized data includes non-sensitive data within the original data range that has not been desensitized, as well as code fields and code values formed after desensitization.
[0181] Step S904 is: Send the de-identified data to the large language model.
[0182] After the anonymized data is sent to the large language model, the large language model performs in-depth analysis tasks such as statistical analysis, trend attribution, and natural language summarization based on the anonymized data and the user's in-depth analysis needs, generating a directly readable in-depth analysis report. In the in-depth analysis report generated by the large language model, sensitive data is presented as code fields and code values, while non-sensitive data is presented as raw data.
[0183] Step S905 is: receiving a deep analysis report corresponding to user needs generated by the large language model based on de-identified data, and restoring the true business description in the deep analysis report based on the mapping relationship.
[0184] After receiving the in-depth analysis report containing code fields and code values returned by the large language model locally, the system uses the mapping relationship between the original data and the code fields and code values to reverse-replace all sensitive data appearing in the in-depth analysis report, restoring them to real business terms, and forming a readable and semantically accurate in-depth analysis report.
[0185] Step S906 is: Output the restored depth analysis report.
[0186] After completing the reverse engineering of real business terminology locally, the final in-depth analysis report is packaged into a specified format (such as PDF, HTML, or interactive dashboard) and officially delivered to the user to meet the user's in-depth analysis needs.
[0187] Although the methods described above are illustrated and depicted as a series of actions for the sake of simplicity, it should be understood and appreciated that these methods are not limited by the order of the actions, as some actions may occur in a different order and / or concurrently with other actions from the illustrations and descriptions herein or not illustrated and described herein but which may be understood by those skilled in the art, according to one or more embodiments.
[0188] According to another aspect of the present invention, a computer device is provided, the computer device including a memory and a processor, the memory storing computer-readable instructions, which, when executed by the processor, cause the processor to perform the business element knowledge base construction method or local data analysis method described in any of the above embodiments.
[0189] According to another aspect of the present invention, one or more non-volatile computer-readable storage media containing computer-executable instructions are provided, which, when executed by one or more processors, cause the processors to perform the method for constructing a business element knowledge base or the local data analysis method described in any of the above embodiments.
[0190] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein can be implemented as electronic hardware, computer software, or a combination of both. To clearly illustrate this interchangeability between hardware and software, the various illustrative components, blocks, modules, circuits, and steps are described above in a generalized manner in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. Those skilled in the art may implement the described functionality in different ways for each specific application, but such implementation decisions should not be construed as departing from the scope of the invention.
[0191] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of both. The software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor such that the processor can read and write information to / from the storage medium. In an alternative, the storage medium may be integrated into the processor. The processor and storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and storage medium may reside as discrete components in the user terminal.
[0192] In one or more exemplary embodiments, the described functionality may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functionality may be stored or transmitted as one or more instructions or code on or through a computer-readable medium. A computer-readable medium includes both computer storage media and communication media, encompassing any medium that facilitates the transfer of a computer program from one location to another. A storage medium may be any available medium accessible to a computer. By way of example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disc storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and is accessible to a computer. Any connection is also legitimately referred to as a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of a medium.
[0193] The preceding description is provided to enable any person skilled in the art to practice the various aspects described herein. However, it should be understood that the scope of protection of this invention should be determined by the appended claims and should not be limited to the specific structures and components of the embodiments described above. Various changes and modifications can be made to the embodiments by those skilled in the art within the spirit and scope of this invention, and these changes and modifications also fall within the scope of protection of this invention.
Claims
1. A method for constructing a business element knowledge base, characterized in that, The business meta-knowledge base includes table structure definitions, business rule documents, and analysis templates for several business scenarios. The construction method includes: Table structure, business rules, and analysis process in business scenarios that receive user input; Establish a table structure definition for each business scenario based on the table structure of each business scenario; Based on the business rules for each business scenario, a business rule document is established for that business scenario; and Based on the analysis process for each business scenario, an analysis template is established for that business scenario. The business meta-knowledge for each business scenario includes the table structure definition, the business rule document, and the analysis template. The business meta-knowledge is used to guide the big oracle model to generate structured data operation statements for that business scenario.
2. The method for constructing a business element knowledge base as described in claim 1, characterized in that, The business metadata for each business scenario also includes examples of user requirements-structured data manipulation statements, and the construction method further includes: Obtain historical cases of successful matching between user requirements and structured data manipulation statements; An index is generated based on each historical case to represent the user requirements and the structured data manipulation statements, thereby constructing a user requirement-structured data manipulation statement example. This user requirement-structured data manipulation statement example is used to guide the large language model to imitate the historical cases and generate structured data manipulation statements.
3. The method for constructing the business element knowledge base as described in claim 2, characterized in that, Also includes: The historical cases are used to train the generation process of structured data operation statements for corresponding business scenarios, so as to establish the analysis template that conforms to the business rules of the business scenario. The analysis template is used to guide the process of the large language model to analyze the business requirements corresponding to the business meta-knowledge.
4. A local data analysis method based on a business element knowledge base, characterized in that, include: Receive user requests; Based on the user needs and the business metadata involved in the user needs, prompt instructions are generated corresponding to the user needs. The prompt instructions include instruction statements generated by the command language model that correspond to the structured data operation statements of the user needs, as well as prompt information containing the business metadata involved in the user needs. Send the prompt instruction to the large language model and receive the structured data operation statement generated based on the prompt instruction returned by the large language model; as well as The structured data manipulation statements are executed locally using the raw data as the object of operation to obtain a response to the user's needs.
5. The local data analysis method as described in claim 4, characterized in that, Generating prompt instructions corresponding to the user's needs based on the user's needs and the business metadata involved in the user's needs includes: Extract several keywords from the user's requirements; Based on the aforementioned keywords, business metadata corresponding to the user's needs is retrieved to determine the prompt information; and The variables in the prompt instruction template are replaced with business metadata corresponding to the user's needs to determine the instruction statement.
6. The local data analysis method as described in claim 4, characterized in that, The business metadata includes table structure definitions, business rules, and analysis processes. Locally, using raw data as the operation object, the structured data manipulation statements are executed to obtain answers to the user's needs, including: Based on the business metadata corresponding to the user requirements, a connection is established between the structured operation statement and the raw data stored locally. Based on the connection, the structured data manipulation statements are executed on the original data to obtain an answer that meets the user's requirements, wherein the answer is the execution result of the structured data manipulation statements that satisfy the user's requirements; and The answer is output to the input window for the user's request.
7. The local data analysis method as described in claim 6, characterized in that, Outputting the answer to the input window for the user's request includes: The execution results of the structured data manipulation statements are then subjected to data type conversion and format standardization; and The output format is standardized.
8. The local data analysis method as described in claim 4, characterized in that, In response to the user's needs, including the need for chart generation, the local data analysis method further includes: A data identifier mapping table is established locally. The data identifier mapping table includes data identifiers and the mapping relationship between the data identifiers and the field names of the original data. The data identifiers are the codes of the original data. Send the data identifier to the large language model; Receive the chart configuration output by the large language model, wherein the chart configuration includes at least the chart type and the presentation method of the data identifier; The chart configuration is parsed in the local chart generator, and the original data corresponding to the data identifier is obtained based on the data identifier mapping table. A chart is generated based on the chart configuration and the original data corresponding to the data identifier, and the chart is the answer to the chart generation requirement.
9. The local data analysis method as described in claim 4, characterized in that, Also includes: In response to the user's request, which includes a need for in-depth analysis, the structured data manipulation statements include data query instructions. Executing the structured data manipulation statements locally, using raw data as the object of operation, to obtain a response to the user's request includes: Execute the data query command locally to determine the range of raw data corresponding to the deep analysis requirement; Sensitive data within the original data range is determined based on the sensitive data range; The sensitive data fields in the original data range are replaced with the corresponding code fields, and the sensitive data values in the original data range are replaced with the corresponding code values to generate desensitized data corresponding to the original data range, and a mapping relationship between the sensitive data and the replaced original data is established locally. The de-identified data is sent to the large language model; Receive the deep analysis report corresponding to the user's needs, generated by the large language model based on the anonymized data, and restore the true business description in the deep analysis report based on the mapping relationship; and Output the restored depth analysis report.
10. A computer device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the method for constructing a business element knowledge base according to any one of claims 1 to 3 or the local data analysis method according to any one of claims 4 to 9.
11. One or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, cause the processors to perform the method for constructing a business element knowledge base as described in any one of claims 1 to 3 or the local data analysis method as described in any one of claims 4 to 9.
Citation Information
Cited By
Artificial intelligence-based data processing method, device and readable storage medium
CN122432221A