An intelligent retrieval method, system, terminal and storage medium for urban multi-department heterogeneous data based on a large language model and knowledge graph

By constructing an intelligent search method for urban multi-department heterogeneous data based on large language models and knowledge graphs, the problem of low efficiency and accuracy of heterogeneous data retrieval in urban multi-department is solved, and efficient and comprehensive data retrieval and intelligent decision-making support are achieved.

CN120316171BActive Publication Date: 2025-08-22SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510798359.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-08-22
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

The existing urban multi-department heterogeneous data retrieval methods have low efficiency and accuracy. Cross-departmental data retrieval has problems such as difficulty in semantic analysis, complex entity alignment, and low data fusion efficiency, which affects the data utilization efficiency and intelligent decision-making capabilities in urban governance.

Method used

The intelligent search method for heterogeneous data in urban areas based on large language models and knowledge graphs is used to construct a knowledge graph based on concept-instance-record organizational level, receive natural language queries and generate query intentions, use graph query language to extract initial search results from the knowledge graph, and supplement the search results from heterogeneous data sources through multi-agent backtracking mechanism, and integrate them to finally obtain the target search results.

Benefits of technology

It realizes natural language-driven cross-origin semantic integration and intelligent retrieval backtracking, improves the search efficiency and accuracy of heterogeneous data in multi-department cities, ensures the comprehensiveness and integrity of search results, and improves data utilization efficiency and intelligent decision-making capabilities in urban governance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120316171B_ABST
    Figure CN120316171B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data retrieval technology, and discloses a method, system, terminal, and storage medium for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph. The method comprises: constructing a knowledge graph based on a concept-instance-record organizational hierarchy; parsing natural language queries based on the large language model to generate query intent; generating a graph query language based on the query intent, and extracting initial retrieval results from the knowledge graph based on the graph query language; if the initial retrieval results do not meet the requirements of the query intent, extracting supplementary retrieval results from the heterogeneous data source through a multi-agent backtracking mechanism, and integrating the initial retrieval results and the supplementary retrieval results to obtain the target retrieval results. The present invention effectively improves the retrieval efficiency and retrieval accuracy of heterogeneous data from multiple urban departments through knowledge graph construction, graph query language generation, and a multi-agent backtracking mechanism, and ensures the comprehensiveness and completeness of the retrieval results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data retrieval technology, and in particular to a method, system, terminal and computer-readable storage medium for intelligent retrieval of heterogeneous data from multiple departments of a city based on a large language model and a knowledge graph. Background Art

[0002] With the acceleration of urbanization, data generated across all areas of urban operations has exploded in volume, encompassing diverse forms such as relational data, GIS (Geographic Information System) spatial data, BIM (Building Information Modeling) architectural models, and IoT (Internet of Things) time-series data. This data is often independently managed by different departments and institutions, using varying standards, formats, and storage methods, resulting in a complex urban data ecosystem. However, due to a lack of interoperability mechanisms, cross-departmental data retrieval often presents significant challenges, leading to the increasingly serious phenomenon of data silos. This isolated data storage and management approach not only hinders data sharing and effective utilization, but also complicates cross-departmental collaboration and intelligent decision-making.

[0003] Existing retrieval technologies, such as keyword-based text retrieval and traditional structured query statements, face challenges in cross-departmental data retrieval, such as difficulty in semantic parsing, complex entity alignment, and low data fusion efficiency. Not only can they not fully meet the complex multi-source heterogeneous data retrieval needs, but they also lack accuracy and flexibility when processing natural language queries. This results in low efficiency and accuracy in existing urban multi-source heterogeneous data retrieval, thus affecting data utilization efficiency and intelligent decision-making capabilities in urban governance.

[0004] Therefore, the existing technology still needs to be improved and developed. Summary of the Invention

[0005] The main purpose of the present invention is to provide a method, system, terminal and computer-readable storage medium for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and knowledge graph, aiming to solve the problems of low efficiency and accuracy of existing methods for retrieval of heterogeneous data from multiple urban departments.

[0006] To achieve the above-mentioned purpose, the present invention provides a method for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph. The method comprises:

[0007] Extracting knowledge from heterogeneous data of multiple urban departments based on the design concepts of the ontology model, and building a knowledge graph based on the concept-instance-record organizational hierarchy by combining the design concepts and the knowledge;

[0008] Receiving a natural language query and parsing the natural language query based on a large language model to generate a query intent including entity categories, attribute requirements, and semantic scope;

[0009] Generate a graph query language according to the query intent, and extract initial retrieval results corresponding to the query intent from the knowledge graph according to the graph query language;

[0010] If the initial search results do not meet the requirements of the query intent, the supplementary search results corresponding to the query intent are extracted from heterogeneous data sources through a multi-agent backtracking mechanism, and the initial search results and the supplementary search results are integrated to obtain the target search results.

[0011] Optionally, the design concept of the ontology model is used to extract knowledge from heterogeneous data of multiple urban departments, and the design concept and the knowledge are combined to construct a knowledge graph based on the concept-instance-record organizational hierarchy, specifically including:

[0012] Determine the design concept of the ontology model in combination with relevant standards of urban multi-department heterogeneous data and the characteristics of the urban multi-department heterogeneous data, wherein the design concept includes entity objects, descriptive attributes and association relationships;

[0013] Extracting entity records corresponding to the entity objects, attribute information corresponding to the descriptive attributes, and relationship information corresponding to the association relationships from the heterogeneous data of multiple departments of the city based on the entity objects, the descriptive attributes, and the association relationships of the ontology model;

[0014] In combination with the node-attribute-edge storage structure of the graph database, the entity objects, the entity records, the attribute information, and the relationship information are organized and associated according to the concept-instance-record organizational hierarchy to obtain a knowledge graph based on the concept-instance-record organizational hierarchy;

[0015] Among them, the entity object includes entity type and instance object, the concept layer of the knowledge graph includes concept nodes for representing the entity type, the instance layer of the knowledge graph includes instance nodes for representing the instance objects, the record layer of the knowledge graph includes record nodes for representing the entity records, the key-value pairs embedded in the record nodes are used to represent the attribute information, and the typed edges between the record nodes are used to represent the relationship information.

[0016] Optionally, receiving a natural language query and parsing the natural language query based on a large language model to generate a query intent including entity categories, attribute requirements, and semantic scope specifically includes:

[0017] Receive a user's natural language query, and parse the natural language query using a few-shot prompt template based on a query parsing module of a large language model to identify entity categories, attribute requirements, and semantic scope in the natural language query;

[0018] The query intent corresponding to the natural language query is obtained by combining the entity category, the attribute requirement and the semantic scope.

[0019] Optionally, generating a graph query language according to the query intent, and extracting initial retrieval results corresponding to the query intent from the knowledge graph according to the graph query language, specifically includes:

[0020] A graph query generation module based on the large language model, combined with the entity alias library and relationship network of the knowledge graph, generates a graph query language according to the query intent;

[0021] Extracting, from the knowledge graph, target entity records corresponding to the entity category, target attribute information corresponding to the attribute requirement, and target relationship information corresponding to the semantic scope according to the graph query language;

[0022] The target entity record, the target attribute information and the target relationship information are combined to obtain an initial retrieval result corresponding to the query intention.

[0023] Optionally, if the initial search results do not meet the requirements of the query intent, a multi-agent backtracking mechanism is used to extract supplementary search results corresponding to the query intent from heterogeneous data sources, and the initial search results and the supplementary search results are integrated to obtain the target search results, specifically including:

[0024] If the initial search results do not meet the requirements of the query intent, the source data backtracking module based on the large language model triggers the multi-agent backtracking mechanism, and selects the corresponding target agent from the multiple agents in the source data backtracking module according to the query intent;

[0025] The target agent generates a target query language adapted to the data format according to the query intent, and extracts supplementary retrieval results corresponding to the query intent from corresponding heterogeneous data sources according to the target query language;

[0026] The initial retrieval result is integrated with the supplementary retrieval result extracted by the target agent to obtain a target retrieval result.

[0027] Optionally, the heterogeneous data sources include a relational database, a GIS database, a BIM database and an IoT database, and the multiple intelligent agents include an SQL query agent, a GIS query agent, a BIM query agent and an IoT query agent. The SQL query agent corresponds to the relational database, the GIS query agent corresponds to the GIS database, the BIM query agent corresponds to the BIM database, and the IoT query agent corresponds to the IoT database.

[0028] Optionally, generating a graph query language according to the query intent, and extracting initial retrieval results corresponding to the query intent from the knowledge graph according to the graph query language, further includes:

[0029] If the initial search result meets the requirements of the query intention, the initial search result is used as the target search result;

[0030] If the initial search results do not meet the requirements of the query intent, additional search results corresponding to the query intent are extracted from the attribute knowledge base through search enhancement technology, and the initial search results, the supplementary search results and the additional search results are integrated to obtain the target search results.

[0031] To achieve the above-mentioned purpose, the present invention further provides an intelligent retrieval system for heterogeneous data from multiple urban departments based on a large language model and a knowledge graph. The intelligent retrieval system for heterogeneous data from multiple urban departments based on a large language model and a knowledge graph comprises:

[0032] Knowledge graph construction module: used to extract knowledge from heterogeneous data of multiple urban departments based on the design concepts of the ontology model, and to construct a knowledge graph based on the concept-instance-record organizational hierarchy by combining the design concepts and the knowledge;

[0033] Query intent generation module: used to receive natural language queries and parse the natural language queries based on the large language model to generate query intent including entity categories, attribute requirements and semantic scope;

[0034] An initial search result generation module is used to generate a graph query language according to the query intent, and extract the initial search results corresponding to the query intent from the knowledge graph according to the graph query language;

[0035] Target retrieval result generation module: used to extract supplementary retrieval results corresponding to the query intent from heterogeneous data sources through a multi-agent backtracking mechanism if the initial retrieval results do not meet the requirements of the query intent, and integrate the initial retrieval results and the supplementary retrieval results to obtain the target retrieval results.

[0036] In order to achieve the above-mentioned purpose of the invention, the present invention also provides a terminal, which includes: a memory, a processor, and an urban multi-department heterogeneous data intelligent retrieval program based on a large language model and a knowledge graph stored on the memory and run on the processor. When the urban multi-department heterogeneous data intelligent retrieval program based on a large language model and a knowledge graph is executed by the processor, the steps of the urban multi-department heterogeneous data intelligent retrieval method based on a large language model and a knowledge graph as described above are implemented.

[0037] In order to achieve the above-mentioned purpose of the invention, the present invention also provides a computer-readable storage medium, which stores a city multi-department heterogeneous data intelligent retrieval program based on a large language model and a knowledge graph. When the city multi-department heterogeneous data intelligent retrieval program based on a large language model and a knowledge graph is executed by a processor, the steps of the city multi-department heterogeneous data intelligent retrieval method based on a large language model and a knowledge graph as described above are implemented.

[0038] In the present invention, knowledge is extracted from heterogeneous data of multiple departments in the city according to the design concept of the ontology model, and the design concept and the knowledge are combined to construct a knowledge graph based on the concept-instance-record organizational hierarchy; a natural language query is received, and the natural language query is parsed based on the large language model to generate a query intent containing entity categories, attribute requirements and semantic scope; a graph query language is generated according to the query intent, and the initial retrieval results corresponding to the query intent are extracted from the knowledge graph according to the graph query language; if the initial retrieval results do not meet the requirements of the query intent, the supplementary retrieval results corresponding to the query intent are extracted from the heterogeneous data source through a multi-agent backtracking mechanism, and the initial retrieval results and the supplementary retrieval results are integrated to obtain the target retrieval results. The present invention realizes natural language-driven cross-source semantic integration, entity-level data query and intelligent retrieval backtracking through knowledge graph construction, graph query language generation and multi-agent backtracking mechanism, effectively improving the retrieval efficiency and retrieval accuracy of heterogeneous data of multiple departments in the city, and ensuring the comprehensiveness and completeness of the retrieval results, thereby greatly improving the data utilization efficiency and intelligent decision-making capabilities in urban governance. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is the first flow chart of a preferred embodiment of the method for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph of the present invention;

[0040] Figure 2 is a schematic diagram of the knowledge graph of the present invention;

[0041] Figure 3 This is the second flow chart of a preferred embodiment of the method for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph of the present invention;

[0042] Figure 4 This is the third flow chart of a preferred embodiment of the method for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph of the present invention;

[0043] Figure 5 This is a structural diagram of a preferred embodiment of the present invention's intelligent retrieval system for heterogeneous data from multiple urban departments based on a large language model and knowledge graph;

[0044] Figure 6 It is a structural diagram of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the present invention more clear and distinct, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0046] With the acceleration of urbanization, data generated across all areas of urban operations has exploded in volume, encompassing diverse forms such as relational data, GIS spatial data, BIM building models, and IoT time-series data. This data is often independently managed by different departments and institutions, using varying standards, formats, and storage methods, resulting in a complex urban data ecosystem. However, due to a lack of interoperability mechanisms, cross-departmental data retrieval often faces significant challenges, leading to the increasingly serious phenomenon of data silos. This isolated data storage and management approach not only hinders data sharing and effective utilization, but also complicates cross-departmental collaboration and intelligent decision-making.

[0047] In view of the current problems of multi-source heterogeneity, semantic fragmentation, and inconsistent structure in urban data, existing retrieval technologies, such as keyword-based text retrieval and traditional structured query statements, face challenges such as difficulty in semantic parsing, complex entity alignment, and low data fusion efficiency in cross-departmental data retrieval. Not only can they not fully meet the complex multi-source heterogeneous data retrieval needs, but they also lack accuracy and flexibility when processing natural language queries. As a result, the efficiency and accuracy of existing urban multi-source heterogeneous data retrieval are low, which affects the data utilization efficiency and intelligent decision-making capabilities in urban governance.

[0048] In order to solve the above technical problems, the present invention provides an intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and a knowledge graph. The method extracts knowledge from the heterogeneous data of urban multi-departments according to the design concept of the ontology model, and constructs a knowledge graph based on the concept-instance-record organizational hierarchy by combining the design concept and the knowledge; receives a natural language query, and parses the natural language query based on a large language model to generate a query intent containing entity categories, attribute requirements and semantic scope; generates a graph query language according to the query intent, and extracts the initial retrieval results corresponding to the query intent from the knowledge graph according to the graph query language; if the initial retrieval result does not meet the requirements of the query intent, the supplementary retrieval result corresponding to the query intent is extracted from the heterogeneous data source through a multi-agent backtracking mechanism, and the initial retrieval result and the supplementary retrieval result are integrated to obtain the target retrieval result. This invention realizes natural language-driven cross-source semantic integration, entity-level data query and intelligent retrieval backtracking through knowledge graph construction, graph query language generation and multi-agent backtracking mechanism, effectively improving the retrieval efficiency and retrieval accuracy of heterogeneous data from multiple departments in the city, and ensuring the comprehensiveness and completeness of the retrieval results, thereby greatly improving data utilization efficiency and intelligent decision-making capabilities in urban governance.

[0049] The application content will be further explained below through description of embodiments in conjunction with the accompanying drawings.

[0050] The preferred embodiment of the intelligent retrieval method for urban multi-department heterogeneous data based on the large language model and knowledge graph of the present invention is as follows: Figure 1 As shown, specifically including:

[0051] S1. Extract knowledge from heterogeneous data of multiple urban departments based on the design concept of the ontology model, combine the design concept and the knowledge, and construct a knowledge graph based on the concept-instance-record organizational hierarchy.

[0052] In one implementation of this embodiment, the design concept of the ontology model is used to extract knowledge from heterogeneous data of multiple urban departments, and the design concept and the knowledge are combined to construct a knowledge graph based on the concept-instance-record organizational hierarchy, specifically including:

[0053] Determine the design concept of the ontology model in combination with relevant standards of urban multi-department heterogeneous data and the characteristics of the urban multi-department heterogeneous data, wherein the design concept includes entity objects, descriptive attributes and association relationships;

[0054] Extracting entity records corresponding to the entity objects, attribute information corresponding to the descriptive attributes, and relationship information corresponding to the association relationships from the heterogeneous data of multiple departments of the city based on the entity objects, the descriptive attributes, and the association relationships of the ontology model;

[0055] In combination with the node-attribute-edge storage structure of the graph database, the entity objects, the entity records, the attribute information, and the relationship information are organized and associated according to the concept-instance-record organizational hierarchy to obtain a knowledge graph based on the concept-instance-record organizational hierarchy;

[0056] Among them, the entity object includes entity type and instance object, the concept layer of the knowledge graph includes concept nodes for representing the entity type, the instance layer of the knowledge graph includes instance nodes for representing the instance objects, the record layer of the knowledge graph includes record nodes for representing the entity records, the key-value pairs embedded in the record nodes are used to represent the attribute information, and the typed edges between the record nodes are used to represent the relationship information.

[0057] Specifically, a knowledge graph of heterogeneous data of multiple urban departments based on the three-level organizational structure of “concept-instance-record” is constructed. The knowledge graph consists of entities, attributes and relationships, such as Figure 2 As shown in the figure, entities represent objects in the city with management value and retrieval needs, and are divided into three levels: concept, instance and record, namely concept layer entities, instance layer entities and record layer entities. Concept layer entities define the semantic classification of abstract urban objects, including major categories and subcategories such as land parcels, buildings, population, and events; instance layer entities represent specific urban objects corresponding to the concept layer, including unique identifiers, standard names, aliases, etc.; record layer entities store original records of multi-source heterogeneous data, including key retrieval information such as data source index, spatiotemporal benchmark, and data source table name, and are associated with the instance layer through relationship edges; attributes include common attributes of urban heterogeneous data, such as ID, location, timestamp, etc.; index attributes, such as source table primary key, field mapping rules, etc., so as to support cross-database backtracking queries while containing basic information; relationships include spatial relationships (such as adjacent, included, etc.), temporal relationships (such as prior, periodic, etc.), hierarchical relationships (such as whole-part, etc.), and cross-domain association relationships (such as monitoring equipment-affiliated buildings, etc.).

[0058] like Figure 2 As shown, Figure 2The document shows the node organization at the concept layer, instance layer, and record layer, as well as the relationships between the three types of nodes: a concept node typically corresponds to multiple instance nodes, and an instance node can also correspond to different record nodes in different data; the relationship between concept nodes and instance nodes is typically based on hierarchical relationships such as has_record; the relationship between instance nodes and record nodes is typically based on hierarchical relationships such as has_instance; and the relationship between record nodes is typically based on diverse relationships such as spatiotemporal associations. It should be noted that concept layer entities refer to the entity types described above, represented by concept nodes; instance layer entities refer to the instance objects described above, represented by instance nodes; and record layer entities refer to the entity records described above, represented by record nodes.

[0059] S2. Receive a natural language query and parse the natural language query based on a large language model to generate a query intent including entity categories, attribute requirements, and semantic scope.

[0060] In one implementation of this embodiment, receiving a natural language query and parsing the natural language query based on a large language model to generate a query intent including entity categories, attribute requirements, and semantic scope specifically includes:

[0061] Receive a user's natural language query and parse the query using a few-shot prompt template using a query parsing module based on a large language model to identify entity categories, attribute requirements, and semantic scope in the query.

[0062] The query intent corresponding to the natural language query is obtained by combining the entity category, the attribute requirement and the semantic scope.

[0063] Specifically, the present invention constructs a multi-agent retrieval system based on a large language model based on the LangChain framework (i.e., the large language model mentioned above. In the present invention, the large language model is synonymous with the multi-agent retrieval system based on the large language model). Few-shot technology is used to provide examples for the large language model and dynamically generate query logic. The large language model (i.e., the multi-agent retrieval system based on the large language model) includes a query parsing module, a graph query generation module, and a source data backtracking module. The query parsing module is used to parse the user's natural language query and identify the query intent; the graph query generation module is used to generate the corresponding graph query language based on the parsed query intent and query the corresponding initial search results in the knowledge graph; the source data backtracking module is used to backtrack heterogeneous data sources through agents to obtain supplementary search results. The present invention uses a large language model to achieve an end-to-end process from natural language intent recognition to heterogeneous data retrieval.

[0064] Specifically, the present invention is based on a large language model, calls a query parsing module, receives the user's natural language query, and uses few-shot prompts to identify the entity category (such as building), attribute requirements (such as energy consumption data) and implicit semantic relationship / semantic range (such as the surrounding 500 meters) in the user's natural language query.

[0065] S3. Generate a graph query language according to the query intent, and extract initial retrieval results corresponding to the query intent from the knowledge graph according to the graph query language.

[0066] In one implementation of this embodiment, generating a graph query language according to the query intent, and extracting initial search results corresponding to the query intent from the knowledge graph according to the graph query language, specifically includes:

[0067] A graph query generation module based on the large language model, combined with the entity alias library and relationship network of the knowledge graph, generates a graph query language according to the query intent;

[0068] Extracting, from the knowledge graph, target entity records corresponding to the entity category, target attribute information corresponding to the attribute requirement, and target relationship information corresponding to the semantic scope according to the graph query language;

[0069] The target entity record, the target attribute information and the target relationship information are combined to obtain an initial retrieval result corresponding to the query intention.

[0070] Specifically, the present invention, based on a large language model, invokes a graph query generation module, combines the knowledge graph's entity alias library and relationship network, generates a graph query language (e.g., a Cypher statement) based on the parsed query intent, and extracts entity records and associated information (i.e., target entity records, target attribute information, and target relationship information corresponding to entity categories, attribute requirements, and implicit semantic relationships) from the knowledge graph using the graph query language. This invention can automatically convert ambiguous natural language queries into precise urban heterogeneous data search statements (i.e., graph query language), improving search accuracy and flexibility and providing efficient support for urban data analysis.

[0071] S4. If the initial search results do not meet the requirements of the query intent, the supplementary search results corresponding to the query intent are extracted from the heterogeneous data source through the multi-agent backtracking mechanism, and the initial search results and the supplementary search results are integrated to obtain the target search results.

[0072] In one implementation of this embodiment, if the initial search results do not meet the requirements of the query intent, a multi-agent backtracking mechanism is used to extract supplementary search results corresponding to the query intent from heterogeneous data sources, and the initial search results and the supplementary search results are integrated to obtain the target search results, which also includes:

[0073] Determine whether the initial search results meet the requirements of the query intent.

[0074] Specifically, for example, when the user's natural language query involves attributes that are not included in the knowledge graph (such as long-tail attributes), fine-grained data (such as fine-grained BIM component information) or real-time data (such as IoT real-time data), it is determined that the initial retrieval results cannot meet the requirements of the query intent.

[0075] In one implementation of this embodiment, if the initial search results do not meet the requirements of the query intent, a multi-agent backtracking mechanism is used to extract supplementary search results corresponding to the query intent from heterogeneous data sources, and the initial search results and the supplementary search results are integrated to obtain the target search results, specifically including:

[0076] If the initial search results do not meet the requirements of the query intent, the source data backtracking module based on the large language model triggers the multi-agent backtracking mechanism, and selects the corresponding target agent from the multiple agents in the source data backtracking module according to the query intent;

[0077] The target agent generates a target query language adapted to the data format according to the query intent, and extracts supplementary retrieval results corresponding to the query intent from corresponding heterogeneous data sources according to the target query language;

[0078] The initial retrieval result is integrated with the supplementary retrieval result extracted by the target agent to obtain a target retrieval result.

[0079] In one implementation of this embodiment, the heterogeneous data sources include a relational database, a GIS database, a BIM database and an IoT database, and the multiple agents include a SQL (Structured Query Language) query agent, a GIS query agent, a BIM query agent and an IoT query agent. The SQL query agent corresponds to the relational database, the GIS query agent corresponds to the GIS database, the BIM query agent corresponds to the BIM database, and the IoT query agent corresponds to the IoT database.

[0080] Specifically, if the graph query result (i.e., the initial retrieval result) cannot meet the requirements of the query intent, the corresponding agents (including SQL query agents, GIS query agents, BIM query agents, and IoT query agents) will backtrack to the corresponding heterogeneous data sources (including relational databases, GIS databases, BIM databases, and IoT databases) to perform supplementary queries. The specific process includes: if the graph query result cannot meet the requirements of the query intent, the multi-agent backtracking mechanism based on the large language model will be triggered. The large language model selects agents with different data formats (i.e., target agents) according to the query intent, and allows the agents to generate an adaptive query language (i.e., target query language, such as SQL query language, GeoJSON query language, etc.) based on the index information obtained in the previous step (i.e., the attribute requirements in the query intent). Then, the agents are connected to the corresponding heterogeneous data sources for backtracking queries, execute the query language generated in the above steps, and generate query results (i.e., supplementary retrieval results). Finally, the query results generated by different agents are integrated with the graph query results generated in the previous step to obtain the final result (i.e., target retrieval result). It should be noted that in the multi-agent backtracking mechanism, there is a corresponding relationship between the called agent, the generated query language, and the backtracked heterogeneous data source. Different agents are called, different query languages ​​are generated, and different heterogeneous data sources are backtracked for different data formats. For example, when the user's natural language query involves attributes (relational data) that are not included in the knowledge graph, and it is determined that the initial search results cannot meet the requirements of the query intent, the multi-agent backtracking mechanism is triggered based on the large language model, the SQL query agent is called, the SQL query language is generated, and the relational database is backtracked to extract supplementary search results.

[0081] In one implementation of this embodiment, generating a graph query language according to the query intent, and extracting initial search results corresponding to the query intent from the knowledge graph according to the graph query language, further includes:

[0082] If the initial search result meets the requirements of the query intention, the initial search result is used as the target search result;

[0083] If the initial search results do not meet the requirements of the query intent, additional search results corresponding to the query intent are extracted from the attribute knowledge base through search enhancement technology, and the initial search results, the supplementary search results and the additional search results are integrated to obtain the target search results.

[0084] Specifically, if the graph query result meets the requirements of the query intent, the process ends and the graph query result is used as the target retrieval result. If the graph query result does not meet the requirements of the query intent, in addition to triggering the multi-agent backtracking mechanism in the above steps and obtaining supplementary retrieval results through agent backtracking query of heterogeneous data sources, additional retrieval results can also be obtained based on the attribute knowledge base through RAG (Retrieval-Augmented Generation) technology. Figure 3 As shown in the figure, to enhance the accuracy of the overall search process, an additional attribute knowledge base was constructed to record the large amount of content that frequently appears in various departments and databases and does not belong to the predefined templates and long-tail attributes not included in the knowledge graph, such as building electricity consumption and IoT device status. When a user raises a query requirement that cannot be met by the knowledge graph and the knowledge graph does not include the attribute, the large language model can search the attribute knowledge base using RAG technology to obtain additional search results.

[0085] The present invention provides the following specific query examples, such as Figure 4 As shown in the figure, after a user asks a question ("How many sensors are there in Building B at University A? Are there any sensors with abnormal values ​​within the past week?"), the large language model uses intent recognition to determine from the fuzzy natural language that the entity categories to be searched are buildings and sensors. The intent is to find the number of sensors in Building B and any abnormal sensor data. Then, through the graph query generation step, a graph query language is generated based on the recognized intent. Then, through the graph query execution step, the graph query language is used to obtain the entity query answer (i.e., the query result, which includes five sensors) based on the attributes and relationships defined in the predefined template. If the query result meets the query requirements, it is directly output. However, in this example, the specific values ​​recorded by the sensors need to be queried, which the predefined template cannot meet. Therefore, the large model uses the source data backtracking step to call the SQL query agent to connect to the relational database for a backtracking query. It then performs a further backtracking query based on the long-tail attributes provided in the attribute knowledge base, resulting in the backtracking query result (a total of two sensors have experienced anomalies). Combining the query result with the backtracking query result yields the final query result (including five sensors, two of which have experienced anomalies within the past seven days). It should be noted that the predefined template here can be understood as an ontology model.

[0086] like Figure 3 and Figure 4 As shown, the present invention obtains user input (i.e., user natural language query) and performs intent recognition (i.e., content recognition) in the following steps: first, identifying the entity category, then identifying the specific intent; in addition, the present invention also adds an alias knowledge base (i.e., entity alias library) and an attribute knowledge base, and uses search enhancement generation technology to ensure the comprehensiveness and completeness of the search results. It should be noted that Figure 3 The results of content recognition output include entity type, attribute requirements and implicit scope. Here, entity type refers to the entity category in the previous text, and implicit scope refers to the implicit semantic relationship / semantic scope in the previous text. The results of knowledge graph query output include filtered records, common attributes and association relationships. Here, filtered records refer to the target entity records in the previous text, common attributes refer to the target attribute information in the previous text, and association relationships refer to the target relationship information in the previous text. Figure 4 The large model in is the large language model.

[0087] In summary, the present invention constructs a hierarchical knowledge graph based on "concept-instance-record" to unify the semantic classification, entity instances and original records of multi-source heterogeneous data in the city, and defines four types of semantic relationships covering space, time and hierarchy; combines a large language model to parse user natural language queries, generates a graph query language through intent recognition and Few-shot templates, and extracts related records from the knowledge graph; for long-tail attributes or real-time data that are not included in the knowledge graph, designs SQL, GIS, BIM, IoT multi-agent backtracking mechanisms, generates adaptive query instructions based on index information, and supplements search results. Through the semantic fusion of the knowledge graph and the cross-source backtracking driven by the large model, the automatic conversion from natural language to precise query is realized, which effectively improves the retrieval efficiency and integrity of multi-department data in the city, and provides efficient decision-making support for scenarios such as dynamic monitoring and emergency response in smart city governance.

[0088] The present invention can effectively break down data silos and improve the accuracy and efficiency of retrieval by constructing a knowledge graph and associating it with the data source. The knowledge graph has high flexibility and expressiveness in representing entities, attributes and relationships. Especially in urban data retrieval, it can achieve more intelligent query and analysis through semantic reasoning and cross-domain association. With the development of large language model technology, its powerful semantic understanding and generation capabilities have provided new possibilities for natural language queries. By combining the large language model with the knowledge graph, the present invention can more accurately parse the user's query intention and generate corresponding query statements. This collaborative work can not only optimize the accuracy of the retrieval results, but also perform backtracking queries through the intelligent system, extract and supplement information from multiple heterogeneous data sources, and ensure the comprehensiveness and completeness of the retrieval results. The present invention has the following beneficial effects: semantic fusion capability: through the three-level knowledge graph of "concept-instance-record", the index and association relationship of multi-source heterogeneous data is uniformly expressed, solving the problem of difficulty in linking the same entity object in heterogeneous data; intelligent retrieval efficiency: based on the large language model to drive intent analysis and query generation, realize the automatic conversion from user fuzzy natural language query to intent, data recognition and finally to precise query statement; cross-source backtracking capability: based on the multi-agent backtracking mechanism, it realizes the automated and professional retrieval of relational data, GIS data, BIM data, and IoT data, reducing the threshold for manual query of heterogeneous data.

[0089] In addition, based on the above-mentioned urban multi-department heterogeneous data intelligent retrieval method based on large language model and knowledge graph, the present invention also provides an urban multi-department heterogeneous data intelligent retrieval system based on large language model and knowledge graph, wherein the preferred embodiment of the urban multi-department heterogeneous data intelligent retrieval system based on large language model and knowledge graph is as follows: Figure 5 As shown, specifically including:

[0090] Knowledge graph construction module 01: used to extract knowledge from heterogeneous data of multiple urban departments based on the design concepts of the ontology model, and to construct a knowledge graph based on the concept-instance-record organizational hierarchy by combining the design concepts and the knowledge;

[0091] Query intent generation module 02: for receiving a natural language query, parsing the natural language query based on a large language model, and generating a query intent including entity categories, attribute requirements, and semantic scope;

[0092] Initial search result generation module 03: used to generate a graph query language according to the query intent, and extract the initial search results corresponding to the query intent from the knowledge graph according to the graph query language;

[0093] Target retrieval result generation module 04: If the initial retrieval result does not meet the requirements of the query intent, it is used to extract the supplementary retrieval results corresponding to the query intent from heterogeneous data sources through a multi-agent backtracking mechanism, and integrate the initial retrieval result and the supplementary retrieval result to obtain the target retrieval result.

[0094] In addition, based on the above-mentioned method and system for intelligent retrieval of heterogeneous data of multiple departments in a city based on a large language model and knowledge graph, the present invention also provides a terminal, wherein a preferred embodiment of the terminal is as follows: Figure 6 As shown, it specifically includes a processor 10, a memory 20 and a display 30. Figure 6 Only some of the components of the terminal are shown, but it should be understood that implementation of all the components shown is not required, and more or fewer components may be implemented instead. The terminal supports services for generating maps and querying data for city data through an API (Application Programming Interface).

[0095] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as the terminal's hard drive or memory. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, or a flash memory card. Furthermore, the memory 20 may include both the terminal's internal storage unit and an external storage device. The memory 20 is used to store application software installed on the terminal and various types of data, such as the terminal's program code. The memory 20 may also be used to temporarily store data that has been output or is about to be output. In one embodiment, the memory 20 stores a program 40 for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph. This program 40 can be executed by the processor 10 to implement the steps of the method for intelligent retrieval of heterogeneous data from multiple urban departments based on a large language model and a knowledge graph as described in this application.

[0096] In some embodiments, the processor 10 can be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code or process data stored in the memory 20, such as executing an intelligent retrieval program 40 for urban multi-department heterogeneous data based on a large language model and knowledge graph.

[0097] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch screen, etc. The display 30 is used to display information on the terminal and to display a visual user interface.

[0098] In one embodiment, when the processor 10 executes the urban multi-department heterogeneous data intelligent retrieval program 40 based on the large language model and knowledge graph in the memory 20, the steps of the urban multi-department heterogeneous data intelligent retrieval method based on the large language model and knowledge graph as described above are implemented.

[0099] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores an intelligent retrieval program for urban multi-department heterogeneous data based on a large language model and a knowledge graph. When the intelligent retrieval program for urban multi-department heterogeneous data based on a large language model and a knowledge graph is executed by a processor, the steps of the above-mentioned method for intelligent retrieval of urban multi-department heterogeneous data based on a large language model and a knowledge graph are implemented.

[0100] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or terminal comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or terminal comprising the element.

[0101] Of course, those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware (such as a processor, controller, etc.) through a computer program. The program can be stored in a computer-readable storage medium that can be read by a computer. When executed, the program can include the processes in the above-described method embodiments. The computer-readable storage medium can be a memory, a magnetic disk, an optical disk, etc.

[0102] It should be understood that the application of the present invention is not limited to the above examples. For those skilled in the art, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. An intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and knowledge graph, characterized by: The intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and knowledge graph includes: Extracting knowledge from heterogeneous data of multiple urban departments based on the design concepts of the ontology model, and building a knowledge graph based on the concept-instance-record organizational hierarchy by combining the design concepts and the knowledge; Receive a natural language query and parse it based on a large language model to generate a query intent containing entity categories, attribute requirements, and semantic scope, specifically including: Receive a user's natural language query, and parse the natural language query using a few-shot prompt template based on a query parsing module of a large language model to identify entity categories, attribute requirements, and semantic scope in the natural language query; Combining the entity category, the attribute requirement, and the semantic scope, obtaining a query intent corresponding to the natural language query; Generating a graph query language according to the query intent, and extracting initial search results corresponding to the query intent from the knowledge graph according to the graph query language, specifically including: A graph query generation module based on the large language model, combined with the entity alias library and relationship network of the knowledge graph, generates a graph query language according to the query intent; Extracting, from the knowledge graph, target entity records corresponding to the entity category, target attribute information corresponding to the attribute requirement, and target relationship information corresponding to the semantic scope according to the graph query language; Combining the target entity record, the target attribute information, and the target relationship information to obtain an initial retrieval result corresponding to the query intent; If the initial search results do not meet the requirements of the query intent, the supplementary search results corresponding to the query intent are extracted from heterogeneous data sources through a multi-agent backtracking mechanism, and the initial search results and the supplementary search results are integrated to obtain the target search results.

2. The intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and knowledge graph according to claim 1 is characterized in that: The design concept of the ontology model is used to extract knowledge from heterogeneous data of multiple urban departments. The design concept and the knowledge are combined to construct a knowledge graph based on the concept-instance-record organizational hierarchy, which specifically includes: Determine the design concept of the ontology model in combination with relevant standards of urban multi-department heterogeneous data and the characteristics of the urban multi-department heterogeneous data, wherein the design concept includes entity objects, descriptive attributes and association relationships; Extracting entity records corresponding to the entity objects, attribute information corresponding to the descriptive attributes, and relationship information corresponding to the association relationships from the heterogeneous data of multiple departments of the city based on the entity objects, the descriptive attributes, and the association relationships of the ontology model; In combination with the node-attribute-edge storage structure of the graph database, the entity objects, the entity records, the attribute information, and the relationship information are organized and associated according to the concept-instance-record organizational hierarchy to obtain a knowledge graph based on the concept-instance-record organizational hierarchy; Among them, the entity object includes entity type and instance object, the concept layer of the knowledge graph includes concept nodes for representing the entity type, the instance layer of the knowledge graph includes instance nodes for representing the instance objects, the record layer of the knowledge graph includes record nodes for representing the entity records, the key-value pairs embedded in the record nodes are used to represent the attribute information, and the typed edges between the record nodes are used to represent the relationship information.

3. The intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and knowledge graph according to claim 1 is characterized in that: If the initial search results do not meet the requirements of the query intent, a multi-agent backtracking mechanism is used to extract supplementary search results corresponding to the query intent from heterogeneous data sources, and the initial search results and the supplementary search results are integrated to obtain the target search results, specifically including: If the initial search results do not meet the requirements of the query intent, the source data backtracking module based on the large language model triggers the multi-agent backtracking mechanism, and selects the corresponding target agent from the multiple agents in the source data backtracking module according to the query intent; The target agent generates a target query language adapted to the data format according to the query intent, and extracts supplementary retrieval results corresponding to the query intent from corresponding heterogeneous data sources according to the target query language; The initial retrieval result is integrated with the supplementary retrieval result extracted by the target agent to obtain a target retrieval result.

4. The intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and knowledge graph according to claim 3 is characterized in that: The heterogeneous data sources include relational databases, GIS databases, BIM databases and IoT databases. The multiple intelligent agents include SQL query agents, GIS query agents, BIM query agents and IoT query agents. The SQL query agent corresponds to the relational database, the GIS query agent corresponds to the GIS database, the BIM query agent corresponds to the BIM database, and the IoT query agent corresponds to the IoT database.

5. The intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and knowledge graph according to claim 3 is characterized in that: The step of generating a graph query language according to the query intent, and extracting initial search results corresponding to the query intent from the knowledge graph according to the graph query language, further includes: If the initial search result meets the requirements of the query intention, the initial search result is used as the target search result; If the initial search results do not meet the requirements of the query intent, additional search results corresponding to the query intent are extracted from the attribute knowledge base through search enhancement technology, and the initial search results, the supplementary search results and the additional search results are integrated to obtain the target search results.

6. An intelligent retrieval system for heterogeneous urban data from multiple departments based on a large language model and knowledge graph, characterized by: The intelligent retrieval system for heterogeneous data of multiple departments in a city based on a large language model and a knowledge graph is applied to the intelligent retrieval method for heterogeneous data of multiple departments in a city based on a large language model and a knowledge graph according to any one of claims 1 to 5, and the intelligent retrieval system for heterogeneous data of multiple departments in a city based on a large language model and a knowledge graph comprises: Knowledge graph construction module: used to extract knowledge from heterogeneous data of multiple urban departments based on the design concepts of the ontology model, and to construct a knowledge graph based on the concept-instance-record organizational hierarchy by combining the design concepts and the knowledge; Query intent generation module: used to receive natural language queries and parse the natural language queries based on the large language model to generate query intent including entity categories, attribute requirements and semantic scope; An initial search result generation module is used to generate a graph query language according to the query intent, and extract the initial search results corresponding to the query intent from the knowledge graph according to the graph query language; Target retrieval result generation module: used to extract supplementary retrieval results corresponding to the query intent from heterogeneous data sources through a multi-agent backtracking mechanism if the initial retrieval results do not meet the requirements of the query intent, and integrate the initial retrieval results and the supplementary retrieval results to obtain the target retrieval results.

7. A terminal, characterized in that: The terminal includes: a memory, a processor, and an intelligent retrieval program for urban multi-department heterogeneous data based on a large language model and a knowledge graph, which is stored in the memory and can be run on the processor. When the intelligent retrieval program for urban multi-department heterogeneous data based on a large language model and a knowledge graph is executed by the processor, the steps of the intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and a knowledge graph are implemented as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an intelligent retrieval program for urban multi-department heterogeneous data based on a large language model and a knowledge graph. When the intelligent retrieval program for urban multi-department heterogeneous data based on a large language model and a knowledge graph is executed by a processor, the steps of the intelligent retrieval method for urban multi-department heterogeneous data based on a large language model and a knowledge graph are implemented as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Nuclear power DCS intelligent question and answer method and system based on large language model

    CN118627613A

  • AI Agent agent based on big language model collaborative knowledge graph and implementation method thereof

    CN119377360A