Intelligent agent query method and device based on bimodal semantics and storage medium
By converting query questions into question vectors, identifying suitable target databases, and generating query statements, the problem of low query efficiency in existing technologies is solved. This enables interoperability between RDF databases and graph databases, improving query efficiency and ease of use.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PERSAGY TECHNOLOGY CO LTD
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, data queries based on knowledge graphs can usually only target one of RDF or graph databases, resulting in low query efficiency and an inability to simultaneously satisfy semantic logical reasoning capabilities and high-efficiency graph structure query capabilities.
The query question is converted into a question vector. Based on the question vector, the target database is determined from the RDF database and the graph database, and a matching query statement is generated to achieve interoperability between the RDF database and the graph database. The query is performed using bimodal semantics.
It improves the efficiency and ease of use of data querying. By automatically generating query statements, users do not need to have knowledge of database query syntax. It also enables interoperability between RDF databases and graph databases, improving the comprehensiveness and accuracy of queries.
Smart Images

Figure CN122262279A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data query technology based on artificial intelligence, and in particular to a method, apparatus and storage medium for intelligent agent query based on bimodal semantics. Background Technology
[0002] With the development of artificial intelligence technology, knowledge graph-based data retrieval and analysis are being applied to fields such as building operation and maintenance, energy systems, and production equipment management.
[0003] Knowledge graphs include two types: RDF (Resource Description Framework) and graph databases. Data queries based on knowledge graphs are typically performed only on RDF or graph databases. Therefore, improving the query efficiency of knowledge graphs is a pressing issue. Summary of the Invention
[0004] This invention provides a method, apparatus, and storage medium for intelligent agent query based on bimodal semantics, in order to solve the problem of low query efficiency when querying based on knowledge graphs.
[0005] According to one aspect of the present invention, an agent query method based on bimodal semantics is provided, comprising:
[0006] Convert the query question into a question vector;
[0007] The target database is determined from the RDF database and the graph database based on the problem vector and the preset problem vector library, wherein the RDF database and the graph database are maintained based on the same basic data;
[0008] Based on the query question, a target query statement matching the type of the target database is determined. The target query statement is then used to query the target database to obtain the query results.
[0009] According to another aspect of the present invention, an intelligent agent query device based on bimodal semantics is provided, comprising:
[0010] The question vector determination module is used to convert query questions into question vectors;
[0011] The target database determination module is used to determine the target database from the RDF database and the graph database based on the problem vector and the preset problem vector library, wherein the RDF database and the graph database are maintained based on the same basic data;
[0012] The target database query module is used to determine a target query statement that matches the type of the target database based on the query question, and to perform a query in the target database based on the target query statement to obtain the query results.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to execute the agent query method based on bimodal semantics as described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the intelligent agent query method based on bimodal semantics as described in any embodiment of the present invention.
[0018] The technical solution of this invention converts a query question into a question vector; determines a target database from an RDF database and a graph database based on the question vector and a preset question vector library, wherein the RDF database and the graph database are maintained based on the same basic data; determines a target query statement that matches the type of the target database based on the query question; and performs a query in the target database based on the target query statement to obtain the query results. Compared to the current situation where data queries can only be performed in either an RDF or graph database, resulting in incomplete data queries and low query efficiency, the technical solution provided by this invention can convert a query question into a question vector, determine a suitable target database based on the question vector, and the target database can be an RDF database or a graph database. Since the RDF database and the graph database are maintained based on the same basic data, interoperability between the RDF database and the graph database can be achieved, improving data query efficiency. Generating a target query statement based on the target database further simplifies user operations. By automatically generating query statements, users only need to describe their query or analysis needs using natural language, without requiring users to have knowledge of database query syntax, thus improving usability.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating an intelligent agent query method based on bimodal semantics provided in an embodiment of the present invention;
[0022] Figure 2 A flowchart illustrating another intelligent agent query method based on bimodal semantics provided in an embodiment of the present invention;
[0023] Figure 3 A schematic diagram of the structure of an intelligent agent query device based on bimodal semantics provided in an embodiment of the present invention;
[0024] Figure 4 A schematic diagram of the structure of an electronic device for implementing the intelligent agent query method based on bimodal semantics in this embodiment of the invention. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims, and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or device.
[0027] The inventors discovered that knowledge graph technology includes semantic graphs based on RDF / OWL (Web Ontology Language) and data models based on attribute graphs. RDF / OWL semantic graphs support rigorous ontology definitions, hierarchical inference, and rule-based reasoning, but their performance is insufficient in large-scale, real-time retrieval scenarios. Attribute graph-based data models offer flexible structures and high read / write performance, often used for large-scale relational data queries, but lack a rigorous semantic logic system. With the development of artificial intelligence, knowledge graph-based data retrieval and analysis are being applied in fields such as building maintenance, energy systems, and production equipment management. The aforementioned two types of single semantic graphs cannot simultaneously possess semantic logic reasoning capabilities (such as fault cause reasoning and equipment interlock judgment) and high-efficiency graph structure query capabilities (such as shortest path and dependency chain tracing), and cannot simultaneously guarantee the query requirements of knowledge consistency, reasoning accuracy, and high-performance querying. How to improve the query efficiency of knowledge graphs has become an urgent problem to be solved.
[0028] Figure 1 This is a flowchart illustrating a bimodal semantic-based agent query method provided in an embodiment of the present invention. This embodiment is applicable to situations where interoperability queries are performed using bimodal semantic graphs based on RDF and graph database components. This method can be executed by a bimodal semantic-based agent query device, which can be implemented in hardware and / or software and can be configured in electronic devices such as personal computers, laptops, smart devices, mobile devices, or servers. Figure 1 As shown, the method includes:
[0029] Step S101: Convert the query question into a question vector.
[0030] The query process in this embodiment of the invention can be applied to an intelligent agent, which includes an artificial intelligence agent (AIAgent). Users can input query questions using natural language according to their needs. The AIAgent converts the query question into a question vector. The question vector is used to represent natural language in a vector format. The query question can be converted into a question vector using methods such as one-hot encoding or the Bag of Words (BoW) model.
[0031] Optionally, before converting the query question into a question vector, the following may also be included:
[0032] Convert triples in an RDF database (also known as an RDF knowledge graph) into node data and relation data in a graph database;
[0033] A graph database (also known as an attribute graph knowledge graph) is constructed based on the node data and the relationship data.
[0034] In this embodiment of the invention, the graph database can be Neo4j, JanusGraph, or HugeGraph, etc. The specific database used is not limited; any database that can organize data in the form of nodes and edges can be considered a graph database. RDF triples organize data in the form of resources, attributes, and attribute values. In most use cases, such as refrigeration equipment data and public area equipment information, data is recorded in the form of RDF triples. An RDF database can be established by importing RDF or OWL files such as industry ontology information and enterprise data dictionaries. Then, the triples in the RDF database can be converted into node data and relational data (i.e., edges in the graph database) using the above method. For example, the n10s tool can be used to convert RDF triple data into nodes and edges in a Neo4j database, thereby converting data in the RDF database into data in a graph database, and thus establishing a graph database. A bidirectional and recognizable indexing system is established by creating a URI mapping between RDF and attribute graph nodes.
[0035] The above implementation method can convert data in an RDF database into data in a graph database, enabling basic data exchange between RDF databases and graph databases, and improving the reliability of database data.
[0036] Furthermore, after constructing the graph database based on the node data and the relationship data, the method further includes:
[0037] When data in either the RDF database or the graph database is updated, the corresponding data in the other database is updated synchronously.
[0038] When RDF triple data changes, the mapping relationship between RDF and graph database can be used to find the corresponding node or edge in the graph database, and then the data in the graph database can be modified accordingly.
[0039] When the data in the graph database changes, such as when new device relationships are added, the corresponding data in the RDF triplet is found and updated based on the mapping relationship between RDF and the graph database.
[0040] The above implementation method can update data in real time when data is modified in RDF database and graph database, thereby improving data validity.
[0041] Optionally, before converting the query question into a question vector, the method further includes: performing inference calculations on the RDF database to obtain inference results; and adding corresponding inference rule data to the graph database based on the inference results.
[0042] SWRL rules and OWL Reasoner can be used to perform inference computation on the semantic layer of RDF triples, and the inference results include inheritance, mutual exclusion or dependency rules, etc.
[0043] The above implementation method enables reasoning computation at the semantic layer using SWRL rules and OWL Reasoner, achieving rule-based reasoning based on RDF semantic graphs. Since RDF semantic graphs are more suitable for analyzing triples to obtain association rules between data compared to graph databases, accurate reasoning results can be obtained through RDF semantic graphs. Furthermore, the reasoning results are synchronized to the graph database, allowing the graph database to also obtain corresponding reasoning results. This achieves data interoperability while leveraging the rule-based reasoning advantages of RDF databases to improve the accuracy of the reasoning results.
[0044] Step S102: Determine the target database from the RDF database and the graph database based on the problem vector and the preset problem vector library. The RDF database and the graph database are maintained based on the same basic data.
[0045] Optionally, the target database can be determined from the RDF database and the graph database based on the problem vector and the preset problem vector library, which can be implemented in the following ways:
[0046] An approximate vector is determined from a preset problem vector library based on the problem vector; a target database is determined based on the database features contained in the approximate vector, wherein the database features represent an RDF database or a graph database.
[0047] After obtaining the question vector in step S101, a search is conducted in a pre-built preset question vector library for similar questions. The similarity between two question vectors can be calculated using parameters such as cosine similarity. The vectors in the preset question database include not only features representing the text content of the vectors but also features suitable for the database. After obtaining approximate vectors similar to the question vectors, the target database for the question vectors is determined based on the database features in the approximate vectors.
[0048] The above implementation method can determine the target database for querying based on the database characteristics of approximate vectors similar to the question vectors in the preset question vector library, thereby achieving more accurate determination of the target database, matching the target database with the question vector, and improving query accuracy.
[0049] Step S103: Determine the target query statement that matches the type of the target database based on the query question, and perform a query in the target database according to the target query statement to obtain the query result.
[0050] Optionally, determining a target query statement that matches the type of the target database based on the query question includes:
[0051] Based on the type of the target database and the query question, query statement prompts are generated; these prompts are then input into a large language model to obtain the target query statement.
[0052] Large language models can be used to convert queries described in natural language into SPARQL queries adapted to RDF databases, or to convert queries described in natural language into Cypher queries adapted to graph databases.
[0053] The above implementation can convert the natural language query questions input by the user into target query statements that match the type of the target database through a large language model, thereby achieving the generation of accurate target query statements and improving query efficiency and ease of use.
[0054] Accordingly, the target database is a graph database, and the query in the target database according to the target query statement can be implemented in the following ways:
[0055] The graph database is subjected to semantic layer analysis based on the target query statement to obtain semantic analysis results; corresponding semantic analysis data is added to the RDF database based on the semantic analysis results.
[0056] The above implementation method can perform semantic layer analysis based on graph databases and synchronize the obtained semantic analysis results to RDF databases, thereby achieving interoperability of semantic analysis results and improving query and analysis efficiency.
[0057] This invention's agent-based query method, based on bimodal semantics, converts a query question into a question vector. Based on the question vector and a preset question vector library, it determines a target database from an RDF database and a graph database, both maintained using the same underlying data. It then determines a target query statement matching the type of the target database based on the query question, and performs a query in the target database using the target query statement to obtain the query results. Compared to the current situation where data queries can only be performed in either RDF or graph databases, resulting in incomplete data retrieval and low efficiency, this invention's agent-based query method converts the query question into a question vector and determines a suitable target database based on the question vector. The target database can be either an RDF database or a graph database. Since the RDF database and the graph database are maintained using the same underlying data, interoperability between the two databases can be achieved, improving data query efficiency. Generating a target query statement based on the target database further simplifies user operations. By automatically generating query statements, users only need to describe their query or analysis needs using natural language, eliminating the need for users to have knowledge of database query syntax, thus improving usability.
[0058] Figure 2 This is a flowchart illustrating an intelligent agent query method based on bimodal semantics provided in an embodiment of the present invention. As a further explanation of the above embodiment, the method includes:
[0059] Step S201: Convert the triples in the RDF database into node data and relation data in the graph database; construct the graph database based on the node data and relation data.
[0060] Step S202: When the data in either the RDF database or the graph database is updated, the corresponding data in the other database is updated synchronously.
[0061] Step S203: Perform inference calculations on the RDF database to obtain inference results; add corresponding inference rule data to the graph database based on the inference results.
[0062] Step S204: Obtain the query question input by the user and convert the query question into a question vector.
[0063] Step S205: Determine an approximate vector from a preset problem vector library based on the problem vector; determine the target database based on the database features contained in the approximate vector, wherein the database features represent an RDF database or a graph database.
[0064] The RDF database and the graph database are maintained based on the same underlying data.
[0065] Step S206: Based on the type of the target database and the query question, determine the query statement and generate prompt words; input the query statement prompt words into the large language model to obtain the target query statement.
[0066] Step S207: Perform a query in the target database according to the target query statement to obtain the query results.
[0067] If the target database is a graph database, querying the target database according to the target query statement can be implemented as follows: performing semantic layer analysis on the graph database according to the target query statement to obtain semantic analysis results; and adding corresponding semantic analysis data to the RDF database according to the semantic analysis results.
[0068] The above implementation proposes a bimodal semantic layer architecture, achieving complementary integration of RDF and attribute graphs. It implements a bidirectional incremental synchronization mechanism from RDF to Neo4j and from Neo4j to RDF. It achieves a parallel system of "rule-based reasoning + graph computation," where the RDF database handles the logic and the Neo4j graph database handles the structure. It proposes an automatic natural language routing mechanism that can intelligently switch between SPARQL queries used in the RDF database and Cypher queries used in the graph database. Semantic consistency management is introduced to ensure synchronization of the bimodal architecture at the structural and conceptual levels. It improves retrieval performance for complex graph data while maintaining semantic reasoning capabilities. It ensures semantic standardization of knowledge, with RDF providing unified ontology constraints to reduce data silos. It utilizes reasoning rule data obtained from RDF database reasoning and deterministic rules from semantic analysis results in the graph database to reduce understanding errors in large language models. It enhances scalability and multi-source data fusion capabilities. It possesses long-lifecycle maintenance capabilities and can continuously evolve as the project expands.
[0069] Figure 3 This is a schematic diagram of a bimodal semantic-based intelligent agent query device provided in an embodiment of the present invention. This embodiment is applicable to situations where interoperability queries are performed using bimodal semantic graphs based on RDF and graph database components. This bimodal semantic-based intelligent agent query device can be implemented in hardware and / or software and can be configured in electronic devices such as personal computers, laptops, smart devices, mobile devices, or servers. Figure 3 As shown, the device includes: a problem vector determination module 31, a target database determination module 32, and a target database query module 33.
[0070] The question vector determination module 31 is used to convert the query question into a question vector.
[0071] The target database determination module 32 is used to determine the target database from the RDF database and the graph database based on the problem vector and the preset problem vector library, wherein the RDF database and the graph database are maintained based on the same basic data;
[0072] The target database query module 33 is used to determine a target query statement that matches the type of the target database based on the query question, and to perform a query in the target database based on the target query statement to obtain the query result.
[0073] Based on the above embodiments, optionally, the target database determination module 32 is used for:
[0074] An approximate vector is determined from a preset problem vector library based on the problem vector;
[0075] The target database is determined based on the database features contained in the approximate vector, where the database features represent an RDF database or a graph database.
[0076] Based on the above embodiments, optionally, the target database query module 33 is used to determine a target query statement that matches the type of the target database according to the query question, including:
[0077] Based on the type of the target database and the query question, determine the query statement and generate suggestion words;
[0078] The query statement is used to generate prompt words, which are then input into the large language model to obtain the target query statement.
[0079] Based on the above embodiments, optionally, an inference module is also included, which is used to perform inference calculations on the RDF database and obtain inference results before the question vector determination module 31 converts the query question into a question vector;
[0080] Based on the reasoning results, add corresponding reasoning rule data to the graph database.
[0081] Based on the above embodiments, optionally, the target database is a graph database, and correspondingly, the target database query module 33 is used to query the target database according to the target query statement, including:
[0082] The semantic layer analysis of the graph database is performed based on the target query statement to obtain the semantic analysis results;
[0083] Based on the semantic analysis results, add the corresponding semantic analysis data to the RDF database.
[0084] Based on the above embodiments, optionally, a construction module is also included, which is used by the question vector determination module 31 to convert the triples in the RDF database into node data and relation data in the graph database before converting the query question into a question vector;
[0085] A graph database is constructed based on the node data and the relationship data.
[0086] Based on the above embodiments, optionally, an update module is also included, which is used to synchronously update the corresponding data in another database when the data in the RDF database or any database in the graph database is updated after the construction module constructs the graph database based on the node data and the relationship data.
[0087] The intelligent agent query device based on bimodal semantics of this invention includes a question vector determination module 31, used to convert the query question into a question vector; a target database determination module 32, used to determine the target database from an RDF database and a graph database based on the question vector and a preset question vector library, wherein the RDF database and the graph database are maintained based on the same basic data; and a target database query module 33, used to determine a target query statement that matches the type of the target database based on the query question, and perform a query in the target database based on the target query statement to obtain the query result. Compared to the current situation where data can only be queried from either an RDF or graph database, resulting in incomplete data query and low query efficiency, the intelligent agent query device based on bimodal semantics of this invention can convert the query question into a question vector and determine the appropriate target database based on the question vector. The target database can be an RDF database or a graph database. Since the RDF database and the graph database are maintained based on the same basic data, interoperability between the RDF database and the graph database can be achieved, improving data query efficiency. Generating target query statements based on the target database can further simplify user operations. By automatically generating query statements, users only need to describe their query or analysis needs in natural language, without needing to have knowledge of database query syntax, thus improving ease of use.
[0088] The intelligent agent query device based on bimodal semantics provided in this embodiment of the invention can execute the intelligent agent query method based on bimodal semantics provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0089] Figure 4This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0090] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0091] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as a camera, ultrasonic sensor, infrared sensor, etc.; output unit 17, such as various types of speakers, etc.; storage unit 18, such as a disk, solid-state drive, etc.; and communication unit 19, such as a network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0092] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the agent query method based on bimodal semantics.
[0093] In some embodiments, the agent query method based on bimodal semantics can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the agent query method based on bimodal semantics described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the agent query method based on bimodal semantics by any other suitable means (e.g., by means of firmware).
[0094] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0095] Computer programs for implementing the bimodal semantics-based agent query method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0096] This invention also provides a computer-readable storage medium storing computer instructions for causing a processor to execute an agent query method based on bimodal semantics, the method comprising:
[0097] Convert the query question into a question vector;
[0098] The target database is determined from the RDF database and the graph database based on the problem vector and the preset problem vector library, wherein the RDF database and the graph database are maintained based on the same basic data;
[0099] Based on the query question, a target query statement matching the type of the target database is determined. The target query statement is then used to query the target database to obtain the query results.
[0100] Based on the above embodiments, optionally, the target database is determined from the RDF database and the graph database according to the problem vector and the preset problem vector library, including:
[0101] An approximate vector is determined from a preset problem vector library based on the problem vector;
[0102] The target database is determined based on the database features contained in the approximate vector, where the database features represent an RDF database or a graph database.
[0103] Based on the above embodiments, optionally, determining a target query statement that matches the type of the target database according to the query question includes:
[0104] Based on the type of the target database and the query question, determine the query statement and generate suggestion words;
[0105] The query statement is used to generate prompt words, which are then input into the large language model to obtain the target query statement.
[0106] Based on the above embodiments, optionally, before converting the query question into a question vector, the method further includes:
[0107] Perform inference calculations on the RDF database to obtain the inference results;
[0108] Based on the reasoning results, add corresponding reasoning rule data to the graph database.
[0109] Based on the above embodiments, optionally, the target database is a graph database, and correspondingly, querying the target database according to the target query statement includes:
[0110] The semantic layer analysis of the graph database is performed based on the target query statement to obtain the semantic analysis results;
[0111] Based on the semantic analysis results, add the corresponding semantic analysis data to the RDF database.
[0112] Based on the above embodiments, optionally, before converting the query question into a question vector, the method further includes:
[0113] Convert triples in an RDF database into node and relation data in a graph database;
[0114] A graph database is constructed based on the node data and the relationship data.
[0115] Based on the above embodiments, optionally, after constructing the graph database according to the node data and the relationship data, the method further includes:
[0116] When data in either the RDF database or the graph database is updated, the corresponding data in the other database is updated synchronously.
[0117] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0118] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0119] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0120] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0121] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0122] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A smart agent query method based on bimodal semantics, characterized in that, include: Convert the query question into a question vector; The target database is determined from the RDF database and the graph database based on the problem vector and the preset problem vector library, wherein the RDF database and the graph database are maintained based on the same basic data; Based on the query question, a target query statement matching the type of the target database is determined. The target query statement is then used to query the target database to obtain the query results.
2. The method according to claim 1, characterized in that, Based on the aforementioned question vectors and a preset question vector library, the target database is determined from the RDF database and the graph database, including: An approximate vector is determined from a preset problem vector library based on the problem vector; The target database is determined based on the database features contained in the approximate vector, where the database features represent an RDF database or a graph database.
3. The method according to claim 2, characterized in that, Based on the query question, determine the target query statement that matches the type of the target database, including: Based on the type of the target database and the query question, determine the query statement and generate suggestion words; The query statement is used to generate prompt words, which are then input into the large language model to obtain the target query statement.
4. The method according to claim 1, characterized in that, Before converting the query question into a question vector, the following is also included: Perform inference calculations on the RDF database to obtain the inference results; Based on the reasoning results, add corresponding reasoning rule data to the graph database.
5. The method according to claim 4, characterized in that, The target database is a graph database. Accordingly, the query is performed in the target database according to the target query statement, including: The semantic layer analysis of the graph database is performed based on the target query statement to obtain the semantic analysis results; Based on the semantic analysis results, add the corresponding semantic analysis data to the RDF database.
6. The method according to claim 5, characterized in that, Before converting the query question into a question vector, the following is also included: Convert triples in an RDF database into node and relation data in a graph database; A graph database is constructed based on the node data and the relationship data.
7. The method according to claim 6, characterized in that, After constructing the graph database based on the node data and the relationship data, the method further includes: When data in either the RDF database or the graph database is updated, the corresponding data in the other database is updated synchronously.
8. A smart agent query device based on bimodal semantics, characterized in that, include: The question vector determination module is used to convert query questions into question vectors; The target database determination module is used to determine the target database from the RDF database and the graph database based on the problem vector and the preset problem vector library, wherein the RDF database and the graph database are maintained based on the same basic data; The target database query module is used to determine a target query statement that matches the type of the target database based on the query question, and to perform a query in the target database based on the target query statement to obtain the query results.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the agent query method based on bimodal semantics as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the agent query method based on bimodal semantics as described in any one of claims 1-7.