Method for processing industrial production data, processing device and storage medium
Patent Information
- Application Number
- CN202511674423.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2045-11-14
AI Technical Summary
[0003]本申请的目的是提供一种工业生产数据的处理方法、处理装置及存储介质,用以解决Text-to-SQL技术在工业生产场景精度较低且存在安全风险的问题
本申请在获取针对工业生产线的自然语言查询问题后,先基于该工业生产线当前的工业时序数据,构建包含术语关联关系并且包含多个数据表的术语映射库。通过实时构建动态术语映射库,可以适配工业生产线数据的结构变化,长期维持查询准确性。然后,基于术语映射库可以确定与自然语言查询问题语义关联的目标数据表,并提取目标数据表中的关键元数据。仅提取关键元数据,可以过滤掉无关字段等冗余信息,减少语义理解错误率以及后续提示信息的令牌消耗量。接着,根据关键元数据、工业生产线对应的设定规则和自然语言查询问题生成提示信息,不仅适配工业生产线的安全规则,减少系统过载情况,并且精简了输入内容,降低了计算负担、提高计算精度且数据在安全规则范围内生成。最后,根据提示信息,通过自然语言查询到数据库查询的转换机制,生成与自然语言查询问题对应的第一数据库操作指令,实现了SQL的自动生成,无需人工编写,可以覆盖动态变化的工业生产线的多样化场景,满足工业生产线的全场景需求。因此,本申请不仅提高了Text-to-SQL技术在工业生产场景的精度,还保障了SQL生成中的数据安全。
Smart Images

Figure CN121501951B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial data processing technology, specifically to a method, processing device, and storage medium for processing industrial production data. Background Technology
[0002] With the continuous development of artificial intelligence and big data technologies, Text-to-SQL technology, as a crucial intersection of Natural Language Processing (NLP) and intelligent database interaction, is demonstrating broad prospects in various industrial applications. Structured Query Language (SQL) is a database query and programming language used to access, query, update, and manage relational database systems. Text-to-SQL refers to automatically converting users' natural language queries into structured SQL statements, which can then be executed directly in the database, significantly lowering the barrier for users to access data. With the development of Large Language Models (LLMs), LLM-based Text-to-SQL methods are increasingly being applied to industrial data querying and analysis. Traditional Text-to-SQL data query methods typically concatenate all Data Definition Language (DDL) information from all relevant tables and historical question-and-answer samples into the prompt words, resulting in a large amount of redundant information, high token consumption, and a lack of constraints from industrial scenario rules. This not only increases computational costs and easily leads to low query data accuracy due to redundant information interference, but also poses security risks in industrial production scenarios due to human error. Summary of the Invention
[0003] The purpose of this application is to provide a method, device, and storage medium for processing industrial production data, in order to solve the problems of low accuracy and security risks of Text-to-SQL technology in industrial production scenarios.
[0004] To achieve the above objectives, the first aspect of this application provides a method for processing industrial production data, comprising: Obtain natural language query questions targeting industrial production lines; Based on the current industrial time-series data of the industrial production line, a term mapping library containing term associations is constructed, and the term mapping library includes multiple data tables; Based on the terminology mapping library, a target data table semantically associated with the natural language query question is determined, and key metadata semantically associated with the natural language query question is extracted from the target data table; Based on the key metadata, the setting rules corresponding to the industrial production line, and the natural language query question, a prompt message is generated; Based on the prompt information, a first database operation instruction corresponding to the natural language query question is generated through a natural language query to database query conversion mechanism.
[0005] A second aspect of this application provides an apparatus for processing industrial production data, comprising: The acquisition module is used to acquire natural language query questions targeting industrial production lines; A construction module is used to build a term mapping library containing term associations based on the current industrial time-series data of the industrial production line; The extraction module is used to extract key metadata from the target data table that is semantically related to the natural language query question, based on the terminology mapping library. The key metadata includes time-series attributes. The prompting module is used to generate prompt information based on the key metadata, the set rules corresponding to the industrial production line, and the natural language query question; The generation module is used to generate a first database operation instruction corresponding to the natural language query question by using a natural language query to convert the information to a database query based on the prompt.
[0006] A third aspect of this application provides a computer-readable storage medium storing a program that can be loaded by a processor and executed using the aforementioned method for processing industrial production data.
[0007] The beneficial effects of this application are: This application, after obtaining a natural language query question for an industrial production line, first constructs a terminology mapping library based on the current industrial time-series data of that production line. This library includes terminology relationships and contains multiple data tables. By constructing a dynamic terminology mapping library in real time, it can adapt to structural changes in the industrial production line data, maintaining query accuracy over the long term. Then, based on the terminology mapping library, the target data table semantically related to the natural language query question can be determined, and key metadata from the target data table can be extracted. Extracting only key metadata filters out irrelevant fields and other redundant information, reducing semantic understanding error rates and token consumption for subsequent prompts. Next, prompts are generated based on the key metadata, the corresponding rules for the industrial production line, and the natural language query question. This not only adapts to the security rules of the industrial production line, reducing system overload, but also simplifies input content, reduces computational burden, improves computational accuracy, and ensures data generation remains within the scope of security rules. Finally, based on the prompts, a first database operation instruction corresponding to the natural language query question is generated through a natural language query to database query conversion mechanism. This achieves automatic SQL generation without manual writing, covering diverse scenarios of dynamically changing industrial production lines and meeting the full-scenario needs of industrial production lines. Therefore, this application not only improves the accuracy of Text-to-SQL technology in industrial production scenarios, but also ensures data security in SQL generation.
[0008] Other features and advantages of this application will be described in detail in the following detailed description section. Attached Figure Description
[0009] Figure 1 This is a schematic diagram illustrating an application scenario of an industrial production data processing method provided in this application embodiment; Figure 2 This is a flowchart illustrating a method for processing industrial production data provided in one embodiment of this application; Figure 3 This is a schematic diagram illustrating the working principle of a terminology mapping library provided in a specific embodiment of this application; Figure 4 This is a flowchart illustrating a method for processing industrial production data provided in another embodiment of this application; Figure 5 This is a schematic diagram of the structure of an industrial production data processing device provided in the embodiments of this application. Detailed Implementation
[0010] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0011] In the description of this application, it should be understood that 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 indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified. In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to implement and use this application. In the following description, details are set forth for illustrative purposes. It should be understood that those skilled in the art will recognize that this application can be implemented without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid unnecessary detail that would obscure the description of this application. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0012] The industrial production data processing method in this embodiment is applied to an industrial production data processing device, which is located in an electronic device. For example... Figure 1 As shown, Figure 1 This is a schematic diagram illustrating an application scenario of an industrial production data processing method provided in this application embodiment. The application scenario of the industrial production data processing method in this application embodiment includes an electronic device 100 for the industrial production data processing method. The electronic device 100 integrates the industrial production data processing method and a computer-readable storage medium corresponding to running the industrial production data processing method, in order to execute the steps of the industrial production data processing method.
[0013] Understandable, Figure 1The electronic devices in the application scenario of the industrial production data processing method shown, or the devices contained in the electronic devices, do not constitute a limitation on the embodiments of this application. That is, the number or type of devices in the application scenario of the industrial production data processing method, or the number or type of devices contained in each device, do not affect the overall implementation of the technical solution in the embodiments of this application, and can all be considered as equivalent substitutions or derivatives of the technical solutions claimed in the embodiments of this application.
[0014] In this application embodiment, the electronic device 100 can be an independent device, or a device network or device cluster composed of devices. For example, the electronic device 100 described in this application embodiment includes, but is not limited to, a computer, a network host, a single network device, a set of multiple network devices, or a cloud device composed of multiple devices. Among them, the cloud device is composed of a large number of computers or network devices based on cloud computing.
[0015] Those skilled in the art will understand that Figure 1 The application scenarios shown are merely one application scenario corresponding to the technical solution of this application, and do not constitute a limitation on the application scenarios of the technical solution of this application. Other application scenarios may include more than one application scenario. Figure 1 The number of more or fewer electronic devices shown, or the network connections of electronic devices, for example Figure 1 Only one electronic device is shown in the diagram. It is understood that the scenario of this industrial production data processing method may also include one or more other electronic devices, which are not specifically limited here. The electronic device 100 may also include a memory and a processor. The memory is used to store information related to the industrial production data processing method.
[0016] Furthermore, in the application scenario of the industrial production data processing method in this application embodiment, the electronic device 100 may be equipped with a display device, or the electronic device 100 may not have a display device but may be communicatively connected to an external display device 200. The display device 200 is used to output the results of the industrial production data processing method executed in the electronic device. The electronic device 100 can access the background database 300. The background database 300 may be the local storage of the electronic device 100 or a cloud database located in the cloud. The background database 300 stores information related to the industrial production data processing method.
[0017] It should be noted that, Figure 1 The application scenario of the industrial production data processing method shown is merely an example. The application scenario of the industrial production data processing method described in the embodiments of this application is to more clearly illustrate the technical solution of the embodiments of this application and does not constitute a limitation on the technical solution provided in the embodiments of this application.
[0018] Based on the application scenarios of the above-mentioned industrial production data processing methods, embodiments of the industrial production data processing methods are proposed. A detailed description is provided below with reference to the accompanying drawings.
[0019] Figure 2 This is a flowchart illustrating an industrial production data processing method according to one embodiment of this application. Figure 2 As shown, in one embodiment, the processing method can be executed by the processor in the above-described electronic device 100, steps 201-205, which will be described in detail below.
[0020] Step 201: Obtain natural language query questions for industrial production lines.
[0021] An industrial production line refers to a continuous operational system for producing industrial products, such as welding lines and assembly lines in industrial manufacturing. It can include elements such as equipment, workstations, and process parameters. Natural language query questions are needs expressed by users in everyday language, which can include spoken language or more formal language structures. Therefore, natural language query questions can include colloquial and abbreviated expressions. In one example, text and voice input can be supported; when the input is voice, it can be converted into corresponding text through speech recognition. In another example, basic input cleaning can be performed to remove redundant interjections or correct obvious errors. Users do not need to learn SQL syntax or table structures; they can initiate query requests using everyday language from industrial production scenarios, improving the coverage of self-service queries for non-professionals.
[0022] Step 202: Based on the current industrial time-series data of the industrial production line, construct a term mapping library containing term associations. The term mapping library includes multiple data tables.
[0023] Industrial time-series data is dynamic data collected in chronological order and can include features such as timestamps and sampled values. For example, it could include current data sampled at 100Hz from a welding torch. By combining real-time and historical data from industrial production lines associated with the current production line, a dynamically updated terminology mapping library can be constructed. Terminology relationships refer to the semantic connections between industrial terms. The terminology mapping library is a structured database that stores these relationships and can include multiple tables. Because it is built upon industrial time-series data, it can incorporate time-series attributes such as sampling frequency and time granularity. Furthermore, the terminology mapping library can adapt to changes in the data structure of industrial production lines and build professional terminology relationships specific to each production line, maintaining long-term query accuracy and improving its timeliness.
[0024] Step 203: Determine the target data table that is semantically associated with the natural language query question based on the terminology mapping library, and extract the key metadata in the target data table that is semantically associated with the natural language query question.
[0025] The target data table is a database table semantically associated with the natural language query question. It can contain time-series data tables (such as a welding torch real-time parameter table) and related business tables (such as a vehicle model process standard table). In one example, the natural language query question can be segmented into words, and similarity matching can be performed based on a term mapping library to determine the target data table associated with the natural language query question.
[0026] Key metadata is a collection of field information in the target data table that is strongly relevant to the query intent. For example, it may include the table name, field names, and data types of basic attributes; the industrial meaning of fields in business attributes; the timestamp field, sampling frequency, and time granularity level of time-series attributes; and the mapping identifier between related attributes and the terminology database, etc.
[0027] Extracting only key metadata can filter out redundant information. Reducing the amount of key metadata reduces the tokens consumed by subsequent prompts, thereby improving the inference speed of Text-to-SQL. Furthermore, key metadata can include business implications relevant to the industrial production line, enabling subsequent conversions to generate SQL that conforms to the current industrial logic, thus improving the accuracy of instruction generation.
[0028] Step 204: Generate prompt information based on key metadata, the setting rules corresponding to the industrial production line, and natural language query questions.
[0029] The configuration rules for industrial production lines refer to the data query constraints specific to industrial production lines. These may include safety constraints and operational instruction generation specifications. Safety constraints involve data security rules. Data security rules are designed to prevent accidental manipulation and can stipulate that generated SQL statements are only for querying, prohibiting the generation of SQL statements for modification, deletion, or insertion. Operational instruction generation specifications can include data volume limits and syntax standards. In industrial production processes, the amount of data generated is enormous. Querying too much data may cause database crashes. To prevent this, it is necessary to limit the amount of data that can be queried, for example, by default querying the latest 100 records. Simultaneously, the syntax of generated SQL can be constrained to make it more standardized and reduce the possibility of generating excessively complex SQL statements. For example, when using aliases in SQL, only English characters can be used; using Chinese characters may result in SQL execution errors. Field types must be consistent during JOIN operations; otherwise, execution errors will occur.
[0030] The prompt message is structured text input into the natural language query to database query conversion mechanism, guiding the mechanism to generate database operation instructions that conform to the industrial production line scenario. The natural language query to database query conversion mechanism is a technical solution that converts natural language into database operation instructions, typically based on a large language model (such as a Text-to-SQL model), fine-tuned with industrial scenario corpora to adapt to industrial terminology and rules. By uniformly assembling key metadata, set rules, and natural language query questions, prompt messages containing related data and rule constraints can be generated. This simplifies the input content, reduces model burden, minimizes overload, and improves data query efficiency. Simultaneously, it ensures that the generated data conforms to the safety rules of the industrial production line scenario.
[0031] Step 205: Based on the prompt information, use the conversion mechanism of natural language query to database query to generate the first database operation instruction corresponding to the natural language query question.
[0032] The first database operation instruction is the initial database query instruction, i.e., an SQL statement, generated by the conversion mechanism to retrieve target data from the industrial database. By inputting prompts into the natural language query-to-database query conversion mechanism, based on the key metadata, set rules, and query intent in the prompts, an SQL statement conforming to the syntax of the industrial database can be generated. This eliminates the need for manual coding, improving the direct execution rate of SQL and reducing the workload of manual labor on industrial production lines.
[0033] This embodiment of the application, after obtaining a natural language query question for an industrial production line, first constructs a terminology mapping library based on the current industrial time-series data of the production line, including terminology relationships and multiple data tables. By constructing a dynamic terminology mapping library in real time, it can adapt to structural changes in industrial production line data and maintain query accuracy over the long term. Then, based on the terminology mapping library, the target data table is determined, and key metadata is extracted from the target data table. Extracting only key metadata can filter out redundant information such as irrelevant fields, reducing semantic understanding error rates and token consumption for subsequent prompts. Next, prompts are generated based on the key metadata, the set rules corresponding to the industrial production line, and the natural language query question. This not only adapts to the security rules of the industrial production line, reducing system overload, but also simplifies input content, reduces computational burden, improves computational accuracy, and ensures data generation within the scope of security rules. Finally, based on the prompts, a first database operation instruction corresponding to the natural language query question is generated through a natural language query to database query conversion mechanism. This achieves automatic SQL generation without manual writing, can cover diverse scenarios of dynamically changing industrial production lines, and meets the full-scenario needs of industrial production lines. Therefore, the embodiments of this application not only improve the accuracy of Text-to-SQL technology in industrial production scenarios, but also ensure data security in SQL generation.
[0034] Because industrial production line terminology is highly scenario-dependent (e.g., production cycle time specifically refers to the welding cycle time of a car body, which differs from the definition in other industrial scenarios), lacks standardization in expression (workshop personnel often use colloquial terms), and has complex table and field naming conventions (physical table names are often in the format of "efficiency service" + long suffix, which users cannot directly perceive), general industry dictionaries only cover basic terminology and cannot adapt to these characteristics, resulting in matching discrepancies or misses between natural language terms and database entities.
[0035] Therefore, this application embodiment solves the matching problem from three dimensions: semantic coverage, entity mapping, and continuous adaptation by constructing a multi-layered terminology database composed of synonyms, hypernyms, and table mappings, and supporting dynamic updates. In this application implementation, terminology associations can include synonym relationships, hypernyms, and table mappings. Synonyms refer to the relationship between industrial terms with the same semantics but different expressions and database fields. The terminology mapping database contains synonym relationships, allowing users to accurately match standard database fields regardless of whether they use standardized terminology, colloquialisms, or Chinese / English abbreviations. Hypernyms refer to the correspondence between industrial terms with hierarchical inclusion relationships such as whole and part or major and minor categories. The hierarchical division needs to align with the business logic of industrial production lines. Hypernyms cover the semantic range of all subordinate terms, and subordinate terms are specific refinements of hypernyms. This supports generalized user queries. When a user queries a hypernym, all fields corresponding to subordinate terms are automatically associated. The hierarchical division also conforms to the business thinking of operators on industrial production lines. Table mapping refers to the correspondence between data tables in an industrial production line that have time-series data flow or business logic relationships, providing a basis for cross-table queries. Synonym relationships can solve the problem of precise matching from natural language to fields, while hyponyms and hypernyms can fully cover industrial terminology. Table mapping can solve cross-table query problems.
[0036] Based on this, in step 202, the target information of the data tables in the database corresponding to the industrial production line can be read first. The target information is a collection of the identities and attributes of the data tables in the industrial production line, and it is the basic data for constructing terminological relationships. The target information may include basic attributes such as the table name, field names, and field types, as well as time-series characteristic information specific to the industrial production line. As an example, time-series characteristic information may include timestamp fields (e.g., fields marking data acquisition time), sampling frequency (i.e., the number of data acquisitions per unit time), and time granularity levels (time dimension classifications based on sampling frequency, such as real-time, minute-level, and hourly levels).
[0037] Specifically, semantic analysis can be performed on the field names of the data table to identify the fields that mark the data collection time and determine the timestamp field. For example, keyword matching can be performed on field names and field comments to initially filter candidate fields. Then, the data integrity and continuity of the candidate fields are verified to exclude fields that are not related to the collection time, such as update time and modification time, and finally, the timestamp field is determined.
[0038] Then, based on consecutive records in the timestamp field, consecutive valid records in the timestamp field are extracted, and disconnected and outlier data are filtered out. The sampling time interval between adjacent data is then calculated. Algorithms such as median filtering are used to remove abnormal intervals caused by network latency or device lag, retaining valid intervals. The sampling frequency is then calculated as the reciprocal of the average valid interval time.
[0039] Finally, based on the sampling frequency and the frequency range of multiple time granularity levels in the industrial production line, the data table is divided into time granularity levels corresponding to the sampling frequency. For example, suppose the time granularity levels include real-time, minute, and hourly levels. Sampling frequencies greater than or equal to 1 Hz are designated as real-time time granularity levels, sampling frequencies less than 1 Hz but greater than 0.0167 Hz are designated as minute-level time granularity levels, and sampling frequencies less than or equal to 0.0167 Hz are designated as hourly time granularity levels.
[0040] By accurately extracting the timestamps, sampling frequencies, and time granularity levels from industrial time-series data, semantic relationships can be bound based on the time granularity level, making it more suitable for industrial scenarios. Then, based on the target information extracted from the data tables, a multi-level terminology mapping library can be constructed.
[0041] First, based on the field names and time-series characteristics of the data table, and combined with the knowledge base corresponding to the industrial production line, synonyms with semantic relationships to the field names are identified to construct a first mapping library. This first mapping library can include the initial mapping relationship between field names and synonyms. The initial mapping relationship is the binding relationship between industrial terms with different expressions but the same semantics and field names. Synonyms can be derived from industrial knowledge bases, historical query corpora, and cross-language terminology. For example, standardized terminology can be extracted from professional materials obtained from industrial production lines, colloquial expressions from operators can be collected, and cross-language terminology related to industrial production lines can be used. Synonym matching can be determined based on semantic similarity calculations. In this way, non-standardized industrial terms can be covered, reducing the difficulty of understanding natural language and adapting to query needs in multiple scenarios.
[0042] Secondly, based on the temporal business logic of the industrial production line and combined with temporal feature information, hypernyms and hyponyms with hierarchical relationships with synonyms are determined to construct a second mapping library. This second mapping library can include the second mapping relationships between synonyms and their hypernyms and hyponyms. The second mapping library can bind terms with inclusion relationships, and the hierarchical division can be strongly correlated with temporal feature information. For example, it can be divided according to the data flow hierarchy of the industrial production line, setting a threshold for temporal features for hypernyms, and hyponyms need to meet this threshold. Furthermore, it can be assisted by process attributes, dividing according to the production role of parameters, etc. Hypernyms need to completely contain the semantics of hyponyms, and the temporal features of hyponyms need to match those of hypernyms to ensure temporal consistency. Based on this, a second mapping library containing hypernym-hypernym structural relationships of hypernyms, hyponyms, and temporal features can be constructed. This reduces the occurrence of temporal granularity mismatches and supports generalized queries by users.
[0043] Finally, based on the field names, field types, and time-series characteristics of the data tables, the table names of data tables with time-series relationships are mapped to obtain a third mapping library. This third mapping library can include third-party mapping relationships between data tables. A third-party mapping relationship refers to the mapping relationship between tables that are related due to time-series data aggregation or flow. Two data tables matched by a join key need to contain the same or convertible join fields. The time interval of the aggregation table needs to include the timestamp of the real-time table. Table data based on business flow logic has production dependencies. This allows for the formation of mapping relationships between source tables, related tables, and join rules to support cross-table time-series queries.
[0044] In industrial production line scenarios, the data table structure changes dynamically. For example, if a table or field in the data table is modified, it needs to be dynamically updated to ensure the validity of the terminology mapping library.
[0045] In step 202, in response to a change in the data table structure of the terminology mapping library, an incremental update can be performed on the mapping library corresponding to the changed data table structure. Incremental updates target localized changes in the table structure, updating only the parts of the terminology mapping library affected by the modification. For example, adding synonyms when adding a new field. This reduces resource waste.
[0046] In response to received query feedback, terms not existing in the terminology mapping database are marked and added to the database. Query feedback, such as "no match" or "match error," reflects user feedback on query results and serves as a basis for optimizing the terminology mapping database. Automatically or manually marking terms not existing in the database and recording their actual meaning in industrial scenarios provides data for subsequent optimization and improves user satisfaction.
[0047] Since the database of an industrial production line is a dynamically changing database, by dynamically updating the terminology mapping library, changes in the terminology mapping library can be tracked in real time, improving the accuracy of queries and adapting to industrial scenarios.
[0048] In step 203, initial fields can be extracted from the natural language query question using a word segmentation algorithm. The word segmentation algorithm in this embodiment is a terminology segmentation tool adapted for industrial scenarios, requiring the integration of a terminology dictionary specific to industrial production lines to reduce erroneous segmentation of industrial terms by general word segmentation. For example, jieba segmentation, which integrates an industrial dictionary, can be used. Initial fields are those strongly related to industrial production data extracted from the natural language query question. Initial fields can include business entities, parameter terms, and time-limited terms. Business entities refer to specific objects in the industrial production line, such as equipment and production objects. Parameter terms are process parameters or indicators in industrial production, such as welding current and production cycle time in a welding production line, which need to be associated with industrial units. Time-limited terms can include time ranges or temporal features. In this way, redundant data can be filtered and the implicit information of terms can be supplemented, forming the basis for subsequent structured input.
[0049] Then, the initial fields are matched with a terminology mapping database to determine a set of target data tables semantically related to the natural language query question. Similarity matching calculates the semantic similarity between the initial fields and terms in the terminology mapping database. For example, a threshold suitable for industrial scenarios can be set to reduce mismatches of similar terms. Due to the heterogeneous nature of industrial databases, field reuse, and complex temporal relationships, directly associating key metadata can easily lead to problems such as ambiguous field context, missing associated data, and incorrect metadata attributes. Therefore, it is necessary to first match the target data tables to provide accurate hierarchical anchors for extracting key metadata.
[0050] The target data table can be determined based on associated fields that have terminological relationships with the initial field, and may include time-series data tables and associated business tables. Time-series data tables can be tables storing high-frequency industrial time-series data or aggregated time-series data, while associated business tables can be tables storing business data related to parameters or entities. The matching process can be performed based on the first, second, and third mapping tables in the terminology mapping library to obtain candidate data tables containing fields that are synonyms, hyponyms, or table mappings to the initial field. Then, interfering data tables are filtered out to obtain the final target data table. In this way, the target data table can be accurately located without a full table traversal. Furthermore, combining hyponyms / hypernyms and time-series features can reduce the probability of false matches and improve matching accuracy.
[0051] For each target data table, key fields semantically related to the initial fields and their metadata attributes are extracted. Key fields are those in the target data table that are semantically strongly related to the initial fields. Metadata attributes are descriptive information about the key fields that fits the needs of the industrial scenario. Metadata attributes can include the business meaning, data type, temporal characteristics, and association identifier with the terminology mapping library. Business meaning refers to the actual significance of the key field in the industrial scenario, requiring annotation of process standards. Data type refers to the storage format of the key field. Temporal characteristics are the temporal attributes of the target data table to which the key field belongs. Association identifiers are the binding identifiers between the key field and the terminology mapping library, used for traceability and updates. Extracting only a few key fields, rather than all fields from the entire data table, reduces the data volume. Furthermore, the inclusion of temporal characteristics in the metadata attributes makes the generated SQL more consistent with industrial logic. The association identifiers also allow for quick location of the mapping relationship in the terminology database.
[0052] Finally, the key fields are integrated according to the categories and structural relationships of the target data tables to form structured key metadata. The categories of the target data tables can include time-series data tables and business data tables. The structural relationships of the target data tables can include logical relationships between the tables, such as time-granularity hierarchical relationships, matching the flow logic of industrial data. Forming structured key metadata based on categories and structural relationships, and outputting structured key metadata, makes the model easier to understand and provides a precise data retrieval basis for the subsequent assembly of prompts, eliminating the need for further data processing.
[0053] Figure 3 This is a schematic diagram illustrating the working principle of a terminology mapping library provided in a specific embodiment of this application. For example... Figure 3 As shown, a terminology mapping library module is provided, which can include the construction, dynamic updating, and dynamic mapping of the terminology mapping library. The construction of the mapping library can be based on basic information from an industrial database table to obtain a thesaurus (first mapping library), a hyponym / hypernym library (second mapping library), and a table mapping library (third mapping library). When the database structure changes or user query feedback is received, the database is automatically and incrementally updated. For user query input, keywords (i.e., initial fields) are first extracted using the jieba algorithm, then vector similarity matching is performed based on the terminology mapping library, and finally the matching fields (i.e., key metadata) are located. By dynamically constructing the terminology mapping library, the construction of prompt information can be more accurate and adapted to dynamically changing industrial scenarios.
[0054] In step 204, semantic parsing can be performed on the natural language query question to obtain the corresponding query elements. Semantic parsing involves a deep understanding of the intent behind the natural language query question. This can be achieved by integrating a natural language processing model with an industrial knowledge base to determine the corresponding query elements. Query elements are structured information obtained after semantic parsing and represent the smallest unit of expression for the user's query intent. They can include query intent, subject object, parameter type, and time range. Query intent is the user's operational purpose, subject object is the queried industrial entity, parameter type refers to industrial parameters and indicators, and time range is the time boundary. Decomposing the fuzzy natural language into four elements—intent, subject, parameters, and time—provides a foundation for subsequent mapping of elements to the database structure, reducing mapping errors caused by element confusion.
[0055] Then, based on key metadata, the query elements are mapped to the database structure to obtain the fourth mapping relationship. This fourth mapping relationship is a dynamic mapping between query elements and database operation objects. It transforms the user's query intent, subject object, parameter type, and time range into executable functions, tables, fields, and conditions in the database, directly serving SQL generation.
[0056] Next, based on the established rules associated with industrial production data, rule constraints are added to the query elements. These rules can include security constraints and operational instruction generation specifications. The established rules are a set of data security and operational specifications specific to industrial production lines. Security constraints are designed to prevent industrial data leakage, tampering, or system overload. Operational instruction specifications are rules that ensure the generated SQL conforms to industrial database syntax and production practices. Rule constraints are the constraints formed by combining the established rules with specific query elements. By adding security constraints and operational instruction specifications, security issues such as data tampering and system overload can be prevented at the source, reducing SQL execution error rates and conforming to industrial production management standards.
[0057] Finally, the query elements, fourth mapping relationships, and rule constraints are integrated into a prompt message according to a preset format. The preset format is a structured input template designed for Text-to-SQL, balancing machine readability and semantic integrity. Integrating query elements, fourth mapping relationships, and rule constraints generates comprehensive information containing user requirements, database information, and industry rules, thus ensuring the accuracy and compliance of the generated SQL.
[0058] Traditional techniques typically concatenate full DDL information and historical question-and-answer samples into the prompt message, resulting in excessive token consumption, increased model computational costs, interference with core intent understanding, and a lack of scenario constraints. Without quantity limits, excessively large sample data can cause database crashes; without syntax standardization, mismatched field types can lead to SQL execution failures. This application's embodiment, based on key metadata extraction from a terminology mapping library and the injection of industry rules, achieves concise, secure, and standardized prompt messages.
[0059] Text-to-SQL, limited by training data, is prone to generating SQL queries that contain missing tables or fields, typos, or incorrect join conditions. If SQL execution fails, the query process is abruptly interrupted, preventing users from obtaining valid data. Based on this, this application's embodiment constructs a three-level error correction loop: pre-execution verification, intelligent replacement and repair, and structured prompt guidance. It utilizes a terminology mapping library to achieve automatic repair and manual remediation. Therefore, as... Figure 4 As shown, Figure 4 This is a flowchart illustrating a method for processing industrial production data according to another embodiment of this application. In this embodiment, the processing method may further include step 206: performing an error correction operation on the first database operation instruction to generate a second database operation instruction.
[0060] Specifically, the first database operation instruction is pre-executed to verify the existence of table fields, data type matching, and the correctness of join conditions. The first database operation instruction is the initial SQL, which may contain issues such as missing tables or fields, data type mismatches, and incorrect join conditions. Pre-execution performs syntax checks and entity existence checks on the SQL without returning the full query results, reducing resource waste and data corruption caused by directly executing erroneous SQL. Verification can include checking the existence of table fields, data type matching, and the correctness of join conditions.
[0061] If the database passes validation, the first database operation instruction is determined as the second database operation instruction. The second database operation instruction is the instruction that can execute SQL statements normally. If there are table fields with spelling errors or inaccurate names, they are automatically replaced with valid fields based on a terminology mapping library to obtain the second database operation instruction. For example, it can be based on synonyms in the first mapping library for replacement.
[0062] If the execution still fails after replacing the valid fields, a structured error message is returned. This structured error message provides actionable remedial information for SQL error correction failures and can include content adapted to industrial scenarios. The structured error message may include a list of queryable production line data tables, table field details, and query examples.
[0063] By automatically correcting common errors, manual intervention is reduced. Errors that fail multiple times are promptly reported for manual handling. This reduces resource waste caused by blindly executing erroneous SQL queries, and structured error messages lower the learning curve and improve repair efficiency.
[0064] In this embodiment of the application, the processing method may further include step 207: generating an interactive chart based on the second database operation instructions. An interactive chart is a dynamic chart that supports user interaction.
[0065] Specifically, after executing the second database operation command and obtaining the query results, a target chart template corresponding to the query results is selected from the set chart templates based on the query results. The query results are a collection of industrial data obtained by executing the second database operation command. The set chart templates are a library of preset visualization templates for industrial data types, which can be categorized according to query intent and data structure, such as statistical, trend, and correlation types. The target chart template is the template in the set template library that best matches the query results.
[0066] The industrial visualization engine renders the data from the query results according to the target chart template, generating interactive charts. An industrial visualization engine, such as ECharts, is a visualization tool that supports high-concurrency rendering of industrial data, accurate alignment of time-series data, and adaptation to industrial symbols. It needs to ensure smooth interaction with large datasets. Outputting interactive charts allows users to directly manipulate and analyze the data. The display interface can include a title, main body, and interactive controls. This lowers the barrier to understanding industrial data for users, supports in-depth data analysis, and adapts to the characteristics of industrial scenarios, providing visual support for production optimization and troubleshooting.
[0067] The following detailed description uses data from a production line in an automotive welding workshop as a specific example to further illustrate the embodiments of this application. The illustrative embodiments and descriptions of this application are for explaining the invention only and are not intended to limit the scope of this application.
[0068] In one example, the following steps may be included.
[0069] S1. Receiving user natural language query questions. Calculating the number of production cycles for different vehicle models in the workstation cycle time table.
[0070] S2. Construction of the terminology mapping library.
[0071] (1) Read all data tables, field names, field types, etc. in the current welding production line. (2) Based on the data table fields, list all possible natural language terms in the welding production line and construct a thesaurus. (3) Based on the thesaurus, construct a hyponym / hypernym thesaurus. (4) Based on all data tables and fields in the current welding production line, construct a terminology mapping library. The terminology mapping library is shown in Tables 1 to 3.
[0072] Table 1 Table 2 Table 3 Dynamic terminology mapping: Keyword extraction yields ["Workstation Cycle Time Table", "Vehicle Model", "Production Cycle Time"]. Matching in the terminology mapping library yields: the relevant table [efficiency_service.DWD_EFFICIENCY_DEVICE_CYCLE_I_RT], and the relevant fields [vehicle_value, produce_beat].
[0073] S3. Based on the data table fields obtained from the terminology mapping in S2, assemble the prompt to obtain: # Role: You are an SQL analysis expert on a welding production line, mainly responsible for converting user natural language questions into accurate and efficient SQL queries. # Database key metadata structure: Table 1: efficiency_service.DWD_EFFICIENCY_STATION_CYCLE_I_RT (workstation cycle time table); Field 1: vehicle_value (vehicle model value), string; Field 2: produce_beat (production cycle time), UInt64. # Processing rules: Security constraints: - Deletion and update operations are prohibited; - Unless otherwise specified, each query will return a maximum of 100 rows of data by default. Please use the LIMIT clause. SQL generation specifications: - Only generate SQL statements, do not include other content; - Omit the semicolon at the end of the SQL statement; - When performing join queries, check whether the types of the join fields are consistent. If they are inconsistent, type conversion is required; - Only generate one SQL statement that meets the conditions. # Original user question: "Count how many production cycles there are for different vehicle models in the workstation cycle time table".
[0074] S4. Input the prompt obtained in S3 into the large model DeepSeek-V3:671b, and obtain the response from the large model as follows: ```sql: SELECT vehicle_value, COUNT(DISTINCT produce_beat) AS produce_beat_count; FROM efficiency_service.DWD_EFFICIENCY_STATION_CYCLE_I_RT; GROUP BY vehicle_value; LIMIT 100```.
[0075] Call the custom SQL extraction module to extract the initial SQL from the large model's response, resulting in: SELECT vehicle_value, COUNT(DISTINCT produce_beat) AS produce_beat_count; FROM efficiency_service.DWD_EFFICIENCY_STATION_CYCLE_I_RT; GROUP BY vehicle_value; LIMIT 100.
[0076] S5: The initial SQL obtained during the trial run did not produce any errors.
[0077] S6: After executing SQL to obtain data, the chart generation module transforms the data into a visual chart. Based on the user's query intent, it selects a bar chart visualization template, and according to the template format, calls the visualization engine ECharts to render the data into an interactive chart, which is then returned to the user.
[0078] In another example, the following steps may be included.
[0079] S1, User Natural Language Query Question Reception: Query the planned cycle time of each workstation in the process tree table.
[0080] S2. The terminology mapping module performs dynamic terminology mapping: Keyword extraction yields ["process tree table", "workstation", "planned beat"], which is matched in the terminology mapping library to obtain: the fields involved are [vehicle_value, plan_beat], but no related tables are involved.
[0081] S3. Based on the data table fields obtained from the terminology mapping in S2, assemble the prompt to obtain: # Role: You are an SQL analysis expert on a welding production line, mainly responsible for converting user natural language questions into accurate and efficient SQL queries. # Database key metadata structure: Table 1: Field 1: station_id (workstation ID), UInt64, Field 2: plan_beat (planned beat), UInt64; # Processing rules: Security constraints - prohibit deletion and update operations; - unless otherwise specified, by default, each query returns a maximum of 100 rows of data, please use the LIMIT clause; SQL generation specifications: - only generate SQL statements, do not include other content; - omit the semicolon at the end of the SQL statement; - when performing join queries, it is necessary to check whether the types of the join fields are consistent, if they are inconsistent, type conversion is required; - only generate one SQL that meets the conditions; # Original user question: "Query the planned beat of each workstation in the process tree table".
[0082] S4. Input the prompt obtained in S3 into the large model DeepSeek-V3:671b, obtain the response from the large model, extract the SQL, and get the following: SELECT station_id, plan_beat; FROM technique_tree; LIMIT 100.
[0083] S5. The initial SQL obtained during trial run resulted in an error: the corresponding database table does not exist. The error correction module was invoked, and no synonym table was found in the terminology mapping library, returning a prompt message. Clicking on the corresponding database table displays its fields.
[0084] S6, Chart Generation Module: SQL error - no data found, no chart displayed.
[0085] Compared to traditional SQL generation methods, this application's embodiments achieve accurate conversion of natural language questions into database entities by constructing a dynamic multi-level terminology database containing synonyms, hyponyms, and table mappings, thus improving the accuracy and efficiency of database queries. Simultaneously, a prompt is assembled based on the terminology mapping results, and rules are injected into the prompt, such as prohibiting data deletion / updating, limiting the number of query results, and specifying SQL generation standards. The prompt is then input into a large Text-to-SQL model to generate initial SQL statements. The SQL is automatically modified through intelligent replacement by the SQL error correction module, and a structured error message is returned when the SQL execution fails again, guiding the user to quickly confirm repair suggestions. This improves the flexibility of SQL generation, enabling it to adapt to diverse user needs and unforeseen query types. Finally, the SQL query results are returned as visual results, supporting visual analysis of the SQL query results.
[0086] Figure 5 This is a schematic diagram of the structure of an industrial production data processing device 500 provided in an embodiment of this application. Figure 5 As shown, the industrial production data processing device 500 may include an acquisition module 501, a construction module 502, an extraction module 503, a prompting module 504, and a generation module 505.
[0087] The acquisition module 501 is used to acquire natural language query questions for industrial production lines; Module 502 is used to build a term mapping library containing term associations based on the current industrial time-series data of the industrial production line; Extraction module 503 is used to extract key metadata from the target data table that is semantically related to the natural language query question based on the terminology mapping library. The key metadata includes time-series attributes. The prompt module 504 is used to generate prompt information based on key metadata, the setting rules corresponding to the industrial production line, and natural language query questions; The generation module 505 is used to generate a first database operation instruction corresponding to the natural language query question by using a conversion mechanism from natural language query to database query based on the prompt information.
[0088] In this embodiment of the application, the term association relationship includes synonym relationship, hierarchical relationship and table mapping relationship, and the construction module 502 may include a reading unit, a first mapping unit, a second mapping unit and a third mapping unit.
[0089] The reading unit is used to read the target information of the data table in the database corresponding to the industrial production line. The target information includes the table name, field names, field types, and time series characteristic information.
[0090] The first mapping unit is used to determine synonyms that have semantic relationships with the field names based on the field names and time-series feature information of the data table, combined with the knowledge base corresponding to the industrial production line, so as to construct a first mapping library. The first mapping library includes the first mapping relationship between the field names and the synonyms.
[0091] The second mapping unit is used to determine the hypernyms and hyponyms that have a hierarchical relationship with synonyms based on the time-series business logic of the industrial production line and combined with time-series feature information, so as to construct a second mapping library. The second mapping library includes the second mapping relationship between synonyms and hypernyms and hyponyms.
[0092] The third mapping unit is used to map the table names of data tables with time-series relationships based on the field names, field types, and time-series characteristic information of the data tables, thus obtaining a third mapping library. The third mapping library includes the third mapping relationships between data tables.
[0093] In this embodiment, the time-series feature information may include a timestamp field, sampling frequency, and time granularity level. The reading unit is also used to perform semantic analysis on the field names of the data table, identify the fields in the data table that mark the data collection time, and determine the timestamp field; based on the continuous records of the timestamp field, calculate the sampling time interval of adjacent data to obtain the sampling frequency; and divide the data table into time granularity levels corresponding to the sampling frequency according to the sampling frequency and the frequency range of multiple time granularity levels in the industrial production line.
[0094] In this embodiment of the application, the construction module 502 further includes an update unit, which is used to incrementally update the terminology mapping library corresponding to the changed data table structure in response to a change in the data table structure of the terminology mapping library; and / or to mark terms that do not exist in the terminology mapping library in response to receiving query feedback information, and to add the marked terms to the terminology mapping library.
[0095] The extraction module 503 includes a word segmentation unit, a matching unit, a sub-extraction unit, and a first integration unit.
[0096] The word segmentation unit is used to extract initial fields from natural language query questions through word segmentation algorithms. The initial fields include business entities, parameter terms, and time-limited words.
[0097] The matching unit is used to perform similarity matching between the initial field and the term mapping library to determine the target data table set composed of target data tables that are semantically related to the natural language query question. The target data tables are determined based on the associated fields that have term association relationships with the initial field.
[0098] The sub-extraction unit is used to extract key fields that have semantic association with the initial fields and the metadata attributes of the key fields for each target data table. The metadata attributes include the business meaning, data type, time series characteristic information and association identifier with the terminology mapping library of the key fields.
[0099] The first integration unit is used to integrate key fields according to the category and structural relationship of the target data table to form structured key metadata.
[0100] The prompt module 504 includes a parsing unit, a fourth mapping unit, a constraint unit, and a second integration unit.
[0101] The parsing unit is used to perform semantic parsing on natural language query questions to obtain the query elements corresponding to the natural language query questions. The query elements include query intent, subject object, parameter type, and time range.
[0102] The fourth mapping unit is used to map query elements to the database structure based on key metadata, thus obtaining the fourth mapping relationship.
[0103] The constraint unit is used to add rule constraints to query elements based on the set rules associated with industrial production data. The set rules include security constraints and operation instruction generation specifications.
[0104] The second integration unit is used to integrate the query elements, the fourth mapping relationship, and the rule constraints into the prompt information according to a preset format.
[0105] In this embodiment, the industrial production data processing apparatus 500 may further include an error correction module, which is used to perform error correction operations on the first database operation instructions. The error correction operation includes a pre-execution unit, a determination unit, a replacement unit, and a return unit.
[0106] The execution unit is used to pre-execute the first database operation instruction and verify the existence of table fields, data type matching, and the correctness of association conditions in the database.
[0107] The determining unit is used to determine the first database operation instruction as the second database operation instruction if the database passes the verification.
[0108] The replacement unit is used to automatically replace table fields with valid fields based on a terminology mapping library if there are spelling errors or inaccurate names, thus obtaining a second database operation instruction.
[0109] The return unit is used to return a structured message if the execution still fails after replacing the data with valid fields. The structured message includes a list of queryable production line data tables, table field details, and a query example.
[0110] In this embodiment, the industrial production data processing apparatus 500 may further include a visualization module for generating interactive charts based on second database operation instructions. The visualization module may include a selection unit and a generation unit.
[0111] The selection unit is used to select the target chart template corresponding to the query result from the set chart templates after the second database operation instruction is executed and the query result is obtained.
[0112] The generation unit is used to call the industrial visualization engine to render the data in the query results according to the target chart template and generate an interactive chart.
[0113] This application also provides a computer-readable storage medium storing a program that can be loaded by a processor and executed as any of the industrial production data processing methods described in this application.
[0114] Those skilled in the art will understand that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to achieve the above functions. For example, the program can be stored in the memory of a device, and when the program in the memory is executed by the processor, all or part of the above functions can be achieved. In addition, when all or part of the functions in the above embodiments are implemented by computer programs, the program can also be stored in a server, another computer, disk, optical disk, flash drive, or external hard drive, etc., and can be downloaded or copied to the memory of a local device, or the system of the local device can be updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be achieved.
[0115] The above examples illustrate this application only to aid understanding and are not intended to limit its scope. Those skilled in the art to which this application pertains can make various simple deductions, modifications, or substitutions based on the ideas presented.
Claims
1. A method for processing industrial production data, characterized in that, include: Obtain natural language query questions targeting industrial production lines; Based on the current industrial time-series data of the industrial production line, a term mapping library containing term association relationships is constructed. The term mapping library includes multiple data tables, and the term association relationships include synonym relationships, hierarchical relationships, and table mapping relationships. Based on the terminology mapping library, a target data table semantically associated with the natural language query question is determined, and key metadata semantically associated with the natural language query question is extracted from the target data table; Based on the key metadata, the setting rules corresponding to the industrial production line, and the natural language query question, a prompt message is generated; Based on the prompt information, a first database operation instruction corresponding to the natural language query question is generated through a natural language query to database query conversion mechanism. The step of constructing a terminology mapping library containing terminology associations based on the current industrial time-series data of the industrial production line includes: Read the target information of the data table in the database corresponding to the industrial production line. The target information includes the table name, field name, field type, and time series characteristic information of the data table. Based on the field names of the data table and the time-series feature information, combined with the knowledge base corresponding to the industrial production line, synonyms with semantic relationships to the field names are determined to construct a first mapping library, which includes the first mapping relationship between the field names and the synonyms. Based on the time-series business logic of the industrial production line and combined with the time-series feature information, the hypernyms and hyponyms that have a hierarchical relationship with the synonyms are determined to construct a second mapping library. The second mapping library includes the second mapping relationship between the synonyms and the hypernyms and the hyponyms. Based on the field names, field types, and time-series feature information of the data tables, the table names of data tables with time-series relationships are mapped to obtain a third mapping library, which includes the third mapping relationship between data tables.
2. The processing method according to claim 1, characterized in that, The time-series feature information includes a timestamp field, sampling frequency, and time granularity level. The step of reading the target information from the data table in the database corresponding to the industrial production line includes: Semantic analysis is performed on the field names of the data table to identify the fields in the data table that mark the data collection time, and the timestamp field is determined. Based on consecutive records in the timestamp field, the sampling time interval between adjacent data is calculated to obtain the sampling frequency; Based on the sampling frequency and the frequency range of multiple time granularity levels in the industrial production line, the data table is divided into time granularity levels corresponding to the sampling frequency.
3. The processing method according to claim 1, characterized in that, The step of constructing a terminology mapping library containing terminology associations based on the current industrial time-series data of the industrial production line also includes: In response to a change in the data table structure of the terminology mapping library, an incremental update is performed on the mapping library corresponding to the changed data table structure; and / or In response to receiving query feedback information, terms that do not exist in the terminology mapping library are marked, and the marked terms are added to the terminology mapping library.
4. The processing method according to claim 1, characterized in that, The step of determining the target data table semantically associated with the natural language query question based on the terminology mapping library, and extracting key metadata from the target data table that is semantically associated with the natural language query question, includes: Initial fields are extracted from the natural language query question using a word segmentation algorithm. These initial fields include business entities, parameter terms, and time-limited words. The initial field is matched with the term mapping library for similarity to determine a set of target data tables that are semantically associated with the natural language query question. The target data tables are determined based on associated fields that have a term association relationship with the initial field. For each target data table, extract key fields that have semantic association with the initial field and metadata attributes of the key fields. The metadata attributes include the business meaning, data type, time series feature information, and association identifier with the terminology mapping library of the key fields. The key fields are integrated according to the categories and structural relationships of the target data table to form the structured key metadata.
5. The processing method according to claim 1, characterized in that, The step of generating prompt information based on the key metadata, the set rules corresponding to the industrial production line, and the natural language query question includes: Semantic parsing is performed on the natural language query question to obtain the query elements corresponding to the natural language query question. The query elements include query intent, subject object, parameter type and time range. Based on the key metadata, the query elements are mapped to the database structure to obtain a fourth mapping relationship; Based on the set rules associated with the industrial production data, rule constraints are added to the query elements, including security constraints and operation instruction generation specifications; The query elements, the fourth mapping relationship, and the rule constraints are integrated into the prompt information according to a preset format.
6. The processing method according to claim 1, characterized in that, Also includes: The first database operation instruction is pre-executed to verify the existence of table fields, data type matching, and the correctness of association conditions in the database. If the database passes the verification, the first database operation instruction will be determined as the second database operation instruction. If there are any table fields with spelling errors or inaccurate names, they are automatically replaced with valid fields based on the terminology mapping library to obtain the second database operation instruction; If the data still fails after replacing the valid fields, a structured prompt message is returned. The structured prompt message includes a list of queryable production line data tables, table field details, and query examples.
7. The processing method according to claim 6, characterized in that, Also includes: After obtaining the query results by executing the second database operation instruction, a target chart template corresponding to the query results is selected from the set chart templates according to the query results; The industrial visualization engine is invoked to render the data in the query results according to the target chart template, generating an interactive chart.
8. An industrial production data processing device, characterized in that, include: The acquisition module is used to acquire natural language query questions targeting industrial production lines; The construction module is used to construct a term mapping library containing term associations based on the current industrial time-series data of the industrial production line. The term mapping library includes multiple data tables, and the term associations include synonym relationships, hierarchical relationships, and table mapping relationships. The extraction module is used to extract key metadata from the target data table that is semantically associated with the natural language query question, based on the terminology mapping library and the target data table. The prompting module is used to generate prompt information based on the key metadata, the set rules corresponding to the industrial production line, and the natural language query question; The generation module is used to generate a first database operation instruction corresponding to the natural language query question based on the prompt information and through a conversion mechanism from natural language query to database query. The building module includes: The reading unit is used to read target information from a data table in the database corresponding to the industrial production line. The target information includes the table name, field names, field types, and time-series characteristic information of the data table. The first mapping unit is used to determine synonyms that have a semantic relationship with the field names based on the field names of the data table and the time-series feature information, combined with the knowledge base corresponding to the industrial production line, so as to construct a first mapping library. The first mapping library includes the first mapping relationship between the field names and the synonyms. The second mapping unit is used to determine the superordinate words and subordinate words that have a hierarchical relationship with the synonyms based on the time-series business logic of the industrial production line and combined with the time-series feature information, so as to construct a second mapping library. The second mapping library includes the second mapping relationship between the synonyms and the superordinate words and the subordinate words. The third mapping unit is used to map the table names of data tables with time-series relationships based on the field names, field types, and time-series feature information of the data tables, to obtain a third mapping library, which includes the third mapping relationship between data tables.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that can be loaded by a processor and executed as a method for processing industrial production data as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Structured query statement generation method and device, storage medium and electronic equipment
CN119829607A
NL2SQL optimization method and device based on large model, equipment and medium
CN120743939A