A method and device for visually constructing a knowledge graph of water conservancy object association relationships
By acquiring and preprocessing water conservancy object data, a water conservancy object association knowledge graph is constructed, which solves the problem of being unable to construct a water conservancy object association knowledge graph in the existing technology, realizes the visual automated construction of water conservancy object association relationships and data timeliness, and reduces The difficulty and cost of construction.
Patent Information
- Application Number
- CN202410962565.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-18
AI Technical Summary
The existing technology fails to effectively construct a knowledge graph of water conservancy object associations, resulting in the inability to intuitively present the relationships between water conservancy objects and increasing the difficulty and cost of data update.
By obtaining and preprocessing the basic data of standard water conservancy objects, selecting the ontology and its attribute field information to construct the water conservancy object association relationship map, using a visual method to draw the association relationship, forming a logical relationship concept map of the map ontology, and mapping it to the graph database. Implement the storage and dynamic update of entity relationship triples.
It reduces the cost and threshold of knowledge graph construction, realizes the visual and automated construction of water conservancy object relationships, ensures the timeliness of data, and simplifies the processing of digital twin water conservancy knowledge.
Smart Images

Figure CN118626684B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of knowledge graph technology, and in particular to a method and device for visually constructing a knowledge graph of association relationships between water conservancy objects. Background Art
[0002] Knowledge graphs present knowledge by organizing entities, attributes, and relationships together. Knowledge graphs are a method of representing and storing knowledge, including not only entities, but also the relationships between them, as well as attribute values. As a product of the big data era, knowledge graphs have the advantages of huge scale, excellent quality, and friendly structure. They are a structured form of data that aims to simulate human thinking and help computers understand and process knowledge. Knowledge graphs have been widely used in industries such as e-commerce, catering, and medical care for application scenarios such as optimized search, assisted question and answer, and intelligent recommendation, greatly improving user experience and retrieval efficiency.
[0003] Digital twin water conservancy proposes the necessity of water conservancy knowledge construction, and uses technologies such as knowledge graphs and machine learning to extract, manage and combine knowledge such as water conservancy object associations and water conservancy laws, providing an intelligent core for digital twin water conservancy construction. Water conservancy object associations are used to describe entities, concepts and their relationships such as rivers, lakes, water conservancy projects and water conservancy object governance and management activities in physical basins. They are used to represent the basic information of water conservancy objects and their spatial relationships, water flow relationships, management relationships, etc., which are the basis for the integration of other water conservancy knowledge and have a positive role in promoting the intelligent development of water conservancy. In recent years, water conservancy departments have successively issued water conservancy-related standards, clearly classified water conservancy geographical entities such as rivers, lakes and water conservancy projects, compiled water conservancy basic data standards, and standardized some water conservancy objects and their attributes. However, these data still exist in traditional relational databases. The water conservancy authorities have to continuously update these water conservancy data every year. There is no knowledge graph of water conservancy object associations, and the relationship between various water conservancy objects cannot be intuitively presented. Summary of the invention
[0004] In view of this, the purpose of the embodiments of the present application is to provide a method and device for visually constructing a knowledge graph of the association relationship of water conservancy objects, so as to reduce the construction cost and threshold of the knowledge graph, quickly realize the generation of the knowledge graph, and dynamically update the data.
[0005] According to a first aspect of an embodiment of the present application, a method for visually constructing a knowledge graph of water conservancy object association relationships is provided, comprising:
[0006] S1: Obtain the basic original structured data of standard water conservancy objects and perform preprocessing;
[0007] S2: Based on the preprocessed data, select the water conservancy object ontology and its attribute field information required to construct the water conservancy object association relationship map;
[0008] S3: Based on the water conservancy object ontology and its attribute field information, the association relationship between the water conservancy objects is drawn in a visual manner to form a graph ontology logical relationship concept diagram, wherein the association relationship between the water conservancy objects is divided into a combination relationship, an aggregation relationship, a dependency relationship, a location relationship, a connectivity relationship, an upstream relationship, a downstream relationship and an association relationship;
[0009] S4: According to the graph ontology logical relationship concept diagram, the corresponding relationship between the ontology object and the original structured data is mapped, and the water conservancy object entity relationship data is read from the original structured data to form entity relationship triples, which are stored in the graph database to form graph data;
[0010] S5: Perform a query based on the graph data, draw the query data results, and form a visualized knowledge graph of water conservancy object association relationships.
[0011] Optionally, obtain the original structured data of the standard water conservancy object and perform preprocessing, including:
[0012] Obtain basic standard data of water conservancy objects, which comply with relevant standards and specifications of the water conservancy industry, and name each data field in accordance with the specifications; the water conservancy objects include rivers, lakes, water conservancy projects, monitoring stations and other management objects;
[0013] Selecting original structured data from the basic standard data of the water conservancy object according to natural watersheds or administrative divisions;
[0014] According to the table structure definition in the water conservancy standard specification, determine the unique object according to the identification code of the water conservancy object and remove duplicate data;
[0015] According to the table structure definition in the water conservancy standards and specifications, determine whether the attribute information of each field meets the requirements of the specifications, retain the data that meets the requirements, and mark the data that does not meet the requirements.
[0016] Optionally, based on the preprocessed data, the water conservancy object ontology and its attribute field information required for constructing the water conservancy object association relationship map are selected, including:
[0017] Based on the preprocessed basic structured data of water conservancy objects, the required water conservancy object ontology and its attribute field information in the atlas are filtered; the filtered water conservancy object ontology corresponds to the entity in the atlas, and the attribute field information corresponds to the attribute information of the atlas elements.
[0018] Optionally, based on the water conservancy object ontology and its attribute field information, the association relationship between the water conservancy objects is drawn in a visual manner to form a graph ontology logical relationship concept diagram, including:
[0019] Build a drag-and-drop drawing page to form a visual drawing canvas;
[0020] List the selected water conservancy objects on the page, drag the required water conservancy objects onto the canvas, connect the various water conservancy objects by drawing connecting lines, and automatically identify the default relationship between different water conservancy objects. The default relationship is: reservoir dams and reservoirs are combined, sluices and irrigation areas are aggregated, seawalls and levees are dependent on rivers, bridges and rivers are located in a relationship, rivers and lakes are connected, and there are upstream and downstream relationships between different rivers;
[0021] According to the logical relationship between various water conservancy objects in the physical world, edit the association relationship between various water conservancy objects to form a conceptual diagram of the logical relationship of the atlas ontology.
[0022] Optionally, according to the graph ontology logical relationship concept diagram, the corresponding relationship between the ontology object and the original structured data is mapped, and the water conservancy object entity relationship data is read from the original structured data, and stored in the graph database in the form of entity relationship triples to form graph data, including:
[0023] Analyze each entity node in the graph ontology logical relationship concept diagram, map the graph ontology to each water conservancy object table in the original structured data, and generate a creation script for the graph database entity table and entity relationship table according to the relationship between the ontology and the object;
[0024] Execute the generated graph database entity table and entity relationship table creation scripts to create the corresponding graph data entity table and entity relationship table in the graph database;
[0025] Extract water conservancy object entities and their attribute data from the original structured data, and form entity relationship mapping data according to the drawn graph ontology logical relationship;
[0026] The entity relationship mapping data is mapped to a graph database and stored in the corresponding graph database entity table and entity relationship table in the form of entity relationship triples to form graph data.
[0027] Optionally, querying based on the graph data and drawing the query data results to form a visual knowledge graph includes:
[0028] Build a knowledge graph query and display function to query various water conservancy objects and their relationships in the graph database, map the query data results to entity objects and relationships through data services, draw a knowledge graph, and form a visual knowledge graph;
[0029] Optionally, it also includes: monitoring the update of the original structured data and dynamically updating the visualized knowledge graph data, including:
[0030] Monitor the addition and update of original structured data, repeat S1-S4 above, extract the new and updated original structured data, and update it to the graph database;
[0031] Monitor the deletion of original structured data and delete it from the graph database.
[0032] According to a second aspect of an embodiment of the present application, a device for visually constructing a knowledge graph of water conservancy object association relationships is provided, comprising:
[0033] The acquisition preprocessing module is used to acquire the basic original structured data of standard water conservancy objects and perform preprocessing;
[0034] A selection module is used to select the water conservancy object ontology and its attribute field information required for constructing a water conservancy object association relationship map based on the preprocessed data;
[0035] A visualization drawing module is used to draw the association relationship between various water conservancy objects in a visualization manner according to the water conservancy object ontology and its attribute field information, so as to form a conceptual diagram of the graph ontology logical relationship, wherein the association relationship between the water conservancy objects is divided into a combination relationship, an aggregation relationship, a dependency relationship, a location relationship, a connectivity relationship, an upstream relationship, a downstream relationship and an association relationship;
[0036] A graph data construction module is used to map the corresponding relationship between the ontology object and the original structured data according to the graph ontology logical relationship concept diagram, and read the water conservancy object entity relationship data from the original structured data to form entity relationship triples, which are stored in the graph database to form graph data;
[0037] The graph forming module performs query based on the graph data, draws the query data results, and forms a visual knowledge graph of the association relationship between water conservancy objects.
[0038] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including:
[0039] one or more processors;
[0040] A memory for storing one or more programs;
[0041] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect.
[0042] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0043] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0044] It can be seen from the above embodiments that the present application first constructs high-quality water conservancy object data by screening and checking the basic data of water conservancy objects in standard specifications; then, by dragging and dropping, visual graph ontology modeling is performed to automatically identify the default association relationship between different water conservancy objects and allow customization of the relationship; then, the graph ontology object is mapped to the entity in the graph data, and the graph database table creation script is automatically generated and executed to generate the table structure corresponding to the graph database, and a channel from the original structured database to the graph database is established; then, the original structured data is extracted to the graph database and stored in the form of entity relationship triples; finally, the entity relationship in the graph database is retrieved and queried to generate a visual graph. In order to ensure the timeliness of the data, the original structured data is monitored and the data in the graph is dynamically updated; thereby realizing the visual automatic construction of the water conservancy object association relationship graph, greatly reducing the difficulty of visually constructing the water conservancy object association relationship knowledge graph, providing a simple and efficient tool for digital twin water conservancy knowledge processing, greatly reducing the threshold and professional requirements for visually constructing the water conservancy object association relationship knowledge graph, and reducing the learning cost of users.
[0045] The present invention can automatically extract water conservancy object entities and the relationships between entities without human intervention, realize dynamic updating of atlas data, and effectively avoid the problem of untimely data updating.
[0046] The present invention sorts out and standardizes the association relationships between various common water conservancy objects according to combination relationships, aggregation relationships, dependency relationships, location relationships, connectivity relationships, upstream relationships, downstream relationships and association relationships, so as to form a water conservancy object association relationship commonly used in the water conservancy industry, thereby facilitating data sharing of water conservancy knowledge.
[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0049] Figure 1 It is a flowchart of a method for visually constructing a knowledge graph of water conservancy object association relationships according to an exemplary embodiment.
[0050] Figure 2 It is a block diagram of a device for visually constructing a knowledge graph of water conservancy object association relationships according to an exemplary embodiment.
[0051] Figure 3 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0052] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0053] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0054] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0055] Figure 1 is a flowchart of a method for visually constructing a knowledge graph of water conservancy object association relationships according to an exemplary embodiment. Figure 1 As shown, the method is applied in a terminal and may include the following steps:
[0056] S1: Obtaining the basic original structured data of the standard water conservancy object and performing preprocessing; this step may include the following sub-steps:
[0057] S11: Acquire basic standard data of water conservancy objects, which meet the requirements of relevant standards and specifications of the water conservancy industry, and name each data field according to the specifications;
[0058] Specifically, based on the given original structured database, in accordance with the table structure and identifier specification of the basic database of water conservancy objects (SL / T 809-2021 table structure and identifier of basic database of water conservancy objects), its library and table structure information is automatically read to obtain the tables and table structure information related to water conservancy objects.
[0059] According to the classification of water conservancy objects in the Ministry of Water Resources standards SL / T 213-2020 (General Principles for Classification and Coding of Water Conservancy Objects) and DB33 / T 2512-2022 (Specifications for Classification of Water Conservancy Objects), the water conservancy objects include rivers, lakes, water conservancy projects, monitoring stations (points) and other management objects, as follows:
[0060] The river, lake and other abstract classes include four entity classes: river basins, rivers, lakes and other water bodies;
[0061] The abstract category of water conservancy projects includes: reservoirs, reservoir dams, hydropower stations, irrigation areas, channels (ditches), water intake wells, sluices, aqueduct inverted siphons, pumping stations, culverts, water diversion projects, rural water supply projects, cellars, ponds, mountain ponds, mountain pond dams, flood storage and detention area embankments, seawalls, polder areas, river control projects, groins, spur dams, pantou, revetments, silt dams, rubber dams, spillways, tunnel culverts, buried pipes under dams, holes in dam bodies, siphons, gates and opening and closing facilities, hydroelectric generators, power plants, booster stations, pressure forebays, sprinkler and micro-irrigation projects, sluice stations, weirs, water towers, flood diversion gates, early gates and pipe networks, etc. 46 entity categories;
[0062] The monitoring station (point) abstract class includes 13 entity classes: hydrological monitoring station, soil and water conservation monitoring station, slope runoff field, small watershed control station, small watershed comprehensive observation station, water supply (withdrawal) volume monitoring point, water affairs image monitoring point, runoff area, flow collection barrel (pond), flow measurement cableway, flow measurement weir, water project safety monitoring point and tidal monitoring station;
[0063] Other abstract classes of management objects include: 18 entity classes, namely, water resource zoning, water function zones, soil and water conservation zoning, river and lake management scope, shoreline function zoning, sand mining zoning, river sections, embankment sections, dangerous sections, water sources, water intakes, drainage outlets, drainage outlets, water users, drainage users, river length sections, lake length sections and key soil and water loss prevention and control areas.
[0064] The main purpose of this step is to obtain standardized structured data of water conservancy objects, ensure that the original data obtained complies with the requirements of standard specifications and is universal, avoid ambiguity, and facilitate the unique identification of subsequent data.
[0065] S12: selecting original structured data from the basic standard data of the water conservancy object according to the natural watershed or administrative division;
[0066] Specifically, according to the needs of constructing the water conservancy object association relationship map, the original structured data is selected according to the natural watershed or administrative division, that is, the basic data of water conservancy objects in an administrative division or natural watershed is selected. If the full amount of data is required, there is no need to restrict the natural watershed or administrative division.
[0067] The main purpose of this step is to limit the basic data range of a water conservancy object, improve data focus, avoid excessive data volume, and avoid the emergence of multi-level graph relationships in the subsequent graph construction process.
[0068] S13: According to the table structure definition in the water conservancy standard specification, determine the unique object according to the identification code of the water conservancy object and remove duplicate data;
[0069] Specifically, for those with multiple original structured data sources, a uniqueness judgment is performed according to the water conservancy object identification code defined in the water conservancy object basic database table structure specification to determine a unique water conservancy object and remove duplicate data records.
[0070] The main purpose of this step is to determine a unique data source when there are multiple identical water conservancy objects from different original structured data sources, retain only one water conservancy object data, and avoid duplication of water conservancy object data.
[0071] S14: According to the table structure definition in the water conservancy standard specification, determine whether each field meets the specification requirements, retain the data that meets the requirements, and mark the data that does not meet the requirements.
[0072] Specifically, according to the requirements of each field in the basic database table specification of water conservancy objects, perform null value check, data type check, date format check, enumeration value range check, numerical logical relationship check, etc., retain the data that meets the requirements, and mark the data that does not meet the requirements as an exception, and do not process the abnormally marked data during subsequent data extraction.
[0073] The main purpose of this step is to screen high-quality water conservancy object data to ensure that the data meets the requirements of water conservancy standards and specifications and avoid data anomalies during the map construction process.
[0074] S2: Based on the preprocessed data, select the water conservancy object ontology and its attribute field information required to construct the water conservancy object association relationship map; this step may include the following sub-steps:
[0075] S21: Based on the preprocessed basic structured data of the water conservancy objects, the required water conservancy object ontology and its attribute field information in the atlas are filtered; the filtered water conservancy object ontology corresponds to the entity in the atlas, and the attribute field information corresponds to the attribute information of the atlas elements.
[0076] Specifically, the schema information of the original structured database is automatically read through the program, and the water conservancy object data table and field information (including field identifiers and field description information) related to the database are extracted. According to the needs of graph construction, the required water conservancy object table and its field information are selected.
[0077] The main purpose of this step is to combine the needs of graph construction and only filter out the water conservancy object entities and their attribute information required by the constructed graph, avoid the appearance of irrelevant water conservancy objects or water conservancy object attribute information, and improve the speed of data processing and the efficiency of graph query and display.
[0078] S3: Based on the water conservancy object ontology and its attribute field information, the association relationship between the water conservancy objects is drawn in a visual manner to form a graph ontology logical relationship concept diagram, wherein the association relationship between the water conservancy objects is divided into a combination relationship, an aggregation relationship, a dependency relationship, a location relationship, a connectivity relationship, an upstream relationship, a downstream relationship and an association relationship; this step may include the following sub-steps:
[0079] S31: Build a drag-and-drop drawing page to form a visual drawing canvas;
[0080] Specifically, a visual and operable page is constructed to edit graphical elements by dragging and dropping. Here, the AntV X6 diagram editing engine is used, and its flowchart drawing function is used to build a draggable drawing page.
[0081] The main purpose of this step is to build a visual drag-and-drop canvas page, based on which the custom drawing of graph ontology elements and relationships can be realized on the canvas page. AntV X6 is a high-performance, highly customizable graph visualization framework that provides rich graphics operations and interactive capabilities, suitable for building various complex flowcharts.
[0082] S32: List the selected water conservancy objects on the page, drag the required water conservancy objects onto the canvas, connect the various water conservancy objects by drawing connection lines, and automatically identify the default relationship between different water conservancy objects;
[0083] Specifically, the screened water conservancy objects are listed one by one on the page as entity node elements in the atlas. Each water conservancy object is dragged to the canvas as needed to form an entity node of the atlas. The related entity nodes are connected by drawing connecting lines. When connecting the entity nodes, the default relationship is automatically generated according to the objects represented by the entity nodes. The default relationship is: the reservoir dam and the reservoir are in a combination relationship, the sluice and the irrigation area are in an aggregation relationship, the seawall and levee and the river are in a dependent relationship, the bridge and the river are in a location relationship, the river and the lake are in a connected relationship, and there are upstream and downstream relationships between different rivers.
[0084] The main purpose of this step is to preliminarily form the association relationship between various water conservancy objects through visual drawing operations, automatically generate default water conservancy object association relationships, reduce human intervention, and improve efficiency.
[0085] S33: According to the logical relationship between the water conservancy objects in the physical world, edit the association relationship between the water conservancy objects to form a conceptual diagram of the logical relationship of the atlas ontology;
[0086] Specifically, select the connection lines between the entity nodes of each water conservancy object in the canvas, and through the water conservancy object entity association relationship configuration interface, customize the editing and modification of each water conservancy object relationship type according to the relationship situation in the actual physical world to obtain a graph ontology logical relationship concept diagram that is consistent with the real world.
[0087] The main purpose of this step is to manually correct the relationship between various water conservancy objects so that they are more in line with the logical relationship in the real world and form an easy-to-understand and relatively intuitive prototype of a water conservancy object relationship map.
[0088] S4: According to the graph ontology logical relationship concept diagram, the corresponding relationship between the ontology object and the structured data is mapped, and the water conservancy object entity relationship data is read from the original structured database to form entity relationship triples, which are stored in the graph database to form graph data; this step may include the following sub-steps:
[0089] S41: Analyze each entity node in the graph ontology logical relationship concept diagram, map the ontology to each water conservancy object table in the original structured database, and generate a creation script for the graph database entity table and entity relationship table according to the relationship between the water conservancy object entities;
[0090] Specifically, according to the drawn graph ontology logical relationship concept diagram, the entity node information of each water conservancy object is extracted. The entity node corresponds to the water conservancy object table in the original structured database, and a mapping relationship between the graph ontology and the water conservancy object table is established. Combined with the screened water conservancy object attribute information, according to the Neo4j graph database syntax, by splicing the graph database entity table name and table field attribute information, a graph data entity table creation script is dynamically generated; the connection lines between the water conservancy object entity nodes in the graph ontology logical relationship concept diagram are analyzed, and the relationship between the water conservancy object entities is extracted. According to the Neo4j graph database syntax, by splicing the graph database entity relationship table name and table field attribute information, a graph data entity relationship creation script is dynamically generated.
[0091] The main purpose of this step is to determine the entity objects and their relationships in the graph to be constructed, and to establish a one-to-one mapping relationship between the entity nodes in the graph logical concept diagram and the original structured water conservancy object data by mapping the entity nodes and their relationships in the graph ontology logic diagram to the entities and relationships in the graph database. This increases the flexibility of operation by dynamically and automatically creating graph database scripts.
[0092] S42: Execute the generated graph database entity table and entity relationship table creation script to create corresponding graph data entity table and entity relationship table in the graph database respectively;
[0093] Specifically, in the Neo4j graph database, an APOC plug-in is installed, and the entity table and entity relationship table scripts dynamically generated in the above process are called and executed by the APOC plug-in to create the corresponding graph data entity table and entity relationship table.
[0094] The main purpose of this step is to automatically generate the corresponding graph database entity table and entity relationship table according to the graph database script, reduce human participation, improve processing efficiency, and provide a channel for storing graph data entities and entity relationship data.
[0095] S43: extracting water conservancy object entities and their attribute data from the original structured database, and forming entity relationship mapping data according to the drawn graph ontology logical relationship;
[0096] Specifically, according to the mapping relationship between the ontology and the water conservancy object table, the Kettle ETL tool is used to extract the corresponding water conservancy object data and the filtered water conservancy object attribute information from the original structured database, and the entity relationship mapping data is constructed by combining the relationship between the water conservancy objects in the graph ontology logic diagram.
[0097] The main purpose of this step is to extract the water conservancy objects and their attribute information from the original structured database in preparation for storing them in the graph database in the next step.
[0098] S44: Mapping the entity relationship data to a graph database, storing the entity relationship triples in the corresponding graph database entity table and entity relationship table to form graph data;
[0099] Specifically, the extracted entity relationship data is stored in the corresponding graph database entity table, and the water conservancy object entity relationship table is written into the corresponding graph database relationship table according to the relationship in the graph ontology logic diagram.
[0100] The main purpose of this step is to write entity relationship data into the graph database to form graph data for subsequent retrieval and query.
[0101] S5: Querying based on the graph data, plotting the query data results, and forming a visual knowledge graph. This step may include the following sub-steps:
[0102] S51: Build a knowledge graph query and display function to query various water conservancy objects and their relationships in the graph database, map the query data results to entity objects and relationships through data services, draw a knowledge graph, and form a visual knowledge graph.
[0103] Specifically, a knowledge graph query and display function is constructed to retrieve relevant water conservancy objects and their relationships from the Neo4j graph database based on the query conditions entered by the user. The retrieved data is mapped to entity objects and relationships through data services, and visualized through D3.js to form a visual knowledge graph.
[0104] The main purpose of this step is to query the data in the Neo4j graph database and draw a visual relationship map of water conservancy objects. With the help of the Canvas drawing function of D3.js, the repulsion and distance between different map node attributes are set, and the map elements are evenly dispersed to achieve avoidance between element nodes and avoid overlap, making the final map more beautiful.
[0105] It may also include: S52: developing a knowledge graph export function to export and download the generated water conservancy object association relationship graph as a picture.
[0106] Specifically, obtain the Canvas object for graph drawing, export the drawn graph file stream through the toDataURL method, and save it as a picture.
[0107] The main purpose of this step is to export the generated water conservancy object association relationship map as a picture to facilitate the circulation and storage of the map.
[0108] The method may further include:
[0109] S6: Monitor the update status of the original structured data and dynamically update the visualized knowledge graph data.
[0110] Specifically, monitor the original structured database log, analyze the addition and update of water conservancy object data, repeat the above S1-S4, extract the newly added and updated water conservancy object data, and update it to the graph database;
[0111] Monitor the original structured database logs, analyze the deletion of water conservancy objects, and delete them from the graph database.
[0112] It can be seen from the above embodiments that the present application first constructs high-quality water conservancy object data by screening and checking the basic data of water conservancy objects in standard specifications; then, by dragging and dropping, visual graph ontology modeling is performed to automatically identify the default association relationship between different water conservancy objects and allow customization of the relationship; then, the graph ontology object is mapped to the entity in the graph data, and the graph database table creation script is automatically generated and executed to generate the table structure corresponding to the graph database, and a channel from the original structured data to the graph database is established; then, the original structured data is extracted to the graph database and stored in the form of entity relationship triples; finally, the entity relationship in the graph database is retrieved and queried to generate a visual graph. In order to ensure the timeliness of the data, the original structured data is monitored and the data in the graph is dynamically updated; thereby realizing the visual and automated construction of the water conservancy object association relationship graph, greatly reducing the difficulty of visually constructing the water conservancy object association relationship knowledge graph, while ensuring the timeliness of the graph data, and providing a simple and efficient tool for digital twin water conservancy knowledge processing.
[0113] Corresponding to the aforementioned embodiment of the method for visually constructing a knowledge graph of water conservancy object association relationships, the present application also provides an embodiment of a device for visually constructing a knowledge graph of water conservancy object association relationships.
[0114] Figure 2 The present invention is a block diagram of a device for visually constructing a knowledge graph of water conservancy object association relationships according to an exemplary embodiment. Figure 2 , the device comprises:
[0115] The acquisition preprocessing module 1 is used to acquire the basic original structured data of the standard water conservancy object and perform preprocessing;
[0116] The data selection module 2 is used to select the water conservancy object ontology and its attribute field information required for constructing the water conservancy object association relationship map based on the preprocessed data;
[0117] A visualization drawing module 3 is used to draw the association relationship between various water conservancy objects in a visualization manner according to the water conservancy object ontology and its attribute field information, so as to form a graph ontology logical relationship concept diagram, wherein the association relationship between the water conservancy objects is divided into a combination relationship, an aggregation relationship, a dependency relationship, a location relationship, a connectivity relationship, an upstream relationship, a downstream relationship and an association relationship;
[0118] A graph data construction module 4 is used to map the corresponding relationship between the ontology object and the original structured data according to the graph ontology logical relationship concept diagram, and read the water conservancy object entity relationship data from the original structured data to form entity relationship triples, which are stored in the graph database to form graph data;
[0119] The graph forming module 5 is used to perform a query based on the graph data, draw the query data results, and form a visual knowledge graph.
[0120] The device may also include:
[0121] The dynamic update module is used to monitor the update status of the original structured data and dynamically update the visual knowledge graph data.
[0122] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0123] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0124] Accordingly, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method of visually constructing a knowledge graph of water conservancy object association relationships. Figure 3 As shown, a hardware structure diagram of any device with data processing capability where a device for visually constructing a knowledge graph of water conservancy object association relationships provided by an embodiment of the present invention is located, except Figure 3 In addition to the processor, memory, DMA controller, disk, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiment is located may also include other hardware, which will not be described in detail, generally based on the actual functions of the device with data processing capabilities.
[0125] Accordingly, the present application also provides a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the method of visually constructing a knowledge graph of water conservancy object association relationships as described above is implemented. The computer-readable storage medium can be an internal storage unit of any device with data processing capabilities described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium can also be an external storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium can also include both an internal storage unit and an external storage device of any device with data processing capabilities. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capabilities, and can also be used to temporarily store data that has been output or is to be output.
[0126] Those skilled in the art will readily appreciate other embodiments of the present application after considering the description and practicing the contents disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The description and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0127] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for visually constructing a knowledge graph of water conservancy object association relationships, characterized in that: include: S1: Obtain the basic original structured data of standard water conservancy objects and perform preprocessing; S2: Based on the preprocessed data, select the water conservancy object ontology and its attribute field information required to construct the water conservancy object association relationship map; S3: Based on the water conservancy object ontology and its attribute field information, the association relationship between the water conservancy objects is drawn in a visual manner to form a graph ontology logical relationship concept diagram, wherein the association relationship between the water conservancy objects is divided into a combination relationship, an aggregation relationship, a dependency relationship, a location relationship, a connectivity relationship, an upstream relationship, a downstream relationship and an association relationship; S4: According to the graph ontology logical relationship concept diagram, the corresponding relationship between the ontology object and the original structured data is mapped, and the water conservancy object entity relationship data is read from the original structured data to form entity relationship triples, which are stored in the graph database to form graph data; S5: querying based on the graph data, drawing the query data results, and forming a visualized knowledge graph of water conservancy object association relationships; According to the water conservancy object ontology and its attribute field information, the association relationship between the water conservancy objects is drawn in a visual manner to form a graph ontology logical relationship concept diagram, including: Build a drag-and-drop drawing page to form a visual drawing canvas; List the selected water conservancy objects on the page, drag the required water conservancy objects onto the canvas, connect the various water conservancy objects by drawing connecting lines, and automatically identify the default relationship between different water conservancy objects. The default relationship is: reservoir dams and reservoirs are combined, sluices and irrigation areas are aggregated, seawalls and levees are dependent on rivers, bridges and rivers are located in a relationship, rivers and lakes are connected, and there are upstream and downstream relationships between different rivers; According to the logical relationship between various water conservancy objects in the physical world, edit the association relationship between various water conservancy objects to form a conceptual diagram of the logical relationship of the atlas ontology; According to the graph ontology logical relationship concept diagram, the corresponding relationship between the ontology object and the original structured data is mapped, and the water conservancy object entity relationship data is read from the original structured data, and stored in the graph database in the form of entity relationship triples to form graph data, including: Analyze each entity node in the graph ontology logical relationship concept diagram, map the graph ontology to each water conservancy object table in the original structured data, and generate a creation script for the graph database entity table and entity relationship table according to the relationship between the ontology and the object; Execute the generated graph database entity table and entity relationship table creation scripts to create the corresponding graph data entity table and entity relationship table in the graph database; Extract water conservancy object entities and their attribute data from the original structured data, and form entity relationship mapping data according to the drawn graph ontology logical relationship; Mapping the entity relationship mapping data to a graph database, storing the entity relationship triples in the corresponding graph database entity table and entity relationship table to form graph data; The query is performed based on the graph data, and the query data results are plotted to form a visual knowledge graph, including: Build a knowledge graph query and display function, query various water conservancy objects and their relationships in the graph database, map the query data results to entity objects and relationships through data services, draw a knowledge graph, and form a visual knowledge graph.
2. The method according to claim 1, characterized in that Obtain the basic original structured data of standard water conservancy objects and perform preprocessing, including: Obtain basic standard data of water conservancy objects, which comply with relevant standards and specifications of the water conservancy industry, and name each data field in accordance with the specifications; the water conservancy objects include rivers, lakes, water conservancy projects, monitoring stations and other management objects; Selecting original structured data from the basic standard data of the water conservancy object according to natural watersheds or administrative divisions; According to the table structure definition in the water conservancy standard specification, determine the unique object according to the identification code of the water conservancy object and remove duplicate data; According to the table structure definition in the water conservancy standards and specifications, determine whether the attribute information of each field meets the requirements of the specifications, retain the data that meets the requirements, and mark the data that does not meet the requirements.
3. The method according to claim 1, characterized in that Based on the preprocessed data, the water conservancy object ontology and its attribute field information required to construct the water conservancy object association relationship map are selected, including: Based on the preprocessed basic structured data of water conservancy objects, the required water conservancy object ontology and its attribute field information in the atlas are filtered; the filtered water conservancy object ontology corresponds to the entity in the atlas, and the attribute field information corresponds to the attribute information of the atlas elements.
4. The method according to claim 1, characterized in that: Also includes: Monitor the update of original structured data and dynamically update the visualized knowledge graph data, including: Monitor the addition and update of original structured data, repeat S1-S4 above, extract the new and updated original structured data, and update it to the graph database; Monitor the deletion of original structured data and delete it from the graph database.
5. A device for visually constructing a knowledge graph of water conservancy object association relationships, characterized in that: include: The acquisition preprocessing module is used to acquire the basic original structured data of standard water conservancy objects and perform preprocessing; A selection module is used to select the water conservancy object ontology and its attribute field information required for constructing a water conservancy object association relationship map based on the preprocessed data; A visualization drawing module is used to draw the association relationship between various water conservancy objects in a visualization manner according to the water conservancy object ontology and its attribute field information, so as to form a conceptual diagram of the graph ontology logical relationship, wherein the association relationship between the water conservancy objects is divided into a combination relationship, an aggregation relationship, a dependency relationship, a location relationship, a connectivity relationship, an upstream relationship, a downstream relationship and an association relationship; A graph data construction module is used to map the corresponding relationship between the ontology object and the original structured data according to the graph ontology logical relationship concept diagram, and read the water conservancy object entity relationship data from the original structured data to form entity relationship triples, which are stored in the graph database to form graph data; A graph forming module, which performs a query based on the graph data, draws the query data results, and forms a visual knowledge graph of the association relationship of water conservancy objects; According to the water conservancy object ontology and its attribute field information, the association relationship between the water conservancy objects is drawn in a visual manner to form a graph ontology logical relationship concept diagram, including: Build a drag-and-drop drawing page to form a visual drawing canvas; List the selected water conservancy objects on the page, drag the required water conservancy objects onto the canvas, connect the various water conservancy objects by drawing connecting lines, and automatically identify the default relationship between different water conservancy objects. The default relationship is: reservoir dams and reservoirs are combined, sluices and irrigation areas are aggregated, seawalls and levees are dependent on rivers, bridges and rivers are located in a relationship, rivers and lakes are connected, and there are upstream and downstream relationships between different rivers; According to the logical relationship between various water conservancy objects in the physical world, edit the association relationship between various water conservancy objects to form a conceptual diagram of the logical relationship of the atlas ontology; According to the graph ontology logical relationship concept diagram, the corresponding relationship between the ontology object and the original structured data is mapped, and the water conservancy object entity relationship data is read from the original structured data, and stored in the graph database in the form of entity relationship triples to form graph data, including: Analyze each entity node in the graph ontology logical relationship concept diagram, map the graph ontology to each water conservancy object table in the original structured data, and generate a creation script for the graph database entity table and entity relationship table according to the relationship between the ontology and the object; Execute the generated graph database entity table and entity relationship table creation scripts to create the corresponding graph data entity table and entity relationship table in the graph database; Extract water conservancy object entities and their attribute data from the original structured data, and form entity relationship mapping data according to the drawn graph ontology logical relationship; Mapping the entity relationship mapping data to a graph database, storing the entity relationship triples in the corresponding graph database entity table and entity relationship table to form graph data; The query is performed based on the graph data, and the query data results are plotted to form a visual knowledge graph, including: Build a knowledge graph query and display function, query various water conservancy objects and their relationships in the graph database, map the query data results to entity objects and relationships through data services, draw a knowledge graph, and form a visual knowledge graph.
6. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Visual ontology construction system and method for knowledge graph
CN109857870A
Knowledge graph construction method and device for water conservancy informatization
CN110543571A
