Automatic generation and decision-making system and method for equipment operation and maintenance SQL (Structured Query Language)

By deeply integrating large models, knowledge graphs, and intelligent agents, the problem of the broken link between natural language queries and executable SQL in industrial equipment operation and maintenance has been solved, realizing efficient and interpretable SQL generation and decision support, and improving data analysis efficiency and result credibility.

CN121526558APending Publication Date: 2026-02-13YUEYANG CLPEC ELECTROMECHANICAL ENG & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511636637.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Traditional business intelligence tools and manually written SQL queries suffer from semantic gaps, difficulties in handling complex relationships, a disconnect between knowledge accumulation and data-driven approaches, and insufficient real-time performance and scalability when dealing with multi-source, heterogeneous, high-concurrency, and time-series industrial equipment operation and maintenance data. Furthermore, general-purpose large language models suffer from domain illusion, unstable generation, and insufficient credibility in industrial operation and maintenance scenarios, making it impossible to achieve an end-to-end closed loop from natural language queries to executable SQL.

Method used

By deeply integrating large models, knowledge graphs, and intelligent agents, and through data collection and governance modules, knowledge graph modules, intelligent agent coordination modules, and large model semantic modules, natural language problems can be decomposed, SQL generated, and decision supported. Path reasoning and entity disambiguation are performed in conjunction with knowledge graphs, and a weighted fusion strategy is adopted to ensure the executability and interpretability of the generated SQL.

Benefits of technology

It achieves end-to-end automation from natural language to complex SQL, with an average response time of ≤3.5 seconds and a complex SQL generation accuracy of ≥94.7%, improving data analysis efficiency and result reliability, and supporting rapid response and interpretable decision-making in complex business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121526558A_ABST
    Figure CN121526558A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of intelligent operation and maintenance of industrial equipment, and particularly relates to an automatic generation and decision support system for complex SQL (Structured Query Language) of equipment operation and maintenance based on deep fusion of a large model, a knowledge graph and an intelligent agent. According to the system, natural language questions of users are automatically converted into high-execution-rate SQL containing recursion and multi-table JOIN through data treatment, knowledge graph construction, agent scheduling and large model semantic analysis, interpretable conclusions and operation and maintenance suggestions are output, and data analysis efficiency and decision scientificity are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent operation and maintenance technology for industrial equipment, specifically involving an automatic generation and decision-making system and method for equipment operation and maintenance SQL that deeply integrates large language models, knowledge graphs and intelligent agent technologies. Background Technology

[0002] With the deep integration of industrial automation, information technology, and the Internet of Things (IoT), modern industrial enterprises have generally deployed multiple heterogeneous systems such as DCS, SCADA, CMMS, and EAM, accumulating massive amounts of equipment operation and maintenance data characterized by "multi-source, heterogeneous, high concurrency, and strong time series." Faced with this type of data, traditional business intelligence (BI) tools, fixed reports, or manually written SQL queries are increasingly inadequate, mainly due to the following limitations:

[0003] (1) Semantic gap: Business personnel are used to asking questions in natural language (such as "Which 35kV main transformers had more than 3 high temperature alarms last week?"), while the underlying data is scattered in dozens or even hundreds of tables with different field names and unit standards, which makes the cycle from clarifying requirements to writing and verifying SQL take several hours or even days.

[0004] (2) Complex relationship processing is difficult: the relationship between equipment, components, work orders and defect records is a mixed "network + tree" relationship, involving complex SQL syntax such as multi-table JOIN, recursive query, time window aggregation, etc. Manual writing is very easy to make mistakes and difficult to reuse.

[0005] (3) Disconnect between knowledge accumulation and data-driven approach: The accumulated expert experience, operating procedures and other unstructured knowledge cannot be directly used in data analysis, resulting in poor interpretability and actionability of the analysis results.

[0006] (4) Insufficient real-time performance and scalability: Traditional rule engines or wide table solutions require modification of table structure and scripts when faced with new devices or test points, resulting in long iteration cycles and failing to meet the needs of rapid response in operation and maintenance.

[0007] In recent years, Large Language Models (LLMs) have demonstrated powerful capabilities in natural language processing and code generation, offering potential solutions to the aforementioned problems. However, directly applying general-purpose LLMs to industrial operations and maintenance scenarios still faces significant challenges: First, domain illusion—LLMs lack awareness of specialized entities such as equipment coding and failure modes, easily leading to factual errors; second, unstable generation of complex SQL—due to the lack of industrial-grade elements in the training data, the executable rate of generated statements is low; third, poor credibility and traceability—their "black box" output makes it difficult to provide data sources and business explanations, failing to meet the security audit requirements of high-risk industries.

[0008] Therefore, existing technologies have not yet been able to effectively achieve an end-to-end closed loop from "natural language questioning" to "executable SQL" and then to "credible decision recommendations." There is an urgent need for an intelligent data analysis system that can deeply integrate domain knowledge and has high reliability and interpretability. Summary of the Invention

[0009] This invention aims to provide a system and method for automatic generation and decision-making of equipment operation and maintenance SQL through deep integration of "large model + knowledge graph + intelligent agent". This system solves the problems of broken links in the "natural language question → executable SQL" link and low accuracy of automatic generation of complex queries in traditional operation and maintenance data analysis. It overcomes the domain illusion and lack of credibility of general large models in industrial scenarios, and finally realizes the closed loop of "data-knowledge-decision", allowing operation and maintenance personnel to obtain interpretable and actionable conclusions in a zero-code manner.

[0010] To solve the above-mentioned technical problems, the present invention is implemented as follows:

[0011] This invention provides an automated SQL generation and decision-making system for equipment operation and maintenance, comprising:

[0012] The data acquisition and governance module is used to extract IoT time-series data, CMMS work order data and EAM asset data in real time through Flink or CDC technology, and perform cleaning and normalization processing such as missing value imputation, duplicate value removal, unit conversion and time zone alignment.

[0013] The knowledge graph module is used to build a semantic network containing nodes of equipment, components, sensors, failure modes, maintenance activities, and environmental parameters, as well as relation types such as belong_to, causes, precedes, and locates_at. It realizes a unified mapping of fields, tables, and business meanings, and supports path reasoning and entity disambiguation.

[0014] The intelligent agent coordination module, including a task decomposer, tool invoker, context manager, and monitoring feedback unit, is used for the entire process scheduling of natural language problems, including task decomposition, SQL generation, execution verification, and weighted fusion. It supports multi-turn dialogue, error self-healing, and continuous learning.

[0015] The large model semantic module is used to create a three-part prompt template based on role definition, splitting rules, and prompt engineering. It splits natural language questions into "SQL generation questions" and "data analysis questions" and injects knowledge graph association paths and business meanings into the prompts to generate executable SQL statements that include recursive queries, multi-table JOINs, time window aggregations, and date formatting.

[0016] The user interaction module supports voice input, referencing and re-questioning. The front end uses Vue and ECharts for data visualization, and the back end automatically generates PDF maintenance reports with three columns: conclusion, root cause, and recommendations.

[0017] Furthermore, the data acquisition and governance module uses a star-snowflake hybrid schema to store the governed subject dataset and provides a unified RESTful API or SQL interface for upper-layer applications to shield the heterogeneous differences of the underlying multi-database architecture.

[0018] Furthermore, the knowledge graph module is constructed and stored using Neo4j or Nebula Graph graph databases, and the path reasoning includes fault propagation path analysis based on "high temperature alarm → heat dissipation system → old equipment".

[0019] Furthermore, the context manager in the intelligent agent coordination module uses a sliding window and summary mechanism to maintain the dialogue state machine to achieve referential resolution; the monitoring feedback device automatically captures exceptions and calls the large model for retry and correction when SQL execution fails, with a maximum of 3 retries.

[0020] Furthermore, the large model semantic module employs the following syntax constraints when generating SQL to ensure high execution rates:

[0021] Cross-database references must be enclosed in single quotes in the format 'database'.'table';

[0022] Table joins must use the explicit INNER JOIN or LEFT JOIN syntax and use table aliases;

[0023] When queries involve departmental or regional levels, the WITH RECURSIVE statement is automatically generated for recursive querying;

[0024] Use the DATE_FORMAT function to uniformly format date and time fields.

[0025] Furthermore, the final analysis results output by the system are generated through a weighted fusion strategy, wherein the weight of the SQL query results is 0.5, the weight of the knowledge graph reasoning results is 0.3, and the weight of the historical case matching results is 0.2.

[0026] This invention also provides a method for automatically generating and making decisions on equipment operation and maintenance SQL, based on the aforementioned system, and includes the following steps:

[0027] Receive device maintenance queries from users via natural language input;

[0028] Knowledge retrieval and keyword extraction are performed based on a pre-built knowledge base to obtain background knowledge and business concepts related to the problem.

[0029] The large model semantic module is invoked, and the natural language question is split into "precise questions for generating SQL" and "data analysis questions based on SQL results" according to the prompt template of role definition and splitting rules.

[0030] Combine knowledge graphs to perform SQL intent analysis and generate an element analysis report that includes databases, tables, fields, join relationships, recursive requirements, and date formatting methods;

[0031] Based on the feature analysis report, generate executable SQL statements that include recursive queries, multi-table JOINs, and Chinese aliases;

[0032] Execute the generated SQL statement, obtain the query results, and search the knowledge base again to complete the fault mode and threshold definition expertise;

[0033] The query results are cleaned, logically verified, and deduced to produce both numerical and semantic outputs.

[0034] The system presents users with a combination of textual conclusions, visual charts, and operational suggestions, and supports downloading the results and asking further questions.

[0035] Furthermore, the SQL generation process employs single-quote cross-database references, explicit JOIN syntax, WITH recursive statements, and date formatting functions to ensure that the generated SQL statements can be directly executed in the MySQL database.

[0036] Furthermore, when the method is implemented in engineering projects, the average end-to-end response time from natural language to SQL does not exceed 3.5 seconds, and the one-time generation execution rate of complex SQL statements is not less than 94%.

[0037] Compared with the prior art, the advantages of this invention are as follows:

[0038] (1) Significantly improved data analysis efficiency: The entire process from natural language to complex SQL is automated, with an average response time of ≤3.5 seconds, which is more than 80 times faster than the traditional manual method. Through the "problem decomposition - knowledge graph mapping - prompt engineering guidance" mechanism, the accuracy of generating advanced SQL containing multi-table JOIN and recursive queries is ≥94.7%.

[0039] (2) Deep mining of data value: By driving business semantic understanding through knowledge graph, the leap from "table fields" to "business entities" has been realized, supporting implicit relational reasoning and high-level analysis scenarios (such as potential fault mode identification), providing an interpretable path for decision-making.

[0040] (3) Dual guarantee of data quality and result credibility: The AI ​​and knowledge base joint verification mechanism is adopted, and a weighted fusion strategy is implemented on the final answer (SQL result weight 0.5, knowledge graph reasoning weight 0.3, historical case matching weight 0.2), which significantly improves the business relevance and credibility of the answer, and the user satisfaction rate is over 92%.

[0041] (4) The system has the ability to continuously learn and iterate rapidly: the intelligent agent achieves dynamic error correction through task decomposition, tool scheduling, context memory and error recovery. New devices or indicators only need to be registered in the knowledge graph layer without modifying the code, and the adaptation cycle of new queries is shortened from 3-5 days in the traditional way to 1 day.

[0042] (5) Fully support complex business scenarios: It can automatically generate and execute SQL statements for industrial-grade complex scenarios such as recursive hierarchical queries, cross-database multi-table JOIN, and complex time window statistics with one click, solving the development bottleneck of traditional methods.

[0043] (6) In the actual application of this system in a certain Sinopec equipment operation and maintenance system, the average response time was reduced from 15-30 minutes by manual operation to 3.2 seconds, the accuracy of complex SQL generation reached 94.7%, and the user satisfaction increased to 92%. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein:

[0045] Figure 1 This invention provides a framework diagram of an automated SQL generation and decision-making system for equipment operation and maintenance.

[0046] Figure 2 The flowchart shows the automatic generation and decision-making method for equipment operation and maintenance SQL provided by the present invention. Detailed Implementation

[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0048] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0049] Please see Figure 1 As shown, this embodiment of the invention provides an automatic generation and decision-making system for equipment operation and maintenance SQL, including a data acquisition and governance module 1, a knowledge graph module 2, an intelligent agent coordination module 3, a large model semantic module 4, and a user interaction module 5.

[0050] The data acquisition and governance module 1 is used to extract IoT time-series data, CMMS work order data and EAM asset data in real time through Flink or CDC technology, and perform cleaning and normalization processing such as missing value filling, duplicate value removal, unit conversion and time zone alignment.

[0051] Furthermore, the data acquisition and governance module 1 uses a star-snowflake hybrid schema to store the governed subject dataset and provides a unified RESTful API or SQL interface for upper-layer applications to shield the heterogeneous differences of the underlying multi-database architecture.

[0052] The knowledge graph module 2 is used to construct a semantic network containing nodes for equipment, components, sensors, fault modes, maintenance activities, and environmental parameters, as well as relation types such as belong_to, causes, precedes, and locates_at. This enables a unified mapping of fields, tables, and business meanings, and supports path reasoning and entity disambiguation.

[0053] Furthermore, the knowledge graph module 2 is constructed and stored using Neo4j or Nebula Graph graph databases, and the path reasoning includes fault propagation path analysis based on "high temperature alarm → heat dissipation system → old equipment".

[0054] The intelligent agent coordination module 3 includes a task decomposer, a tool invoker, a context manager, and a monitoring feedback unit. It is used for the entire process scheduling of natural language problems, including task decomposition, SQL generation, execution verification, and weighted fusion, and supports multi-turn dialogue, error self-healing, and continuous learning.

[0055] Furthermore, the context manager in the intelligent agent coordination module 3 uses a sliding window and summary mechanism to maintain the dialogue state machine to achieve referential resolution; the monitoring feedback device automatically captures exceptions and calls the large model for retry and correction when SQL execution fails, with a maximum of 3 retries.

[0056] The large model semantic module 4 is used to create a three-part prompt template based on role definition, splitting rules, and prompting engineering. It splits natural language questions into "SQL generation questions" and "data analysis questions," and injects knowledge graph association paths and business meanings into the prompts to generate executable SQL statements that include recursive queries, multi-table JOINs, time window aggregations, and date formatting.

[0057] Furthermore, the large model semantic module 4 employs the following syntax constraints when generating SQL to ensure high execution efficiency:

[0058] Cross-database references must be enclosed in single quotes in the format 'database'.'table';

[0059] Table joins must use the explicit INNER JOIN or LEFT JOIN syntax and use table aliases;

[0060] When queries involve departmental or regional levels, the WITH RECURSIVE statement is automatically generated for recursive querying;

[0061] Use the DATE_FORMAT function to uniformly format date and time fields.

[0062] The user interaction module 5 supports voice input, referencing and re-questioning. The front end uses Vue and ECharts to implement data visualization, and the back end automatically generates a PDF maintenance report with three columns: conclusion, root cause and suggestion.

[0063] The final analysis results output by the system are generated through a weighted fusion strategy, where the weight of the SQL query results is 0.5, the weight of the knowledge graph reasoning results is 0.3, and the weight of the historical case matching results is 0.2.

[0064] Combined Figure 2 As shown, a method for automatically generating and making decisions on equipment operation and maintenance SQL, based on the aforementioned system, includes the following steps:

[0065] Step S1: Receive device maintenance query questions input by the user in natural language;

[0066] Step S2: Based on the pre-built knowledge base, perform knowledge retrieval and keyword extraction to obtain background knowledge and business concepts related to the problem;

[0067] Step S3: Call the large model semantic module and, based on the prompt template of role definition and splitting rules, split the natural language question into "precise questions for generating SQL" and "data analysis questions based on SQL results";

[0068] Step S14: Combine the knowledge graph to perform SQL intent analysis and generate an element analysis report that includes databases, tables, fields, join relationships, recursive requirements, and date formatting methods;

[0069] Step S5: Based on the feature analysis report, generate an executable SQL statement that includes recursive queries, multi-table JOINs, and Chinese aliases;

[0070] Step S6: Execute the generated SQL statement, obtain the query results, and search the knowledge base again to complete the professional knowledge of fault modes and threshold definitions;

[0071] Step S7: Perform data cleaning, logical verification, and conclusion deduction on the query results to generate both numerical and semantic outputs.

[0072] Step S8 presents the text conclusions, visualization charts, and operation and maintenance suggestions to the user in one integrated form, and supports downloading the results and asking further questions.

[0073] The SQL generation process employs single-quote cross-database references, explicit JOIN syntax, WITH recursive statements, and date formatting functions to ensure that the generated SQL statements can be directly executed in the MySQL database.

[0074] When the method is implemented in engineering projects, the average end-to-end response time from natural language to SQL is no more than 3.5 seconds, and the one-time generation execution rate of complex SQL statements is no less than 94%.

[0075] The present invention will now be described in detail with reference to the accompanying drawings (though not shown, they can be understood from the description) and embodiments.

[0076] The core architecture of the equipment operation and maintenance SQL automatic generation and decision-making system provided by this invention consists of five layers that work together to achieve an end-to-end closed loop from natural language to decision support.

[0077] I. System Architecture and Module Details

[0078] 1. Data Acquisition and Governance Module

[0079] In its implementation, this module uses Apache Flink and CDC (Change Data Capture) technologies to build a real-time data pipeline. It extracts real-time equipment vibration and temperature time-series data from the SCADA system, work order status and maintenance records from the CMMS system, and equipment asset ledgers from the EAM system. After the data enters the governance phase, the system automatically applies predefined rules: missing temperature readings are filled using forward imputation; pressure values ​​with inconsistent units (e.g., bar vs. MPa) are automatically converted to standard units (MPa); and all timestamps are standardized to UTC+8 time zone. The governed data is stored in a data lake by topic (e.g., "transformer operation"), organized using a star-snowflake hybrid model, and provides a unified RESTful API interface for the upper layers.

[0080] 2. Knowledge Graph Module

[0081] This module is the core of the system's business semantics and is built and stored using the Neo4j graph database.

[0082] Nodes and attributes: including devices (attributes: ID, name, model), sensors (attributes: measurement point ID, range), and fault modes (attributes: fault code, description, risk level), etc.

[0083] Relationships and semantics: including belongs_to (sensor -> device), causes (failure mode -> device), precedes (maintenance activity A -> maintenance activity B), etc.

[0084] Example of path reasoning: When a user queries "high temperature alarm", the system can automatically infer the path (device) - [has_sensor] -> (sensor: temperature) - [triggers] -> (alarm: high temperature) - [may_cause] -> (fault mode: insulation aging), providing a basis for root cause analysis.

[0085] 3. Agent Coordination Module

[0086] This module is the system's scheduling hub, driven by an intelligent agent program implemented in Python.

[0087] Task Decomposer: Receives the user's original question, such as "Statistics on the equipment in all subordinate departments of Company A that has been running for more than 100 hours and has experienced more than 2 failures", and breaks it down into SQL generation and data analysis sub-tasks.

[0088] Tool invoker: Invokes the SQL generator, SQL executor (connects to MySQL), calculator (calculates failure rates, etc.), and visualizer in sequence.

[0089] Context Manager: A sliding window and summary mechanism are used to maintain the dialog state machine. For example, when the user asks a second question, "What is its operating temperature?", the system can recognize from the context that "it" refers to "device A" mentioned earlier.

[0090] Monitoring Feedback Unit: Monitors SQL execution. If it fails (e.g., "field does not exist"), it automatically captures the exception, logs it, and requests the large model to retry generating SQL based on the error information, with a maximum of 3 retries.

[0091] 4. Large Model Semantic Module

[0092] This module is the core of natural language to SQL translation, using large models such as open source CodeLlama or commercial GPT-4, and constraining its output through precise prompting engineering.

[0093] Example of a prompt word template:

[0094] text

[0095] #Role Definition

[0096] Role: You are a seasoned industrial data analysis expert...

[0097] #Splitting Rules

[0098] Please break down the user's question into:

[0099] 1. Precise questions for generating SQL: [Explicitly define the query target, conditions, and time range]

[0100] 2. Data analysis problems based on SQL results: [Identify analysis objectives such as trends, root causes, and recommendations]

[0101] #Knowledge Graph Enhancement

[0102] / * Knowledge graph information: High-risk equipment is defined as risk_level > 3, and the associated table is bz_risk_type * /

[0103] Syntax constraints: The SQL generation prompt explicitly states that cross-database references must use the 'database'.`table` format; explicit JOIN must be used; and the DATE_FORMAT(record_time, '%Y-%m-%d') function must be used for date fields.

[0104] 5. User Interaction Module

[0105] This module is the system's front-end interface, built using the Vue.js framework and the ECharts charting library. Users can input questions via text or voice. Query results are displayed in the form of tables, trend line charts, device topology diagrams, etc. Users can click on specific areas of the chart to drill down and view the underlying data. The system back-end automatically generates structured PDF maintenance reports, including three columns: "Conclusions," "Root Cause Analysis," and "Maintenance Recommendations," for users to download and report.

[0106] II. Implementation Examples of the Method and Flow.

[0107] Taking the user's question, "Please compile a list of devices in all departments of a company that have been running for more than 100 hours and have experienced more than 2 failures this month," as an example, the internal system process is as follows:

[0108] S1 & S2 & S3: The agent coordination layer calls the semantic layer of the large model. The large model breaks down the problem into:

[0109] The SQL precision question is: "Query the company with company ID 100 and all its subordinate departments, and find the device ID, device name, total running time and total number of failures that have a total running time of more than 100 hours and more than 2 failure records within this month."

[0110] Data analysis question: "Based on the query results, summarize high-risk equipment by department and propose priority suggestions for inspection and maintenance of these devices."

[0111] S4 & S5: The agent passes the "precise SQL question" to the large model for SQL intent analysis and injects information retrieved from the knowledge graph (such as the structure of the sys_dept table and the relationship between the equ_run_record and fault_record tables). The large model, adhering to strict syntax rules, generates the following SQL statements that can be directly executed in MySQL:

[0112] SQL

[0113] WITH RECURSIVE dept_tree AS (

[0114] SELECT id, dept_name FROM sys_dept WHERE id = 100

[0115] UNION ALL

[0116] SELECT d.id, d.dept_name FROM sys_dept d

[0117] INNER JOIN dept_tree dt ON d.parent_id = dt.id )

[0119] SELECT

[0120] e.device_id AS 'device ID',

[0121] e.device_name AS 'device name',

[0122] SUM(e.run_hours) AS 'Total running time',

[0123] COUNT(f.id) AS 'Number of failures'

[0124] FROM 'device_db'.`equ_run_record` e

[0125] LEFT JOIN 'fault_db'.`fault_record` f ON e.device_id = f.device_id

[0126] WHERE e.dept_id IN (SELECT id FROM dept_tree)

[0127] AND DATE_FORMAT(e.record_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')

[0128] GROUP BY e.device_id, e.device_name

[0129] HAVING: Total runtime > 100 AND number of failures > 2;

[0130] S6 & S7 & S8: The agent executes SQL to obtain a device list, then retrieves supplementary information such as device model, age, and historical failure modes from the knowledge graph. After the large model cleans, validates, and analyzes the data, the front end presents it to the user.

[0131] The text concludes: "Statistically, a total of 3 pieces of equipment met the criteria, among which equipment B-101 had the highest number of failures, with 5 failures."

[0132] Visualization chart: A bar chart comparing the uptime and number of failures of the three devices.

[0133] Maintenance recommendation: "Equipment B-101 has been in operation for 12 years. Most of its historical failures are related to the heat dissipation system. It is recommended to prioritize the replacement of infrared temperature measurement and fans."

[0134] III. Engineering Implementation and Verification of Beneficial Effects

[0135] The system of this invention has been successfully deployed in the equipment operation and maintenance system of a certain Sinopec company. Implementation data shows that:

[0136] Efficiency improvement: The average response time has been reduced from 15-30 minutes manually to 3.2 seconds.

[0137] High accuracy: The accuracy rate of complex SQL generation reaches 94.7%, and the accuracy rate of join queries involving more than 5 tables has been improved from less than 60% in the traditional method to 91.2%.

[0138] User satisfaction: The satisfaction rate of operations and maintenance engineers increased from approximately 65% ​​to 92%.

[0139] Decision science: The system provides explainable root causes and operational recommendations, enabling maintenance decisions to shift from "passive response" to "predictive maintenance".

[0140] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A system for automatically generating and making decisions on equipment operation and maintenance SQL, characterized in that, include: The data acquisition and governance module is used to extract IoT time-series data, CMMS work order data and EAM asset data in real time through Flink or CDC technology, and perform cleaning and normalization processing such as missing value imputation, duplicate value removal, unit conversion and time zone alignment. The knowledge graph module is used to build a semantic network containing nodes of equipment, components, sensors, failure modes, maintenance activities, and environmental parameters, as well as relation types such as belong_to, causes, precedes, and locates_at. It realizes a unified mapping of fields, tables, and business meanings, and supports path reasoning and entity disambiguation. The intelligent agent coordination module, including a task decomposer, tool invoker, context manager, and monitoring feedback unit, is used for the entire process scheduling of natural language problems, including task decomposition, SQL generation, execution verification, and weighted fusion. It supports multi-turn dialogue, error self-healing, and continuous learning. The large model semantic module is used to create a three-part prompt template based on role definition, splitting rules, and prompt engineering. It splits natural language questions into "SQL generation questions" and "data analysis questions" and injects knowledge graph association paths and business meanings into the prompts to generate executable SQL statements that include recursive queries, multi-table JOINs, time window aggregations, and date formatting. The user interaction module supports voice input, referencing and re-questioning. The front end uses Vue and ECharts for data visualization, and the back end automatically generates PDF maintenance reports with three columns: conclusion, root cause, and recommendations.

2. The system as described in claim 1, characterized in that, The data acquisition and governance module uses a star-snowflake hybrid schema to store the governed subject dataset and provides a unified RESTful API or SQL interface for upper-layer applications to shield the heterogeneous differences of the underlying multi-database architecture.

3. The system as described in claim 1, characterized in that, The knowledge graph module is constructed and stored using Neo4j or NebulaGraph graph databases, and the path reasoning includes fault propagation path analysis based on "high temperature alarm → heat dissipation system → old equipment".

4. The system as described in claim 1, characterized in that, The context manager in the agent coordination module uses a sliding window and digest mechanism to maintain the dialogue state machine to achieve referential resolution; the monitoring feedback unit automatically captures exceptions and calls the large model for retry and correction when SQL execution fails, with a maximum of 3 retries.

5. The system as described in claim 1, characterized in that, The large model semantic module employs the following syntax constraints when generating SQL to ensure high execution rates: Cross-database references must be enclosed in single quotes in the format 'database'.'table'; Table joins must use the explicit INNER JOIN or LEFT JOIN syntax and use table aliases; When queries involve departmental or regional levels, the WITH RECURSIVE statement is automatically generated for recursive querying; Use the DATE_FORMAT function to uniformly format date and time fields.

6. The system as described in claim 1, characterized in that, The final analysis results output by the system are generated through a weighted fusion strategy, where the weight of the SQL query results is 0.5, the weight of the knowledge graph reasoning results is 0.3, and the weight of the historical case matching results is 0.

2.

7. A method for automatically generating and making decisions on equipment operation and maintenance SQL, implemented based on the system described in any one of claims 1 to 6, characterized in that, Includes the following steps: Receive device maintenance queries from users via natural language input; Knowledge retrieval and keyword extraction are performed based on a pre-built knowledge base to obtain background knowledge and business concepts related to the problem. The large model semantic module is invoked, and the natural language question is split into "precise questions for generating SQL" and "data analysis questions based on SQL results" according to the prompt template of role definition and splitting rules. Combine knowledge graphs to perform SQL intent analysis and generate an element analysis report that includes databases, tables, fields, join relationships, recursive requirements, and date formatting methods; Based on the feature analysis report, generate executable SQL statements that include recursive queries, multi-table JOINs, and Chinese aliases; Execute the generated SQL statement, obtain the query results, and search the knowledge base again to complete the fault mode and threshold definition expertise; The query results are cleaned, logically verified, and deduced to produce both numerical and semantic outputs. The system presents users with a combination of textual conclusions, visual charts, and operational suggestions, and supports downloading the results and asking further questions.

8. The method as described in claim 7, characterized in that, The SQL generation process employs single-quote cross-database references, explicit JOIN syntax, WITH recursive statements, and date formatting functions to ensure that the generated SQL statements can be directly executed in the MySQL database.

9. The method as described in claim 7, characterized in that, When the method is implemented in engineering projects, the average end-to-end response time from natural language to SQL is no more than 3.5 seconds, and the one-time generation execution rate of complex SQL statements is no less than 94%.