Construction method of geographic knowledge question answering system based on knowledge graph
By introducing a deep learning model's knowledge graph embedding method in a query question and answer system based on geographic knowledge graphs, combined with the aggregation of time features, the problems of explicit relationship query limitations, insufficient utilization of time features and low integration in the existing system are solved, and higher query accuracy and user trust are achieved.
Patent Information
- Application Number
- CN202411385322.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-09-30
AI Technical Summary
The existing query and answer system based on geographic knowledge graphs has problems such as limitations on explicit relational query, insufficient utilization of time features, low deep learning integration, and lack of transparency in reasoning paths.
By introducing a knowledge graph embedding method based on deep learning models, entities and relationships in the geographical knowledge graph are mapped to low-dimensional continuous vector space for calculation, and combined with the aggregation of temporal features, the intelligence level of the system and the transparency of the inference path are improved.
Querying unrecorded triplets in the geographical knowledge graph is realized, which improves the coverage and accuracy of query results, and improves the overall performance of the system and user trust.
Smart Images

Figure CN118963717B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geographic knowledge question answering technology, and in particular to a method for constructing a geographic knowledge question answering system based on a knowledge graph. Background Art
[0002] In the current knowledge-driven era, geographic knowledge graphs have become an important technology to enhance the intelligence of geographic information systems. Using technologies such as the Neo4j graph database, the query and answer system based on the geographic knowledge graph can parse and reason about questions raised by users. Users only need to enter the content to be reasoned in the browser according to the specified rules, and the system can analyze the question through the geographic knowledge graph in the graph database and give an accurate answer.
[0003] The existing query and answering systems based on geographic knowledge graphs have achieved certain results and applications, but there are still some problems. First, the query and answering of knowledge graphs based on Neo4j graph database can only query the explicit knowledge existing in the current knowledge graph. If the query triple is not recorded in the geographic knowledge graph, the corresponding answer cannot be found. Secondly, when performing query and answering of geographic knowledge graphs, the existing retrieval query and answering methods do not make sufficient use of time features. The time dimension is very important in geographic knowledge, and many geographic entities and events have significant spatiotemporal characteristics. For example, the changes in administrative regions during urban development, the spatiotemporal evolution during the occurrence of natural disasters, etc. In addition, the current query and answering systems still have deficiencies in integrating deep learning algorithms, and fail to fully utilize the advantages of deep learning in knowledge reasoning. The intelligence level of the question and answering system is limited. Finally, when providing answers, the geographic logic query algorithm based on knowledge graph embedding often lacks detailed explanations and transparent reasoning path display, making it difficult for users to understand the basis of the answers given by the system, reducing the user's trust and the interpretability of the results. Knowledge graph embedding methods based on deep learning models can effectively capture and represent the rich semantic and structural information of entities and relationships by mapping entities and relationships in geographic knowledge graphs to low-dimensional continuous vector spaces for calculations, including models such as GQE (Graph Query Embedding) and CGA (Contextual Graph Attention model). By performing calculations in vector space and performing a certain degree of knowledge reasoning, the implicit information in the geographic knowledge graph can be observed, thereby realizing queries for unrecorded triples in the geographic knowledge graph. By aggregating geographic object features and time features in the geographic knowledge graph, the time features can be effectively utilized in knowledge graph embedding calculations.
[0004] The geographic knowledge question-answering system based on knowledge graph integrates geographic knowledge graph and logical query, and provides a rich relationship network through precise knowledge graph query and reasoning to support complex geographic reasoning tasks. Therefore, it is necessary to integrate deep learning algorithms into the knowledge graph geographic logical query system with front-end and back-end, improve the time feature processing capability, reasoning path transparency and deep learning integration, so as to provide intelligent geographic knowledge question-answering services. Summary of the invention
[0005] The purpose of this invention is to provide a method for constructing a geographic knowledge question-answering system based on a knowledge graph to solve the problems of explicit relationship query limitations, insufficient utilization of time features, low integration of deep learning, and lack of transparency of reasoning paths in existing systems. The query capability and reasoning effect of the system are demonstrated through multiple examples, including different scenarios such as general query question-answering and geographic query question-answering. The system can accurately understand and process complex geographic query requests, and provide intuitive result displays such as reasoning path visualization and attribute tables.
[0006] This paper introduces a knowledge graph embedding method based on a deep learning model to map entities and relationships in the geographic knowledge graph to a low-dimensional continuous vector space for calculation. Through calculation and reasoning in the vector space, the implicit relationships in the knowledge graph can be captured and represented, and queries for unrecorded triples in the geographic knowledge graph can be realized, thereby improving the coverage and accuracy of the query results.
[0007] The present invention enhances the intelligence level of the system through a deep learning model, enabling the system to perform more complex and accurate geographic knowledge reasoning and improve the overall performance of the question-answering system. The present invention aggregates the features and time features of geographic objects in the knowledge graph embedding calculation. When performing queries and reasoning, the system can effectively utilize information in the time dimension, making queries for time-sensitive geographic entities and events more accurate. For example, in queries on changes in administrative regions during urban development or queries on the spatiotemporal evolution of natural disasters, the system can provide more detailed answers.
[0008] In order to improve user trust and the interpretability of results, the present invention provides a visualization function of the reasoning path. When the system returns the answer, it displays the path and logical basis of the reasoning process, so that users can clearly understand the basis for the system to give the answer, thereby enhancing user experience and trust.
[0009] To achieve the above object, the present invention provides a method for constructing a geographical knowledge question-answering system based on a knowledge graph, comprising the following steps:
[0010] S1. Create a system development environment based on browser-server architecture;
[0011] S2, build a system architecture including data layer, application service layer and user layer;
[0012] S3, build a geographic knowledge graph query question-answering parsing and processing module;
[0013] S4. Develop a geographical knowledge question-answering system that takes time characteristics into consideration.
[0014] Preferably, in step S1, the browser-server architecture includes front-end interface design, back-end logic processing, and data storage and management;
[0015] The front-end interface design uses HTML, CSS and JavaScript to build a user interface, wherein the JavaScript is used to provide dynamic content update, user input processing, and event response interaction functions for the Web page;
[0016] The backend logic processing uses Python language to build and deploy pre-trained deep learning models, and parse and process geographic knowledge graph query and answer tasks;
[0017] The data storage and management adopts Neo4j graph database, which is used to store structured data in the network and supports efficient query using Cypher language.
[0018] Preferably, in step S2, the data layer is used for data storage and response of the knowledge graph geographic query question-answering system;
[0019] The application service layer is used to parse the query statements returned by the front end and implement geographic logic query;
[0020] The user layer is constructed using HTML, CSS, and JavaScript, and is used for users to input reasoning query statements and display graph visualization and attribute tables of reasoning results.
[0021] Preferably, in step S3, the geographic knowledge graph query question and answer parsing and processing module includes a general query question and answer module and a geographic query question and answer module;
[0022] The general query question and answer refers to the question and answer that does not involve geographic logic reasoning in the knowledge graph query question and answer task, and only performs simple retrieval. The general query question and answer uses Neo4j as the database and uses Cypher commands to retrieve the corresponding answer from the database for output, including forward query and reverse query;
[0023] The geographic query question and answer refers to the user's logical query of basic geographic issues, including geographic entity query, spatial relationship query, geographic event impact query, geographic event occurrence process query and geographic event cause query.
[0024] Preferably, the forward query refers to obtaining a target node through a given head entity and relationship; the reverse query refers to querying an unknown head entity target node given a tail entity and relationship;
[0025] The spatial relationship query refers to the spatial relationship between geographic entities, including topological spatial relationship, sequential spatial relationship and metric spatial relationship, and adopts double-node intersection reasoning as the basic query subgraph, that is, given two starting nodes and two edges, a triplet of two tail entities intersecting is formed to infer the common node;
[0026] The geographic event impact query refers to querying the impact of geographic events, using double-node chain reasoning as the basic query subgraph, that is, knowing a starting node and two edges, and inferring the target node to be queried;
[0027] The geographic entity query refers to the query of geographic entities related to location, and adopts three-node star reasoning as the basic query subgraph, that is, given three starting nodes and three edges, a triple of three intersecting tail entities is formed, and a common node is inferred;
[0028] The geographic event occurrence process query refers to a query related to the occurrence process and dynamic evolution of geographic events, using three-node chain reasoning as the basic query subgraph, that is, given a starting node and three edges, the target node is inferred based on the edges;
[0029] The geographic event cause query refers to querying the cause of the geographic event, using three-node intersection chain reasoning as the basic query subgraph, that is, two starting nodes and three edges are known, and the target node is first intersected and then chained according to the edges.
[0030] Preferably, step S4 specifically includes the following steps:
[0031] S41. Demand analysis includes user demand analysis and system demand analysis;
[0032] S42, Functional design includes algorithm selection, parsing query content, knowledge graph matching and reasoning, logical query and result display;
[0033] S43. Using a modular development approach, the contents of the two modules, front-end page design and back-end reasoning algorithm, are designed in turn.
[0034] Preferably, in step S43, the user interface module is first implemented to ensure the interactivity of the query process and the intuitiveness of the results. The server receives the reasoning instructions passed in by the front-end user, parses and converts them into corresponding queries or geographic reasoning tasks, and calls the reasoning algorithm to generate geographic reasoning results and the Top K entities with higher credibility, and visualizes the reasoning path and attributes in the graph.
[0035] Therefore, the present invention adopts the above-mentioned method for constructing a geographical knowledge question-answering system based on knowledge graph, and the beneficial effects are as follows:
[0036] (1) The present invention designs and implements a geographic query and answering prototype system based on knowledge graph by adopting a browser-server architecture, combining front-end user interface design with back-end deep learning models, and provides a visual query system that supports geographic logical reasoning.
[0037] (2) By analyzing the system requirements, the present invention divides the system into three parts: data layer, application service layer and user layer; adopts front-end technologies such as HTML, CSS and JavaScript to realize rich front-end interactive functions; uses Python language and Neo4j graph database to realize back-end algorithm module and database storage module; supports general query and answer of geographic knowledge and geographic query and answer; supports algorithm selection, query parsing, knowledge graph matching, logical query and result display and other functions, realizing the complete process from user query input to reasoning result display.
[0038] (3) The present invention demonstrates the query capability and reasoning effect of the system through multiple examples, including different scenarios such as general query question and answer and geographic query question and answer; the system can accurately understand and process complex geographic query requests, and provide intuitive result displays such as reasoning paths and attribute tables visualized in knowledge graphs.
[0039] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flow chart of a knowledge graph geographic logic query system of an embodiment of a method for constructing a geographic knowledge question-answering system based on a knowledge graph of the present invention;
[0041] Figure 2 It is a page design of a knowledge graph geographic logic query system according to an embodiment of a method for constructing a geographic knowledge question-answering system based on a knowledge graph of the present invention;
[0042] Figure 3 This is an example of a forward query result of an embodiment of a method for constructing a geographic knowledge question-answering system based on a knowledge graph of the present invention;
[0043] Figure 4 This is an example of a reverse query result of an embodiment of a method for constructing a geographic knowledge question-answering system based on a knowledge graph of the present invention;
[0044] Figure 5 This is an example of a query result of a geographic entity spatial relationship in an embodiment of a method for constructing a geographic knowledge question-answering system based on a knowledge graph of the present invention;
[0045] Figure 6 This is an example of a query result of the impact of geographical events according to an embodiment of a method for constructing a geographical knowledge question-answering system based on a knowledge graph of the present invention;
[0046] Figure 7 This is an example of a geographic entity location query result according to an embodiment of a method for constructing a geographic knowledge question-answering system based on a knowledge graph of the present invention;
[0047] Figure 8 This is an example of a query result of a geographical event occurrence process according to an embodiment of a method for constructing a geographical knowledge question-answering system based on a knowledge graph of the present invention;
[0048] Fig. 9 This is an example of a query result of a geographical event occurrence process according to an embodiment of a method for constructing a geographical knowledge question-answering system based on a knowledge graph of the present invention;
[0049] Fig.10 The invention is based on the GQE diag Examples of the algorithm’s reasoning results;
[0050] Fig.11 The invention is based on TFKGE full An example of the algorithm's inference results. DETAILED DESCRIPTION
[0051] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0052] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.
[0053] The method for constructing a geographic knowledge question-answering system based on a knowledge graph includes the following steps:
[0054] S1. Create a system development environment based on the browser-server (BS) architecture, including front-end interface design, back-end logic processing, and data storage and management;
[0055] The front-end interface design uses HTML, CSS and JavaScript to build the user interface, which is easy to develop and can provide a rich interactive experience. Libraries such as jQuery based on the JavaScript language are used to provide interactive functions such as dynamic content updates, user input processing, and event response for Web pages; GraphVis is an interactive graph data visualization tool library developed based on native JavaScript, with rich built-in graph layout and analysis algorithms, which can effectively improve development efficiency.
[0056] Backend logic processing uses Python, which has a large number of library support in the fields of data processing and machine learning and is one of the most widely used languages in the field of artificial intelligence. Python can be used to build and deploy pre-trained deep learning models, parse and process geographic knowledge graph query and answer tasks;
[0057] The data storage and management in the present invention adopts Neo4j graph database, which is currently the most popular high-performance NoSQL database, for storing structured data in the network and using Cypher language for efficient query.
[0058] S2, such as Figure 1 As shown in the figure, a knowledge graph geographic query and answering system architecture is built, which includes a data layer, an application service layer, and a user layer;
[0059] The data layer is used for data storage and response of the knowledge graph geographic query and answering system. By using the Neo4j graph database to store geographic knowledge graph data, it can support basic queries on the knowledge graph, and use deep learning algorithms to support geographic logical reasoning query functions.
[0060] The application service layer is used to parse the query statements returned by the front end and implement geographic logical queries. For general query questions and answers of the knowledge graph input by users, after obtaining the query statement on the front end page, it is parsed to form a Cypher query statement, and the query content required by the user is obtained from the Neo4j database; for geographic query questions and answers of the knowledge graph input by users, after obtaining the query statement on the front end page, the geographic logical query statement is parsed, and the pre-trained deep learning models such as CGA, GQE, TFKGE are used to infer the user's query request, and the inference results are generated and returned to the user.
[0061] The user layer is a web-based front-end interface built with HTML, CSS, and JavaScript. It is used for users to input reasoning query statements and display graph visualization and attribute tables of reasoning results.
[0062] S3, build a geographic knowledge graph query question-answering parsing and processing module;
[0063] The geographic knowledge graph query and answer parsing and processing module includes a general query and answer module and a geographic query and answer module. After receiving the user's query request, the server parses the query statement into the Cypher language form for general query and answer and the reasoning language form for geographic query and answer according to different query rules.
[0064] General query question answering refers to the question answering that does not involve geographic logic reasoning in the knowledge graph query question answering task, but only performs simple retrieval. General query question answering uses Neo4j as the database, and uses Cypher commands to retrieve the corresponding answers from the database for output, including forward query (entity, relationship, C?) and reverse query (C?, relationship, entity), and takes the basic query of a single triple missing entity as an example to illustrate.
[0065] (1) Forward query
[0066] A forward query is to obtain the target node through a given head entity and relationship. For example, to query "what is the capital of country A", the user constructs the query command on the front end:
[0067] (1)
[0068] in, Indicates the entity to be queried. This statement indicates the query header entity country A and the entity to be queried There is a capital relationship (HasCapital) between them.
[0069] After receiving the forward query request, the system parses it into the Cypher language format that supports the Neo4j graph database:
[0070] (2)
[0071] Among them, p represents the head entity, and the type of p is place (Place); t represents the entity to be queried, and the type of t is place (Place), and the head entity p and the entity to be queried t form a HasCapital relationship.
[0072] (2) Reverse query
[0073] Reverse query means to query the unknown head entity target node given the tail entity and relationship, for example, query "all countries adjacent to country B". The user constructs the query command:
[0074] (3)
[0075] in, Indicates the entity to be queried. This statement indicates that the query tail entity country B and the entity to be queried There is a neighboring relationship between them (HasNeighbor).
[0076] After receiving the reverse query request, the system parses it into the Cypher language format that supports the Neo4j graph database:
[0077] (4)
[0078] Among them, p represents the entity to be queried, and the type of p is place (Place); m represents the tail entity, and the type of m is place (Place), and the query entity p and the tail entity m constitute a HasNeighbor relationship.
[0079] Geographic query answering means that users can use CGA (Contextual Graph Attention model), GQE (Graph Query Embedding), GQE diag (GQE model uses the bilinear diagonal matrix in DisMult as the projection operator), TFKGE direct (a knowledge graph logical query model that takes into account temporal features, and the temporal feature encoder uses a direct encoding method), TFKGE fnn (a knowledge graph logical query model that takes into account temporal features, and the temporal feature encoder uses a feedforward neural network encoding method) and TFKGE full (a knowledge graph logical query model that takes into account time features, and the time feature encoder uses the Date2vec encoding method) and other algorithms to perform logical queries on basic geographic issues, including queries on spatial relationships of geographic entities, queries on the impact of geographic events, queries on the location of geographic entities, queries on the process of geographic events, and queries on the causes of geographic events. The pre-trained model supports multi-level reasoning. When users need to perform geographic logical queries, they can select the corresponding algorithm and generate reasoning paths by reasoning triples. After the server obtains the reasoning requirements, it calls the pre-trained model to generate reasoning results and attribute tables. At the same time, this system provides functions such as further querying the attribute relationship characteristics of the target node inferred by the query.
[0080] In response to geographical questions such as "Where is it", "How did it happen", "What does it look like", "Why is it there", and "What impact did it have", examples of queries on the spatial relationships of geographic entities, the impact of geographic events, the location of geographic entities, the process of geographic events, and the causes of geographic events are shown.
[0081] (1) Spatial relations between geographic entities
[0082] Spatial relationship query refers to the spatial relationship between geographic entities, including topological spatial relationship, sequential spatial relationship and metric spatial relationship. Double-node intersection reasoning is used as the basic query subgraph, that is, given two starting nodes and two edges, a triplet of two tail entities intersecting is formed, and the common node is inferred. The following query statement is to find a country that is adjacent to both country C and country D, and query the climate characteristics of this country.
[0083] (5)
[0084] in, Represents the entity to be queried, Represents the climate characteristics of the entity to be queried.
[0085] The query of this module is divided into two parts: reasoning and retrieval. Taking the query of spatial relationship of geographic entities as an example, the system first uses the deep learning model to reason about "find a country that is adjacent to both country C and country D" to obtain the target entity to be queried. Then use Cypher language to retrieve the target entity in the Neo4j database Climate characteristics .
[0086] (2) Impact of geographical events
[0087] Geographic event impact query refers to querying the impact of geographic events. It uses two-node chain reasoning as the basic query subgraph, that is, given a starting node and two edges, the target node to be queried is inferred. The query problem is constructed based on the human-land relationship and event impact in geographical problems. The following query statement queries an event participated in by a person A's country and returns the impact of the event.
[0088] (6)
[0089] in, Represents the entity to be queried, Indicates the impact of the entity to be queried. Indicates the country where person A is located.
[0090] (3) Geographical entity location
[0091] Geographic entity location query refers to the query of geographic entities related to location. It uses three-node star reasoning as the basic query subgraph, that is, given three starting nodes and three edges, three tuples of intersection of the tail entities are formed, and the common nodes are inferred. The following query statement is to query whether event A and event B occurred in a place, and the official language of the place is language A.
[0092] (7)
[0093] in, Represents the entity to be queried, and the target answer is obtained by intersecting three triplets.
[0094] (4) The process of geographical events
[0095] Geographic event occurrence process query refers to the query related to the occurrence process and dynamic evolution of geographic events. It uses three-node chain reasoning as the basic query subgraph, that is, given a starting node and three edges, the target node is inferred based on the edges. The following query statement is to query a geographic event that occurs in the place where country F is located, and this place is the capital of a place, and return the occurrence process of the target node of the geographic event.
[0096] (8)
[0097] in, Represents the entity event to be queried, Indicates the occurrence process of the entity event to be queried. Indicates unknown nodes in the reasoning process. The query statement first finds a location A in country F, then finds a location B whose capital is location A, and then finds events that occur in location B. , and finally query the event The process of occurrence.
[0098] (5) Geographical causes
[0099] Geographic event cause query refers to querying the cause of the geographic event. It uses three-node intersection chain reasoning as the basic query subgraph, that is, given two starting nodes and three edges, the target node is first intersected and then chained. The following query statement queries events that occurred in a region, which is located in country H and is the capital of country G, and returns the cause of the geographic event.
[0100] (9)
[0101] in, Represents the entity to be queried, Indicates the cause of the entity event to be queried. Represents the country entity involved in the reasoning process.
[0102] S4. Constructing a geographic logic query system, specifically including the following steps:
[0103] S41. When designing and implementing a geographic logic query system, the first thing to do is to conduct a demand analysis, including user demand analysis and system demand analysis;
[0104] (1) User needs analysis
[0105] The main user demand is to be able to ask geographic-related questions through specific rules and obtain corresponding reasoning results. Users expect the system to understand complex geographic entity relationships, quickly return reliable query results, and interact and display results through an intuitive interface. The goal of the user side is to achieve three functions: query input, selection of reasoning algorithms, and visual display of reasoning results. Due to the large amount of data in the knowledge graph, users need selectable and searchable entities and relationships, and visually construct reasoning statements. Similarly, on the page, users can independently choose the algorithm used for reasoning. In terms of visual display of reasoning results, it includes visual display of the graph and table display of the Top K more credible reasoning entities.
[0106] (2) System requirements analysis
[0107] The system requirements are mainly in terms of system processing speed, stability, reliability and scalability. The system needs to use pre-trained models and call reasoning interfaces to improve the speed of geographic logic queries. In terms of stability, it supports input verification, data validation and other aspects, and ensures that the information input by users is reliable and valid through the front-end and back-end rule settings. In terms of reliability, it has high availability and accessibility and can run stably on multiple devices. In terms of scalability, the system needs to be able to efficiently manage and maintain a large knowledge graph database and have scalability to support future knowledge updates and function enhancements.
[0108] S42. Functional design should focus on core requirements, including algorithm selection, query parsing, knowledge graph matching, logical query and result display; mainly including parsing the query input by the user and converting it into corresponding reasoning statements and query statements by setting specified input rules and commands; knowledge graph query engine, used to find relevant information in the geographic knowledge graph; reasoning algorithm, used to perform logical query in the knowledge graph; and user interface, used to display query results and reasoning paths.
[0109] S43. The system implementation will adopt a modular development method to sequentially design the contents of the two modules, front-end page design and back-end reasoning algorithm. First, the user interface module is implemented to ensure the interactivity of the query process and the intuitiveness of the results. The server receives the reasoning instructions passed in by the front-end user, parses and converts them into corresponding queries or geographic reasoning tasks, calls the reasoning algorithm to generate geographic reasoning results and the Top K entities with high credibility, and displays the map and attributes through the front-end.
[0110] (1) User interface implementation
[0111] like Figure 2As shown in the figure, when a user accesses the front-end page of the geographic knowledge graph reasoning system, the system loads the relevant CSS style sheet, JavaScript script, and graph visualization library. The front-end page provides interactive functions such as user input, reasoning algorithm selection, and feature aggregation. The user interface mainly consists of two areas: the input area and the reasoning result display area.
[0112] Users enter the triple information (head entity, relationship, tail entity) they want to reason about through the input box in the front-end interface. At the same time, they can choose different reasoning algorithms and whether to enable feature aggregation. The reasoning algorithm selection box includes CGA, GQE, GQE diag TFKGE direct TFKGE fnn and TFKGE full The user selects the corresponding inference algorithm through the drop-down box. Feature aggregation options include whether to enable temporal inference, including CGA, GQE and GQE diag By default, feature aggregation is not enabled when the model is selected. direct TFKGE fnn and TFKGE full When fusing models, you can choose to aggregate time features. The area for generating reasoning triples consists of three search selection boxes: head entity search selection box, relationship edge search selection box, and tail entity search selection box. Since there are many entities in the knowledge graph, the system supports users to manually select entities from the drop-down box and search for entities through the search box.
[0113] After the user selects the head entity, relationship edge, and tail entity, click Generate Edge to preview the generated reasoning triples. Click Generate Reasoning Path to add the generated triples to the reasoning content input box, and you can add them multiple times. The reasoning content input box supports manual addition and modification of rules. After the user has added the content to be reasoned, click Start Reasoning to transmit the reasoning content to the backend, and the backend returns the reasoning results to be displayed in the reasoning result display area.
[0114] The reasoning result display area consists of two areas. The upper part is responsible for displaying the visualized knowledge graph and reasoning path, and the lower part is responsible for displaying the attribute table of the reasoning result. The reasoning result returned by the backend is returned to the frontend through HTTP response. The GraphVis library is used to visualize the query results, display the geographic logical query path of the knowledge graph, and list the attribute values of the relevant query results in the attribute table. At the same time, this system supports users to adjust the input content for multiple queries of different algorithms.
[0115] (2) Backend inference algorithm design
[0116] After the user clicks the "Start Inference" button, the front end listens to the button click event through JavaScript. The user's input data is obtained and sent to the application layer on the server side through an Ajax request. The application layer on the server side receives the inference query and user setting options from the front end. The application layer parses the data containing the user input into specific query commands, which are divided into basic queries of the knowledge graph and geographic logical queries. For basic queries of the knowledge graph such as a single triple, the system will generate Cypher statements, and the application layer will send query commands to the data layer. The data layer uses the Neo4j graph database to execute these commands, retrieve data, and generate query results. For the inference of knowledge graphs such as multiple triples, the corresponding pre-trained model is called for logical query processing. The data layer returns the inference results to the application layer, and the application layer organizes and formats the results. .
[0117] Query example result analysis
[0118] General Enquiry Questions and Answers
[0119] (1) Forward query
[0120] The query "What is the capital of country A" has the following results: Figure 3 As shown, this query is a basic query of the knowledge graph. The query target is the capital of country A. It only contains one answer entity. This system outputs the answer entity and gives the corresponding time information.
[0121] (2) Reverse query
[0122] Query "all countries adjacent to country B"
[0123] The query results are as follows Figure 4 As shown in the figure, by analyzing the query statement, it can be found that the query goal is to find all countries adjacent to country B, but since country B borders many countries, there are multiple query entities. This system outputs all answer entities and returns the visualized query path and the time information corresponding to the target answer entity.
[0124] Geographical Query Answering
[0125] (1) Querying the spatial relationship of geographic entities
[0126] The query is "find a country that is adjacent to both country C and country D, and query the climate characteristics of this country". The first triplet indicates that the HasNeighbor relationship between the country C entity and the target entity constitutes the first edge; the second triplet indicates that the HasNeighbor relationship between the country D entity and the target entity constitutes the second edge; the two known edges intersect to obtain the target node to be inferred, forming an inference path; after obtaining the target node, the climate characteristics of the target node are obtained.
[0127] The query results of geographic entity spatial relationship are as follows: Figure 5 As shown in the figure, the green node represents the starting node, the blue node represents the target node of the query, and the yellow node represents the climate characteristics of the target node. It can be seen from the figure that through the interaction of spatial relationships, country 11 adjacent to both country C and country D is obtained, and the climate characteristics of this country are displayed. The inference result attribute table contains the ranking of the inference results and the corresponding time information.
[0128] (2) Query on the impact of geographical events
[0129] Geographic event impact query refers to querying the impact of geographic events. It uses double-node chain reasoning as the basic query subgraph, that is, given a starting node and two edges, the target node to be queried is inferred;
[0130] The query is "an event in which person A's country participates, and returns the impact of the event." This query consists of two triples. Given a known starting node person A, we can infer the target node through two edges, and the intermediate node connecting the two edges is The same is unknown. Therefore, the system needs to infer the correct target node through nodes and edges. After obtaining the target event node, the impact of the event is returned. The query results of the impact of geographic events are as follows: Figure 6 As shown in the figure, we can see that through the reasoning of the relationship between people and land, we get a node participated by person A in country A, and the impact of this node is shown on the interface.
[0131] (3) Geographic entity location query
[0132] The query is "Event A' and Event B occurred at a location, and the official language of the location is Language A".
[0133] This inference statement is similar to the two-node intersection inference query, except that it has an additional attribute edge. The system predicts each starting node and its corresponding edge, obtains the prediction vector on the edge, obtains the final prediction result through the intersection operator, and finally obtains the target node through the nearest neighbor search. The query result of the geographic entity location is as follows: Figure 7 As shown. Through the query of the intersection of three nodes, the geographic entity target node Country 6 is obtained. This entity is not only a country with geographical location attributes, but also a representation of a historical period with corresponding time information. By analyzing the data in the attribute table, it can be found that Country 6 has corresponding relationships with all three query statements, indicating that Country 6 is the target node to be queried. Country 7, which has a lower similarity ranking, also has the event A triple. Country 7 is the target entity of this single triple, but not the target entity of other triples, which may be the reason for the lower ranking.
[0134] (4) Query of the occurrence process of geographical events
[0135] Query "a certain geographical event, the event occurred in the place where country F is located, and this place is the capital of a place, return the occurrence process of the target node of the geographical event". This reasoning statement consists of three triples. A known starting node country F is known, and the target node is inferred through three edges. By iterating the relationship between places, the target node that is difficult to obtain from the reasoning starting node is reached. Among them, HappenedIn¹ is the inverse relationship of HappenedIn, which can be understood as the relationship between "happened" and "happened in". The query results of the geographical event occurrence process are as follows Figure 8 As shown, after obtaining the target node of the geographic event, the Occur relationship query is used to obtain the occurrence process of the event.
[0136] (5) Query of causes of geographical events
[0137] The query is "an event that occurs in a region that is located in country H and is the capital of country G. Return the cause of the geographical event." This inference statement consists of three triples. Given two known starting nodes, country H and country G, we first infer the intersecting countries through two edges, and then infer the target node through the HappenedIn edge. By iterating the relationship between locations, we reach the target node that is difficult to obtain from the inference starting node. The query result of the geographical event cause is as follows: Fig. 9 shown.
[0138] Display of inference results of different algorithms
[0139] About GQE diag and TFKGE full The query effects of the two algorithms are compared. GQE diag It is the base model for geographic logical query of knowledge graph, TFKGE full The model uses the Date2Vec time encoder to extract time features and perform fusion reasoning. The following reasoning query is to query an event that is participated by country J and occurs in country K. The target answer of this query is event 1:
[0140] (8)
[0141] in, Represents the target entity to be queried. The query is formed by the intersection of two triples, representing an event in which country J participated and the event occurred in country K.
[0142] Based on GQE diag The query results of the model are as follows Fig.10As shown, based on TFKGE full The query results are as follows Fig.11 As shown in the figure, TFKGE full Compared with GQE diag The target node was correctly identified, which shows the role of time features in improving the effect of geographic logic query. It can be seen that this system has good support for different algorithms, and the reasoning results can be given in the form of graph visualization and attribute table.
[0143] Therefore, the present invention adopts the above-mentioned method of constructing a geographic knowledge question and answer system based on knowledge graph, and demonstrates the query capability and reasoning effect of the system through multiple examples, including different scenarios such as general query question and answer and geographic query question and answer; the system can accurately understand and process complex geographic query requests, and provide intuitive result displays such as knowledge graph visualization and attribute table.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for constructing a geographic knowledge question-answering system based on a knowledge graph, characterized in that: The following steps are involved: S1. Create a system development environment based on browser-server architecture; S2, build a system architecture including data layer, application service layer and user layer; S3, build a geographic knowledge graph query question-answering parsing and processing module; S4. Form a geographical knowledge question-answering system that takes into account time characteristics; In step S1, the browser-server architecture includes front-end interface design, back-end logic processing, and data storage and management; The front-end interface design uses HTML, CSS and JavaScript to build a user interface, wherein the JavaScript is used to provide dynamic content update, user input processing and event response interaction functions for the Web page; The backend logic processing uses Python language to build and deploy pre-trained deep learning models, and parse and process geographic knowledge graph query and answer tasks; The data storage and management adopts Neo4j graph database, which is used to store structured data in the network and supports efficient query using Cypher language; In step S3, the geographic knowledge graph query question and answer parsing and processing module includes a general query question and answer module and a geographic query question and answer module; The general query question and answer refers to the question and answer that does not involve geographic logic reasoning in the knowledge graph query question and answer task, and only performs simple retrieval. The general query question and answer uses Neo4j as the database and uses Cypher commands to retrieve the corresponding answer from the database for output, including forward query and reverse query; The geographic query question and answer refers to the user's logical query of basic geographic issues, including geographic entity query, spatial relationship query, geographic event impact query, geographic event occurrence process query and geographic event cause query; The forward query refers to obtaining the target node through a given head entity and relationship; the reverse query refers to querying the unknown head entity target node given a tail entity and relationship; The spatial relationship query refers to the spatial relationship between geographic entities, including topological spatial relationship, sequential spatial relationship and metric spatial relationship, and adopts double-node intersection reasoning as the basic query subgraph, that is, given two starting nodes and two edges, a triplet of two tail entities intersecting is formed to infer the common node; The geographic event impact query refers to querying the impact of geographic events, using double-node chain reasoning as the basic query subgraph, that is, knowing a starting node and two edges, and inferring the target node to be queried; The geographic entity query refers to the query of geographic entities related to location, and adopts three-node star reasoning as the basic query subgraph, that is, given three starting nodes and three edges, a triple of three intersecting tail entities is formed, and a common node is inferred; The geographic event occurrence process query refers to a query related to the occurrence process and dynamic evolution of geographic events, using three-node chain reasoning as the basic query subgraph, that is, given a starting node and three edges, the target node is inferred based on the edges; The geographic event cause query refers to querying the cause of the geographic event, using three-node intersection chain reasoning as the basic query subgraph, that is, two starting nodes and three edges are known, and the target node is first intersected and then chained according to the edges.
2. The method for constructing a geographic knowledge question-answering system based on a knowledge graph according to claim 1, characterized in that: In step S2, the data layer is used to store and respond to data of the knowledge graph geographic query question-answering system; The application service layer is used to parse the query statements returned by the front end and implement geographic logic query; The user layer is constructed using HTML, CSS, and JavaScript, and is used for users to input reasoning query statements and display graph visualization and attribute tables of reasoning results.
3. The method for constructing a geographic knowledge question-answering system based on a knowledge graph according to claim 2, characterized in that: Step S4 specifically includes the following steps: S41. Demand analysis includes user demand analysis and system demand analysis; S42, Functional design includes algorithm selection, parsing query content, knowledge graph matching and reasoning, logical query and result display; S43. Using a modular development approach, the contents of the two modules, front-end page design and back-end reasoning algorithm, are designed in turn.
4. The method for constructing a geographic knowledge question-answering system based on a knowledge graph according to claim 3 is characterized in that: In step S43, the user interface module is first implemented to ensure the interactivity of the query process and the intuitiveness of the results. The server receives the reasoning instructions passed in by the front-end user, parses and converts them into corresponding queries or geographic reasoning tasks, and calls the reasoning algorithm to generate geographic reasoning results and the Top K entities with higher credibility, and visualizes the reasoning path and attributes in the graph.