CN-121144306-B - Method and system for modeling water system upstream and downstream relation and automatically mapping graph database based on domain-specific language
Abstract
The application relates to a water system upstream and downstream relation modeling and graph database automatic mapping method based on a domain-specific language, which comprises the steps of converting nodes of a water system network into DSL text according to a pre-designed domain-specific language; the method comprises the steps of automatically completing DSL text, automatically checking the automatically completed DSL text, carrying out relation analysis and data structuring on the automatically checked DSL text, thereby producing a node and a relation data table, importing the node and the relation data table into a graph database, and visualizing data in the graph database. The application can abstract and check grammar level aiming at the relation characteristic of the water system structure, thereby realizing the high self-adaption of the service layer and greatly improving modeling efficiency, accuracy and automation level.
Inventors
- JI KEBIN
- CHEN CHUANZHONG
- ZHANG QI
- YANG WEICAI
- YANG WANGLONG
- BAI XUE
- Jiang Mingcen
- Yan Luyu
- XIE XIN
- LI WENPAN
Assignees
- 中国环境监测总站
Dates
- Publication Date
- 20260512
- Application Date
- 20250902
Claims (8)
- 1. A water system upstream and downstream relation modeling and graph database automatic mapping method based on a domain-specific language is characterized by comprising the following steps: step S1, converting nodes of a water system network into DSL text according to a pre-designed special language of the field; Step S1 comprises the following sub-steps: Step S11, mapping and defining nodes of the water system network so as to allocate unique node IDs for the nodes of the water system network; Step S12, describing the upstream and downstream relation of each node of the water system network by applying the node ID of each node of the water system network through the grammar rule of the pre-designed DSL; step S13, checking sentences describing the upstream and downstream relations of each node of the water system network according to a preset grammar checking rule, so as to obtain DSL text; S2, automatically completing DSL text; s3, automatically checking the automatically-completed DSL text; S4, carrying out relation analysis and data structuring on the DSL text after automatic verification, thereby producing nodes and a relation data table; S5, importing the nodes and the relation data table into a graph database; And S6, visualizing the data in the graph database.
- 2. The method for automatically mapping a water system upstream and downstream relation modeling and graph database based on a domain-specific language according to claim 1, wherein each node of the water system network is assigned a unique node ID by a mapping dictionary, and a cross-section name of each node of the water system network is specified.
- 3. The method for automatically mapping a water system upstream and downstream relation modeling and graph database based on a domain-specific language according to claim 1 or 2, wherein a unique node ID is assigned to a node of the water system network, and auxiliary information is also assigned to each node of the water system network.
- 4. The method for modeling and automatically mapping a water system upstream and downstream relation and a graph database based on a domain-specific language according to claim 1 or 2, wherein the upstream and downstream relation of each node of the water system network is described, and the grammar rules are described in a mode of combining a node type and a node ID with a flow direction relation identifier "- >", so as to express the water system flow direction.
- 5. The system for automatically mapping the water system upstream and downstream relation modeling and graph database based on the domain-specific language is characterized by comprising a DSL text conversion module, an automatic completion module, an automatic verification module, an analysis and data structuring module, an importing module and a visualization module; The DSL text conversion module converts the nodes of the water system network into DSL text according to a pre-designed special language of the field; the DSL text conversion module comprises a node ID allocation sub-module, a relationship description sub-module and a statement verification sub-module; The node ID allocation sub-module performs mapping definition on nodes of the water system network to allocate unique node IDs for the nodes of the water system network; The relation description sub-module describes the upstream and downstream relation of each node of the water system network by applying the node ID of each node of the water system network through the grammar rule of the pre-designed DSL; the statement checking submodule checks statements describing the upstream and downstream relations of each node of the water system network according to a preset grammar checking rule, so that DSL text is obtained; The automatic complementing module automatically complements the DSL text; The automatic verification module automatically verifies the automatically-completed DSL text; The analysis and data structuring module performs relationship analysis and data structuring on the DSL text after automatic verification, so as to produce nodes and a relationship data table; The importing module imports the nodes and the relation data table into a graph database; the visualization module visualizes the data in the graph database.
- 6. The system for automatically mapping a water system upstream and downstream relation modeling and graph database based on a domain-specific language according to claim 5, wherein the node ID assignment submodule assigns a unique node ID to each node of the water system network through the mapping dictionary and assigns a section name of each node of the water system network.
- 7. The system for modeling and automatically mapping a water system upstream and downstream relation based on a domain-specific language and a graph database according to claim 5 or 6, wherein the node ID assignment sub-module assigns a unique node ID to a node of the water system network and further assigns auxiliary information to each node of the water system network.
- 8. The system for modeling and automatically mapping a water system upstream and downstream relation and a graph database based on a domain-specific language according to claim 5 or 6, wherein the relation description submodule describes the upstream and downstream relation of each node of the water system network, and the grammar rules are described in a mode of combining node type and node ID with flow direction relation identification "- >", so as to express the water system flow direction.
Description
Method and system for modeling water system upstream and downstream relation and automatically mapping graph database based on domain-specific language Technical Field The application relates to the field of water environment management and information system integration, in particular to a method and a system for automatically mapping a water system upstream and downstream relation modeling and graph database based on a language special for the field. Background At present, the upstream and downstream relations between the water system section monitoring points and the river nodes are modeled by manually establishing a table, utilizing a general database or through SQL (Structured Query Language ) sentences and programming script modes. These data are typically imported into the database manually or semi-automatically for supporting drainage basin analysis, traceability and visualization applications. In practical application, related management and technicians usually sort the relationship data of the monitored section and the basin node into an electronic form such as Excel, or directly input the electronic form into a table structure preset in a database. The developer then writes scripts to effect migration of the data, relational modeling, and visualization of the network structure based on the tabular data. Although these methods can meet the requirements of water system relationship management under a certain scale, when facing complex network structures, diversified node types, and multi-tributary and multi-level confluence scenes, a great deal of manual adjustment and repeated verification are often required. In addition, in the prior art, a general data modeling tool and a custom script are relied on, so that a special optimized description language and an automatic verification mechanism are difficult to provide for special network relation modeling scenes such as a water system. In practical engineering, the model expansibility, the automation degree and the usability are obviously insufficient, and the application effect of the model in a large-scale and dynamic change environment is limited. At present, the conventional method mainly has the following defects: modeling efficiency is low, namely, the relation form and the script are difficult to adapt to the rapidly-changing network structure and the maintenance of large-scale nodes and relations; the manual error is easy to occur, the manual adjustment and mapping are needed for the operation of the table, SQL or script, and the problems of node omission, repeated relation or error connection and the like are easy to occur; The method is not suitable for multi-type and multi-role nodes, and is difficult to describe and process actual service scenes such as multi-branch inflow points, dynamic changes of node types and the like; Insufficient verification, namely lack of automatic verification mechanisms such as data uniqueness, node roles, upstream and downstream legality and the like, so that the subsequent data cleaning cost is high. In general, the reason why the conventional method has defects is that the conventional data table and the universal script do not abstract and check the grammar level according to the water system structural relation characteristics, and cannot achieve the high self-adaption of the service layer, so how to abstract and check the grammar level according to the water system structural relation characteristics, and therefore, achieve the high self-adaption of the service layer, is a technical problem which needs to be solved by the skilled person at present. Disclosure of Invention The application aims to overcome the defects in the background technology and provides a water system upstream and downstream relation modeling and graph database automatic mapping method and system based on a Domain Specific Language (DSL), the method realizes the rapid definition of the cross section node and the multistage upstream and downstream relation by using visual text language, automatically completes the data uniqueness check, the node type identification, the sink point discrimination and the data storage of the whole flow, and greatly improves the modeling efficiency, the accuracy and the automation level. In order to solve the technical problems, the application provides the following technical scheme: A method for automatically mapping a water system upstream and downstream relation modeling and graph database based on a domain-specific language comprises the following steps of S1, converting nodes of a water system network into DSL text according to a pre-designed domain-specific language, S2, automatically complementing the DSL text, S3, automatically checking the automatically complemented DSL text, S4, carrying out relation analysis and data structuring on the automatically checked DSL text so as to produce nodes and a relation data table, S5, importing the nodes and the relation data table into the graph database, an