Method for establishing association relationship of water conservancy objects

By obtaining and pre-processing the original basic data of water conservancy objects from the target data source, performing ontology encoding and mapping generation, and combining with the pre-established topological relationship, the incompleteness of establishing the relationship between water conservancy objects and data processing in the existing technology is solved. Standardization has achieved comprehensive and accurate relationship establishment and improved the management efficiency of water conservancy systems.

CN118643163BActive Publication Date: 2025-02-11ZHONGKE SHANSHUI (BEIJING) TECH INFORMATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410666320.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2025-02-11
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

The existing methods for establishing association relationships in water conservancy objects have problems such as dispersed data sources, lack of unified standards and formats, irregular data processing, and ignoring indirect association relationships, resulting in one-sided and incomplete association relationships.

Method used

By obtaining the original basic data from the target data source, pre-processing includes deduplication, missing value filling and error value correction, ontology encoding is performed to unify different types of data, generate entity interconnection maps, and iterate the establishment of water conservancy objects based on pre-established topological relationships Relevant relationship.

Benefits of technology

The integration and quality evaluation of multi-source data has been realized, and a complete and accurate relationship between water conservancy objects has been established, including direct and indirect relationships, which has improved the scientificity and effectiveness of the planning, design and management of water conservancy systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643163B_ABST
    Figure CN118643163B_ABST
Patent Text Reader

Abstract

The present invention provides a method for establishing an association relationship of water conservancy objects, which obtains original basic data for establishing an association relationship of water conservancy objects from a target data source, wherein the original basic data at least includes: description data of rivers, lakes and reservoirs, description data of water conservancy projects and description data of water conservancy management; the original basic data for establishing an association relationship of water conservancy objects is preprocessed to generate valid basic data, wherein the preprocessing includes: deduplication, missing value filling and error value correction; ontology encoding is performed on the valid basic data to map different types of valid basic data to the same standard and establish association relationships between different types of original basic data of the same water conservancy object and generate an entity interconnection map between the valid basic data; based on the pre-established topological relationship of water conservancy objects, entities and functional relationships between entities are iterated according to the entity interconnection map between the valid basic data to establish an association relationship of water conservancy objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent processing technology, and in particular to a method for establishing an association relationship of water conservancy objects. Background Art

[0002] With the intensification of global climate change and the rapid advancement of urbanization, water conservancy project construction is facing unprecedented challenges. As the core elements of water conservancy project construction and management, water conservancy objects are increasing in number, variety and complexity. These water conservancy objects include not only naturally formed rivers, lakes, but also various artificially constructed water conservancy projects and water conservancy management facilities. They form a huge and complex network, and there is a close relationship between them.

[0003] These relationships are of vital importance to the planning, design and operation of water conservancy systems. First, by understanding the relationships between water conservancy objects, the overall performance and stability of the water conservancy system can be more accurately evaluated, providing a scientific basis for the planning and design of water conservancy projects. Secondly, the relationships between water conservancy objects are also the basis for the dispatching and management of water conservancy systems. Only by clearly understanding the interactions and mutual influences between various water conservancy objects can we formulate scientific and reasonable dispatching and management plans to ensure the safe and efficient operation of the water conservancy system.

[0004] However, in practical applications, due to the diversity and complexity of data sources and the limitations of data processing technology, the existing methods for establishing association relationships of water conservancy objects often have the following problems:

[0005] Data sources are scattered and lack unified data standards and formats. Water conservancy object data often come from different departments and institutions, and the format, content and quality of these data and information vary greatly. This makes data integration difficult and makes it impossible to form a complete and accurate water conservancy object database.

[0006] The data processing process is not standardized, and there is a lack of effective data preprocessing and cleaning mechanisms. In the process of data integration, the original data often contains a large number of duplicates, missing values, and erroneous values. These problems not only affect the accuracy of the data, but also increase the difficulty of data processing. The lack of effective data preprocessing and cleaning mechanisms makes it impossible to effectively clean and integrate the data, resulting in low data quality.

[0007] There is a lack of effective mechanism for establishing the association relationship between water conservancy objects. The existing methods for establishing the association relationship between water conservancy objects often only consider the direct association relationship between water conservancy objects, while ignoring the indirect association relationship between them. This leads to the one-sidedness and incompleteness of the association relationship, and cannot fully reflect the actual relationship between water conservancy objects. Summary of the invention

[0008] In order to solve the above technical problems, the present application provides a method for establishing an association relationship between water conservancy objects, so as to at least solve or alleviate the problems existing in the above-mentioned prior art.

[0009] In order to achieve the above object, according to one aspect of the present application, a method for establishing a water conservancy object association relationship is provided, which includes:

[0010] A method for establishing a water conservancy object association relationship, comprising:

[0011] Acquire original basic data for establishing water conservancy object association from the target data source, wherein the original basic data at least includes: description data of rivers, lakes and reservoirs, description data of water conservancy projects and description data of water conservancy management;

[0012] Preprocessing the original basic data for establishing the association relationship of the water conservancy objects to generate effective basic data, wherein the preprocessing includes: deduplication, missing value filling, and error value correction;

[0013] By ontology encoding the effective basic data, different types of effective basic data are mapped to the same standard, and association relationships are established between different types of original basic data of the same water conservancy object, and an entity interconnection map between the effective basic data is generated;

[0014] Based on the pre-established topological relationship of water conservancy objects, the entities and the functional relationships between entities are iterated according to the entity interconnection map between the effective basic data to establish the association relationship of water conservancy objects;

[0015] In this application, the integration of multi-source data is achieved by obtaining the original basic data of water conservancy objects from the target data source (including but not limited to water conservancy departments, environmental departments, local governments, etc.). In the process of data integration. After data integration, the original basic data will be preprocessed, including deduplication, missing value filling and error value correction. Deduplication can eliminate duplicate data and improve the accuracy of data; missing value filling and error value correction can repair incomplete and erroneous parts in the data to ensure the integrity and accuracy of the data. After data preprocessing, this method will also perform quality assessment on the data to ensure that the data meets certain quality standards. For data that does not meet the quality standards, further processing or exclusion will be performed. By ontology encoding the effective basic data, this method maps different types of effective basic data to the same standard. In this way, different types of data can be associated and matched, thereby establishing an association relationship between water conservancy objects. Further on the basis of ontology encoding, an entity interconnection map between effective basic data will be generated. This map reflects the direct and indirect association relationships between water conservancy objects, providing a basis for the subsequent establishment of association relationships. Based on the pre-established topological relationship of water conservancy objects, the functional relationship between entities will be iterated according to the entity interconnection map, so as to gradually establish a complete and accurate association relationship between water conservancy objects. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:

[0017] Figure 1 This is a flow chart of a method for establishing a water conservancy object association relationship according to an embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to enable those skilled in the art to better understand the solution of the present application, the following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0019] Figure 1 This is a flow chart of a method for establishing a water conservancy object association relationship according to an embodiment of the present application. Figure 1 As shown, it includes:

[0020] Acquire original basic data for establishing water conservancy object association from the target data source, wherein the original basic data at least includes: description data of rivers, lakes and reservoirs, description data of water conservancy projects and description data of water conservancy management;

[0021] Preprocessing the original basic data for establishing the association relationship of the water conservancy objects to generate effective basic data, wherein the preprocessing includes: deduplication, missing value filling, and error value correction;

[0022] By ontology encoding the effective basic data, different types of effective basic data are mapped to the same standard, and association relationships are established between different types of original basic data of the same water conservancy object, and an entity interconnection map between the effective basic data is generated;

[0023] Based on the pre-established topological relationship of water conservancy objects, the entities and the functional relationships between entities are iterated according to the entity interconnection map between valid basic data to establish the association relationship of water conservancy objects.

[0024] In this application, the integration of multi-source data is achieved by obtaining the original basic data of water conservancy objects from the target data source (including but not limited to water conservancy departments, environmental departments, local governments, etc.). In the process of data integration. After data integration, the original basic data will be preprocessed, including deduplication, missing value filling and error value correction. Deduplication can eliminate duplicate data and improve the accuracy of data; missing value filling and error value correction can repair incomplete and erroneous parts in the data to ensure the integrity and accuracy of the data. After data preprocessing, this method will also perform quality assessment on the data to ensure that the data meets certain quality standards. For data that does not meet the quality standards, further processing or exclusion will be performed. By ontology encoding the effective basic data, this method maps different types of effective basic data to the same standard. In this way, different types of data can be associated and matched, thereby establishing an association relationship between water conservancy objects. Further on the basis of ontology encoding, an entity interconnection map between effective basic data will be generated. This map reflects the direct and indirect association relationships between water conservancy objects, providing a basis for the subsequent establishment of association relationships. Based on the pre-established topological relationship of water conservancy objects, the functional relationship between entities will be iterated according to the entity interconnection map, so as to gradually establish a complete and accurate association relationship between water conservancy objects.

[0025] Optionally, the original basic data for establishing the association relationship of water conservancy objects is obtained from the target data source, and the original basic data at least includes: description data of rivers, lakes and reservoirs, description data of water conservancy projects, and description data of water conservancy management, including:

[0026] Performing type analysis on the target data source to determine the type of the target data source;

[0027] According to the type of the target data source, the corresponding connector is matched, and the connector is instantiated to load the extraction logic rules onto the connector to obtain the original basic data for establishing the association relationship of the water conservancy object from the target data source.

[0028] Therefore, in the above-mentioned method for establishing the association relationship of water conservancy objects, the target data source is analyzed for type, and the corresponding connector is matched and instantiated accordingly, and the extraction logic rules are loaded to obtain the original basic data from the target data source. This has the following technical benefits:

[0029] (1) Improved adaptability of data sources: By analyzing the type of the target data source, its specific type (such as database, API, file, etc.) can be determined. Then, based on this type information, the most suitable connector can be automatically matched or manually selected. In this way, regardless of the type of data source, efficient and accurate data acquisition can be achieved, greatly improving the adaptability of the data source.

[0030] (2) Improved data extraction efficiency: Matching a corresponding connector for each type of data source and instantiating the connector to load the extraction logic rules can ensure the pertinence and efficiency of the data extraction process. This approach avoids the problems of low efficiency and low accuracy that may exist when using general tools or methods for data extraction.

[0031] (3) Enhanced flexibility: The extraction logic rules loaded onto the connector can be customized and modified according to actual needs. This means that when the structure or content of the data source changes, only the corresponding extraction logic rules need to be adjusted without making large-scale modifications to the entire data acquisition process. This flexibility enables this method to better adapt to complex and changing data environments.

[0032] (4) Improved data quality: Due to the use of connectors and extraction logic rules for specific data sources, data can be better cleaned, verified, and organized during the extraction process. This helps reduce errors, redundancies, and inconsistencies in the data and improves the overall quality of the data.

[0033] (5) Enhanced scalability: When a new data source needs to be added, it is only necessary to analyze the type of the data source and match and instantiate a new connector for it. This scalability enables the method to easily cope with the situation where data sources continue to increase.

[0034] Optionally, the performing type analysis on the target data source to determine the type of the target data source includes:

[0035] Detect the target data source based on the detection instruction to obtain the database type, file format, and API protocol;

[0036] According to the database type, file format, and API protocol, a type analysis is performed on the target data source to determine the type of the target data source.

[0037] Optionally, matching a corresponding connector according to the type of the target data source, and instantiating the connector to load extraction logic rules onto the connector to obtain original basic data for establishing a water conservancy object association relationship from the target data source, including:

[0038] Determine the technology stack used for data acquisition according to the type of the target data source, and traverse the constructed connector abstract base class based on the technology stack to generate a matching connector;

[0039] Triggering a dependency injection container to instantiate the connector and load an extraction logic rule onto the connector to obtain a connector instance;

[0040] Based on the connector instance, components are injected into the target data source to obtain original basic data for establishing an association relationship between water conservancy objects from the target data source.

[0041] To this end, in the above-mentioned method for establishing the association relationship of water conservancy objects, by introducing the type analysis of the target data source, and the steps of obtaining the original basic data based on type matching and instantiating the connector, the following technical benefits are achieved:

[0042] (1) Enhanced data source identification capability: By detecting the target data source based on detection instructions, the database type, file format, API protocol and other information can be accurately obtained, thereby more accurately identifying the type of data source, which helps to ensure the accuracy of subsequent data processing and establishment of association relationships.

[0043] (2) Improve data acquisition efficiency: For different types of data sources, determine the technology stack used for data acquisition, and generate matching connectors based on the connector abstract base class constructed by traversing the technology stack, which can greatly improve the efficiency of data acquisition. Since the connector is designed specifically for a specific type of data source, it can maximize the use of the characteristics of the data source and reduce unnecessary conversion and format adjustment processes.

[0044] (3) Simplify the configuration process: By instantiating connectors and loading extraction logic rules through the dependency injection container, the data acquisition configuration process can be simplified. The dependency injection container can automatically manage the life cycle and dependencies of connectors, reducing the need for manual configuration and management. At the same time, by loading predefined extraction logic rules, the user's workload can be further reduced and the degree of automation of data processing can be improved.

[0045] (4) Enhanced data quality: Since the connector is designed specifically for a specific type of data source and loaded with corresponding extraction logic rules, the quality of data obtained from the data source can be ensured. This helps reduce errors, redundancies, and inconsistencies in the data, and provides high-quality input data for subsequent data processing and relationship building.

[0046] (5) Improve scalability and maintainability: The connector architecture built through the abstract base class has good scalability and maintainability. When you need to add a new data source type, you only need to extend the connector abstract base class and write the corresponding implementation code. At the same time, because the connector instance is managed by the dependency injection container, the connector can be easily replaced or upgraded without modifying the code of other parts.

[0047] The following is the code for product implementation to show the basic process of how to obtain the original basic data from the target data source, including data source type analysis, connector matching and instantiation, loading and extraction logic rules, and extracting data from the data source:

[0048] from enum import Enum

[0049] class DataSourceType(Enum):

[0050] DATABASE = 'DATABASE'

[0051] FILE='FILE'

[0052] API = 'API'

[0053] #Function for data source type analysis

[0054] def analyze_data_source_type(data_source_uri):

[0055] #Detection logic

[0056] if'database'in data_source_uri:

[0057] return DataSourceType.DATABASE

[0058] elif 'file' in data_source_uri:

[0059] return DataSourceType.FILE

[0060] elif 'api' in data_source_uri:

[0061] return DataSourceType.API

[0062] else:

[0063] raise ValueError("Unknown data source type")

[0064] #Connector abstract base class

[0065] class ConnectorBase:

[0066] #Define the common interface and methods of the connector

[0067] pass

[0068] #Connector implementation (taking database connector as an example)

[0069] class DatabaseConnector(ConnectorBase):

[0070] def__init__(self,database_type,connection_details):

[0071] # Initialize the specific implementation of the database connector

[0072] pass

[0073] def extract_data(self):

[0074] # Implement data extraction logic

[0075] pass

[0076] #Connector factory, used to generate connector instances based on data source type

[0077] class ConnectorFactory:

[0078] def create_connector(self,data_source_type,connection_details):

[0079] if data_source_type==DataSourceType.DATABASE:

[0080] return DatabaseConnector(data_source_type,connection_details)

[0081] else:

[0082] raise NotImplementedError(f"No connector for{data_source_type}")

[0083] #Dependency Injection Container

[0084] dependency_container = {}

[0085] #Load the extraction logic rules to the connector

[0086] def load_extraction_rules(connector,extraction_rules):

[0087] #Connector loading rules

[0088] connector.load_rules(extraction_rules)

[0089] #Main process function

[0090] def fetch_raw_data_for_water_objects(data_source_uri):

[0091] #1. Analyze data source type

[0092] data_source_type=analyze_data_source_type(data_source_uri)

[0093] print(f"Detected data source type:{data_source_type}")

[0094] #Database credentials, file paths, API keys, etc.

[0095] connection_details = {

[0096] #Fill in the corresponding connection details according to the data source type

[0097] }

[0098] #2. Match and instantiate the connector

[0099] connector_factory=ConnectorFactory()

[0100] connector=connector_factory.create_connector(data_source_type,connection_details)

[0101] #Predefine extraction logic rules

[0102] extraction_rules = {

[0103] #Define the extraction logic rules

[0104] }

[0105] #3. Load the extraction logic rules to the connector

[0106] load_extraction_rules(connector,extraction_rules)

[0107] #4. Use connectors to get raw data from data sources

[0108] raw_data=connector.extract_data()

[0109] #Return the original data or perform subsequent processing

[0110] return raw_data

[0111] data_source_uri = "some_database_uri" #Replace with the actual data source URI

[0112] raw_data=fetch_raw_data_for_water_objects(data_source_uri)

[0113] Optionally, the original basic data for establishing the association relationship of the water conservancy objects is preprocessed to generate valid basic data, and the preprocessing includes: deduplication, missing value filling, and error value correction, including:

[0114] Based on the hash function, the original basic data for establishing the water conservancy object association relationship is grouped to convert the original basic data into a grouping key and map it into a hash bucket;

[0115] The capacity of the hash bucket is counted to pre-process the original basic data for establishing the association relationship of the water conservancy objects to generate effective basic data.

[0116] The process of preprocessing the original basic data for establishing the association relationship of water conservancy objects to generate effective basic data, especially preprocessing by grouping through hash functions and capacity statistics of hash buckets, has the following technical advantages:

[0117] (1) Improve data quality:

[0118] Deduplication: Hash functions can be used to efficiently identify and remove duplicate data entries, ensuring the uniqueness of the data and thus avoiding errors in subsequent data processing and analysis.

[0119] Missing value filling: During the hash bucket statistics process, it is possible to identify which grouping keys (i.e. hash values) have missing data, and then adopt appropriate strategies to fill in the missing values ​​to improve data integrity.

[0120] Error value correction: Through hash grouping and capacity statistics, abnormal values ​​or error values ​​(such as values ​​outside a reasonable range) can be identified, and then corrected or marked as invalid data to reduce the impact of erroneous data on subsequent analysis.

[0121] (2) Improve data processing efficiency:

[0122] Fast grouping: Hash functions can complete data grouping in a constant time, which greatly improves grouping efficiency compared to traditional traversal comparison methods.

[0123] Parallel processing: The independence of hash buckets enables data in different buckets to be processed in parallel, further improving the overall data processing efficiency.

[0124] (3) Simplify data relationship management:

[0125] Through hash grouping, data with similar characteristics or attributes can be grouped together, facilitating subsequent data association and analysis.

[0126] The capacity statistics of hash buckets can provide data distribution information, help understand the overall structure and characteristics of the data, and provide valuable reference for subsequent data modeling and relationship building.

[0127] (4) Enhance system scalability:

[0128] The hash grouping and hash bucket methods do not depend on a specific data source or data structure, so they are highly versatile and extensible. When the data source or data structure changes, you only need to adjust the hash function or hash bucket settings to adapt to the new situation.

[0129] (5) Reduce storage requirements:

[0130] Through deduplication and error value correction, invalid or redundant data stored in the system can be reduced, thereby reducing storage costs.

[0131] Hash grouping and hash bucket methods can also be used for data compression and indexing to further improve data storage efficiency.

[0132] Optionally, the method of grouping the original basic data for establishing the water conservancy object association relationship based on a hash function to convert the original basic data into a grouping key and map it into a hash bucket includes:

[0133] Encoding the original basic data for establishing the association relationship of the water conservancy object according to the coding of the ID, name, and geographic location of the water conservancy object to create a corresponding hash key;

[0134] Based on the hash function, the hash key is hashed to group the original basic data for establishing the association relationship of the water conservancy objects to obtain a hash value of fixed length;

[0135] A hash bucket index is generated according to the hash value to convert the original basic data into a grouping key and map it into a hash bucket.

[0136] To this end, when the hash function is used to group the original basic data for establishing the association relationship of water conservancy objects, a hash key is created by combining the ID, name, and geographic location code of the water conservancy object, and the hash operation and mapping are performed and mapped to the hash bucket, which has the following technical benefits:

[0137] (1) Efficient data grouping:

[0138] The hash function can be used to quickly group the original basic data according to the characteristics of the water conservancy object (such as ID, name, geographic location). This grouping method is based on the intrinsic attributes of the data rather than through complex traversal or comparison, so it can greatly improve the grouping efficiency.

[0139] (2) Optimize data processing:

[0140] The grouped data is stored in hash buckets so that data with the same or similar characteristics are clustered together. This helps with subsequent data processing and analysis because specific operations can be performed on the data in each hash bucket without considering the entire data set.

[0141] (3) Reduce data redundancy:

[0142] Through hashing and grouping, duplicate data entries can be identified and removed. Since hash functions are deterministic, the same input always produces the same output, so it can ensure that data with the same characteristics is only stored once, thereby reducing data redundancy.

[0143] (4)Support fast retrieval:

[0144] The generated hash value can be used as a grouping key to directly index the data in the hash bucket. This means that when you need to retrieve data for a specific water conservancy object, you only need to calculate the hash value of the object and then directly access the corresponding hash bucket without traversing the entire data set, which greatly improves the retrieval speed.

[0145] (5) Improve system scalability:

[0146] This method does not depend on a specific data source or data structure, so it has strong versatility and scalability. When the data source or data structure changes, you only need to adjust the hash function or hash bucket settings to adapt to the new situation.

[0147] (6) Simplify data relationship management:

[0148] Mapping the original basic data into hash buckets can clearly show the association relationship between the data. Since hash buckets are grouped according to the characteristics of the data, data with the same or similar characteristics will be clustered together, which is convenient for subsequent data association and analysis.

[0149] (7) Support parallel processing:

[0150] Due to the independence of hash buckets, data in different buckets can be processed in parallel, which means that multi-core processors or distributed computing resources can be fully utilized to speed up the data processing process and improve overall performance.

[0151] Optionally, encoding the original basic data for establishing the association relationship of the water conservancy object according to the coding of the ID, name, and geographic location of the water conservancy object to create a corresponding hash key includes:

[0152] Generate a key-value pair of a water conservancy object according to the ID, name, and geographic location code of the water conservancy object;

[0153] The water conservancy object key-value pair is serialized to obtain a JSON string, and the JSON string chain address is encoded to create a corresponding hash key.

[0154] To this end, when a water conservancy object key-value pair is generated according to the encoding of the water conservancy object's ID, name, and geographic location, and a hash key is further created by serializing the JSON string and chain address encoding, the following technical benefits are achieved:

[0155] (1) Structured data representation:

[0156] By organizing the ID, name, and geographic location of water conservancy objects into key-value pairs and serializing them in JSON format, we can ensure the structured representation of data. This structured data format is easy to understand, process, and store, and also facilitates subsequent data analysis and visualization.

[0157] (2) Data consistency:

[0158] Using a unified JSON format for serialization can ensure data consistency between different data sources or systems. This is especially important for establishing relationships between water conservancy objects, because accurate and consistent data is the basis for ensuring the validity of the relationship.

[0159] (3) Reduce hash conflicts:

[0160] When creating a hash key, chain address encoding (such as SHA-256, MD5, etc.) of the JSON string can generate a fixed-length and almost unique hash value. This encoding method greatly reduces the possibility of hash collisions, thereby improving the accuracy of data grouping and retrieval.

[0161] (4) Support complex association relationships:

[0162] Since the hash key is generated based on multiple attributes of the water conservancy object (such as ID, name, geographic location), it can support more complex associations. By comparing the hash keys of different objects, the similarities or differences between them can be quickly determined, thereby discovering potential associations or differences.

[0163] The generation and use of hash keys are independent of the physical storage location of the data, so they can support distributed storage and computing environments. In such an environment, different nodes can process data independently and coordinate and communicate through hash keys, thereby achieving efficient data processing and analysis.

[0164] Optionally, the hash operation is performed on the hash key based on the hash function to group the original basic data for establishing the water conservancy object association relationship to obtain a hash value of a fixed length, including:

[0165] Based on the hash function, performing a hash operation on the hash key to obtain a first hash value;

[0166] Indexing the first hash value into a pre-established Merkle tree to generate a corresponding leaf node;

[0167] Based on the semantic distance between the leaf nodes, the leaf nodes are spliced ​​to group the original basic data for establishing the association relationship of the water conservancy objects to obtain a hash value of a fixed length.

[0168] To this end, a method based on hash functions and Merkle Tree is used to group the original basic data of water conservancy objects and generate a fixed-length hash value, which has the following technical benefits:

[0169] (1) Data integrity verification:

[0170] The structure of the Merkle tree allows for efficient verification of data integrity. Since each leaf node represents a hash value of data, only the root hash value of the Merkle tree needs to be verified to confirm that the entire data set is complete and has not been tampered with.

[0171] (2) Efficient data grouping:

[0172] The first hash value obtained by the hash function is indexed to the leaf node of the Merkle tree, so that data can be automatically grouped according to the characteristics of the hash value (such as distribution and similarity). This grouping method is not only efficient, but also can maintain the logical relevance of the data.

[0173] (3)Support semantic grouping:

[0174] In the Merkle tree, the semantic distance between leaf nodes is used for splicing, which can achieve semantic grouping based on data content. This means that water conservancy object data with similar characteristics or attributes will be clustered together, making it easier to conduct subsequent data analysis and establish association relationships.

[0175] Optionally, generating a hash bucket index according to the hash value to convert the original basic data into a grouping key and map it into a hash bucket includes:

[0176] Performing an integer modulo operation on the number of the hash buckets using the hash value to determine the hash bucket index;

[0177] Based on the hash bucket index, a grouping slot is determined to convert the original basic data into a grouping key and map it into a hash bucket.

[0178] To this end, when the hash value is used to perform an integer modulo operation on the number of hash buckets to determine the hash bucket index, and the original base data is mapped into the hash bucket based on the index, the following technical benefits are achieved:

[0179] (1) Uniform distribution:

[0180] By using integer modulo operations, we can ensure that hash values ​​are evenly distributed among the hash buckets. This helps avoid situations where some hash buckets are overloaded while others are idle, thus improving the overall performance and efficiency of the system.

[0181] (2) Quick search:

[0182] Since the hash value is calculated by the hash function and has a one-to-one correspondence with the original data, the corresponding hash bucket and grouping slot can be quickly located according to the hash value, which greatly speeds up the retrieval and access of data.

[0183] (3) Flexibility and scalability:

[0184] The number of hash buckets can be adjusted according to actual needs. When the amount of data increases, the number of hash buckets can be increased to maintain the uniform distribution and retrieval efficiency of the data. In addition, the adjustment of the number of hash buckets will not affect the data already stored in the system, so it has high flexibility and scalability.

[0185] (4) Reduce hash conflicts:

[0186] Although the hash function itself already tries to reduce the possibility of hash collisions, using integer modulo operations as an additional step to determine the hash bucket index can further reduce the probability of collisions. This is because integer modulo operations are deterministic and the same hash value will always map to the same hash bucket index.

[0187] (5) Simplify data processing:

[0188] Once the original base data is mapped into hash buckets, the data in each hash bucket can be processed independently. This simplifies the data processing process and makes parallel processing and distributed computing possible. At the same time, since the data has been grouped into different hash buckets, specific algorithms or operations can be applied to the data in each hash bucket.

[0189] Optionally, the determining of the grouping slot based on the hash bucket index to convert the original basic data into a grouping key and map it into a hash bucket includes:

[0190] Based on the hash bucket index, performing local sensitive hash analysis on the original basic data to determine the grouping slot;

[0191] Based on the set load factor, the grouping slots are optimized to generate a virtual hash exchange;

[0192] Based on the virtual hash ring, the original basic data is converted into grouping keys and mapped into hash buckets.

[0193] To this end, in the above process, locality sensitive hashing (LSH) analysis and load factor optimization are combined to determine the grouping slots, and a virtual hash ring is further generated to map the original basic data to the hash bucket, which has the following benefits:

[0194] (1) Improve search efficiency:

[0195] The basic idea of ​​locality sensitive hashing (LSH) is to map similar data items into the same bucket, thereby reducing the search scope. In the establishment of water conservancy object associations, LSH analysis can ensure that the original basic data with similar characteristics or attributes are assigned to similar grouping slots, thereby improving the efficiency of subsequent searches and queries.

[0196] (2) Reduce hash conflicts:

[0197] Through LSH analysis, similar data items are mapped to the same bucket or similar slots, which helps reduce the probability of hash collisions. Hash collisions usually lead to reduced search performance and increased errors, and LSH analysis can effectively reduce this risk.

[0198] (3) Optimize load distribution:

[0199] The load factor is a parameter used to control the relationship between the number of elements and the number of buckets in a hash table (or hash bucket). By optimizing the grouping slots according to the load factor, you can ensure a more even distribution of load between hash buckets, avoid overloading some buckets while others are idle, and help improve the overall performance and stability of the system.

[0200] (4)Support dynamic expansion:

[0201] The introduction of the virtual hash ring allows the number of hash buckets to be dynamically expanded as needed. When the amount of data increases, more data items can be accommodated by increasing the number of nodes on the virtual hash ring without recalculating the hash values ​​of all data or redistributing data. The ability to dynamically expand makes the system more flexible and scalable.

[0202] (5) Improve data access speed:

[0203] Once the original basic data is mapped to the hash bucket, the corresponding data item can be quickly located through the hash bucket index and grouping slot. This hash-based access method is more efficient than traditional linear search or traversal methods, and can significantly improve data access speed and processing efficiency.

[0204] (6) Support parallel processing:

[0205] Since hash buckets are independent storage units, data items in different hash buckets can be processed in parallel. This parallel processing capability can make full use of multi-core processors or distributed computing resources to further improve the speed and efficiency of data processing.

[0206] Optionally, the performing capacity statistics on the hash bucket to pre-process the original basic data for establishing the water conservancy object association relationship to generate effective basic data includes:

[0207] Based on the set counter, real-time capacity statistics of the hash bucket are performed;

[0208] According to the instant capacity statistics, clustering processing is performed on the original basic data for establishing the association relationship of the water conservancy objects to obtain a plurality of clusters of original basic data;

[0209] Vectorize each cluster of original basic data to obtain a vector representation of the data;

[0210] Grouping and pattern recognition of vector representations of the data to determine behavior patterns of water conservancy objects affected by hydrological conditions, geographical location layout, and water conservancy facilities;

[0211] Based on the water conservancy object behavior pattern, the original basic data for establishing the water conservancy object association relationship is labeled to generate effective basic data.

[0212] To this end, the process of performing capacity statistics on the hash bucket and preprocessing the original basic data for establishing the association relationship of the water conservancy objects to generate effective basic data has the following technical benefits:

[0213] (1) Optimize data processing efficiency:

[0214] Through real-time capacity statistics, the system can understand the load of the hash bucket in real time, thereby optimizing the data storage and access strategy. This helps reduce data access latency and improve data processing efficiency.

[0215] (2) Clustering processing and pattern recognition:

[0216] Clustering the original basic data can bring together data with similar characteristics or attributes to form several clusters. This helps to identify hidden patterns or trends in the data and provides a basis for subsequent analysis of water conservancy object behavior patterns.

[0217] (3) Vectorized data representation:

[0218] By vectorizing each cluster of original basic data, we can get its vector representation. This representation method can retain the main features of the data while reducing the data dimension, which is convenient for subsequent data processing and pattern recognition.

[0219] (4) Pattern recognition and behavior analysis:

[0220] Grouping and pattern recognition of the vector representation of data can reveal the behavior patterns of water conservancy objects affected by hydrological conditions, geographical location layout, and water conservancy facilities. This analysis helps to deeply understand the operation laws and mutual influences of water conservancy objects and provide a scientific basis for water conservancy management and decision-making.

[0221] (5) Labeling and data validity improvement:

[0222] Based on the identified behavior patterns of water conservancy objects, labeling the original basic data can generate more effective basic data. These labeled data can more accurately describe the characteristics and status of water conservancy objects, providing more valuable information for subsequent association analysis and data mining.

[0223] Optionally, the original basic data for establishing the association relationship of the water conservancy objects is clustered according to the real-time capacity statistics to obtain a plurality of clusters of original basic data, including:

[0224] Generate a cluster dendrogram based on the constructed inter-cluster distances, and determine cluster division points based on the cluster dendrogram;

[0225] Based on the cluster division points and according to the real-time capacity statistics, the original basic data for establishing the association relationship of the water conservancy objects are clustered to obtain a plurality of clusters of original basic data.

[0226] To this end, the method of clustering the original basic data for establishing the association relationship of water conservancy objects according to the real-time capacity statistics and determining the cluster division points by constructing the inter-cluster distance and the cluster dendrogram has the following technical advantages:

[0227] (1) Accurate cluster division:

[0228] The cluster dendrogram generated based on the inter-cluster distance can accurately reflect the similarities and differences between data points. By determining the cluster division points, data points with similar characteristics can be clustered together to form clusters with clear boundaries, which helps to ensure the accuracy and reliability of the clustering results.

[0229] (2) Consider real-time capacity statistics:

[0230] Combining clustering with real-time capacity statistics can ensure that the clustering results are consistent with the load of the hash bucket. Real-time capacity statistics provide real-time distribution information of data in the hash bucket. By considering this information, it is possible to avoid allocating too many data points to the same cluster, thereby maintaining load balance between hash buckets.

[0231] (3) Optimize data storage and retrieval:

[0232] After the original basic data is divided into several clusters, targeted data storage and retrieval optimization can be performed according to the characteristics and needs of the clusters. For example, data with similar characteristics can be stored in the same physical location or partition to reduce disk I / O operations and improve data retrieval speed.

[0233] (4) Improve data analysis efficiency:

[0234] By dividing the original basic data into several clusters, the analysis tasks can be distributed to each cluster for parallel processing, which can not only improve the efficiency of data analysis, but also reduce the computational workload and resource consumption of a single analysis task.

[0235] Optionally, vectorizing each cluster of original basic data to obtain a vector representation of the data includes:

[0236] Perform one-hot encoding on the categorical data of each cluster of original basic data and perform numerical encoding on the numerical data to generate data encoding;

[0237] The data encoding is subjected to multi-scale changes to generate a vector representation of the data.

[0238] To this end, the method of vectorizing each cluster of original basic data and generating data vector representation through one-hot encoding, numerical encoding and multi-scale changes has the following technical advantages:

[0239] (1) Unified data format:

[0240] One-hot encoding and numerical encoding can convert different types of data (such as categorical data and numerical data) into a unified format, namely a numerical vector. This helps with subsequent data processing and analysis because all data follow the same mathematical representation and operation rules.

[0241] (2) Reduce data redundancy:

[0242] One-hot encoding can efficiently handle categorical data, especially when the categorical variable has multiple possible values. By converting each categorical value into a unique binary vector, one-hot encoding can eliminate redundancy and ambiguity in the original categorical data.

[0243] (3) Preserve data relationships:

[0244] Multi-scale transformation (for example, using feature scaling or normalization) can transform data to the same scale while maintaining the internal relationships in the data. This is very important for certain machine learning algorithms because they usually require input data to have similar scales.

[0245] Optionally, the grouping and pattern recognition of the vector representation of the data to determine the behavior patterns of water conservancy objects affected by hydrological conditions, geographical location layout, and water conservancy facilities includes:

[0246] Conducting principal component analysis on the vectors of the data to determine the degree of direct influence of hydrological conditions, geographical location layout, and water conservancy facilities on the behavior of water conservancy objects;

[0247] Based on the direct influence of the hydrological conditions, geographical location layout, and water conservancy facilities on the behavior of water conservancy objects, frequent item sets and association rules between the vector representations of the data are established to group and pattern recognize the vector representations of the data.

[0248] To this end, the process of grouping and pattern recognition of vector representations of data to determine the behavior patterns of water conservancy objects affected by hydrological conditions, geographical location layout, and water conservancy facilities, by combining principal component analysis (PCA) and the establishment of frequent item sets and association rules, has the following technical benefits:

[0249] (1) Principal component analysis (PCA) can reveal the principal components in the data, namely the hydrological conditions, geographical location and water conservancy facilities that have the greatest direct impact on the behavior of water conservancy objects. This helps researchers and managers gain a deeper understanding of how these factors affect the behavior of water conservancy objects.

[0250] (2) Improve the accuracy of pattern recognition:

[0251] Based on the results of PCA analysis, frequent item sets and association rules between vector representations of data can be established. This statistically based pattern recognition method can more accurately identify potential patterns and laws in the behavior of water conservancy objects and reduce the possibility of misjudgment and omission.

[0252] (3) Support complex data analysis:

[0253] For water conservancy object behavior data containing a large number of variables and complex relationships, PCA and association rule analysis can effectively process high-dimensional data and nonlinear relationships and discover deep information hidden in the data. This is of great significance for understanding and predicting the behavior patterns of water conservancy objects.

[0254] (4) Optimize resource allocation:

[0255] By identifying the behavior patterns of water resources affected by hydrological conditions, geographical location, and water facilities, the allocation and utilization of water resources can be optimized. For example, different water resource scheduling plans can be formulated according to the hydrological conditions and water facilities in different regions to improve the utilization efficiency of water resources.

[0256] (5) Improve system efficiency:

[0257] Through grouping and pattern recognition, water conservancy objects with similar behavior patterns can be classified into the same group, which is convenient for subsequent data processing and analysis. This can not only improve the processing efficiency of the system, but also reduce unnecessary computing resource consumption.

[0258] Optionally, based on the water conservancy object behavior pattern, labeling the original basic data for establishing the water conservancy object association relationship to generate effective basic data includes:

[0259] A hierarchical label structure is constructed to label the original basic data for establishing the association relationship of the water conservancy objects based on the water conservancy object behavior pattern to generate effective basic data, wherein: the hierarchical label structure is as follows:

[0260] Top level: natural environment, water conservancy projects, hydrological monitoring, and water resources management;

[0261] The second layer: natural environment, basin characteristics, basin area, topography, climate conditions, annual precipitation, seasonal distribution, geology and soil, water conservancy projects, dams and reservoirs, building types, capacity scale, irrigation systems, drainage facilities, drainage capacity, pipe network layout, hydrological monitoring, water level monitoring, real-time water level, historical trends, flow measurement, maximum flow, average flow, water quality analysis, pH value, suspended matter content, water resources management, water supply management, water supply, user types, flood prevention and mitigation, and flood control standards;

[0262] The third layer: Building type: gravity dam, arch dam, earth-rock dam; Capacity scale: small, medium, large, extra-large; Safety level: A, B, C; Operating status: normal operation, under maintenance, idle.

[0263] To this end, based on the water conservancy object behavior pattern, a method for hierarchically labeling the original basic data for establishing the association relationship of water conservancy objects to generate effective basic data has the following technical advantages:

[0264] (1) Structured and systematic data:

[0265] By building a hierarchical label structure, the original basic data is systematically organized and classified. This helps to transform the data from a chaotic state into a structured and systematic form, which is convenient for subsequent data analysis and processing.

[0266] (2) Improve data retrieval efficiency:

[0267] The hierarchical tag structure makes data retrieval more efficient. Tags can be used to quickly locate relevant data subsets, reduce unnecessary search and screening time, and improve the efficiency of data analysis.

[0268] (3) Support multi-level analysis:

[0269] The hierarchical label structure supports data analysis from multiple levels. From the top level to the bottom level, you can gradually explore various aspects of the water conservancy object and discover the potential patterns and associations in the data.

[0270] (4) Enhance data interpretability:

[0271] The hierarchical label structure makes the data more interpretable. Each label represents a specific concept or attribute. Through the label, the meaning and background of the data can be clearly understood, making it easier to explain and communicate to non-professionals.

[0272] (5) Through labeling, we can clearly understand the distribution, scale, status and other information of different types of water conservancy objects, which helps to optimize the allocation and utilization of resources. For example, we can formulate targeted maintenance and management plans based on label information to improve the operating efficiency and service life of water conservancy facilities.

[0273] Based on the above exemplary explanation of preprocessing the original basic data for establishing the association relationship of water conservancy objects to generate valid basic data, the preprocessing includes: deduplication, missing value filling, and error value correction, the following provides an exemplary code for implementing preprocessing the original basic data for establishing the association relationship of water conservancy objects to generate valid basic data, the preprocessing includes: deduplication, missing value filling, and error value correction:

[0274] import hashlib

[0275] import json

[0276] from collections import defaultdict

[0277] from sklearn.preprocessing import OneHotEncoder

[0278] from sklearn.decomposition import PCA

[0279] from sklearn.cluster import AgglomerativeClustering

[0280] from pyspark.mllib.fpm import FPGrowth

[0281] #The original basic data is a dictionary list containing multiple water conservancy object information

[0282] raw_data=[

[0283] {'id':'001','name':'Dam A','location':'Location A'},

[0284] #...More data... ]

[0286] #Preprocess the original basic data

[0287] def preprocess_data(data):

[0288] #De-duplication, missing value filling, error value correction and other operations

[0289] return processed_data

[0290] #Hash function grouping

[0291] def hash_function_grouping(data):

[0292] hash_buckets=defaultdict(list)

[0293] for itemin data:

[0294] #Create a hash key based on the ID, name, and geographic location code of the water conservancy object

[0295] hash_key=json.dumps({'id':item['id'],'name':item['name'],'location':item['location']},sort_keys=True)

[0296] #Hash operation

[0297] hash_value=hashlib.sha256(hash_key.encode()).hexdigest()

[0298] #Generate hash bucket index

[0299] bucket_index=int(hash_value,16)%len(hash_buckets)

[0300] #Map to hash bucket

[0301] hash_buckets[bucket_index].append(item)

[0302] return hash_buckets

[0303] #Capacity statistics and clustering processing

[0304] def capacity_statistics_and_clustering(hash_buckets):

[0305] #Capacity Statistics

[0306] capacities=[len(bucket)for bucket in hash_buckets.values()]

[0307] #Clustering Process

[0308] return clusters

[0309] #Vectorization and pattern recognition

[0310] def vectorization_and_pattern_recognition(clusters):

[0311] #Vectorize the original basic data of each cluster

[0312] # Specific implementation is omitted here

[0313] #Pattern Recognition

[0314] return patterns

[0315] #Tag processing

[0316] def tagging(patterns):

[0317] #Build a hierarchical label structure

[0318] return tagged_data

[0319] #Main process

[0320] def main():

[0321] #Preprocess data

[0322] processed_data=preprocess_data(raw_data)

[0323] #Hash function grouping

[0324] hash_buckets=hash_function_grouping(processed_data)

[0325] #Capacity statistics and clustering processing

[0326] clusters=capacity_statistics_and_clustering(hash_buckets)

[0327] #Vectorization and pattern recognition

[0328] patterns=vectorization_and_pattern_recognition(clusters)

[0329] #Tag processing

[0330] tagged_data=tagging(patterns)

[0331] # Output or further process tagged_data

[0332] if__name__=="__main__":

[0333] main()

[0334] Optionally, the ontology encoding of the effective basic data is performed to map different types of effective basic data to the same standard and establish associations between different types of original basic data of the same water conservancy object and generate an entity interconnection graph between the effective basic data, including:

[0335] Based on the gradient boosting algorithm, extracting the water conservancy object attribute features from the effective basic data;

[0336] RDF ontology description language builds water conservancy object ontology model;

[0337] By constructing the water conservancy object ontology model, ontology encoding is performed on the attribute characteristics of the water conservancy object, so as to map different types of effective basic data to the same standard and establish an association relationship between different types of original basic data of the same water conservancy object;

[0338] Importing the association relationship into a graph database to generate an entity interconnection graph between valid basic data;

[0339] Among them, the water conservancy object ontology model includes: defining water conservancy object classes to clarify the categories of water conservancy objects; defining attributes: defining attributes for each water conservancy object class, including at least name, location, type, and capacity; defining relationships: defining relationships between water conservancy objects, including at least control relationships and water replenishment relationships.

[0340] To this end, the method of ontology encoding effective basic data and constructing a water conservancy object ontology model to generate an entity interconnection graph has the following technical benefits:

[0341] (1) Data standardization and unification:

[0342] Through ontology coding, different types of valid basic data are mapped to the same standard, achieving data standardization and unification. This eliminates the heterogeneity between data and improves the quality and availability of data.

[0343] (2) Enhanced data association and interconnection:

[0344] Ontology coding enables clear associations to be established between different types of original basic data of the same water conservancy object. Through the defined water conservancy object classes, attributes and relationships, the connections between data are clearly represented, which helps to discover and analyze the complex relationships between water conservancy objects.

[0345] (3) Support knowledge reasoning:

[0346] The constructed water conservancy object ontology model not only defines the classes, attributes and relationships of water conservancy objects, but also provides a basis for knowledge reasoning. Based on this model, logical reasoning, knowledge query and intelligent analysis can be performed to provide decision support for water conservancy management.

[0347] (4) Support dynamic update and maintenance:

[0348] Ontology coding and water conservancy object ontology model are built based on graph database, which has good scalability and maintainability. With the continuous update and change of water conservancy object data, the entity interconnection graph can be easily updated and maintained to maintain the timeliness and accuracy of the data.

[0349] The following is an example code to show how to build a water conservancy object ontology model, perform ontology encoding, and generate an entity interconnection graph:

[0350] #List of features extracted from valid basic data

[0351] #water_object_features=[...]

[0352] #1. Define the water conservancy object ontology model (pseudo code)

[0353] #Use RDF / OWL description language to define the ontology

[0354] #Define water conservancy object class

[0355] class WaterObject:

[0356] #Class definition, including name, location, type, capacity and other attributes

[0357] pass

[0358] #Define properties (using RDF / OWL syntax)

[0359] #For example, define the attribute name

[0360] def name_property(water_object):

[0361] return RDFProperty(name='name',domain=WaterObject,range=xsd:string)

[0362] #Define relationship

[0363] def control_relation(controller,controlled):

[0364] return RDFRelation(name='control',domain=WaterObject,range=WaterObject,inverse='isControlledBy')

[0365] #2. Encode the attributes of water conservancy objects into ontology

[0366] #Map features to ontology attributes

[0367] def encode_water_object_features(water_object_features):

[0368] #Create a water conservancy object instance

[0369] water_object=WaterObject()

[0370] #Traverse the feature list and encode it according to the ontology model

[0371] for feature in water_object_features:

[0372] if feature.name == 'name':

[0373] #feature.value is the value of the feature

[0374] water_object.set_property(name_property,feature.value)

[0375] #Return the encoded water conservancy object instance

[0376] return water_object

[0377] #3. Import the association relationship into the graph database

[0378] #Using Neo4j as a graph database

[0379] def import_into_graph_database(water_objects):

[0380] #Connect to Neo4j database

[0381] #Traverse the list of water conservancy objects and create nodes and relationships

[0382] for water_object in water_objects:

[0383] #Create a node

[0384] #...Use the graph database API to create the water_object node...

[0385] #Traverse the relationship of water_object and create edges

[0386] for relation in water_object.get_relations():

[0387] #relation contains the relationship type and the associated water conservancy object

[0388] #...Use the graph database API to create relationship edges...

[0389] #Close the database connection

[0390] #...

[0391] #List of encoded water conservancy objects

[0392] #water_objects=[encode_water_object_features(features)for featuresinwater_object_features_list]

[0393] #Import to graph database

[0394] #import_into_graph_database(water_objects)

[0395] Optionally, the iterating of entities and functional relationships between entities based on the pre-established topological relationship of water conservancy objects according to the entity interconnection graph between valid basic data to establish the association relationship of water conservancy objects includes:

[0396] Mapping the entity interconnection graph between the valid basic data to the pre-established water conservancy object topological relationship to iterate the entities and the functional relationships between entities and obtain a dependency-oriented description between water conservancy objects;

[0397] According to the dependency-oriented description between the water conservancy objects, the implicit regular propagation path between the water conservancy objects is mined to establish the association relationship between the water conservancy objects.

[0398] To this end, based on the pre-established topological relationship of water conservancy objects, and according to the entity interconnection map between valid basic data, entities and functional relationships between entities are iterated to establish the method of water conservancy object association relationship, which has the following technical benefits:

[0399] (1) Enhance data relevance and accuracy: By mapping the entity interconnection graph to the pre-established topological relationship of water conservancy objects, the actual relationship and dependency between water conservancy objects can be described more accurately. This mapping not only enhances the relevance of data, but also improves the accuracy of data, providing a reliable foundation for the subsequent establishment of association relationships.

[0400] (2) Supporting implicit law mining: By iterating entities and functional relationships between entities, the implicit law propagation paths between water conservancy objects can be mined. These implicit laws may not be obtained through simple data analysis or intuitive observation, but they are of great significance for understanding the operating laws of water conservancy systems and predicting potential risks. By mining these implicit laws, a more comprehensive and in-depth association relationship between water conservancy objects can be established.

[0401] (3) Adaptability and scalability: This method has strong adaptability and scalability. As the water conservancy system develops and changes, the topological relationship of water conservancy objects and the entity interconnection map can be easily updated and expanded to adapt to new needs and changes.

[0402] The following is an exemplary code that combines the entity interconnection map between valid basic data with the pre-established topological relationship of water conservancy objects, so as to iterate the entities and their functional relationships, and mine the implicit regular propagation paths between water conservancy objects.

[0403] Python

[0404] #Graph database connection (such as Neo4j)

[0405] #Imported the entity interconnection graph with valid basic data

[0406] #At the same time, it has a representation of the pre-established topological relationship of water conservancy objects

[0407] #1. Load the pre-established water conservancy object topology

[0408] # def load_water_object_topology() loaded from a file, database, or other data source:

[0409] #Loading logic, which may be queried from Neo4j or loaded from other data sources

[0410] #Return a graph or data structure representing the topological relationship of water conservancy objects

[0411] pass

[0412] #2. Map the entity interconnection graph to the topological relationship of water conservancy objects

[0413] #Map or merge two graphs or data structures

[0414] def map_entity_graph_to_topology(entity_graph,topology):

[0415] #Traverse each node and relationship in the entity interconnection graph

[0416] #Try to find the corresponding nodes and relationships in the topology

[0417] #If found, update the node's attributes or the relationship's metadata to indicate this mapping relationship

[0418] #If not found, mark it as a new discovery or perform other processing

[0419] pass

[0420] #3. Iterate entities and functional relationships between entities

[0421] #Graph traversal algorithm: depth-first search (DFS) or breadth-first search (BFS)

[0422] def iterate_entity_relationships(mapped_graph):

[0423] #Traverse the mapped graph (mapped_graph) and analyze the properties of nodes and edges

[0424] #According to the functions and attributes of water conservancy objects, iteratively build or update the relationship between them

[0425] #Identify control relationships, water replenishment relationships, etc., and update them in the diagram

[0426] pass

[0427] #4. Mining the implicit regularity propagation path

[0428] #Use graph analysis algorithms, such as shortest path algorithm, PageRank, etc.

[0429] def mine_implicit_patterns(iterated_graph):

[0430] #Use graph analysis algorithms to identify implicit patterns and propagation paths between water conservancy objects

[0431] #Find the key factors or transmission chains that affect specific water conservancy objects

[0432] #Return the discovered patterns and paths

[0433] pass

[0434] #5. Establish water conservancy object association

[0435] #Build the association relationship between water conservancy objects based on the mined implicit rules and propagation paths

[0436] def build_water_object_associations(implicit_patterns):

[0437] #Analyze the patterns and paths found to determine which water conservancy objects are related

[0438] #Create or update these associations in the graph

[0439] #Save the association to the database or use it for further analysis and visualization

[0440] pass

[0441] #Example Process

[0442] # Load topology

[0443] water_object_topology=load_water_object_topology()

[0444] #Get or load the entity interconnection graph

[0445] entity_interconnection_graph=load_entity_interconnection_graph()

[0446] #Map entity interconnection graph to topological relationship

[0447] mapped_graph=map_entity_graph_to_topology(entity_interconnection_graph,water_object_topology)

[0448] #Iterate entities and functional relationships between entities

[0449] iterated_graph=iterate_entity_relationships(mapped_graph)

[0450] #Explore the implicit regularity propagation path

[0451] implicit_patterns=mine_implicit_patterns(iterated_graph)

[0452] #Establish water conservancy object association

[0453] build_water_object_associations(implicit_patterns)

[0454] Optionally, mapping the entity interconnection graph between the valid basic data to the pre-established water conservancy object topological relationship to iterate the entities and the functional relationships between entities and obtain the dependency-oriented description between water conservancy objects includes:

[0455] Based on a community detection algorithm, the entity interconnection graph between the effective basic data is converted into a subset of water conservancy objects with internal connectivity;

[0456] The subset of water conservancy objects is mapped to a pre-established topological relationship of water conservancy objects to iterate entities and functional relationships between entities and obtain a dependency-oriented description between water conservancy objects.

[0457] To this end, the entity interconnection graph between valid basic data is converted into internally connected water conservancy object subsets based on the community detection algorithm, and these subsets are mapped to the pre-established water conservancy object topological relationships, which provides multiple technical benefits:

[0458] (1) Reduce complexity: Water conservancy systems usually involve a large number of objects (such as reservoirs, rivers, hydropower stations, etc.) and complex relationship networks between them. By identifying subsets of water conservancy objects with high internal connectivity through community detection algorithms, the complexity of system analysis can be significantly reduced, and groups of objects with similar functions and interdependencies can be identified.

[0459] (2) Improve accuracy: Mapping a subset of water conservancy objects to the pre-established topological relationships of water conservancy objects can ensure that when iterating entities and the functional relationships between entities, reasoning and analysis can be performed based on the existing topological structure information, which helps to reduce misjudgments and errors caused by insufficient information or data errors.

[0460] (3) Discover implicit dependencies: By iterating entities and functional relationships between entities, combined with the topological relationships of water conservancy objects, implicit dependencies between water conservancy objects can be discovered. These implicit dependencies may not be easily perceived in actual operations, but they are crucial to the stability and efficiency of the system.

[0461] The following is an exemplary code that describes how to convert the entity interconnection graph between valid basic data (which may be a graph in a graph database) into internally connected water conservancy object subsets through a community detection algorithm, and map these subsets to pre-established water conservancy object topological relationships, thereby iterating entities and their inter-entity functional relationships:

[0462] Python

[0463] import networkx as nx

[0464] from community import best_partition#Install python-louvain library

[0465] from neo4j import GraphDatabase#Use Neo4j as a graph database

[0466] #Connect to the Neo4j database

[0467] driver=GraphDatabase.driver("bolt: / / localhost:7687",auth=("neo4j","password"))

[0468] #Load the entity interconnection graph from Neo4j into the NetworkX graph object

[0469] def load_entity_interconnection_graph(driver):

[0470] G = nx.Graph()

[0471] with driver.session()as session:

[0472] #Cypher query

[0473] result=session.run("MATCH(n)-[r]->(m)RETURN id(n)AS source,id(m)AStarget")

[0474] for record in result:

[0475] source,target=record["source"],record["target"]

[0476] G.add_edge(source,target)

[0477] return G

[0478] #Execute community detection algorithm

[0479] def detect_communities(G):

[0480] #Use Louvain algorithm for community detection

[0481] partition = best_partition(G)

[0482] communities={}

[0483] for node in partition:

[0484] if partition[node]not in communities:

[0485] communities[partition[node]]=[]

[0486] communities[partition[node]].append(node)

[0487] return communities

[0488] #Map the water conservancy object subset to the topological relationship and iterate the functional relationship between entities

[0489] def map_communities_to_topology(communities,topology_graph):

[0490] #topology_graph is a NetworkX graph object that represents the pre-established topological relationship of water conservancy objects

[0491] # Treat each community as a subset of water conservancy objects and iterate over the nodes and relationships in it

[0492] dependency_descriptions = {}

[0493] for community_id,nodes in communities.items():

[0494] #Iterate the nodes and relationships within the community and iterate the functional relationships

[0495] subset_graph=G.subgraph(nodes)

[0496] #Analyze the subset graph and generate dependency description

[0497] #dependency_description=analyze_subset_graph(subset_graph)

[0498] #Community ID as dependency description

[0499] dependency_descriptions[community_id]="Community_{}".format(community_id)

[0500] #Mapping logic

[0501] return dependency_descriptions

[0502] #Load the entity interconnection graph

[0503] G=load_entity_interconnection_graph(driver)

[0504] #Detection Community

[0505] communities=detect_communities(G)

[0506] #topology_graph is a pre-established NetworkX graph object of the topological relationship of water conservancy objects

[0507] #topology_graph=...

[0508] #Map communities to topological relationships and iterate functional relationships

[0509] dependency_descriptions=map_communities_to_topology(communities,topology_graph)

[0510] #Print dependency-oriented description

[0511] for community_id,description in dependency_descriptions.items():

[0512] print(f"Community{community_id}:{description}")

[0513] #Close the Neo4j database connection

[0514] driver.close()

[0515] Optionally, mining implicit regular propagation paths between water conservancy objects according to the dependency-oriented description between the water conservancy objects to establish association relationships between the water conservancy objects includes:

[0516] Based on a genetic algorithm, a heuristic search is performed on the dependency-oriented descriptions between the water conservancy objects to determine the co-occurrence patterns between the water conservancy objects;

[0517] Based on the constructed Markov chain model, the co-occurrence patterns between the water conservancy objects are analyzed for state changes based on time series, and the implicit regular propagation paths between the water conservancy objects are used to establish the association relationship between the water conservancy objects.

[0518] To this end, using genetic algorithms and Markov chain models to mine implicit regular propagation paths between water conservancy objects and establish association relationships between water conservancy objects has the following technical benefits:

[0519] (1) Discovering complex relationships: The water conservancy system is a complex network that contains multiple interdependent and mutually influential objects. Heuristic search through genetic algorithms can discover complex and nonlinear dependencies between these objects, which may be difficult to discover through traditional statistical analysis methods.

[0520] (2) Global optimization: Genetic algorithm is a global optimization algorithm that can conduct extensive exploration in the search space rather than just the local optimal solution. This helps to discover more comprehensive dependencies and co-occurrence patterns between water conservancy objects.

[0521] (3) Time series analysis: Based on the constructed Markov chain model, the state changes of water conservancy objects can be analyzed in time series. This can reveal the dynamic dependencies between objects that change over time, thereby discovering implicit regular propagation paths.

[0522] (4) Prediction capability: Through the Markov chain model, the future state of water conservancy objects can be predicted. This is very important for the planning, management and decision-making of water conservancy systems, and can help predict and avoid potential problems.

[0523] (5) Establishing association relationships: Based on the above analysis, association relationships between water conservancy objects can be established to form a more complete and accurate water conservancy system model. This model can provide strong support for the research, analysis and optimization of the water conservancy system.

[0524] (6) Scalability and interpretability: Methods based on genetic algorithms and Markov chain models have good scalability and interpretability. This means that these methods can be easily adjusted and optimized when the water conservancy system changes or needs to be expanded. At the same time, the results of these methods are easy to interpret and understand, making them easy to communicate with decision makers and other stakeholders.

[0525] The following is an exemplary code based on the above description. The code uses a genetic algorithm (here simplified as a pseudo-algorithm of random search) to discover co-occurrence patterns between water conservancy objects, and builds a simplified Markov chain model based on these patterns to analyze state changes in time series, thereby mining implicit regular propagation paths between water conservancy objects:

[0526] Python

[0527] import numpy as np

[0528] from collections import defaultdict

[0529] #Dependency-oriented description between water conservancy objects

[0530] #key is the water conservancy object, value is the list of objects that have dependencies on it

[0531] dependency_descriptions = {

[0532] 'Object A':['Object B', 'Object C'],

[0533] 'Object B':['Object A', 'Object D'],

[0534] 'Object C':['Object D', 'Object E'],

[0535] 'Object D':['Object B', 'Object C'],

[0536] 'Object E':['Object F'],

[0537] }

[0538] #Genetic Algorithm: Heuristic Search for Co-occurrence Patterns

[0539] def genetic_algorithm_simplified(dependency_descriptions,population_size=10,generations=10):

[0540] # Initialize the population

[0541] population=[np.random.choice(list(dependency_descriptions.keys()),3,replace=False)for_in range(population_size)]

[0542] #Genetic algorithm iteration

[0543] for_in range(generations):

[0544] #Evaluate each individual in the population (co-occurrence pattern)

[0545] fitness_scores=[evaluate_co_occurrence_pattern(pattern,dependency_descriptions)for pattern in population]

[0546] #choose

[0547] best_pattern=population[np.argmax(fitness_scores)]

[0548] print(f"Generation{_+1}:Best pattern found is{best_pattern}")

[0549] #Return the best co-occurrence pattern

[0550] return best_pattern

[0551] #Function to evaluate co-occurrence patterns

[0552] def evaluate_co_occurrence_pattern(pattern,dependency_descriptions):

[0553] score=0

[0554] for obj in pattern:

[0555] for neighbor in dependency_descriptions[obj]:

[0556] if neighbor in pattern:

[0557] score+=1#The co-occurrence score is a simple count based on the number of co-occurrences

[0558] return score

[0559] #Time series analysis based on the constructed Markov chain model

[0560] def build_markov_chain(dependency_descriptions):

[0561] # Initialize the state transfer matrix

[0562] transition_matrix=defaultdict(lambda:defaultdict(int))

[0563] #Traverse the dependency description and count the number of state transitions

[0564] for obj,dependents in dependency_descriptions.items():

[0565] for dependent in dependents:

[0566] transition_matrix[obj][dependent]+=1

[0567] #Standardized state transfer matrix (calculate probability)

[0568] for obj,transitions in transition_matrix.items():

[0569] total=sum(transitions.values())

[0570] for dependent,count in transitions.items():

[0571] transition_matrix[obj][dependent]=count / total

[0572] return transition_matrix

[0573] # Run the genetic algorithm to find the co-occurrence pattern and analyze it using the Markov chain model

[0574] best_co_occurrence_pattern=genetic_algorithm_simplified(dependency_descriptions)

[0575] print(f"Best co-occurrence pattern found:{best_co_occurrence_pattern}")

[0576] #Build a Markov chain model

[0577] markov_chain=build_markov_chain(dependency_descriptions)

[0578] #Analyze the implicit law propagation path

[0579] for state,transitions in markov_chain.items():

[0580] print(f"From{state}:{transitions}")

[0581] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A method for establishing a water conservancy object association relationship, characterized in that: include: Acquire original basic data for establishing water conservancy object association from the target data source, wherein the original basic data at least includes: description data of rivers, lakes and reservoirs, description data of water conservancy projects and description data of water conservancy management; Preprocessing the original basic data for establishing the association relationship of the water conservancy objects to generate effective basic data, wherein the preprocessing includes: deduplication, missing value filling, and error value correction; By ontology encoding the effective basic data, different types of effective basic data are mapped to the same standard, and association relationships are established between different types of original basic data of the same water conservancy object, and an entity interconnection map between the effective basic data is generated; Based on the pre-established topological relationship of water conservancy objects, the entities and the functional relationships between entities are iterated according to the entity interconnection map between the effective basic data to establish the association relationship of water conservancy objects; The original basic data for establishing the association relationship between water conservancy objects is obtained from the target data source, and the original basic data at least includes: description data of rivers, lakes and reservoirs, description data of water conservancy projects, and description data of water conservancy management, including: Performing type analysis on the target data source to determine the type of the target data source; According to the type of the target data source, a corresponding connector is matched, and the connector is instantiated to load the extraction logic rules onto the connector to obtain the original basic data for establishing the association relationship of the water conservancy object from the target data source; The performing type analysis on the target data source to determine the type of the target data source includes: Detect the target data source based on the detection instruction to obtain the database type, file format, and API protocol; According to the database type, file format, and API protocol, a type analysis is performed on the target data source to determine the type of the target data source; The method of matching a corresponding connector according to the type of the target data source and instantiating the connector to load the extraction logic rules onto the connector to obtain the original basic data for establishing the association relationship of the water conservancy object from the target data source includes: Determine the technology stack used for data acquisition according to the type of the target data source, and traverse the constructed connector abstract base class based on the technology stack to generate a matching connector; Triggering a dependency injection container to instantiate the connector and load an extraction logic rule onto the connector to obtain a connector instance; Based on the connector instance, inject components into the target data source to obtain original basic data for establishing a water conservancy object association relationship from the target data source; The ontology encoding of the effective basic data is performed to map different types of effective basic data to the same standard, establish associations between different types of original basic data of the same water conservancy object, and generate an entity interconnection graph between the effective basic data, including: Based on the gradient boosting algorithm, extracting the water conservancy object attribute features from the effective basic data; RDF ontology description language builds water conservancy object ontology model; By constructing the water conservancy object ontology model, ontology encoding is performed on the attribute characteristics of the water conservancy object, so as to map different types of effective basic data to the same standard and establish an association relationship between different types of original basic data of the same water conservancy object; Importing the association relationship into a graph database to generate an entity interconnection graph between valid basic data; Among them, the water conservancy object ontology model includes: defining water conservancy object classes to clarify the categories of water conservancy objects; defining attributes: defining attributes for each water conservancy object class, including at least name, location, type, and capacity; defining relationships: defining relationships between water conservancy objects, including at least control relationships and water replenishment relationships.

2. A method for establishing a water conservancy object association relationship according to claim 1, characterized in that: The original basic data for establishing the association relationship of the water conservancy objects is preprocessed to generate effective basic data, and the preprocessing includes: deduplication, missing value filling, and error value correction, including: Based on the hash function, the original basic data for establishing the water conservancy object association relationship is grouped to convert the original basic data into a grouping key and map it into a hash bucket; The capacity of the hash bucket is counted to pre-process the original basic data for establishing the association relationship of the water conservancy objects to generate effective basic data.

3. A method for establishing a water conservancy object association relationship according to claim 2, characterized in that: The method of grouping the original basic data for establishing the water conservancy object association relationship based on the hash function to convert the original basic data into a grouping key and map it into a hash bucket includes: Encoding the original basic data for establishing the association relationship of the water conservancy object according to the coding of the ID, name, and geographic location of the water conservancy object to create a corresponding hash key; Based on the hash function, the hash key is hashed to group the original basic data for establishing the association relationship of the water conservancy objects to obtain a hash value of fixed length; Generate a hash bucket index according to the hash value to convert the original basic data into a grouping key and map it to a hash bucket; The encoding of the original basic data for establishing the association relationship of the water conservancy object according to the ID, name, and geographic location of the water conservancy object to create a corresponding hash key includes: Generate a key-value pair of a water conservancy object according to the ID, name, and geographic location code of the water conservancy object; Serializing the water conservancy object key-value pair to obtain a JSON string, and encoding the JSON string chain address to create a corresponding hash key; The method of performing a hash operation on the hash key based on the hash function to group the original basic data for establishing the association relationship of the water conservancy objects to obtain a hash value of a fixed length includes: Based on the hash function, performing a hash operation on the hash key to obtain a first hash value; Indexing the first hash value into a pre-established Merkle tree to generate a corresponding leaf node; Based on the semantic distance between the leaf nodes, the leaf nodes are spliced ​​to group the original basic data for establishing the association relationship of the water conservancy objects to obtain a hash value of a fixed length; The step of generating a hash bucket index according to the hash value to convert the original basic data into a grouping key and map it into a hash bucket includes: Performing an integer modulo operation on the number of the hash buckets using the hash value to determine the hash bucket index; Based on the hash bucket index, determine a grouping slot to convert the original basic data into a grouping key and map it into a hash bucket; The step of determining the grouping slot based on the hash bucket index to convert the original basic data into a grouping key and map it into the hash bucket includes: Based on the hash bucket index, performing local sensitive hash analysis on the original basic data to determine the grouping slot; Based on the set load factor, the grouping slots are optimized to generate a virtual hash ring; Based on the virtual hash ring, the original basic data is converted into grouping keys and mapped into hash buckets.

4. A method for establishing a water conservancy object association relationship according to claim 2, characterized in that: The method of performing capacity statistics on the hash bucket to pre-process the original basic data for establishing the water conservancy object association relationship to generate effective basic data includes: Based on the set counter, real-time capacity statistics of the hash bucket are performed; According to the instant capacity statistics, clustering processing is performed on the original basic data for establishing the association relationship of the water conservancy objects to obtain a plurality of clusters of original basic data; Vectorize each cluster of original basic data to obtain a vector representation of the data; Grouping and pattern recognition of vector representations of the data to determine behavior patterns of water conservancy objects affected by hydrological conditions, geographical location layout, and water conservancy facilities; Based on the water conservancy object behavior pattern, the original basic data for establishing the water conservancy object association relationship is labeled to generate effective basic data.

5. A method for establishing a water conservancy object association relationship according to claim 4, characterized in that: According to the instant capacity statistics, the original basic data for establishing the association relationship of the water conservancy objects is clustered to obtain a plurality of clusters of original basic data, including: Generate a cluster dendrogram based on the constructed inter-cluster distances, and determine cluster division points based on the cluster dendrogram; Based on the cluster division points and according to the real-time capacity statistics, the original basic data for establishing the association relationship of the water conservancy objects are clustered to obtain a plurality of clusters of original basic data.

6. A method for establishing a water conservancy object association relationship according to claim 4, characterized in that: The vectorization of each cluster of original basic data to obtain a vector representation of the data includes: Perform one-hot encoding on the categorical data of each cluster of original basic data and perform numerical encoding on the numerical data to generate data encoding; The data encoding is subjected to multi-scale changes to generate a vector representation of the data.

7. A method for establishing a water conservancy object association relationship according to claim 4, characterized in that: The grouping and pattern recognition of the vector representation of the data to determine the behavior patterns of water conservancy objects affected by hydrological conditions, geographical location layout, and water conservancy facilities includes: Conducting principal component analysis on the vectors of the data to determine the degree of direct influence of hydrological conditions, geographical location layout, and water conservancy facilities on the behavior of water conservancy objects; Based on the direct influence of the hydrological conditions, geographical location layout, and water conservancy facilities on the behavior of water conservancy objects, frequent item sets and association rules between the vector representations of the data are established to group and pattern recognize the vector representations of the data.

8. A method for establishing a water conservancy object association relationship according to claim 4, characterized in that: The labeling process of the original basic data for establishing the association relationship of the water conservancy objects based on the water conservancy object behavior pattern to generate effective basic data includes: Construct a hierarchical label structure to label the original basic data for establishing the association relationship of the water conservancy objects based on the water conservancy object behavior pattern to generate effective basic data, wherein: the hierarchical label structure is as follows: Top level: natural environment, water conservancy projects, hydrological monitoring, and water resources management; The second layer: natural environment, basin characteristics, basin area, topography, climate conditions, annual precipitation, seasonal distribution, geology and soil, water conservancy projects, dams and reservoirs, building types, capacity scale, irrigation systems, drainage facilities, drainage capacity, pipe network layout, hydrological monitoring, water level monitoring, real-time water level, historical trends, flow measurement, maximum flow, average flow, water quality analysis, pH value, suspended matter content, water resources management, water supply management, water supply, user types, flood prevention and mitigation, and flood control standards; The third layer: Building type: gravity dam, arch dam, earth-rock dam; Capacity scale: small, medium, large, extra-large; Safety level: Class A, Class B, Class C; Operating status: normal operation, under maintenance, idle.

9. A method for establishing a water conservancy object association relationship according to claim 1, characterized in that: The method of iterating entities and functional relationships between entities based on the pre-established topological relationship of water conservancy objects and the entity interconnection graph between valid basic data to establish the association relationship of water conservancy objects includes: Mapping the entity interconnection graph between the effective basic data to the pre-established water conservancy object topological relationship to iterate the entities and the functional relationships between entities and obtain a dependency-oriented description between water conservancy objects; According to the dependency-oriented description between the water conservancy objects, the implicit regularity propagation path between the water conservancy objects is mined to establish the association relationship between the water conservancy objects; The mapping of the entity interconnection graph between the valid basic data to the pre-established water conservancy object topological relationship to iterate the entities and the functional relationships between the entities and obtain the dependency-oriented description between the water conservancy objects includes: Based on a community detection algorithm, the entity interconnection graph between the effective basic data is converted into a subset of water conservancy objects with internal connectivity; Mapping the subset of water conservancy objects to a pre-established topological relationship of water conservancy objects to iterate entities and functional relationships between entities and obtain a dependency-oriented description between water conservancy objects; Wherein, mining the implicit regular propagation paths between the water conservancy objects according to the dependency-oriented description between the water conservancy objects to establish the association relationship between the water conservancy objects includes: Based on a genetic algorithm, a heuristic search is performed on the dependency-oriented descriptions between the water conservancy objects to determine the co-occurrence patterns between the water conservancy objects; Based on the constructed Markov chain model, the co-occurrence patterns between the water conservancy objects are analyzed for state changes based on time series, and the implicit regular propagation paths between the water conservancy objects are used to establish the association relationship between the water conservancy objects.

Citation Information

Patent Citations

  • Knowledge graph construction method and device for water conservancy informatization

    CN110543571A

  • Remote sensing image search recommendation method based on knowledge graph in water conservancy field

    CN112765322A