A power grid model online publishing system and method

CN122547425APending Publication Date: 2026-08-11NARI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]1.耦合性高,维护困难:当数据库表结构发生变更,或对外发布的Proto接口定义更新时,必须修改并重新编译、部署数据发布程序,导致系统维护成本高、响应速度慢

Benefits of technology

[0045]1、本发明将数据模型转换规则从程序代码中剥离,通过外部配置文件管理。当数据库结构或Proto接口发生变更时,仅需修改配置文件即可生效,实现了“配置即代码”,极大降低了维护成本和发布周期。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122547425A_ABST
    Figure CN122547425A_ABST
Patent Text Reader

Abstract

This invention discloses an online power grid model publishing system and method. It declaratively defines mapping rules from relational database table structures to Proto message structures through a mapping description file. Utilizing the reflection mechanism of protocol buffers, it dynamically converts power grid model data from the relational database into Proto message instances and serializes them at runtime. This invention decouples the mapping rules from the program code, allowing for flexible changes to the scope of published data and field mapping relationships by modifying configuration files without recompilation and deployment. It also supports many-to-one mapping scenarios where data from multiple different source database tables are uniformly published as the same message type. This enables dynamic, online conversion and publishing from relational databases to Proto serialized models, significantly improving the system's maintainability, flexibility, and scalability.
Need to check novelty before this filing date? Find Prior Art

Claims

1. An online power grid model publishing system, characterized in that, The system includes: A mapping configuration module is used to provide at least one mapping description file, which declaratively defines the mapping rules from at least one relational database structure table to the target Proto message structure; the mapping rules include overall mapping information for specifying the correspondence between the source relational database table and the target Proto message type, and attribute mapping information for specifying the correspondence between the source database table fields and the target Proto message fields; The protocol description file compilation module is used to load the interface definition file of the target Proto message to be published, and generate the descriptor of the target Proto message type based on the reflection mechanism of the protocol buffer; A mapping semantic parsing module, connected to the mapping configuration module, is used to parse the mapping description file to generate a mapping semantic object, wherein the mapping semantic object contains the mapping rules defined by the overall mapping information and the attribute mapping information; The data query module, connected to the mapping semantic parsing module, is used to generate and execute query statements for the source relational database table based on the mapping semantic object and the received data publishing request, and obtain a data result set; The message reflection construction module is connected to the protocol description file compilation module and the mapping semantic parsing module, respectively. It is used to set the field values ​​in the data result set to the dynamically created target Proto message instance through the reflection mechanism of the protocol buffer, according to the mapping rules in the mapping semantic object and the descriptor. The serialization output module, connected to the message reflection construction module, is used to serialize the target Proto message instance with set field values ​​into a binary data stream.

2. The online power grid model publishing system according to claim 1, characterized in that, The overall mapping information is defined by the object entity mapping tag, and its attributes include at least: Identifiers are used to distinguish and isolate different object mapping description information; The target message type attribute is used to identify the name of the target Proto message type; The target message identifier attribute is used to identify the field name of the target Proto message instance corresponding to the overall mapping information in the top-level protocol buffer response message. The source relational database table attribute is used to identify the name of the source relational database table.

3. The online power grid model publishing system according to claim 1, characterized in that, The attribute mapping information is defined by attribute mapping information tags. The attribute mapping information tags have target attributes for identifying the field name of the target Proto message, source column attributes for identifying the field name of the source relational database table, target type attributes for identifying the data type of the target Proto message field, and source type attributes for identifying the data type of the source relational database table field.

4. The online power grid model publishing system according to claim 2, characterized in that, The mapping description file also includes a data query definition tag, which contains SQL statements or statement fragments for retrieving data and references the identifier of the object entity mapping tag.

5. The online power grid model publishing system according to claim 4, characterized in that, The mapping description file also includes dynamic SQL condition tags, which include... <where>Label, <choose>Tags and <when> The tags are used to trim the data range of the power grid model; the data query executor is also used to parse the dynamic SQL condition tags to dynamically generate SQL WHERE clauses based on the query parameters carried in the data publishing request.< / when> < / choose> < / where> 6. The online power grid model publishing system according to claim 1, characterized in that, The system is also used to uniformly publish data from multiple different source relational databases into a single power grid model, wherein: The mapping configuration module is also used to configure the overall mapping information in the multiple provided mapping description files to have the same target type attribute and target identifier attribute, as well as different source table attributes; The data query module is used to respond to a release request for the power grid model by searching for multiple associated mapping description files based on the target identifier attribute corresponding to the request, and performing data queries corresponding to the multiple mapping description files respectively. The message reflection building module is used to aggregate and add the separately generated target Proto message instances to the same message list field specified by the target identifier attribute in the top-level protocol buffer response message.

7. The online power grid model publishing system according to claim 1, characterized in that, When parsing the mapping description file, the mapping semantic parsing module establishes an index with an identifier as the key and the overall mapping information as the value. The identifier is unique within the mapping description file.

8. The online power grid model publishing system according to claim 7, characterized in that, The data query module is also used to, when processing a request to obtain the power grid model, execute data queries corresponding to all associated mapping description files in parallel or serially, and obtain data from the multiple different source relational database tables respectively; The message reflection construction module is used to convert the data obtained from the data query into target Proto message instances according to the mapping rules in the mapping description file corresponding to each source relational database table, and merge all message instances into the same repeated message list field.

9. The online power grid model publishing system according to claim 1, characterized in that, The mapping semantics parsing module is further configured to, after the mapping description file is modified, re-parse the modified mapping description file to update the mapping semantic object, so that changes to the mapping rules take effect without recompiling and deploying the system; wherein, the modifications include: Add field definitions to the interface definition file, add corresponding attribute mapping information tags to the attribute mapping information, and add corresponding fields to the SQL statements in the data query definition tags; or Modify the dynamic SQL condition labels.

10. A method based on the online power grid model publishing system according to any one of claims 1-9, characterized in that, The method includes: Obtain at least one mapping description file, which describes the mapping rules from at least one relational database structure table to the target Proto message; The protocol description file compilation module loads the interface definition file of the target Proto message to be published and generates a descriptor for the target Proto message type based on the reflection mechanism of the protocol buffer; The mapping semantic parsing module parses the mapping description file and generates a mapping semantic object, which contains the mapping rules defined by the overall mapping information and the attribute mapping information; In response to a data publishing request, the data query module generates and executes a query statement against the source relational database table based on the mapped semantic object to obtain a data result set; The message reflection construction module traverses each record in the data result set, and sets the field values ​​in the data result set to the dynamically created target Proto message instance according to the mapping rules in the mapping semantic object and the descriptor through the reflection mechanism of the protocol buffer; The serialization output module serializes the target Proto message instance, which has all field values ​​set, into a binary data stream.