Knowledge graph construction method for alternative planting of poppy
By combining IoT sensing and remote sensing technologies with graph neural networks, a knowledge graph for poppy alternative planting is constructed, which solves the problem of insufficient semantic association and reasoning ability of multi-source heterogeneous data, realizes intelligent planting decision support, and improves the scientificity and operability of planting management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUILIN UNIV OF ELECTRONIC TECH
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-12
AI Technical Summary
The existing management of opium poppy substitution planting suffers from a lack of semantic association among multi-source heterogeneous data, fragmented knowledge representation, weak reasoning ability, and insufficient cross-domain collaboration, which limits the construction and application of intelligent decision support systems.
By acquiring environmental data through IoT sensor nodes and analyzing crop growth status using remote sensing images, an initial set of triples is constructed. Then, a graph neural network encoder and graph attention mechanism are used to calculate the semantic association weights between entities, construct a dynamic adjacency matrix, iteratively update node representations through graph convolutional layers, derive implicit planting adaptation rules, and finally achieve reliable knowledge storage and cross-domain collaboration in a distributed graph database.
It achieves deep integration and intelligent reasoning of multi-source information, provides interpretable and executable planting decision suggestions, improves the scientificity, compliance and operability of planting decisions, and supports the intelligent and precise management of poppy substitution planting.
Smart Images

Figure CN122021633A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph and agricultural information technology, specifically to a method for constructing a knowledge graph for poppy substitution planting. Background Technology
[0002] In the field of opium poppy substitution, traditional agricultural management methods mainly rely on experience-based judgment and fragmented data recording, lacking systematic integration of multi-source heterogeneous information such as crop growth environment, pest and disease early warning, soil nutrient changes, and policies and regulations. In recent years, with the development of precision agriculture and digital rural construction, some studies have attempted to introduce IoT devices, remote sensing monitoring, and biological detection technologies to assist in substitution planting management. For example, some solutions use an adaptive fusion positioning algorithm based on inertial sensors, combined with fiber optic synchronization and wireless communication technologies, to track the location of field biological detection equipment; other technologies integrate microfluidic chips with optical detection modules for PCR quantitative analysis of crop pathogens. These technologies improve the real-time performance and accuracy of data acquisition in specific scenarios, but at the knowledge organization level, they still exist in the form of isolated data points or simple databases, failing to establish a semantic association system covering dimensions such as planting varieties, geographical climate, agricultural operations, and policy guidance. Therefore, when facing complex and ever-changing substitution planting needs, existing methods have limitations in the structure of knowledge expression, reasoning ability, and cross-domain collaboration, restricting the construction and application of intelligent decision support systems. Summary of the Invention
[0003] This invention provides a knowledge graph construction method for poppy alternative planting, aiming to solve the problems of lack of semantic association, fragmented knowledge expression, weak reasoning ability and insufficient cross-domain collaboration in the existing alternative planting management of multi-source heterogeneous data.
[0004] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0005] A method for constructing a knowledge graph for poppy substitution planting includes: acquiring soil moisture, light intensity, temperature, and precipitation data from IoT sensor nodes deployed in the substitution planting area, analyzing crop growth status using remote sensing images, and generating structured environmental observation tuples; performing entity recognition and relation extraction on policy and regulatory texts, agricultural technology manuals, and historical planting records to construct an initial set of triples; inputting the structured environmental observation tuples and the initial set of triples into a graph neural network encoder to generate node embedding vectors; calculating semantic association weights between entities using a graph attention mechanism based on the node embedding vectors to construct a dynamic adjacency matrix; iteratively updating node representations through graph convolutional layers to obtain entity feature vectors that integrate multi-source information; executing a path reasoning algorithm based on the entity feature vectors to derive implicit planting adaptation rules in the knowledge graph; if the reasoning result meets preset substitution planting compliance constraints, writing the newly generated triples into a distributed graph database and synchronizing them to edge computing nodes through a consensus mechanism; retrieving subgraph structures matching the current plot coordinates from the distributed graph database, determining whether a closed-loop reasoning path exists in the subgraph, and outputting executable planting decision suggestions if such a path exists.
[0006] In one aspect of this disclosure, the step of acquiring soil moisture, light intensity, temperature, and precipitation data from IoT sensor nodes deployed in alternative planting areas, analyzing crop growth status in conjunction with remote sensing imagery, and generating structured environmental observation tuples includes:
[0007] Raw sensor data is collected from soil temperature and humidity sensors, light sensors, and weather stations deployed in the field via the LoRaWAN protocol and encapsulated into JSON format messages with timestamps and geographic coordinates.
[0008] Using a drone equipped with a multispectral camera to acquire NDVI index images, crop coverage areas are extracted using a U-Net segmentation model to generate pixel-level growth status labels;
[0009] Align JSON format messages with NDVI image labels to the same geographic grid cell, and use spatial interpolation algorithms to fill in missing values to form observation records with uniform spatiotemporal granularity;
[0010] Perform schema mapping on the observation records, mapping the field "soil moisture" to the predicate "hasSoilMoisture" in the RDF triple, with the subject "Plot_Region_XY" and the object being a numeric literal;
[0011] Add a source identifier to all mapped triples. The identifier includes the device ID, acquisition time, and data reliability score, generating a structured environmental observation tuple with traceability information.
[0012] In one aspect of this disclosure, the step of performing entity recognition and relation extraction on policy and regulatory texts, agricultural technical manuals, and historical planting records to construct an initial set of triples includes:
[0013] Policy documents related to alternative cropping were crawled from the official website of the Ministry of Agriculture and Rural Affairs and the databases of local anti-drug offices. The BERT-BiLSTM-CRF model was used to identify named entities such as "crop varieties", "prohibited planting areas" and "subsidy standards".
[0014] After performing OCR processing on the agricultural technology extension PDF document, the subject-verb-object structure is extracted by matching operational phrases such as "fertilization cycle", "irrigation frequency" and "pest and disease control" using rule templates.
[0015] Extract farmer ID, planting area, harvest yield and crop rotation records from historical planting ledgers, and construct instance triples in the form of "Farmer_A-cultivated-Crop_B";
[0016] Align the entity recognition results and relation extraction results to a predefined ontology, which includes the Class "AlternativeCrop", Property "requiresMinRainfall", and Datatype "hectare".
[0017] An authority-based resolution strategy is applied to conflicting triples, prioritizing the retention of data from government-published sources to generate an initial set of conflict-free triples.
[0018] In one aspect of this disclosure, the step of inputting the structured environment observation tuples and the initial set of triples into a graph neural network encoder to generate node embedding vectors includes:
[0019] Transform the triples into a graph structure, where each unique URI is a graph node and each predicate is a directed edge;
[0020] For numerical attributes (such as rainfall), binning and discretization are used for embedding, while for textual attributes (such as policy clauses), Sentence-BERT is used to generate 768-dimensional vectors.
[0021] Initialize the node feature matrix, where rows correspond to nodes and columns correspond to feature dimensions; missing features are filled with zero vectors.
[0022] The node feature matrix and adjacency matrix are input into a two-layer GraphSAGE encoder. Each layer aggregates the neighbor node information and concatenates its own features.
[0023] After processing with the nonlinear activation function ReLU, a 128-dimensional node embedding vector is output, which contains a mixture of semantic and numerical features.
[0024] In one aspect of this disclosure, the step of calculating semantic association weights between entities and constructing a dynamic adjacency matrix based on the node embedding vector using a graph attention mechanism includes:
[0025] For any two nodes i and j, calculate the dot product attention score of their embedding vectors;
[0026] The attention score is normalized using Softmax to obtain the weight α_ij of edge (i,j);
[0027] Set a threshold τ=0.35. If α_ij≥τ, then keep the edge in the dynamic adjacency matrix; otherwise, set it to zero.
[0028] Add a relationship type label to the retained edges, such as "climate suitability" or "policy compliance";
[0029] Output a sparse dynamic adjacency matrix, where the matrix elements reflect the strength of semantic relevance.
[0030] In one aspect of this disclosure, the step of iteratively updating node representations through graph convolutional layers to obtain entity feature vectors incorporating multi-source information includes:
[0031] The dynamic adjacency matrix and node embedding vector are input into a three-layer GCN, and each layer executes... Operations;
[0032] Where A is the adjacency matrix, D is the degree matrix, W^(l) is the learnable parameter, and σ is the ELU activation function;
[0033] After the output of the third layer, the feature vector of each node is L2 normalized;
[0034] Perform cluster analysis on the normalized vectors to identify potential planting pattern clusters;
[0035] Output the final entity feature vector for subsequent inference.
[0036] In one aspect of this disclosure, the step of executing a path reasoning algorithm based on the entity feature vector to derive implicit planting adaptation rules in the knowledge graph includes:
[0037] Set the source node to the current parcel's geographic identifier and the target node to the "ApprovedAlternativeCrop" class;
[0038] The TransR spatial mapping method is used to project relations onto a specific subspace to calculate path scores;
[0039] Traverse paths with a length of no more than 4 and filter candidate paths with a score higher than 0.8;
[0040] Perform logical consistency checks on candidate paths and exclude paths that violate hard constraints such as "no planting at altitudes above 2500m";
[0041] The effective path is transformed into a rule form of "If soil pH ∈ [6.0, 7.5] AND annual rainfall > 800 mm THEN recommends planting maca".
[0042] In one aspect of this disclosure, the step of writing the newly generated triplet into the distributed graph database and synchronizing it to the edge computing nodes through a consensus mechanism if the inference result satisfies the preset alternative planting compliance constraints includes:
[0043] Serialize the rule triples into XML format;
[0044] The IPFS client is invoked to generate a content hash CID, which serves as a unique identifier for the triple.
[0045] Initiate a write transaction to the Neo4j cluster. The transaction includes the CID, generation time, and inference path summary.
[0046] Edge nodes monitor event logs on the blockchain and trigger local cache updates when a new block is detected to contain the CID of their local area.
[0047] The Raft consensus protocol ensures that at least three edge nodes confirm successful writes and complete synchronization.
[0048] In one aspect of this disclosure, the step of retrieving a subgraph structure matching the current plot coordinates from a distributed graph database, determining whether a closed-loop reasoning path exists in the subgraph, and outputting an executable planting decision suggestion if such a path exists, includes:
[0049] Query the spatial index using the plot coordinates as the key to return all entity nodes within a radius of 5 kilometers;
[0050] Construct an induced subgraph containing these nodes and their connecting edges;
[0051] Run a depth-first search to check if there is a loop that starts from "CurrentPlot" and returns to "ApprovedCrop";
[0052] If a loop exists, extract all relation labels on the loop and combine them into a chain of decision reasons;
[0053] The decision recommendations and reasoning chains are encapsulated in JSON-LD format and pushed to farmers' mobile terminals via the MQTT protocol.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] The knowledge graph construction method for opium poppy substitution proposed in this invention achieves full-chain knowledge construction and decision support from data collection, knowledge extraction, semantic association to intelligent reasoning by deeply integrating multi-source heterogeneous information such as IoT sensor data, remote sensing images, policy and regulatory texts, agricultural technology manuals, and historical planting records. The method first utilizes the LoRaWAN protocol and UAV remote sensing technology to achieve real-time and accurate perception of the planting area environment and crop growth status, generating structured observation tuples with traceability information. Then, through the BERT-BiLSTM-CRF model and rule templates, entities and relationships are extracted from text and unstructured data to construct a set of triples conforming to ontology specifications. Further, by leveraging a graph neural network encoder and attention mechanism, semantic relationships between entities are dynamically learned to construct a dynamic knowledge graph that reflects complex dependencies. Based on this, multi-source features are fused through a graph convolutional network, and planting rules that meet environmental adaptability and policy compliance are automatically derived based on the TransR path reasoning mechanism. Ultimately, the system achieves reliable knowledge storage and cross-domain collaboration through a distributed graph database and blockchain synchronization mechanism. Combined with geospatial retrieval and closed-loop path analysis, it provides farmers with interpretable and actionable planting decision recommendations. This method effectively overcomes the problems of data silos, knowledge fragmentation, and insufficient reasoning ability in traditional alternative crop management, significantly improving the scientific rigor, compliance, and operability of planting decisions. It provides strong technical support for promoting the intelligent, precise, and sustainable development of poppy alternative crop cultivation. Attached Figure Description
[0056] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0057] Figure 1 This is one of the flowcharts for a knowledge graph construction method for poppy alternative planting according to the present invention.
[0058] Figure 2 This is the second flowchart of a knowledge graph construction method for poppy alternative planting according to the present invention. Detailed Implementation
[0059] The present invention will be further described below with reference to embodiments. These embodiments are merely some, not all, of the embodiments of the present invention. Other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are all within the protection scope of the present invention.
[0060] Example 1
[0061] Please see Figure 1 as well as Figure 2 As shown, this embodiment discloses a method for constructing a knowledge graph for poppy substitution planting, including: acquiring soil moisture, light intensity, temperature, and precipitation data from IoT sensor nodes deployed in the substitution planting area; analyzing crop growth status by combining remote sensing images to generate structured environmental observation tuples; performing entity recognition and relation extraction on policy and regulatory texts, agricultural technology manuals, and historical planting records to construct an initial triplet set; inputting the structured environmental observation tuples and the initial triplet set into a graph neural network encoder to generate node embedding vectors; and using a graph attention mechanism to calculate the actual... Semantic association weights between entities are used to construct a dynamic adjacency matrix; node representations are iteratively updated through graph convolutional layers to obtain entity feature vectors that integrate multi-source information; based on the entity feature vectors, a path reasoning algorithm is executed to deduce implicit planting adaptation rules in the knowledge graph; if the reasoning result meets the preset alternative planting compliance constraints, the newly generated triples are written into the distributed graph database and synchronized to edge computing nodes through a consensus mechanism; subgraph structures matching the current plot coordinates are retrieved from the distributed graph database, and it is determined whether there is a closed-loop reasoning path in the subgraph; if so, an executable planting decision suggestion is output.
[0062] The knowledge graph construction method for opium poppy substitution proposed in this invention achieves full-chain knowledge construction and decision support from data collection, knowledge extraction, semantic association to intelligent reasoning by deeply integrating multi-source heterogeneous information such as IoT sensor data, remote sensing images, policy and regulatory texts, agricultural technology manuals, and historical planting records. The method first utilizes the LoRaWAN protocol and UAV remote sensing technology to achieve real-time and accurate perception of the planting area environment and crop growth status, generating structured observation tuples with traceability information. Then, through the BERT-BiLSTM-CRF model and rule templates, entities and relationships are extracted from text and unstructured data to construct a set of triples conforming to ontology specifications. Further, by leveraging a graph neural network encoder and attention mechanism, semantic relationships between entities are dynamically learned to construct a dynamic knowledge graph that reflects complex dependencies. Based on this, multi-source features are fused through a graph convolutional network, and planting rules that meet environmental adaptability and policy compliance are automatically derived based on the TransR path reasoning mechanism. Ultimately, the system achieves reliable knowledge storage and cross-domain collaboration through a distributed graph database and blockchain synchronization mechanism. Combined with geospatial retrieval and closed-loop path analysis, it provides farmers with interpretable and actionable planting decision recommendations. This method effectively overcomes the problems of data silos, knowledge fragmentation, and insufficient reasoning ability in traditional alternative crop management, significantly improving the scientific rigor, compliance, and operability of planting decisions. It provides strong technical support for promoting the intelligent, precise, and sustainable development of poppy alternative crop cultivation.
[0063] Example 2
[0064] Please see Figure 1 as well as Figure 2 As shown, this embodiment is a further optimization based on embodiment one. In this embodiment, the specific operations are as follows:
[0065] First, an IoT sensor node network is deployed within the alternative planting area, including soil temperature and humidity sensors, light intensity sensors, and a miniature weather station. These devices communicate with the edge gateway via the LoRaWAN protocol. The soil temperature and humidity sensors are buried 10 to 30 centimeters below the surface, the light intensity sensors are mounted on the top of a pole 1.5 meters above the ground, and the weather station is deployed in the center of the field. All three types of devices are equipped with GPS modules to obtain precise geographic coordinates and have built-in real-time clocks for time synchronization. Each sensor node collects raw data at a preset period (e.g., every 15 minutes) and encapsulates the data into a JSON message. The message structure includes the fields: “device_id”, “timestamp”, “latitude”, “longitude”, “soil_moisture”, “light_intensity”, “air_temperature”, and “precipitation”. This JSON message is uploaded to the edge computing node via the LoRaWAN wireless link, completing the initial aggregation of environmental observation data.
[0066] Meanwhile, drones equipped with multispectral cameras periodically photograph the same alternative planting area, with a flight altitude set at 80 meters, a forward overlap rate of no less than 70%, and a lateral overlap rate of no less than 60%. After acquiring red and near-infrared images, the normalized difference vegetation index (NDVI) is calculated in real time using the formula NDVI = (NIR - Red) / (NIR + Red). The acquired NDVI images are input into a pre-trained U-Net semantic segmentation model, which has been fine-tuned on a local historical crop image dataset. The output is a pixel-level classification result, with each pixel labeled as "crop cover" or "bare soil / non-crop". Subsequently, the segmentation results are spatially overlaid with the plot vector boundaries in a geographic information system (GIS), and the pixel labels are aggregated into standard geographic grid units (e.g., a 100m × 100m grid) to generate a crop growth status label for each grid unit, such as "vigorous", "medium", "sparse", or "no cover".
[0067] Next, the aforementioned JSON-formatted sensor data is spatiotemporally aligned with the NDVI-derived growth status labels. Specifically, using geographic grid cells as the basic unit, data from all sensor nodes falling within the same grid are aggregated according to a time window (e.g., daily). Inverse distance weighted interpolation is used to fill in missing values caused by equipment failure, ensuring that each grid cell has a complete environmental observation record within each time step. Then, a schema mapping operation is performed: the subject of the RDF triple is defined as a URI of the form "Plot_Region_XY", where X and Y are the coordinates of the lower left corner of the grid; the predicates include "hasSoilMoisture", "hasLightIntensity", "hasAirTemperature", "hasPrecipitation", and "hasCropCoverageStatus"; the objects are the corresponding numerical or enumerated values. For example, if the average daily soil moisture of a certain grid cell is 28%, then the following triple is generated:<Plot_Region_1024_512> "28"^^xsd:float. Additionally, a source identifier is appended to each triple, consisting of the device ID, data acquisition start and end times, and a confidence score (between 0.0 and 1.0) calculated based on the device calibration records, forming a structured set of environmental observation tuples with traceability information.
[0068] On the other hand, policy and regulatory texts, agricultural technology guidance manuals, and historical planting records related to alternative cropping were crawled from the official website of the Ministry of Agriculture and Rural Affairs, the databases of provincial drug control committee offices, and public channels of local agricultural technology extension stations. Policy documents were stored in PDF or HTML format, and the plain text content was first extracted using the Apache Tika tool. Agricultural technology manuals were mostly scanned PDFs, requiring text recognition by the Tesseract OCR engine before text cleaning. For the cleaned text, a pre-trained BERT-BiLSTM-CRF joint model was loaded. This model was fine-tuned on local corpora labeled with entity types such as "crop variety," "prohibited planting area," "subsidy amount," and "rotation requirements" to identify named entities. For example, in the "Yunnan Province Alternative Crop Subsidy Management Measures," the entities "Maca" (type: AlternativeCrop), "Nujiang Prefecture" (type: ProhibitedRegion), and "1500 yuan / mu" (type: SubsidyStandard) were identified. For operational descriptions in agricultural technical documents, such as "Apply 15 kg / mu of nitrogen fertilizer on the 30th day after maca sowing," regular expression templates are used to match the subject (crop name), predicate (operational verb), and object (parameters) to extract structured relationships. Historical planting ledgers are usually stored in Excel or CSV format. Fields such as "farmer ID," "planting plot code," "crop type," "area (mu)," "harvest (kg)," and "rotation year" are parsed to construct a structured relationship.<Farmer_GD2023><Crop_Maca> ,<Crop_Maca><Plot_Region_1024_512> Instance triples, etc.
[0069] The triples obtained from the above text parsing are aligned with a predefined ontology. This ontology is written in OWL, with top-level classes including "GeographicRegion", "Farmer", "AlternativeCrop", and "PolicyDocument"; object attributes including "cultivated", "prohibits", and "recommends"; and data attributes including "requiresMinRainfall" (domain: AlternativeCrop, value domain: xsd:float) and "hasArea" (domain: Plot, value domain: xsd:decimal, unit: hectare). During the alignment process, if multiple sources of triples are found to contain conflicting information (e.g., different documents specify minimum rainfall requirements for maca of 700mm and 800mm respectively), the data sources are sorted according to their authority: national policy documents > provincial documents > municipal documents > agricultural technology manuals > historical ledgers. Only the triples from the highest authority source are retained, generating an initial set of triples without logical contradictions.
[0070] The structured environment observation tuples are merged with the initial set of triples and uniformly converted into a graph structure representation. Each unique URI in the graph (e.g.,<Plot_Region_1024_512> ,<Crop_Maca> ,<Policy_YN2022> Each node corresponds to a predicate in a triplet; each predicate corresponds to a directed edge, with the direction pointing from the subject to the object. Node features are initialized: for numerical attributes (such as rainfall and area), equal-frequency binning is used to divide them into 10 intervals, each interval is mapped to a 10-dimensional one-hot vector; for textual attributes (such as the full text of policy clauses), the Sentence-BERT model (all-MiniLM-L6-v2) is used to encode them into a 768-dimensional dense vector; for categorical attributes (such as crop types), an embedding layer is used to map them into a 64-dimensional vector. The above features are concatenated to form the initial node feature vector, with missing feature dimensions filled with zeros. Then, the node feature matrix H^(0) and the adjacency matrix A are input into a two-layer GraphSAGE encoder. The first layer aggregates the feature mean of each node's first-order neighbors, concatenates it with its own features, and then performs a linear transformation and ReLU activation to obtain H^(1); the second layer repeats the same operation to obtain H(2), and finally outputs a 128-dimensional node embedding vector, which integrates semantic and numerical information.
[0071] Based on node embedding vectors, the semantic association strength between any two nodes i and j is calculated. Specifically, a dot product attention mechanism is used: e_ij = h_i^T·h_j is calculated, where h_i and h_j are the embedding vectors of nodes i and j, respectively. For all neighbors j of node i, the normalized weight α_ij = exp(e_ij) / Σ_kexp(e_ik) is calculated. A threshold τ = 0.35 is set; if α_ij ≥ τ, the edge (i,j) is retained in the dynamic adjacency matrix A'; otherwise, it is set to 0. A relation type label is attached to the retained edge, which is mapped from the original triple predicate, such as "hasSoilMoisture" mapped to "EnvironmentalObservation", and "recommends" mapped to "PolicyCompliance". This generates a sparse dynamic adjacency matrix A', whose element values reflect the strength of semantic correlation between entities.
[0072] The dynamic adjacency matrix A' and the node embedding vector H^(2) are input into a three-layer graph convolutional network (GCN). The first layer performs the operation H^(3)=ELU(D'^(-1 / 2)A'D'^(-1 / 2)H^(2)W^(2)), where D' is the degree matrix of A' and W^(2) is a 128×128 learnable parameter matrix. The second and third layers perform the same operation in sequence, resulting in H^(4) and H^(5) respectively. After the output of the third layer, the feature vector of each node is normalized by the L2 norm to obtain the final entity feature vector. Then, DBSCAN clustering is performed on the feature vector set with parameters set to eps=0.4 and min_samples=5, which identifies several planting pattern clusters, each cluster representing a typical "environment-crop-policy" combination pattern.
[0073] Based on the current land parcel to be decided (e.g.)<Plot_Region_1024_512> Using `p=(e_1,r_1,e_2,r_2,...,e_n)` as the source node and all instances of the `ApprovedAlternativeCrop` class in the ontology as target nodes, path reasoning is performed. The TransR model is used, projecting nodes and relations onto relation-specific subspaces: for a path `p=(e_1,r_1,e_2,r_2,...,e_n)`, its score function is Σ_i||M_{r_i}e_i+r_i-M_{r_i}e_{i+1}||2, where M{r_i} is the projection matrix corresponding to relation `r_i`. All paths with a length not exceeding 4 are traversed, and paths with scores below 0.8 are eliminated. Hard constraint checks are performed on the remaining candidate paths; for example, if a path contains "altitude > 2500m" and the target crop is "rubber tree" (it is known that rubber trees are prohibited from being planted above 1500m), then the entire path is invalid. The effective path is transformed into an IF-THEN rule, such as "If soil pH ∈ [6.0, 7.5] AND annual rainfall > 800 mm THEN recommends planting maca", and further encoded into a triplet form, such as...<Rule_001><Condition_A> ,<Condition_A> "[6.0,7.5]" etc.
[0074] If the generated rule triples meet preset compliance constraints (such as not violating national anti-drug regulations or conforming to local industrial planning), they are serialized into XML format. The IPFS (InterPlanetary FileSystem) client is invoked to add the XML file to the distributed file system, generating a Content Identifier (CID) (e.g., QmXyZ...). A write transaction is then initiated to the Neo4j graph database cluster, including the CID, rule generation timestamp, and inference path summary (recording the nodes and edges used). This transaction is recorded on a private blockchain (e.g., Hyperledger Fabric), and edge computing nodes continuously monitor the blockchain event log. When a new block is detected containing a CID relevant to the local area, the edge node automatically triggers a local cache update process: pulling the corresponding XML file from the IPFS network, parsing it, and loading it into a local lightweight graph database (e.g., JanusGraph). To ensure data consistency, the Raft consensus protocol is used, requiring at least three edge nodes to confirm successful writes before synchronization is considered complete.
[0075] When a farmer submits a request to query plot coordinates via a mobile terminal, the system uses those coordinates as the center to query a spatial index (such as GeoHash or R-tree), returning all entity nodes within a 5-kilometer radius. Based on these nodes and their interconnections, an induced subgraph G_sub is constructed. A depth-first search (DFS) algorithm is run on G_sub, starting at the current plot node and ending at any "ApprovedAlternativeCrop" instance. If, during the DFS process, a path is found that ultimately returns to a recommended crop node and forms a closed loop (i.e., there exists a path from the starting point through several intermediate nodes that eventually leads to...), the system will consider the farmer's actions.<Crop_X> ,and<Crop_X> If the structure can be indirectly linked back through other paths, a closed-loop reasoning path is determined to exist. The relation labels of all edges on this loop are extracted and sequentially combined into a decision reasoning chain, such as "suitable soil moisture - meets maca's water requirements - policy allows planting - stable historical yields". Finally, the recommended crop name, planting parameter suggestions, and reasoning chain are encapsulated in JSON-LD format and pushed to the farmer's registered mobile terminal via the MQTT protocol, completing the output of the planting decision suggestion.
[0076] Throughout the implementation, all modules—including environmental perception, text parsing, graph embedding, relationship modeling, feature fusion, rule reasoning, data synchronization, and decision output—interact with each other via API interfaces. Data exchange uses standardized formats (such as JSON-LD and XML) to ensure loose coupling and scalability between system components. Edge computing nodes are deployed at county-level agricultural information centers, possessing local data processing and caching capabilities, and can continue to provide basic decision-making services even during network outages. The central knowledge graph server is responsible for global model training and rule validation, and periodically distributes updated embedding models and ontology definitions to edge nodes, enabling continuous system evolution and optimization.
[0077] To enable those skilled in the art to fully understand and implement this invention, the following explanation of the implementation principle of this invention is provided in conjunction with a specific application scenario.
[0078] In a demonstration area for alternative crop cultivation in Nujiang Prefecture, Yunnan Province, the local agricultural department plans to guide farmers to convert their former poppy-growing plots into legal cash crop cultivation. The area has complex terrain, with an altitude ranging from 1800 to 2300 meters, an average annual rainfall of approximately 950 mm, and red soil as the main soil type with a pH of approximately 6.3. The system first acquires environmental data through a LoRaWAN sensor network deployed in the fields: soil temperature and humidity sensors are buried at a depth of 20 cm and upload data every 15 minutes; a miniature weather station records daily cumulative rainfall and average daily temperature; and a light sensor simultaneously collects average daily light intensity. Simultaneously, a drone performs a weekly aerial photography mission at an altitude of 80 meters to acquire multispectral images covering the entire demonstration area. After NDVI calculation and U-Net model segmentation, the crop cover status within the grid cell numbered Plot_Region_1024_512 is identified as "moderate," indicating that the current crop growth is not optimal.
[0079] The aforementioned sensor data and remote sensing labels were spatiotemporally aligned to the same 100m × 100m geographic grid, and missing values due to offline status of individual sensors were supplemented using inverse distance-weighted interpolation. Subsequently, the system mapped the daily average soil moisture (28%), daily average light intensity (45klux), daily average temperature (18.5℃), daily precipitation (0.2mm), and crop status "moderate" into RDF triples, with the subject unified as...<Plot_Region_1024_512> The data is then appended with a source identifier, and a confidence score is set to 0.92 based on the device’s most recent calibration record, forming a structured set of environmental observation tuples.
[0080] Meanwhile, the system crawled the "National Recommended Directory of Alternative Crops (2023 Edition)" from the official website of the Ministry of Agriculture and Rural Affairs, obtained the "List of Prohibited Crops in High-Altitude Areas of Nujiang Prefecture" from the Yunnan Provincial Narcotics Control Commission database, and obtained the "Standardized Cultivation Technical Regulations for Maca" from the prefecture's agricultural technology extension station. After processing with ApacheTika and TesseractOCR, the system used a fine-tuned BERT-BiLSTM-CRF model to identify key entities: "Maca" (AlternativeCrop), "Nujiang Prefecture" (ProhibitedRegion), "Minimum Annual Rainfall 800mm" (MinRainfallRequirement), and "Suitable pH Range 6.0–7.5" (SoilPHRange). Rule template matching extracted operation instructions such as "Apply 15 kg / mu of nitrogen fertilizer on the 30th day after maca sowing". Historical record analysis showed that the plot had been planted with maca by farmer Farmer_GD2023 in rotation for the past three years, with an average yield of 1200 kg / mu and no violations. All information was converted into triples and aligned with the predefined OWL ontology. When a provincial document requires a minimum rainfall of 800mm for maca production, while a county-level manual states 700mm, the system retains the provincial data based on authority to eliminate the conflict.
[0081] An initial knowledge graph is constructed by merging environmental observation tuples and text triples. (Nodes in the graph)<Plot_Region_1024_512> Numerical attributes (e.g., rainfall 950mm) are mapped into one-hot vectors using equal-frequency binning; textual attributes (e.g., policy clauses) are encoded into 768-dimensional vectors using Sentence-BERT; and categorical attributes (e.g., crop type) are generated into 64-dimensional vectors through an embedding layer. These are then concatenated to form the initial features. This feature matrix and the adjacency matrix are input into a two-layer GraphSAGE encoder. The first layer aggregates its direct neighbors (e.g., ...).<Crop_Maca> ,<Policy_YN2022> ,<Farmer_GD2023> The second layer further aggregates second-order neighbor information, and finally outputs a 128-dimensional embedding vector, which implicitly encodes the comprehensive semantics of "the plot is environmentally suitable for maca, policy allows it, and has a good historical performance".
[0082] Based on this embedding vector, the system calculates...<Plot_Region_1024_512> and<Crop_Maca> The dot product attention score e_ij = h_i^T·h_j, after Softmax normalization, yields a weight α_ij = 0.41, which is higher than the threshold τ = 0.35. Therefore, the edge is retained in the dynamic adjacency matrix A' and labeled with the relation type "EnvironmentalSuitability". Similarly,<Crop_Maca> and<Policy_YN2022> The compliance of the marginal policy between them is also preserved. The three-layer GCN iteratively updates the node representation on this sparse graph. After L2 normalization, the output of the third layer is identified by DBSCAN clustering as belonging to the "high-altitude maca-adapted" pattern cluster.
[0083] Path reasoning stage, with<Plot_Region_1024_512> Starting from the class, traverse all paths to that class. A path of length 3 is:<Plot_Region_1024_512> The path with the following parameters (SoilPH "6.3" - Crop_Maca ← requires Min Rainfall "800" ← Plot_Region_1024_512, annual rainfall 950 > 800) scored 0.76 using TransR projection subspace, which is below the 0.8 threshold and was therefore discarded. Another path included a hard constraint check: the system determined the site's elevation to be 2100 meters, while rubber trees are prohibited above 1500 meters; therefore, paths containing rubber trees were forcibly excluded. The final valid path was converted into the rule: "If soil pH ∈ [6.0, 7.5] AND annual rainfall > 800 mm THEN, maca is recommended for planting."
[0084] After the rule triplets undergo compliance verification (not violating Article 19 of the Anti-Drug Law and the Nujiang Prefecture Industrial Planning), they are serialized into XML, uploaded to IPFS to obtain CIDQmXyZ..., and the transaction is written to Neo4j and recorded on the Hyperledger Fabric blockchain. Three edge nodes deployed at the Nujiang Prefecture Agricultural Information Center reach consensus via the Raft protocol and synchronously load the rule into their local JanusGraph database.
[0085] When farmers submit their coordinates (102.4°E, 26.8°N) via a mobile app, the system uses a GeoHash index to retrieve entities within a 5-kilometer radius, constructing an induced subgraph G_sub. The Depth-First Search (DFS) algorithm discovers the path in G_sub: -hasSoilMoisture-EnvironmentalCondition_A-suitableFor-Crop_Maca-cultivatedBy-Farmer_GD2023-plantedOn-CurrentPlot, forming a closed loop. The system extracts the relational tag sequence and generates a reasoning chain: "Suitable soil pH - Sufficient annual rainfall - Meets the ecological requirements of maca - Explicitly permitted by policy - Successful historical crop rotation." Finally, the system recommends "maca" and corresponding fertilization suggestions, pushed to the farmer's terminal via MQTT in JSON-LD format, achieving interpretable, traceable, and compliant intelligent decision-making output.
[0086] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for constructing a knowledge graph for poppy substitution planting, characterized in that, include: Data on soil moisture, light intensity, temperature and precipitation are obtained from IoT sensor nodes deployed in alternative planting areas. The crop growth status is analyzed by combining remote sensing images to generate structured environmental observation tuples. Entity identification and relation extraction are performed on policy and regulatory texts, agricultural technology manuals, and historical planting records to construct an initial set of triples; The structured environment observation tuples and the initial set of triples are input into the graph neural network encoder to generate node embedding vectors; Based on the node embedding vector, a graph attention mechanism is used to calculate the semantic association weights between entities and construct a dynamic adjacency matrix; The node representation is updated iteratively through graph convolutional layers to obtain entity feature vectors that fuse information from multiple sources; Based on the entity feature vector, a path reasoning algorithm is executed to deduce the implicit planting adaptation rules in the knowledge graph; If the reasoning result meets the preset alternative planting compliance constraints, the newly generated triple is written into the distributed graph database and synchronized to the edge computing node through the consensus mechanism. Retrieve subgraph structures that match the coordinates of the current plot from the distributed graph database, determine whether there is a closed-loop reasoning path in the subgraph, and if so, output executable planting decision suggestions.
2. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The steps of acquiring soil moisture, light intensity, temperature, and precipitation data from IoT sensor nodes deployed in alternative planting areas, analyzing crop growth status in conjunction with remote sensing imagery, and generating structured environmental observation tuples include: Raw sensor data is collected from soil temperature and humidity sensors, light sensors, and weather stations deployed in the field via the LoRaWAN protocol and encapsulated into JSON format messages with timestamps and geographic coordinates. Using a drone equipped with a multispectral camera to acquire NDVI index images, crop coverage areas are extracted using a U-Net segmentation model to generate pixel-level growth status labels; Align JSON format messages with NDVI image labels to the same geographic grid cell, and use spatial interpolation algorithms to fill in missing values to form observation records with uniform spatiotemporal granularity; Perform schema mapping on the observation records, mapping the soil moisture field to the predicate hasSoilMoisture in the RDF triple, with the subject being Plot_Region_XY and the object being a numeric literal; Add a source identifier to all mapped triples. The identifier includes the device ID, acquisition time, and data reliability score, generating a structured environmental observation tuple with traceability information.
3. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The steps of performing entity recognition and relation extraction on policy and regulatory texts, agricultural technology manuals, and historical planting records to construct an initial set of triples include: We crawled relevant policy documents on alternative planting from the official website of the Ministry of Agriculture and Rural Affairs and the database of local anti-drug offices, and used the BERT-BiLSTM-CRF model to identify named entities of crop varieties, prohibited planting areas and subsidy standards. After performing OCR processing on the agricultural technology extension PDF document, the operation phrases of fertilization cycle, irrigation frequency, and pest and disease control are matched using rule templates to extract the subject-verb-object structure; Extract farmer IDs, planting areas, harvest yields, and crop rotation records from historical planting ledgers to construct instance triples of the form Farmer_A-cultivated-Crop_B. Align the entity recognition results and relation extraction results to a predefined ontology, which includes the Class "AlternativeCrop", Property "requiresMinRainfall", and Datatype "hectare". An authority-based resolution strategy is applied to conflicting triples, prioritizing the retention of data from government-published sources to generate an initial set of conflict-free triples.
4. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The step of inputting the structured environment observation tuples and the initial set of triples into the graph neural network encoder to generate node embedding vectors includes: Transform the triples into a graph structure, where each unique URI is a graph node and each predicate is a directed edge; For numerical attributes, binning and discretization are used before embedding; for textual attributes, Sentence-BERT is used to generate 768-dimensional vectors. Initialize the node feature matrix, where rows correspond to nodes and columns correspond to feature dimensions; missing features are filled with zero vectors. The node feature matrix and adjacency matrix are input into a two-layer GraphSAGE encoder. Each layer aggregates the neighbor node information and concatenates its own features. After processing with the nonlinear activation function ReLU, a 128-dimensional node embedding vector is output.
5. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The step of calculating semantic association weights between entities and constructing a dynamic adjacency matrix based on the node embedding vector using a graph attention mechanism includes: For any two nodes i and j, calculate the dot product attention score of their embedding vectors; The attention score is normalized using Softmax to obtain the weight α_ij of edge (i,j); Set a threshold τ=0.
35. If α_ij≥τ, then keep the edge in the dynamic adjacency matrix; otherwise, set it to zero. Add a relation type label to the retained edges; Output a sparse dynamic adjacency matrix.
6. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The step of iteratively updating node representations through graph convolutional layers to obtain entity feature vectors that fuse multi-source information includes: The dynamic adjacency matrix and node embedding vector are input into a three-layer GCN, and each layer executes... Operations; Where A is the adjacency matrix, D is the degree matrix, W^(l) is the learnable parameter, and σ is the ELU activation function; After the output of the third layer, the feature vector of each node is L2 normalized; Perform cluster analysis on the normalized vectors to identify potential planting pattern clusters; Output the final entity feature vector.
7. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The step of executing a path reasoning algorithm based on the entity feature vector to derive implicit planting adaptation rules in the knowledge graph includes: Set the source node to the current parcel's geographic identifier and the target node to the "ApprovedAlternativeCrop" class; The TransR spatial mapping method is used to project relations onto a specific subspace to calculate path scores; Traverse paths with a length of no more than 4 and filter candidate paths with a score higher than 0.8; Perform a logical consistency check on the candidate paths and exclude paths that violate the hard constraint that prohibits planting at altitudes above 2500m. The effective path is transformed into a rule form of "If soil pH∈[6.0,7.5]AND annual rainfall>800mmTHEN recommends planting maca".
8. The method for constructing a knowledge graph for poppy substitution planting according to claim 1, characterized in that: The step of writing the newly generated triplet into the distributed graph database and synchronizing it to the edge computing nodes through a consensus mechanism if the inference result meets the preset alternative planting compliance constraints includes: Serialize the rule triples into XML format; The IPFS client is invoked to generate a content hash CID, which serves as a unique identifier for the triple. Initiate a write transaction to the Neo4j cluster. The transaction includes the CID, generation time, and inference path summary. Edge nodes monitor event logs on the blockchain and trigger local cache updates when a new block is detected to contain the CID of their local area. The Raft consensus protocol ensures that at least three edge nodes confirm successful writes and complete synchronization.