A knowledge graph-based query processing system, method and medium

By monitoring changes in the data table fields of the non-graph database and updating the mapping relationships of the graph database in real time, the real-time and accuracy issues of knowledge graph query processing are solved, achieving efficient query processing.

CN116881474BActive Publication Date: 2025-11-11GONGFU (QINGDAO) TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310874365.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-17
Publication Date
2025-11-11
Estimated Expiration
2043-07-17

AI Technical Summary

Technical Problem

In existing technologies, the query processing of knowledge graphs is not real-time and has poor accuracy, mainly because the mapping relationship between non-graph databases and graph databases cannot be updated in a timely manner, resulting in an inability to respond promptly to changes in the database.

Method used

Design a knowledge graph-based query system, including a monitoring module, a mapping relationship construction module, and a query module. The system monitors changes in data table fields in a non-graph database, updates the mapping relationships in the graph database in real time, and performs queries by converting the graph database query language into the non-graph database query language.

Benefits of technology

It enables timely response and accurate querying of knowledge graph data sources, improves the real-time performance and accuracy of queries, reduces dependence on graph databases, and saves costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881474B_ABST
    Figure CN116881474B_ABST
Patent Text Reader

Abstract

The application provides a knowledge graph-based query processing system, method and medium. When the monitoring module collects the change in the number of fields of the data table of the non-graph database associated with the knowledge graph, the system determines the target field causing the change in the data table, so that the mapping relationship construction module is used to establish the first mapping relationship between the target field and the data of the graph database mode associated with the knowledge graph, and the first mapping relationship is used to obtain the updated mapping relationship; then the query module converts the graph database query language into the non-graph database query language based on the updated mapping relationship sent by the information center module to realize the query processing of the knowledge graph. For digital transformation factories and industrial internet enterprises, the application can directly and real-timely obtain the latest information from the non-graph database through the graph database query language (RDF / CYPHER), and then realize the intelligentization of the enterprise without increasing a new graph database to save the cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data, specifically to a query processing system, method, and medium based on knowledge graphs. Background Technology

[0002] Knowledge graphs are structured semantic knowledge bases used to quickly describe concepts and their relationships in the physical world. Through knowledge graphs, information, data, and links on the Web can be aggregated into knowledge, making information resources easier to compute, understand, and evaluate, and enabling rapid response and retrieval of knowledge.

[0003] In existing technologies, knowledge graphs are primarily stored in the form of graph databases, such as those using the Resource Description Framework (RDF) format, one of the data models for graph databases. It is understood that data from graph databases can serve as a data source for knowledge graphs. Furthermore, due to the diversification of data models, non-graph database data models, such as relational databases (Redis Database, RDB), can also serve as data sources for knowledge graphs. However, data from non-graph databases used as source data for knowledge graphs requires data transformation processing to convert it into graph database data. For example, existing technologies can utilize D2RQ tools to convert data from relational databases into RDF format for storage.

[0004] However, when data tables or attributes in a relational database are added or deleted, the D2RQ tool cannot detect these changes in a timely manner and convert them into RDF format data. This results in technical problems such as low real-time performance and poor accuracy when querying knowledge graphs. Summary of the Invention

[0005] This application provides a knowledge graph-based query processing system, method, and medium to solve the technical problems of low timeliness and poor accuracy in existing knowledge graph-based query processing.

[0006] In the first aspect, this application provides a knowledge graph-based query system, comprising a monitoring module, a mapping relationship construction module, and a query module;

[0007] The monitoring module is used to monitor whether the number of fields in each data table of the non-graph database associated with the knowledge graph has changed; when it is determined that the number of fields has changed, the target data table in which the number of fields has changed is identified, and the target field in which the change is obtained from the target data table;

[0008] The mapping relationship construction module is used to receive the target field sent by the monitoring module, and map the target field to the graph database associated with the knowledge graph to obtain the first mapping relationship between the target field and the graph database;

[0009] The mapping relationship construction module is also used to add / delete the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtain the updated initial mapping relationship, and send the updated initial mapping relationship to the query module; the updated initial mapping relationship includes: the identifier of the entity / ontology, and the identifier of the data table associated with the identifier of the entity / ontology;

[0010] The query module is used to obtain the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtain the identifier of the data table to be queried corresponding to the entity / ontology to be queried in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried.

[0011] In one specific implementation, the non-graph database includes: identifiers for data tables and fields associated with the identifiers of each data table; then the monitoring module is specifically used for:

[0012] For each table identifier in the non-graph database, count the first quantity value of the fields of the table corresponding to the table identifier at the current time.

[0013] Accumulate the second quantity value of the fields in the data table associated with the current time point at the previous time point;

[0014] The first quantity value and the second quantity value are compared; wherein the first quantity value and the second quantity value are the same or different.

[0015] If the first quantity value and the second quantity value are not the same, it is determined that the number of fields in the data table has changed.

[0016] In one specific embodiment, the non-graph database further includes: a field name associated with the identifier of each of the data tables; the monitoring module is further specifically used for:

[0017] For a target data table where the number of fields changes, obtain the first field name corresponding to a first number value of the fields in the target data table, and obtain the second field name corresponding to a second number value of the fields in the target data table; wherein, the first field name and the second field name may be the same or different;

[0018] The first field name is matched with the second field name, and the field corresponding to either the first field name or the second field name that cannot be matched is taken as the target field.

[0019] In one specific implementation, the graph database includes: entity / ontology identifiers; then the mapping relationship construction module is specifically used for:

[0020] In the non-graph database, the identifier of the target data table is obtained according to the target data table to which the target field belongs;

[0021] Traverse the entity / ontology identifiers in the graph database to obtain the identifiers of the target entity / ontology corresponding to the identifiers of the target data table;

[0022] Add / delete the target field corresponding to the identifier of the target entity / ontology to obtain the first mapping relationship.

[0023] In one specific implementation, the mapping relationship construction module is further configured to:

[0024] For the initial mapping relationship between the non-graph database and the graph database, a set of mapping relationships between the identifier of the target entity / ontology and the identifier of the target data table is determined; the set of mapping relationships does not contain the first mapping relationship;

[0025] The first mapping relationship is added to the mapping relationship set, or the first mapping relationship is deleted from the mapping relationship set, to obtain the updated initial mapping relationship.

[0026] In one specific implementation, the query module is specifically used for:

[0027] Obtain the query processing request sent by the user; the query processing request includes: graph database query language; the graph database query language includes: the identifier of the entity / ontology to be queried;

[0028] Based on the updated initial mapping relationship, the query mapping relationship corresponding to the identifier of the entity / ontology to be queried, and the identifier of the query data table associated with the query mapping relationship are obtained;

[0029] Using the conversion rules between the graph database query language and the non-graph database query language, the graph database query language is converted into a non-graph database query language related to the data table to be queried, which corresponds to the identifier of the data table to be queried.

[0030] Using the non-graph database query language, a search is performed in the data table corresponding to the identifier of the data table to be queried, so as to find information associated with the identifier of the entity / ontology to be queried.

[0031] In one specific embodiment, the system further includes: an information center module and a database center module;

[0032] The information center module is connected to the monitoring module, the mapping relationship construction module, and the query module, respectively, and is used to transmit communication data between the monitoring module, the mapping relationship construction module, and the query module; the communication data includes: the target field and the first mapping relationship;

[0033] The database center module is used to receive the non-graph database query language sent by the query module, perform search processing in the query data table corresponding to the identifier of the query data table according to the non-graph database query language, and feed back the search processing result to the user in the form of a graph database.

[0034] Secondly, this application provides a knowledge graph-based query method, which, when applied to the system described in the first aspect, includes:

[0035] The monitoring module monitors whether the number of fields in each data table of the non-graph database associated with the knowledge graph has changed; when it is determined that the number of fields has changed, it identifies the target data table where the number of fields has changed and obtains the target field that has changed from the target data table.

[0036] The mapping relationship construction module receives the target field sent by the monitoring module and maps the target field to a graph database associated with the knowledge graph to obtain the first mapping relationship between the target field and the graph database.

[0037] The mapping relationship construction module adds / deletes the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtains the updated initial mapping relationship, and sends the updated initial mapping relationship to the query module; the updated initial mapping relationship includes: the identifier of the entity / ontology, and the identifier of the data table associated with the identifier of the entity / ontology;

[0038] The query module obtains the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtains the identifier of the data table to be queried corresponding to the entity / ontology in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried.

[0039] Thirdly, this application provides a server, including: a processor, and a memory communicatively connected to the processor;

[0040] The memory is used to store the executable instructions of the processor;

[0041] The processor is configured to execute the method described in the second aspect by executing the executable instructions.

[0042] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the second aspect.

[0043] This application provides a knowledge graph-based query processing system, method, and medium. The monitoring module is used to monitor whether the number of fields in each data table of the non-graph database associated with the knowledge graph changes; when it is determined that the number of fields has changed, the target data table where the number of fields has changed is identified, and the changed target field is obtained from the target data table; the mapping relationship construction module is used to receive the target field sent by the monitoring module, map the target field to the graph database associated with the knowledge graph, and obtain a first mapping relationship between the target field and the graph database; the mapping relationship construction module is also used to add / delete the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtain an updated initial mapping relationship, and send the updated initial mapping relationship to the query module; the updated initial mapping relationship includes: the identifier of the entity / ontology, and the identifier of the data table associated with the identifier of the entity / ontology; the query module is used to obtain the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtain the identifier of the data table to be queried corresponding to the entity / ontology to be queried in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried. Compared to existing technologies, the method provided in this application can automatically monitor changes in the data sources corresponding to the knowledge graph, especially changes in non-graph database format data, and automatically update the mapping relationship between non-graph database data and graph database data in a timely manner based on the changes in the non-graph database. This allows the graph database query language to be converted into the non-graph data query language when users use the knowledge graph query language, i.e., the graph database query language, to perform queries, thereby facilitating the query of non-graph database data content. This approach can respond to updates to the non-graph database in a timely manner and improve the accuracy of knowledge graph-based queries. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 A schematic diagram of the structure of a knowledge graph-based query system according to an embodiment of this application;

[0046] Figure 2 A flowchart illustrating the processing steps of the monitoring module provided in this application, as shown in Embodiment 1.

[0047] Figure 3 A flowchart illustrating the processing steps of the mapping relationship construction module provided in this application, as shown in Embodiment 1;

[0048] Figure 4 A schematic diagram of the structure of a graph database provided in this application;

[0049] Figure 5 This application provides a data illustration of the target fields mapped to a graph database schema.

[0050] Figure 6 A flowchart illustrating the query module processing steps of Embodiment 1 provided in this application;

[0051] Figure 7 A schematic diagram of the structure of Embodiment 2 of the knowledge graph-based query system provided in this application;

[0052] Figure 8 This is a flowchart illustrating an embodiment of the knowledge graph-based query method provided in this application. Detailed Implementation

[0053] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments made by those skilled in the art under the guidance of these embodiments are within the scope of protection of this application.

[0054] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises 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 processes, methods, products, or apparatus.

[0055] In existing technologies, with the development of computer technology and big data, knowledge graphs are no longer limited to the search field, but also include applications in areas such as automated question answering and big data analysis. As the data foundation for these fields, knowledge graphs can establish relationships between data from various aspects, thus forming a structured semantic knowledge base. This, in turn, facilitates processing in these fields, improving processing efficiency. It is conceivable that the richer and more comprehensive the knowledge content covered by the knowledge graph, the higher the accuracy of the processing work it assists in.

[0056] The amount of content in a knowledge graph is related to the domain and depth of its corresponding data source. Currently, knowledge graph data can come from structured, semi-structured, or unstructured data, basically covering various types of data generated in people's daily lives and work. Structured data refers to relatively standardized data, such as data in relational databases; semi-structured data refers to HTML documents, XML documents, etc.; unstructured data includes a line of text, an image, a log, and an email. Knowledge graphs use graph databases for storage, which are a type of unstructured data. This storage method includes related points and lines. Points represent the ontology or entity in the knowledge graph, while lines represent the relationships between two points. Correspondingly, querying knowledge graphs under the graph data storage model gives rise to a corresponding graph database query language, which, based on semantic recognition, enables rapid query processing of knowledge graphs.

[0057] However, with societal development, the knowledge base stored in a knowledge graph is not static; rather, its content becomes increasingly richer over time. In the subsequent enrichment of the knowledge graph, if graph data structures are used exclusively, engineers also need to construct non-graph databases (including structured and semi-structured data, as well as unstructured data other than graph databases) into non-graph data for storage. Due to the large volume of data involved, the processing workload is substantial, and the frequent enrichment of the data sources corresponding to the knowledge graph slows down the creation process, thus impacting query efficiency.

[0058] Based on this, researchers developed the D2RQ tool to convert data from non-graph databases into virtual graph databases, such as converting data from relational databases to RDF format. This establishes a mapping relationship between non-graph databases and graph databases, generating a mapping file. This mapping file can then be used to convert knowledge graph query language (graph database query language) into non-graph database query language, such as converting SPARQL to SQL. This allows for querying non-graph databases without needing to construct them into graph database data. In other words, by uploading relevant non-graph databases to the corresponding knowledge graph database, and without needing to construct the uploaded non-graph database into an existing graph database format, queries can be performed on the non-graph database using graph database query language.

[0059] Currently, existing technologies also have corresponding drawbacks: they cannot update the mapping relationship between non-graph databases and graph databases in a timely manner. This means that even if the database in the knowledge graph is updated, the updated content cannot be retrieved, resulting in low accuracy for knowledge graph queries. This is because each time data from a non-graph database is uploaded to the knowledge graph, the D2RQ engine needs to be manually started to establish the mapping relationship between the non-graph database and the graph database. Furthermore, the D2RQ engine cannot autonomously detect changes in the non-graph database, such as changes to table attributes or the tables themselves. This prevents timely conversion of the data into RDF format, leading to technical problems such as low real-time performance and poor accuracy when querying the knowledge graph.

[0060] Based on the above-mentioned technical problems, the technical concept of this application is: how to design a query system and method that can improve the real-time performance and accuracy of knowledge graph queries.

[0061] The technical solution of this application will now be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0062] Figure 1 This is a schematic diagram illustrating the structure of an embodiment of a knowledge graph-based query system provided in this application. See also... Figure 1 The system 10 includes a monitoring module 101, a mapping relationship construction module 102, and a query module 103.

[0063] It should be noted that the system mentioned in this embodiment can be applied not only to the aforementioned fields, but also to industrial scenarios. That is, industrial scenarios are not limited to a small workshop, but more often to scenarios corresponding to the entire industrial chain, and can be applied to scenarios where different data storage modes are adopted for entities under multiple industrial chains.

[0064] The monitoring module is used to monitor whether the number of fields in each data table in the non-graph database associated with the knowledge graph has changed; when it is determined that the number of fields has changed, the target data table where the number of fields has changed is identified, and the target field that has changed is obtained from the target data table.

[0065] In this embodiment, the monitoring module can detect changes in the number of fields in the data tables of the non-graph data associated with the knowledge graph in real time, thus enabling real-time monitoring of whether there are changes in the non-graph data.

[0066] Taking a non-graph relational database as an example, each relational database stores multiple different data tables, and each data table stores multiple different fields. Therefore, it can be understood that changes in a non-graph database can be caused by changes in the number of fields in the data tables, such as adding or removing fields.

[0067] Changes in the number of data tables also fall under the category of changes in non-graph databases. Corresponding to this situation, the processing steps performed by the system are similar to those for changes in the number of fields, and will not be elaborated here.

[0068] After the monitoring module detects a change in the number of fields in a data table, it needs to determine which specific data table experienced the change. This means identifying the target data table where the field number change occurred, as well as the target field that changed within that target data table. For example, if a new field A was added, then field A becomes the target field. The target field is then sent to the mapping relationship construction module for subsequent processing.

[0069] Once the mapping relationship building module receives the target field, it can be used to receive the target field sent by the monitoring module and map the target field to the graph database associated with the knowledge graph in order to obtain the first mapping relationship between the target field and the graph database.

[0070] The mapping relationship construction module is a bridge for transforming target fields into knowledge graph data graph databases. In this embodiment, the transformation mentioned is only a conceptual transformation, which can be understood as mapping target fields into virtual graph database pattern data.

[0071] It should be noted that the graph database in a knowledge graph includes: ontology and entity; specifically, the graph database is composed of nodes and lines. Nodes can represent either ontology or entity, and lines represent the relationship between two nodes. Ontology is a higher-level concept relative to entity. For example, if the ontology is the concept of "person", then the corresponding entity can be the specific information of "Xiaoming".

[0072] Optionally, the mapping relationship construction module first needs to establish the first mapping relationship between the target field and the data in the graph database schema, that is, to convert the information in the target field into nodes in the graph database and establish the association relationship between the node and other nodes, thereby obtaining the first mapping relationship.

[0073] Secondly, the mapping relationship construction module is also used to add / delete the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtain the updated initial mapping relationship, and send the updated initial mapping relationship to the query module; the updated initial mapping relationship includes: the identifier of the entity / ontology, and the identifier of the data table associated with the identifier of the entity / ontology.

[0074] It's worth mentioning that the system pre-stores the initial mapping relationship between graph databases and non-graph databases. This mapping relationship specifically refers to the correspondence between data in non-graph databases and graph databases. In other words, the initial mapping relationship is the mapping relationship between entities / ontologies in the graph database and data tables in the non-graph database.

[0075] Since changes in a graph database can be either adding new tables or adding new table attributes, or deleting a table or table attributes, the initial mapping relationship should be added or deleted in order to obtain the updated initial mapping relationship.

[0076] Correspondingly, the updated initial mapping relationship consists of the entity / ontology identifier and the identifier of the data table associated with the entity / ontology identifier.

[0077] Subsequently, the mapping relationship building module feeds back the updated mapping relationship to the query module for subsequent query processing.

[0078] It is conceivable that by repeating the above processing, the mapping relationship in the knowledge graph will be updated, thereby automatically mapping the changing non-graph database to the graph database.

[0079] After updating the mapping relationship, it is beneficial for the query module to convert and process the query language, and also helps to perform query processing quickly, efficiently and in real time.

[0080] In other words, the updated mapping relationship can be used as a reference for the query language, thereby enabling timely and efficient search processing.

[0081] Optionally, a query module is used to obtain the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtain the identifier of the data table to be queried corresponding to the entity / ontology to be queried in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried.

[0082] In this embodiment, when a user performs a query on the terminal interface, a query processing request is sent to the system. The query processing request includes a query statement, which is usually a query statement corresponding to a graph database, such as the SPARQL language. The query statement includes the content to be queried, such as the entity to be queried or the attributes of the entity.

[0083] Next, the query module needs to confirm whether the identifier of the entity / ontology to be queried exists in a non-graph database. Optionally, the query module can traverse the updated mapping relationship according to the content to be queried to determine the identifier of the entity or the entity's identifier associated with the query table. Then, based on the conversion rules between graph database query language and non-graph data query language, the graph database query language SPARQL is converted into SQL language for queryable data tables, so as to perform search processing in the query table to find the information associated with the identifier of the entity / ontology to be queried.

[0084] In this embodiment, a knowledge graph-based query system is provided, comprising a monitoring module, a mapping relationship construction module, and a query module. The monitoring module monitors whether the number of fields in each data table of a non-graph database associated with the knowledge graph changes. When a change in the number of fields is detected, the system identifies the target data table where the field number change occurred and retrieves the changed target field from the target data table. The mapping relationship construction module receives the target field sent by the monitoring module and maps the target field to the graph database associated with the knowledge graph to obtain a first mapping relationship between the target field and the graph database. The mapping relationship construction module also... This system is used to add / delete the first mapping relationship in the initial mapping relationship between non-graph databases and graph databases, obtain the updated initial mapping relationship, and send the updated initial mapping relationship to the query module. The updated initial mapping relationship includes the identifier of the entity / ontology and the identifier of the data table associated with the entity / ontology identifier. The query module is used to obtain the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtain the identifier of the data table to be queried corresponding to the entity / ontology to be queried in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried. The monitoring module provided by this system can monitor the data source corresponding to the knowledge graph in real time, so as to determine whether the non-graph data in the data source corresponding to the knowledge graph has changed. When a change occurs, it triggers other modules in this system to cooperate to automatically map the target field to the data in the graph database schema, thereby updating the initial mapping relationship of the knowledge graph in a timely manner, so as to effectively convert the query language for querying non-graph databases, and improve the query processing efficiency and accuracy when the target field can be queried. For factories undergoing digital transformation and industrial internet enterprises, this application can directly obtain the latest information from non-graph databases in real time through Graph Database Query Language (RDF / CYPHER), thereby achieving enterprise intelligence without adding new graph databases to save costs.

[0085] The following is combined with Figure 2 The monitoring module provided in this application will be further described below. Figure 2 The flowchart of the monitoring module processing steps in Embodiment 1 provided in this application is shown below. Figure 2 As shown, the processing steps include:

[0086] S201, for each table identifier in the non-graph database, calculate the first quantity value of the fields of the table corresponding to the table identifier at the current time.

[0087] It should be noted that the data storage mode corresponding to knowledge graphs is mainly graph database mode, such as RDF, but as various industries expand their businesses and their business needs change, their data storage mode can also be non-graph database, such as relational database.

[0088] In addition, it should be noted that non-graph databases include: the identifier of the data table, and the fields associated with the identifier of each data table.

[0089] In this embodiment, the monitoring module monitors the database containing the data corresponding to the knowledge graph, especially the non-graph database. Optionally, the monitoring module can use log monitoring to monitor the non-graph database, that is, it can determine whether the non-graph database has changed by monitoring information such as the database logs.

[0090] Specifically, each time the monitoring module obtains the log information of the database corresponding to the knowledge graph, it retrieves the previous log information, performs information comparison processing, and determines whether the non-graph database has changed.

[0091] This can be understood as the monitoring module calculating the first quantity value of each field in each data table in the non-graph database at the current time, such as counting the number of class vectors in each data table, in order to determine the first quantity value of each field in each data table.

[0092] S202, the second quantity value of the fields of the data table associated with the current time at the previous time.

[0093] More specifically, the monitoring module also needs to obtain the second quantity value of the field of the data table associated with the current time, following the aforementioned processing steps.

[0094] Therefore, the quantity obtained at the previous moment is used as the basis for determining whether the non-graph database has changed.

[0095] S203, compare the first quantity value and the second quantity value; wherein the first quantity value and the second quantity value are the same or different.

[0096] Furthermore, the monitoring module can compare the first quantity value with the second quantity value to determine whether the number of fields in each data table of the non-graph database has increased or decreased.

[0097] S204, if the first quantity value and the second quantity value are different, then it is determined that the number of fields in the data table has changed.

[0098] When the monitoring module determines that the number of fields in a data table in a non-graph database has increased or decreased, it indicates that the non-graph database method has changed.

[0099] If the monitoring module determines that the number of data tables in the non-graph database has not increased or decreased, and / or determines that the attributes of the data tables have not increased or decreased, and determines that the non-graph database method has not changed, it also needs to generate change information, such as the field value corresponding to the change information being 0.

[0100] In one optional embodiment, it is specifically explained that when a change is determined to occur in a non-graph database, the monitoring module, for a target data table where the number of fields has changed, obtains the first field name corresponding to a first quantity value of the fields in the target data table, and obtains the second field name corresponding to a second quantity value of the fields in the target data table; wherein the first field name and the second field name are the same or different; the first field name and the second field name are matched, and the field corresponding to the first field name or the second field name that cannot be matched is taken as the target field.

[0101] It is worth mentioning that the non-graph database in this embodiment also includes: field names of fields associated with the identifier of each data table.

[0102] In this optional embodiment, the monitoring module needs to determine the difference between the log at the current time and the log at the previous time. Optionally, the monitoring module can compare the data table name corresponding to the first quantity value obtained at the current time with the field names of the data table corresponding to the second quantity value one by one to determine the data table that has been added or removed. At the same time, it also needs to compare the field names in each data table to determine the data table that has been added or removed, that is, to compare the first field with the second field one by one.

[0103] Specifically, the monitoring module obtains the first field name corresponding to the first quantity value of the field in the target data table at the current time; similarly, it also needs to obtain the second field name corresponding to the second data quantity value of the field in the target data table at the previous time.

[0104] Subsequently, the monitoring module matches the first field name with the second field name one by one to identify the data that differs. That is, the first field name that cannot be matched with the second field name will be used as the target field.

[0105] In this optional embodiment, the monitoring module uses a method of comparing log information from a non-graph database to determine the target field in the non-graph data, thereby accurately locating the content of the target field so that subsequent processing can be performed only based on the target field. This shortens the processing time and improves the system's processing efficiency.

[0106] The following is combined with Figure 3 The mapping relationship construction module provided in this application will be further explained. Figure 3The flowchart of the mapping relationship construction module processing steps provided in this application is shown in Embodiment 1. Figure 3 As shown, the processing steps include:

[0107] S301, In a non-graph database, obtain the identifier of the target data table based on the target data table to which the target field belongs.

[0108] It should be noted that graph databases store ontology and entities, as well as information such as entity attributes. Graph databases are mainly composed of nodes and line segments. Nodes can be ontology or entities, and ontology is a higher-level concept than entity. That is, multiple entities can exist under a certain ontology, and the relationships between multiple entities can be represented by line segments. Figure 4 A schematic diagram of the structure of a graph database provided in this application, such as... Figure 4 As shown in the diagram, A represents a student, B represents a school, and C represents a class. It can be seen that there is a line segment "attends" relationship between A and B, meaning A attends B; a line segment "belongs" relationship between A and C, meaning A belongs to C; and a line segment "belongs" relationship between C and B, meaning C belongs to B. A, B, and C are entities, and each can belong to a different entity, such as A belonging to the student entity, B belonging to the school entity, and C belonging to the class entity.

[0109] In this embodiment, after the mapping relationship construction module obtains the target field, it performs mapping processing on the non-graph database target field to graph database schema data.

[0110] Specifically, after obtaining the target field, the mapping relationship construction module can, as described above, be a newly added / deleted data table and / or a newly added / deleted field. However, regardless of the type of target field, the mapping relationship construction module needs to obtain the target data table corresponding to these target fields, as well as the target name of the target data table, in order to determine whether these target fields correspond to entities or ontologies in the graph database.

[0111] S302, traverse the entity / ontology identifiers in the graph database and obtain the identifier of the target entity / ontology corresponding to the identifier of the target data table.

[0112] Specifically, the mapping relationship construction module needs to traverse the graph database, which can be done using a breadth-first traversal method, in order to determine the identifier of the target entity / ontology that matches the target name. For example, if the target name of the target data table is "student Xiaoming", then the target field is determined to correspond to node A mentioned in the previous example, that is, the target field should be stored in this position of the graph data.

[0113] S303, Add / delete target fields in the target entity / ontology corresponding to the identifier of the target entity / ontology, and obtain the first mapping relationship.

[0114] Furthermore, when the mapping relationship construction module determines that the target entity / ontology corresponding to the identifier of the target name, such as "student Xiaoming" mentioned in the previous example, should belong to the ontology to which node A belongs, and has a classmate relationship with node A, the target field is set as node D. Figure 5 A data diagram illustrating the mapping of the target fields provided in this application to a graph database schema, such as... Figure 5 As shown, compared to Figure 4 There is an additional node D, and D and A have a classmate relationship.

[0115] Subsequently, the mapping relationship building module obtains the first mapping relationship.

[0116] S304, for the initial mapping relationship between a non-graph database and a graph database, determine the set of mapping relationships between the identifier of the target entity / ontology and the identifier of the target data table; the set of mapping relationships does not contain the first mapping relationship.

[0117] To improve the accuracy of subsequent query processing, the mapping relationship construction module also needs to update the initial mapping relationship.

[0118] Specifically, the mapping relationship construction module obtains a set of all mapping relationships between the target entity / ontology identifier and the target data table identifier from the initial mapping relationship based on the identifier of the target entity / ontology and the identifier of the target data table in the first mapping relationship.

[0119] S305, add the first mapping relationship to the mapping relationship set, or delete the first mapping relationship from the mapping relationship set, to obtain the updated initial mapping relationship.

[0120] After the mapping relationship building module obtains the first mapping relationship, it needs to add it to the mapping relationship collection to obtain the updated mapping relationship. For example, adding information like "target field - A, classmate" to the mapping relationship. Alternatively, there might be a situation where the first mapping relationship is deleted from the mapping relationship collection.

[0121] This embodiment specifically explains how the mapping relationship construction module constructs the first mapping relationship between the target field and the data in the graph database pattern, and how it uses the first mapping relationship to obtain the updated mapping relationship. By automatically mapping the target field to the data in the graph database pattern associated with the knowledge graph in real time, it can respond promptly to changes in non-graph databases, laying the foundation for accurate queries.

[0122] The following is combined with Figure 6 The query module mentioned in this application will be further explained below. Figure 6 A flowchart illustrating the query module processing steps in Embodiment 1 of this application is shown below. Figure 6 As shown, the processing steps include:

[0123] S601, Obtain the query processing request sent by the user; the query processing request includes: graph database query language; the graph database query language includes: the identifier of the entity / ontology to be queried.

[0124] In this embodiment, when a user needs to query, such as by sending an HTML request or entering a command-line statement through a terminal to query the production process of a certain device, the user can send a query processing request through the terminal. This query processing request includes the identifier of the entity / ontology to be queried. It is understood that the query language for a knowledge graph can be a one-sentence description, possessing certain semantic elements.

[0125] S602, based on the updated initial mapping relationship, obtain the query mapping relationship corresponding to the identifier of the entity / ontology to be queried, and the identifier of the data table to be queried associated with the query mapping relationship.

[0126] Specifically, after obtaining the identifier of the entity / ontology to be queried in the query language of the graph database in the query processing request, the query module first traverses the updated initial mapping relationship, and then determines all the query mapping relationships corresponding to the identifier of the entity / ontology to be queried, as well as the identifier of the data table to be queried associated with the query mapping relationship in the updated initial mapping relationship.

[0127] In other words, by using the updated initial mapping relationship, the identifier of the data table to be queried, which is associated with the identifier of the entity / ontology to be queried, can be deduced.

[0128] As in the previous example, assuming the search is for student information of school F, the entity F is identified in the mapping relationship. Then, based on the entity F, related entities associated with it are searched, that is, the entity F is taken as the target entity, and the corresponding target mapping relationship associated with the entity F is determined. Then, it is determined what database the target ontology or target entity associated with these target mapping relationships is. When it is determined that the database corresponding to the target entity or target ontology is a non-graph database, the target data table to which the target entity or target ontology belongs is determined.

[0129] S603 uses the conversion rules between graph database query language and non-graph database query language to convert the graph database query language into a non-graph database query language related to the identifier of the data table to be queried.

[0130] It should be noted that the system has pre-stored syntax rules for converting between graph database query language and non-graph data query language. These syntax rules are used to translate query languages, and the implementation of these syntax rules includes, but is not limited to, those set by those skilled in the art.

[0131] Based on this, the query module converts the graph query language into a non-graph query language according to the mapping rule, and the non-graph query language is a non-graph database query language related to the data table to be queried, which corresponds to the identifier of the data table to be queried.

[0132] Optionally, this embodiment can also utilize a language conversion tool to implement the upload processing steps; however, the specific language conversion tool is not limited here.

[0133] S604. Using a non-graph database query language, perform a search process in the data table corresponding to the identifier of the data table to be queried, so as to find the information associated with the identifier of the entity / ontology to be queried.

[0134] Subsequently, the query module uses a non-graph database query language to connect to the corresponding query table of the data table to be queried through the related modules in the system, and performs a search to find the information associated with the identifier of the entity / ontology to be queried.

[0135] This embodiment specifically illustrates how the query language conversion module converts the graph database query language into a non-graph database query language based on the updated mapping relationship, which lays the foundation for timely queries.

[0136] Below, in conjunction with Figure 7 The system provided in this application will be further described. Figure 7 This is a schematic diagram of the structure of Embodiment 2 of the knowledge graph-based query system provided in this application, as shown below. Figure 7 As shown, the system also includes an information center module 104 and a database center module 105.

[0137] Specifically, the information center module is connected to the monitoring module, the mapping relationship construction module, and the query module, respectively, and is used to transmit communication data between the monitoring module, the mapping relationship construction module, and the query module; the communication data includes: target field and first mapping relationship.

[0138] In this embodiment, the information center module serves both as an information storage area and as a central hub for information flow in the query system. The information center module can be used to acquire change information from non-graph databases associated with the knowledge graph detected by the monitoring module.

[0139] Optionally, the information center module can be connected to the monitoring module, the mapping relationship construction module, and the query module via a communication interface, and the monitoring module can send the results it monitors to the information center module in real time or periodically.

[0140] In other words, the monitoring module will report back to the information center module whether there have been any changes in the non-graph databases associated with the knowledge graph.

[0141] Correspondingly, the information center module is also used to obtain the target fields that have changed in the non-graph database, and send the target fields to the mapping relationship construction module. This triggers the mapping relationship construction module to update the mapping relationship: first, it constructs the first mapping relationship between the target field and the graph database, then updates the initial mapping relationship according to the first mapping relationship, and after the update process is completed, the message center module feeds back the updated mapping relationship to the query module so that the query module can perform query processing.

[0142] The database center module receives non-graph database query language sent by the query module, performs search processing in the corresponding query table based on the identifier of the query table according to the non-graph database query language, and feeds back the search processing results to the user in graph database form.

[0143] In this embodiment, the database center module is a system used to store graph databases associated with the knowledge graph and / or, that is, the database center module can serve as a data source for the knowledge graph.

[0144] Correspondingly, after the query module converts the graph database query language into a non-graph database query language, it connects to the data center module through the communication port so that it can perform search processing in the database center module according to the query language.

[0145] Accordingly, the database center performs lookup processing according to the query language to obtain the corresponding lookup results; at the same time, the database center module also needs to display the lookup results in the form of graph database data.

[0146] It's worth mentioning that in real-world scenarios, the data source for a knowledge graph might be a non-graph database, or a combination of graph and non-graph databases. Therefore, the aforementioned search processing method for the database center only applies when the data source for the knowledge graph is a non-graph database. However, when the data source for the knowledge graph is both a graph database and a non-graph database, the query language might coexist. Therefore, the database center module should process these two query languages ​​separately: performing a search in the graph database using the graph database query language, and performing a search in the non-graph database using the non-graph database query language. Finally, the results found in the non-graph database need to be converted into graph database data before being presented to the user.

[0147] This embodiment specifically illustrates the processing steps of how the database center module performs query processing according to the query language, which improves the accuracy of the query compared to the prior art.

[0148] Based on the aforementioned embodiments, this embodiment specifically illustrates the processing steps when the data source corresponding to the knowledge graph is reconstructed. Optionally, assuming that due to changes in business requirements, all data in the graph database mode needs to be converted to data in the non-graph database mode, the mapping relationship construction module and query module in this system can be used.

[0149] Specifically, the mapping relationship construction module can map all data in the non-graph database to data in the graph database schema according to the aforementioned execution principle. Then, the query module converts the query language into the non-graph database query language according to the mapping relationship for subsequent query processing.

[0150] This embodiment specifically illustrates the processing steps when the entire graph database containing the data source corresponding to the knowledge graph is reconstructed into a non-graph database.

[0151] Figure 8 A flowchart illustrating an embodiment of the knowledge graph-based query method provided in this application is shown below. Figure 8 As shown, the method includes:

[0152] S801, the monitoring module monitors whether the number of fields in each data table of the non-graph database associated with the knowledge graph has changed; when it is determined that the number of fields has changed, the target data table where the number of fields has changed is identified, and the target field that has changed is obtained from the target data table.

[0153] S802, the mapping relationship construction module receives the target field sent by the monitoring module, maps the target field to the graph database associated with the knowledge graph, and obtains the first mapping relationship between the target field and the graph database.

[0154] S803, the mapping relationship construction module adds / deletes the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtains the updated initial mapping relationship, and sends the updated initial mapping relationship to the query module; the updated initial mapping relationship includes: the identifier of the entity / ontology, and the identifier of the data table associated with the identifier of the entity / ontology.

[0155] S804, the query module obtains the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtains the identifier of the data table to be queried corresponding to the entity / ontology to be queried in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried.

[0156] The implementation principle and beneficial effects of the method mentioned in this embodiment are similar to those of the previous embodiments, and will not be described again here.

[0157] This application also provides a server, including: a processor, and a memory communicatively connected to the processor;

[0158] Memory is used to store the processor's executable instructions;

[0159] The processor is configured to execute the methods mentioned in the foregoing embodiments by executing executable instructions.

[0160] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods mentioned in the embodiments.

[0161] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A knowledge graph-based query system, characterized in that, include: The module includes a monitoring module, a mapping relationship construction module, and a query module. The monitoring module is used to monitor whether the number of fields in each data table of the non-graph database associated with the knowledge graph has changed; when it is determined that the number of fields has changed, the target data table in which the number of fields has changed is identified, and the target field in which the change is obtained from the target data table; The mapping relationship construction module is used to receive the target field sent by the monitoring module, and map the target field to the graph database associated with the knowledge graph to obtain the first mapping relationship between the target field and the graph database; The mapping relationship construction module is also used to add / delete the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtain the updated initial mapping relationship, and send the updated initial mapping relationship to the query module; The updated initial mapping relationship consists of the identifier of the entity / ontology and the identifier of the data table associated with the identifier of the entity / ontology. The query module is used to obtain the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtain the identifier of the data table to be queried corresponding to the entity / ontology to be queried in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried.

2. The system according to claim 1, characterized in that, The non-graph database includes: identifiers for data tables and fields associated with the identifiers of each data table; therefore, the monitoring module is specifically used for: For each table identifier in the non-graph database, count the first quantity value of the fields of the table corresponding to the table identifier at the current time. Accumulate the second quantity value of the fields in the data table associated with the current time point at the previous time point; The first quantity value and the second quantity value are compared; wherein the first quantity value and the second quantity value are the same or different. If the first quantity value and the second quantity value are not the same, it is determined that the number of fields in the data table has changed.

3. The system according to claim 2, characterized in that, The non-graph database further includes: field names of fields associated with the identifier of each of the data tables; the monitoring module is also specifically used for: For a target data table where the number of fields changes, obtain the first field name corresponding to a first number value of the fields in the target data table, and obtain the second field name corresponding to a second number value of the fields in the target data table; wherein, the first field name and the second field name may be the same or different; The first field name is matched with the second field name, and the field corresponding to either the first field name or the second field name that cannot be matched is taken as the target field.

4. The system according to claim 3, characterized in that, The graph database includes: entity / ontology identifiers; the mapping relationship construction module is specifically used for: In the non-graph database, the identifier of the target data table is obtained according to the target data table to which the target field belongs; Traverse the entity / ontology identifiers in the graph database to obtain the identifiers of the target entity / ontology corresponding to the identifiers of the target data table; Add / delete the target field corresponding to the identifier of the target entity / ontology to obtain the first mapping relationship.

5. The system according to claim 4, characterized in that, The mapping relationship construction module is also specifically used for: For the initial mapping relationship between the non-graph database and the graph database, determine the set of mapping relationships between the identifier of the target entity / ontology and the identifier of the target data table; The set of mapping relationships does not contain the first mapping relationship; The first mapping relationship is added to the mapping relationship set, or the first mapping relationship is deleted from the mapping relationship set, to obtain the updated initial mapping relationship.

6. The system according to claim 5, characterized in that, The query module is specifically used for: Get the query processing request sent by the user; The query processing request includes: a graph database query language; the graph database query language includes: the identifier of the entity / ontology to be queried; Based on the updated initial mapping relationship, the query mapping relationship corresponding to the identifier of the entity / ontology to be queried, and the identifier of the query data table associated with the query mapping relationship are obtained; Using the conversion rules between the graph database query language and the non-graph database query language, the graph database query language is converted into a non-graph database query language related to the data table to be queried, which corresponds to the identifier of the data table to be queried. Using the non-graph database query language, a search is performed in the data table corresponding to the identifier of the data table to be queried, so as to find information associated with the identifier of the entity / ontology to be queried.

7. The system according to any one of claims 1 to 6, characterized in that, The system also includes: an information center module and a database center module; The information center module is connected to the monitoring module, the mapping relationship construction module, and the query module, respectively, and is used to transmit communication data between the monitoring module, the mapping relationship construction module, and the query module; the communication data includes: the target field and the first mapping relationship; The database center module is used to receive the non-graph database query language sent by the query module, perform search processing in the query data table corresponding to the identifier of the query data table according to the non-graph database query language, and feed back the search processing result to the user in the form of a graph database.

8. A query method based on knowledge graphs, characterized in that, The method, when applied to the system as described in any one of claims 1-7, comprises: The monitoring module monitors whether the number of fields in each data table of the non-graph database associated with the knowledge graph has changed; when it is determined that the number of fields has changed, it identifies the target data table where the number of fields has changed and obtains the target field that has changed from the target data table. The mapping relationship construction module receives the target field sent by the monitoring module and maps the target field to a graph database associated with the knowledge graph to obtain the first mapping relationship between the target field and the graph database. The mapping relationship construction module adds / deletes the first mapping relationship in the initial mapping relationship between the non-graph database and the graph database, obtains the updated initial mapping relationship, and sends the updated initial mapping relationship to the query module; the updated initial mapping relationship includes: the identifier of the entity / ontology, and the identifier of the data table associated with the identifier of the entity / ontology; The query module obtains the identifier of the entity / ontology to be queried in the graph database query language sent by the user, and obtains the identifier of the data table to be queried corresponding to the entity / ontology in the updated initial mapping relationship, so as to query the information associated with the identifier of the entity / ontology to be queried in the data table corresponding to the identifier of the data table to be queried.

9. A server, characterized in that, Includes: a processor, and a memory communicatively connected to the processor; The memory is used to store the executable instructions of the processor; The processor is configured to execute the method of claim 8 by executing the executable instructions.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in claim 8.

Citation Information

Patent Citations

  • Data processing system for updating knowledge graph

    CN114168608A

  • Frequency class graph query method and related device, electronic equipment and storage medium

    CN116089636A