Management method, device and equipment for point-edge relation data of knowledge graph and medium
By building a target mapping table and a compressed package management mechanism, the problem of point-edge relationship data management in the knowledge graph is solved, efficient data management and storage performance improvement are achieved, and data recovery is ensured.
Patent Information
- Application Number
- CN202411804652.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-18
AI Technical Summary
With the development of knowledge graphs and the expansion of application scenarios, the amount of point-edge relationship data in the knowledge graph has increased explosively, resulting in data management problems and affecting the database's operating efficiency and storage space utilization.
By building a target mapping table, save the identification of deleted point-edge relationship data and the compressed package storage path, determine the data to be deleted for compression and storage, delete the original data, and restore the data when needed.
Effectively manage point-edge relationship data, reduce storage space usage, improve database query and storage performance, avoid increased storage costs, and ensure that deleted data can be recovered.
Smart Images

Figure CN119848267A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of knowledge graph point-edge relationship data management, and in particular to a knowledge graph point-edge relationship data management method, a knowledge graph point-edge relationship data management system, an electronic device and a computer-readable storage medium. Background Art
[0002] In the construction and application of knowledge graphs, point-edge relationship data plays a vital role. With the continuous development of knowledge graphs and the expansion of application scenarios, the amount of point-edge relationship data in knowledge graphs has exploded.
[0003] In this case, how to effectively manage this data and improve the operating efficiency and storage space utilization of the knowledge graph database has become an urgent problem to be solved. Summary of the invention
[0004] In view of the above problems, a method for managing knowledge graph point-edge relationship data, a management system for knowledge graph point-edge relationship data, an electronic device and a computer-readable storage medium are proposed to overcome the above problems or at least partially solve the above problems, including:
[0005] A method for managing knowledge graph point-edge relationship data, the method comprising:
[0006] Constructing a target mapping table, wherein the target mapping table stores the identifier of the deleted point-edge relationship data and the compressed package storage path corresponding to the deleted point-edge relationship data;
[0007] Determine the target point-edge relationship data to be deleted, and compress the target point-edge relationship data to obtain a target compressed package;
[0008] The target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path;
[0009] Deleting the target point edge relationship data;
[0010] In response to a recovery instruction for the target point-edge relationship data, query the target mapping table, determine a target compressed package storage path corresponding to the target point-edge relationship data, and obtain the target compressed package from the target compressed package storage path;
[0011] The target point-edge relationship data is restored according to the target compression package.
[0012] Optionally, after restoring the target point-edge relationship data according to the target compressed package, the method further includes:
[0013] The target compressed package is deleted, and the information on the target point-edge relationship data in the target mapping table is deleted.
[0014] Optionally, compressing the target point-edge relationship data to obtain a target compressed package includes:
[0015] Create a target folder for the current time period, and store the target point-edge relationship data in the target folder;
[0016] The target folder is compressed to obtain the target compressed package.
[0017] Optionally, the target point-edge relationship data includes a plurality of data, and storing the target point-edge relationship data in the target folder includes:
[0018] Group multiple target point edge relationship data;
[0019] The target point-edge relationship data belonging to the same group are stored in the same target folder.
[0020] Optionally, the method further comprises:
[0021] Delete the compressed file corresponding to the target folder in the first time period.
[0022] Optionally, the target point-edge relationship data includes a plurality of data, and compressing the target point-edge relationship data includes:
[0023] Compress multiple target point-edge relationship data in batches.
[0024] Optionally, determining the target point-edge relationship data to be deleted includes:
[0025] In response to the cleaning instruction, taking the point-edge relationship data with invisible data attribute as the target point-edge relationship data;
[0026] Alternatively, in response to the cleaning instruction, the point-edge relationship data of the second time period is used as the target point-edge relationship data;
[0027] Alternatively, in response to the cleaning instruction, the point-edge relationship data specified by the user is used as the target point-edge relationship data.
[0028] An embodiment of the present invention further provides a management system for knowledge graph point-edge relationship data, the management system comprising:
[0029] A mapping table management module constructs a target mapping table, wherein the target mapping table stores the identifier of the deleted point-edge relationship data and the compressed package storage path corresponding to the deleted point-edge relationship data;
[0030] The data grouping compression module determines the target point-edge relationship data to be deleted, and compresses the target point-edge relationship data to obtain a target compressed package; stores the target compressed package in a target compressed package storage path, and updates the target mapping table according to the identifier of the target point-edge relationship data and the target compressed package storage path;
[0031] A data deletion module is used to delete the target point edge relationship data;
[0032] The data recovery module, in response to a recovery instruction for the target point-edge relationship data, queries the target mapping table, determines the target compressed package storage path corresponding to the target point-edge relationship data, and obtains the target compressed package from the target compressed package storage path; and recovers the target point-edge relationship data according to the target compressed package.
[0033] Optionally, the management system further includes:
[0034] The timing cleaning module is used to regularly delete the target compressed package.
[0035] An embodiment of the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the above-mentioned method for managing knowledge graph point-edge relationship data.
[0036] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for managing point-edge relationship data of a knowledge graph as described above is implemented.
[0037] The embodiments of the present invention have the following advantages:
[0038] In an embodiment of the present invention, a target mapping table is constructed, and the target mapping table stores the identifier of the deleted point-edge relationship data and the compressed package storage path corresponding to the deleted point-edge relationship data; the target point-edge relationship data to be deleted is determined, and the target point-edge relationship data is compressed to obtain a target compressed package; the target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path; the target point-edge relationship data is deleted; in response to a recovery instruction for the target point-edge relationship data, the target mapping table is queried to determine the target compressed package storage path corresponding to the target point-edge relationship data, and the target compressed package is obtained from the target compressed package storage path; according to the target compressed package, the target point-edge relationship data is restored. By deleting part of the point-edge relationship data, and based on the target mapping table and the compressed package, it is ensured that the deleted point-edge relationship data can be restored, thereby preventing the file from occupying too much storage space, and thus avoiding the large-scale data from affecting the query and storage performance of the knowledge graph database table. And by flexibly managing the point-edge relationship data, it is possible to avoid occupying too much storage space, thereby avoiding the problem of increased storage costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 This is a flowchart of the steps of a method for managing knowledge graph point-edge relationship data according to an embodiment of the present invention;
[0041] Figure 2 This is a flowchart of another method for managing knowledge graph point-edge relationship data according to an embodiment of the present invention;
[0042] Figure 3 This is a flowchart of the steps of another method for managing knowledge graph point-edge relationship data according to an embodiment of the present invention;
[0043] Figure 4 This is a data interaction diagram for managing point-edge relationship data according to an embodiment of the present invention;
[0044] Figure 5 It is a structural diagram of a management system for knowledge graph point-edge relationship data in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In the knowledge graph, points represent entities, edges represent the relationships between entities, and point-edge relationship data is the data that describes these entities and relationships. In the application of knowledge graphs, point-edge relationship data is crucial, but as its number continues to grow, management difficulties are becoming increasingly prominent.
[0047] Traditional knowledge graph data management methods may have the following problems:
[0048] 1. When the amount of data reaches a certain scale, the query and storage performance of the knowledge graph database table will drop significantly, seriously affecting the application effect of the knowledge graph.
[0049] 2. The management of a large amount of historical point-edge relationship data is not flexible enough, which may take up too much storage space and increase storage costs.
[0050] In response to the above problems, an embodiment of the present invention provides a method for managing knowledge graph point-edge relationship data, which can delete part of the point-edge relationship data and ensure that the deleted point-edge relationship data can be restored based on the target mapping table and the compression package, thereby preventing the file from occupying too much storage space, and further avoiding the large-scale data from affecting the query and storage performance of the knowledge graph database. And by flexibly managing the point-edge relationship data, it is possible to avoid occupying too much storage space, thereby avoiding the problem of increased storage costs.
[0051] For details, please refer to Figure 1 , showing a step flow chart of a method for managing knowledge graph point-edge relationship data according to an embodiment of the present invention.
[0052] like Figure 1 As shown, the method for managing the knowledge graph point-edge relationship data may include the following steps:
[0053] Step 101: construct a target mapping table, wherein the target mapping table stores identifiers of deleted point-edge relationship data and compressed package storage paths corresponding to the deleted point-edge relationship data.
[0054] In practical applications, the management system may first construct a target mapping table, which may store the identifier of the deleted point-edge relationship data and the location where the compressed package corresponding to the deleted point-edge relationship data is stored, that is, the compressed package storage path.
[0055] In the embodiment of the present invention, the management system can update and maintain the target mapping table based on the deletion operation in real time.
[0056] Step 102: determine the target point-edge relationship data to be deleted, and compress the target point-edge relationship data to obtain a target compressed package.
[0057] During the daily operation of the management system, the target point-edge relationship data to be deleted can be first determined from all the point-edge relationship data in the knowledge graph database; these target point-edge relationship data can be determined based on user settings, or they can be invalid or worthless point-edge relationship data automatically determined by the management system based on parameters such as time and attributes of the point-edge relationship data.
[0058] Exemplarily, when the number of point-edge relationship data reaches a certain threshold, the target point-edge relationship data to be deleted can be triggered to be determined; or a preset management time can be set, and when the preset management time is reached, the target point-edge relationship data to be deleted can be automatically triggered to be determined. The embodiments of the present invention are not limited to this.
[0059] After determining the target point-edge relationship data to be deleted, the management system may first compress the target point-edge relationship data to obtain a target compressed package.
[0060] Step 103: Store the target compressed package in the target compressed package storage path, and update the target mapping table according to the identifier of the target point-edge relationship data and the target compressed package storage path.
[0061] After compressing the target point-edge relationship data, the obtained target compressed package can be stored in a location corresponding to the target compressed package storage path; this location may be different from the location of the knowledge graph database, and the embodiment of the present invention does not impose any restrictions on this.
[0062] After storing the target compressed package in the target compressed package storage path, the management system can update the target mapping table according to the identifier corresponding to the target point-edge relationship data and the target compressed package storage path, so that the target compressed package storage path where the target compressed package corresponding to the target point-edge relationship data is stored can be indexed according to the updated target mapping table.
[0063] The identifier of the target point-edge relationship data may be a unique identifier, which may uniquely point to the target point-edge relationship data.
[0064] Step 104: Delete the target point edge relationship data.
[0065] After storing the target compressed package in the target compressed package storage path, the management system can delete the target point-edge relationship data, thereby reducing the amount of data in the knowledge graph database and improving the query and storage performance of the knowledge graph database.
[0066] Step 105 : In response to the recovery instruction for the target point-edge relationship data, query the target mapping table, determine the target compressed package storage path corresponding to the target point-edge relationship data, and obtain the target compressed package from the target compressed package storage path.
[0067] In an embodiment of the present invention, when a recovery instruction for target point-edge relationship data is detected, the management system may query the target mapping table first in response to the recovery instruction for the target point-edge relationship data.
[0068] Exemplarily, the recovery instruction may be generated when there is a need to use the target point-edge relationship data.
[0069] When querying the target mapping table, the management system can use the identifier of the target point-edge relationship data to query; based on the identifier, the management system can query the target compressed package storage path where the target compressed package corresponding to the target point-edge relationship data is stored from the target mapping table.
[0070] After obtaining the target compressed package storage path, the management system may obtain the target compressed package from the target compressed package storage path.
[0071] Step 106: Restore the target point-edge relationship data according to the target compression package.
[0072] Next, the management system can decompress the target compressed package to obtain the target point-edge relationship data, and insert the target point-edge relationship data into the knowledge graph database in batches according to a specific format, thereby realizing the recovery of the target point-edge relationship data.
[0073] In an embodiment of the present invention, a target mapping table is constructed, and the target mapping table stores the identifier of the deleted point-edge relationship data and the compressed package storage path corresponding to the deleted point-edge relationship data; the target point-edge relationship data to be deleted is determined, and the target point-edge relationship data is compressed to obtain a target compressed package; the target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path; the target point-edge relationship data is deleted; in response to a recovery instruction for the target point-edge relationship data, the target mapping table is queried to determine the target compressed package storage path corresponding to the target point-edge relationship data, and the target compressed package is obtained from the target compressed package storage path; according to the target compressed package, the target point-edge relationship data is restored. By deleting part of the point-edge relationship data, and based on the target mapping table and the compressed package, it is ensured that the deleted point-edge relationship data can be restored, thereby preventing the file from occupying too much storage space, and thus avoiding the large-scale data from affecting the query and storage performance of the knowledge graph database table. And by flexibly managing the point-edge relationship data, it is possible to avoid occupying too much storage space, thereby avoiding the problem of increased storage costs.
[0074] Reference Figure 2 , showing a flowchart of another method for managing knowledge graph point-edge relationship data according to an embodiment of the present invention, which may include the following steps:
[0075] Step 201: Build a target mapping table.
[0076] In practical applications, the management system may first construct a target mapping table, which may store the identifier of the deleted point-edge relationship data and the location where the compressed package corresponding to the deleted point-edge relationship data is stored, that is, the compressed package storage path.
[0077] Step 202: Determine target point-edge relationship data to be deleted, where the target point-edge relationship data includes multiple data.
[0078] During the daily operation of the management system, multiple target point-edge relationship data to be deleted can be first determined from all the point-edge relationship data in the knowledge graph database.
[0079] Step 203: compress multiple target point edge relationship data in batches.
[0080] After determining multiple target point edge relationship data, in order to avoid performance degradation and memory overflow caused by processing a large amount of data at one time, the management system can compress multiple target point edge relationship data in batches, as well as the subsequent steps of updating the target mapping table and deleting the target point edge relationship data.
[0081] In some feasible embodiments, ① in the process of data deletion, grouping, compression and recovery, in order to improve performance, data can also be processed in an asynchronous manner. Asynchronous processing allows the system to continue processing other tasks while executing a certain task, thereby improving the system's response speed and overall performance.
[0082] Exemplarily, the compression method can be set according to actual conditions. For example, 7z compression can be used to compress the edge relationship number of each target point.
[0083] In practical applications, you can refer to Table 1. As the amount of data increases, the compression ratio of the 7z compression method continues to increase. The higher the compression ratio, the lower the compression ratio of the rar method.
[0084] The data compression ratios of zip compression, bz2 compression, and Gzip compression are basically stable, and all maintain a constant compression ratio.
[0085] Tar compression has the worst compression performance.
[0086] Table 1:
[0087]
[0088]
[0089] Step 204: store the target compressed package in the target compressed package storage path, and update the target mapping table according to the identifier of the target point-edge relationship data and the target compressed package storage path.
[0090] After compressing the target point-edge relationship data, the obtained target compressed package can be stored in a location corresponding to the target compressed package storage path; this location may be different from the location of the knowledge graph database, and the embodiment of the present invention does not impose any restrictions on this.
[0091] After storing the target compressed package in the target compressed package storage path, the management system can update the target mapping table according to the identifier corresponding to the target point-edge relationship data and the target compressed package storage path, so that the target compressed package storage path where the target compressed package corresponding to the target point-edge relationship data is stored can be indexed according to the updated target mapping table.
[0092] Step 205: Delete the target point edge relationship data.
[0093] After storing the target compressed package in the target compressed package storage path, the management system can delete the target point-edge relationship data, thereby reducing the amount of data in the knowledge graph database and improving the query and storage performance of the knowledge graph database.
[0094] Step 206: In response to the recovery instruction for the target point-edge relationship data, query the target mapping table, determine the target compressed package storage path corresponding to the target point-edge relationship data, and obtain the target compressed package from the target compressed package storage path.
[0095] In an embodiment of the present invention, when a recovery instruction for target point-edge relationship data is detected, the management system may query the target mapping table first in response to the recovery instruction for the target point-edge relationship data.
[0096] When querying the target mapping table, the management system can use the identifier of the target point-edge relationship data to query; based on the identifier, the management system can query the target compressed package storage path where the target compressed package corresponding to the target point-edge relationship data is stored from the target mapping table.
[0097] After obtaining the target compressed package storage path, the management system may obtain the target compressed package from the target compressed package storage path.
[0098] Step 207: Restore the target point-edge relationship data according to the target compression package.
[0099] Next, the management system can decompress the target compressed package to obtain the target point-edge relationship data, and insert the target point-edge relationship data into the knowledge graph database in batches according to a specific format, thereby realizing the recovery of the target point-edge relationship data.
[0100] In an embodiment of the present invention, a target mapping table is constructed; target point-edge relationship data to be deleted is determined, and the target point-edge relationship data includes multiple data; multiple target point-edge relationship data are compressed in batches; the target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path; the target point-edge relationship data is deleted; in response to a recovery instruction for the target point-edge relationship data, the target mapping table is queried to determine the target compressed package storage path corresponding to the target point-edge relationship data, and the target compressed package is obtained from the target compressed package storage path; according to the target compressed package, the target point-edge relationship data is restored. By deleting part of the point-edge relationship data, and based on the target mapping table and the compressed package, it is ensured that the deleted point-edge relationship data can be restored, thereby preventing the file from occupying too much storage space, and thus avoiding the large-scale data from affecting the query and storage performance of the knowledge graph database table. And by flexibly managing the point-edge relationship data, it is possible to avoid occupying too much storage space, thereby avoiding the problem of increased storage costs.
[0101] Reference Figure 3 , shows a flowchart of the steps of another method for managing knowledge graph point-edge relationship data according to an embodiment of the present invention, which may include the following steps:
[0102] Step 301: Build a target mapping table.
[0103] In practical applications, the management system may first construct a target mapping table, which may store the identifier of the deleted point-edge relationship data and the location where the compressed package corresponding to the deleted point-edge relationship data is stored, that is, the compressed package storage path.
[0104] Step 302: determine the target point-edge relationship data to be deleted, create a target folder for the current time period, and store the target point-edge relationship data in the target folder.
[0105] During the daily operation of the management system, multiple target point-edge relationship data to be deleted can be first determined from all the point-edge relationship data in the knowledge graph database.
[0106] In addition, during the daily operation of the management system, a target folder for the current time period may be created; then, the management system may store the determined plurality of target point-edge relationship data in the target folder.
[0107] In some feasible embodiments, the target point-edge relationship data may be saved in a target folder in the form of SQL (Structured Query Language) insert statements or in JSON format.
[0108] In one embodiment of the present invention, the step of determining the target point-edge relationship data to be deleted in step 302 may be implemented by the following sub-steps:
[0109] Sub-step 11: In response to a cleaning instruction, taking the point-edge relationship data with invisible data attribute as target point-edge relationship data.
[0110] In some feasible embodiments, the management system may respond to a cleanup instruction and use point-edge relationship data with invisible data attributes as target point-edge relationship data; illustratively, due to issues such as data privacy, the data attributes of some point-edge relationship data in the knowledge graph database may be set to invisible or visible.
[0111] Since these data are actually invisible, they are normally secret and unreadable; therefore, based on the data attribute, the management system can delete the point-edge relationship data with invisible data attributes as target point-edge relationship data.
[0112] Sub-step 12: In response to the cleanup instruction, use the point-edge relationship data of the second time period as target point-edge relationship data.
[0113] In some feasible embodiments, the point-edge relationship data may also be deleted based on the time dimension; specifically, in response to a cleanup instruction, the management system may use the point-edge relationship data that has been stored for a long time as the target point-edge relationship data.
[0114] Specifically, a time rule for cleaning can be set. For example, if data from one week ago needs to be cleaned, then one week ago can be used as the second time period. Then, the management system can use the point-edge relationship data from the period of "one week ago" as the target point-edge relationship data, thereby effectively managing the historical point-edge relationship data.
[0115] Sub-step 13: In response to the cleaning instruction, the point-edge relationship data specified by the user is used as the target point-edge relationship data.
[0116] In some feasible embodiments, the point-edge relationship data may also be deleted based on user needs; specifically, in response to a cleanup instruction, the management system may determine the point-edge relationship data specified by the user and use these point-edge relationship data as target point-edge relationship data.
[0117] For example, the user can set how long a certain type of data should be stored before being deleted, or can set how long any data from before should be deleted, and so on.
[0118] In one embodiment of the present invention, the target point-edge relationship data includes multiple data. The step of storing the target point-edge relationship data in the target folder in step 302 can be implemented by the following sub-steps:
[0119] Sub-step 21: grouping multiple target point edge relationship data.
[0120] In some feasible embodiments, multiple target point-edge relationship data may be grouped first; illustratively, the grouping rules may be set according to actual conditions, for example: point-edge relationship data of the same type may be grouped together, or point-edge relationship data of the same time period may be grouped together, and the embodiments of the present invention do not impose any restrictions on this.
[0121] Sub-step 22: Store the target point-edge relationship data belonging to the same group into the same target folder.
[0122] Next, the management system can store the target point-edge relationship data belonging to the same group in the same target folder to facilitate the management of the point-edge relationship data.
[0123] Step 303: compress the target folder to obtain a target compressed package.
[0124] After storing the target point-edge relationship data in the target folder, the management system can compress the target folder to obtain a target compressed package.
[0125] Step 304: Store the target compressed package in the target compressed package storage path, and update the target mapping table according to the identifier of the target point-edge relationship data and the target compressed package storage path.
[0126] Then, the management system may store the target compressed package to a location corresponding to the target compressed package storage path.
[0127] After storing the target compressed package in the target compressed package storage path, the management system can update the target mapping table according to the identifier corresponding to the target point-edge relationship data and the target compressed package storage path, so that the target compressed package storage path where the target compressed package corresponding to the target point-edge relationship data is stored can be indexed according to the updated target mapping table.
[0128] Step 305: Delete the target point edge relationship data.
[0129] After storing the target compressed package in the target compressed package storage path, the management system can delete the target point-edge relationship data, thereby reducing the amount of data in the knowledge graph database and improving the query and storage performance of the knowledge graph database.
[0130] Step 306: In response to the recovery instruction for the target point-edge relationship data, query the target mapping table, determine the target compressed package storage path corresponding to the target point-edge relationship data, and obtain the target compressed package from the target compressed package storage path.
[0131] In an embodiment of the present invention, when a recovery instruction for target point-edge relationship data is detected, the management system may query the target mapping table first in response to the recovery instruction for the target point-edge relationship data.
[0132] When querying the target mapping table, the management system can use the identifier of the target point-edge relationship data to query; based on the identifier, the management system can query the target compressed package storage path where the target compressed package corresponding to the target point-edge relationship data is stored from the target mapping table.
[0133] After obtaining the target compressed package storage path, the management system may obtain the target compressed package from the target compressed package storage path.
[0134] Step 307: Restore the target point-edge relationship data according to the target compression package.
[0135] Next, the management system can decompress the target compressed package to obtain the target point-edge relationship data, and insert the target point-edge relationship data into the knowledge graph database in batches according to a specific format, thereby realizing the recovery of the target point-edge relationship data.
[0136] Step 308: Delete the target compressed package, and delete the information on the target point-edge relationship data in the target mapping table.
[0137] In some feasible embodiments, after restoring the target point-edge relationship data based on the target compressed package, the management system may also delete the target compressed package stored at a location corresponding to the target compressed package storage path, and update the target mapping table.
[0138] Specifically, the management system may delete information on target point-edge relationship data in the target mapping table.
[0139] In an embodiment of the present invention, the above method may further include the following steps:
[0140] Delete the compressed file corresponding to the target folder in the first time period.
[0141] In some feasible embodiments, the compressed package corresponding to the target folder in the first time period can also be automatically deleted to directly and completely delete useless or worthless point-edge relationship data. The first time period can be defined according to actual conditions, for example, one month ago, one year ago, etc., and the embodiment of the present invention does not limit this.
[0142] For example, Figure 4 As shown, when the system is initialized, the user can set the management task and delete time configuration of the scheduled task. The management system can be equipped with a scheduled task manager, and the scheduled task management can regularly detect the data volume and current date of the knowledge graph database.
[0143] When it is detected that the data volume of the knowledge graph database reaches the threshold, or the current time meets the conditions set by the user, the point-edge relationship data that meets the set conditions can be queried from the knowledge graph database as the target point-edge relationship data to be deleted, and these target point-edge relationship data can be asynchronously deleted based on the asynchronous service.
[0144] In addition, you can create folders corresponding to dates in a specified directory, group the target point-edge relationship data according to specific rules, and save them into different SQL files.
[0145] The obtained folder is compressed using 7z to obtain the target compressed package, and the target compressed package is stored in the corresponding directory, and the target mapping table is updated.
[0146] Scheduled tasks can periodically delete old compressed packages in a specified directory; for example, you can check a specified directory and delete compressed packages from one year ago.
[0147] When a user requests data recovery, the file path where the target point-edge relationship data is located can be queried based on the unique identifier, and the compressed package can be obtained from the corresponding file path.
[0148] Based on the asynchronous service, the compressed package can be decompressed and inserted into the database in batches. In addition, after the recovery is completed, the compressed package can be deleted and the information corresponding to the point edge data in the target mapping table can be deleted.
[0149] In actual applications, in order to optimize system performance and OOM (Out of Memory), data recovery can be processed asynchronously.
[0150] In the embodiment of the present invention, a target mapping table is constructed; the target point-edge relationship data to be deleted is determined, and a target folder for the current time period is created, and the target point-edge relationship data is stored in the target folder; the target folder is compressed to obtain a target compressed package; the target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path; the target point-edge relationship data is deleted; in response to a recovery instruction for the target point-edge relationship data, the target mapping table is queried to determine the target compressed package storage path corresponding to the target point-edge relationship data, and the target compressed package is obtained from the target compressed package storage path; according to the target compressed package, the target point-edge relationship data is restored; the target compressed package is deleted, and the information for the target point-edge relationship data in the target mapping table is deleted. By deleting part of the point-edge relationship data, and based on the target mapping table and the compressed package, it is ensured that the deleted point-edge relationship data can be restored, thereby preventing the file from occupying too much storage space, and thus avoiding the large-scale data from affecting the query and storage performance of the knowledge graph database table. And by flexibly managing the point-edge relationship data, it is possible to avoid occupying too much storage space, thereby avoiding the problem of increased storage costs.
[0151] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0152] Reference Figure 5 , showing a structural schematic diagram of a management system for knowledge graph point-edge relationship data in an embodiment of the present invention.
[0153] like Figure 5 As shown, the management system 50 of the knowledge graph point-edge relationship data may include the following modules:
[0154] A mapping table management module 501 constructs a target mapping table, wherein the target mapping table stores the identifier of the deleted point-edge relationship data and the storage path of the compressed package corresponding to the deleted point-edge relationship data;
[0155] The data grouping compression module 502 determines the target point-edge relationship data to be deleted, and compresses the target point-edge relationship data to obtain a target compressed package; stores the target compressed package in the target compressed package storage path, and updates the target mapping table according to the identifier of the target point-edge relationship data and the target compressed package storage path;
[0156] Data deletion module 503, deleting target point edge relationship data;
[0157] The data recovery module 504, in response to the recovery instruction for the target point-edge relationship data, queries the target mapping table, determines the target compressed package storage path corresponding to the target point-edge relationship data, and obtains the target compressed package from the target compressed package storage path; and recovers the target point-edge relationship data according to the target compressed package.
[0158] In an optional embodiment of the present invention, the management system further includes:
[0159] The scheduled cleanup module is used to regularly delete target compressed packages.
[0160] In the embodiment of the present invention, a target mapping table is constructed; the target point-edge relationship data to be deleted is determined, and a target folder for the current time period is created, and the target point-edge relationship data is stored in the target folder; the target folder is compressed to obtain a target compressed package; the target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path; the target point-edge relationship data is deleted; in response to a recovery instruction for the target point-edge relationship data, the target mapping table is queried to determine the target compressed package storage path corresponding to the target point-edge relationship data, and the target compressed package is obtained from the target compressed package storage path; according to the target compressed package, the target point-edge relationship data is restored; the target compressed package is deleted, and the information for the target point-edge relationship data in the target mapping table is deleted. By deleting part of the point-edge relationship data, and based on the target mapping table and the compressed package, it is ensured that the deleted point-edge relationship data can be restored, thereby preventing the file from occupying too much storage space, and thus avoiding the large-scale data from affecting the query and storage performance of the knowledge graph database table. And by flexibly managing the point-edge relationship data, it is possible to avoid occupying too much storage space, thereby avoiding the problem of increased storage costs.
[0161] An embodiment of the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the above-mentioned method for managing point-edge relationship data of the knowledge graph is implemented.
[0162] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for managing point-edge relationship data of a knowledge graph as described above is implemented.
[0163] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0164] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0165] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0166] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0167] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.
[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0169] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0170] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0171] The above provides a detailed introduction to a method for managing point-edge relationship data of a knowledge graph, a management system for point-edge relationship data of a knowledge graph, an electronic device and a computer-readable storage medium. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for managing knowledge graph point-edge relationship data, characterized in that: The method comprises: Constructing a target mapping table, wherein the target mapping table stores the identifier of the deleted point-edge relationship data and the compressed package storage path corresponding to the deleted point-edge relationship data; Determine the target point-edge relationship data to be deleted, and compress the target point-edge relationship data to obtain a target compressed package; The target compressed package is stored in the target compressed package storage path, and the target mapping table is updated according to the identifier of the target point-edge relationship data and the target compressed package storage path; Deleting the target point edge relationship data; In response to a recovery instruction for the target point-edge relationship data, query the target mapping table, determine a target compressed package storage path corresponding to the target point-edge relationship data, and obtain the target compressed package from the target compressed package storage path; The target point-edge relationship data is restored according to the target compression package.
2. The method according to claim 1, characterized in that After restoring the target point-edge relationship data according to the target compressed package, the method further includes: The target compressed package is deleted, and the information on the target point-edge relationship data in the target mapping table is deleted.
3. The method according to claim 1, characterized in that The step of compressing the target point-edge relationship data to obtain a target compressed package includes: Create a target folder for the current time period, and store the target point-edge relationship data in the target folder; The target folder is compressed to obtain the target compressed package.
4. The method according to claim 3, characterized in that The target point edge relationship data includes a plurality of data, and storing the target point edge relationship data in the target folder includes: Group multiple target point edge relationship data; The target point-edge relationship data belonging to the same group are stored in the same target folder.
5. The method according to claim 4, characterized in that The method further comprises: Delete the compressed file corresponding to the target folder in the first time period.
6. The method according to claim 1, characterized in that The target point edge relationship data includes a plurality of data, and compressing the target point edge relationship data includes: Compress multiple target point-edge relationship data in batches.
7. The method according to claim 1, characterized in that The step of determining the target point-edge relationship data to be deleted includes: In response to the cleaning instruction, taking the point-edge relationship data with invisible data attribute as the target point-edge relationship data; Alternatively, in response to the cleaning instruction, the point-edge relationship data of the second time period is used as the target point-edge relationship data; Alternatively, in response to the cleaning instruction, the point-edge relationship data specified by the user is used as the target point-edge relationship data.
8. A management system for knowledge graph point-edge relationship data, characterized in that: The management system comprises: A mapping table management module constructs a target mapping table, wherein the target mapping table stores the identifier of the deleted point-edge relationship data and the compressed package storage path corresponding to the deleted point-edge relationship data; The data grouping compression module determines the target point-edge relationship data to be deleted, and compresses the target point-edge relationship data to obtain a target compressed package; stores the target compressed package in a target compressed package storage path, and updates the target mapping table according to the identifier of the target point-edge relationship data and the target compressed package storage path; A data deletion module is used to delete the target point edge relationship data; The data recovery module, in response to a recovery instruction for the target point-edge relationship data, queries the target mapping table, determines the target compressed package storage path corresponding to the target point-edge relationship data, and obtains the target compressed package from the target compressed package storage path; and recovers the target point-edge relationship data according to the target compressed package.
9. The management system according to claim 8, characterized in that: The management system also includes: The timing cleaning module is used to regularly delete the target compressed package.
10. An electronic device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, it implements the management method of knowledge graph point-edge relationship data as described in any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for managing knowledge graph point-edge relationship data as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Data updating method and device for water conservancy knowledge graph and medium
CN120804111A