Method for processing graph structure data and storage engine for graph structure data

By receiving the storage request of the target graph, obtaining historical data, determining data changes and generating version information, it solves the problem of time-consuming calculation and storage of graph structure data, realizes incremental storage, and improves the availability and ease of graphs in microservice scenarios. Usability.

CN115905266BActive Publication Date: 2024-10-18ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211711471.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2024-10-18
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

The calculation and storage of graph-structured data is time-consuming and active, resulting in repeated calculations and storage. It is difficult for existing technologies to provide a universal solution, especially in scenarios such as microservices.

Method used

By receiving storage requests from the target graph, it obtains historical data, determines data changes, generates version information, and maps changed nodes, edges and version information to storage components to achieve incremental storage.

Benefits of technology

It greatly reduces the computing and storage overhead of graph structured data, improves the availability and ease of use of graphs in scenarios such as microservices, simplifies the data storage process, and improves storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905266B_ABST
    Figure CN115905266B_ABST
Patent Text Reader

Abstract

The embodiments of this specification disclose a method for processing graph-structured data, a storage engine and a device for graph-structured data. The method can be implemented by a storage engine for graph-structured data, including: receiving a storage request for first data of a target graph, the storage request including a graph identifier of the target graph and the first data; based on the graph identifier, obtaining historical data of the target graph corresponding to the graph identifier from a storage component, and determining target data that has changed in the first data of the target graph relative to the historical data, generating version information corresponding to the target data, the target data including data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph; mapping the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of computer technology, and in particular to a method for processing graph structured data, a storage engine and a device for graph structured data, in particular a storage engine that can be used for graph structured data, and a method for processing graph structured data implemented by the storage engine. Background Art

[0002] Graph is a commonly used data structure that can be used to represent data with more complex topological structures. Graphs are widely used and can represent the internal topological structures of large-scale microservice applications. In our daily lives, we are also using graphs unconsciously.

[0003] The computation and storage of graphs have the following properties: Graph computation may be very time-consuming. For example, computing the k shortest paths between any two points in a large map is often very time-consuming. In addition, graphs are prone to change frequently. For example, some points and edges are often added or modified in the map. In addition, the use of graphs sometimes needs to be traced back to previous versions. For example, the change analysis brought about by the version iteration of microservices requires comparing two versions of graphs. The above properties bring certain difficulties to the use of graphs, especially the activeness of graphs, which leads to a large amount of repeated computation and storage. Although it can be optimized for specific scenarios, the above methods cannot provide a sufficiently general solution for the use of graphs. To this end, it is necessary to provide a representation method that supports the storage of historical information of graphs in an incremental manner, thereby greatly reducing the computation and storage overhead of graphs, and thus improving the availability and ease of use of graphs in microservices and other aspects. Summary of the invention

[0004] The purpose of the embodiments of this specification is to provide a representation method that supports storing the historical information of a graph in an incremental manner, thereby greatly reducing the storage engine's overhead in graph computing and storage, and further improving the availability and ease of use of the graph in microservices and other aspects.

[0005] In order to implement the above technical solution, the embodiments of this specification are implemented as follows:

[0006] An embodiment of the present specification provides a method for processing graph structured data, the method comprising: receiving a storage request for first data of a target graph, the storage request comprising a graph identifier of the target graph and the first data. Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data that has changed in the first data of the target graph relative to the historical data is determined, and version information corresponding to the target data is generated, the target data comprising data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph. The nodes and / or edges of the target graph associated with the target data are mapped, and the target data is stored in the storage component in combination with the version information.

[0007] An embodiment of the present specification provides a storage engine for graph-structured data, the storage engine comprising: a storage request module, receiving a storage request for first data of a target graph, the storage request comprising a graph identifier of the target graph and the first data. A graph data processing module, based on the graph identifier, obtaining historical data of the target graph corresponding to the graph identifier from a storage component, and determining target data that has changed in the first data of the target graph relative to the historical data, and generating version information corresponding to the target data, the target data comprising data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph. A graph data storage module, mapping the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information.

[0008] An embodiment of the present specification provides a storage device for graph structured data, the storage device for graph structured data comprising: a storage engine for graph structured data; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the storage engine for graph structured data: receives a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data. Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data of the first data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph. The nodes and / or edges of the target graph associated with the target data are mapped, and the target data is stored in the storage component in combination with the version information.

[0009] The embodiments of this specification also provide a storage medium, which is used to store computer-executable instructions. When the executable instructions are executed, the corresponding storage engine for graph structure data can implement the following process: receiving a storage request for the first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data. Based on the graph identifier, the historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and the target data of the first data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes the data of the nodes in the first data of the target graph and / or the data of the edges in the first data of the target graph. The nodes and / or edges of the target graph associated with the target data are mapped, and the target data is stored in the storage component in combination with the version information. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0011] Figure 1A This is an embodiment of a method for processing graph structure data in this specification;

[0012] Figure 1B A schematic diagram of a processing process of graph structure data in this specification;

[0013] Figure 2 A schematic diagram of another processing process of graph structure data in this specification;

[0014] Figure 3 A schematic diagram of another processing process of graph structure data in this specification;

[0015] Figure 4 This is an embodiment of a storage engine for graph structured data in this specification;

[0016] Figure 5 This is an embodiment of a storage device for graph structured data in this specification. DETAILED DESCRIPTION

[0017] The embodiments of this specification provide a method for processing graph structured data, a storage engine and a device for graph structured data.

[0018] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0019] Embodiment 1

[0020] like Figure 1A and Figure 1B As shown, an embodiment of the present specification provides a method for processing graph structured data, wherein the executor of the method may be a terminal device or a storage engine in a terminal device, etc., wherein the terminal device may be a mobile terminal device such as a mobile phone, a tablet computer, or a computer device such as a laptop computer or a desktop computer, or an IoT device (specifically, a smart watch, a vehicle-mounted device, etc.), etc.

[0021] The storage engine of the execution subject may be a storage engine that can be used for graph structure data. The storage engine is a component or device that can implement data storage, data indexing, data updating, data querying and other technologies. In this embodiment, the storage engine may specifically include one or more of the functional units such as data definition, data indexing, data storage, data loading and data cleaning, wherein data definition may distinguish and define different versions of data, data indexing may be used to find duplicate data, data that needs to be modified, data that needs to be deleted and data that needs to be read, etc., and data cleaning may be used to remove redundant data and data that needs to be deleted, etc. In this embodiment, the processing process of the graph structure data processing method may be executed by the above functional units in the storage engine, that is, the storage engine may receive a storage request for the first data of the target graph, and then, the storage engine may obtain the historical data of the target graph corresponding to the graph identifier from the storage component based on the above graph identifier, and determine the target data of the first data of the target graph that has changed relative to the historical data through the storage engine, and generate version information corresponding to the target data. Finally, the storage engine may map the nodes and / or edges of the target graph associated with the target data, and store the target data in the storage component in combination with the above version information. The method may specifically include the following steps:

[0022] In step S102, a storage request for first data of a target graph is received, where the storage request includes a graph identifier of the target graph and the first data.

[0023] Among them, the target graph can be any graph with nodes and edges, such as graphs, charts, etc. In practical applications, the target graph can also be a map, a knowledge graph, a relationship graph between people and things, a relationship graph between microservice components, and a program structure and semantic graph of various graph structures (such as a control flow graph and a call graph, etc.), especially a large-scale graph with frequent local changes, etc. The target graph can be a graph used to describe various entities and concepts existing in the real world, and the relationship between them. The graph can be a semantic network. The target graph can include multiple different nodes, and there can be an association relationship between different nodes. The association relationship can be represented by the edge connecting the nodes. The edge can be a directed edge with a direction, or an undirected edge without a direction, etc., which can be set according to the actual situation. The target graph may include a directed multi-sided graph, or a mixed graph of a directed graph and an undirected graph. Specifically, if there is a bidirectional edge between two nodes in a certain graph, then this part can be regarded as a part of the graph and is regarded as undirected. There are also cases where there are only unidirectional edges between other nodes, etc. The above target graph can be applied to a variety of different businesses, such as online trading business, social business, financial-related business, risk prevention and control business, recommendation business, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this. The node can represent any entity, such as a node can represent a user, or a node can represent an account, or a node can represent a book, or a node can represent a TV series or a movie, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this. The attribute information of the node can include multiple, such as the name of the node, the category to which it belongs, the attribute of the numerical class (specifically such as size, occupied space size, height, etc.), the location, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this. The graph identifier can be the name, code, etc. of the target graph, which can be set according to actual conditions, and the embodiments of this specification do not limit this.

[0024] In practice, graphs are a commonly used data structure that can be used to represent data with relatively complex topological structures, such as the relationship between people, the relationship between people and things, and the relationship between things. Graphs are widely used and can represent the internal topological structure of large-scale microservice applications. For example, the program control flow graph represents the control flow information within the method, and the program call graph represents the call relationship information between methods. In daily life, we also use graphs unconsciously. For example, the common map navigation problem is essentially the problem of calculating the k shortest paths between two points in the graph.

[0025] The calculation and storage of graphs have the following properties: the calculation of graphs may be very time-consuming. For example, calculating the k shortest paths between any two points in a larger map is often very time-consuming. In addition, graphs are prone to change frequently. For example, some points and edges are often added or modified in the map. In addition, the use of graphs sometimes needs to be traced back to previous versions. For example, the change analysis brought about by the version iteration of microservices requires comparing two versions of graphs. The above properties bring certain difficulties to the use of graphs, especially the activity of graphs leads to a large amount of repeated calculations and storage. Although it can be optimized for specific scenarios, the above methods cannot provide a sufficiently general solution for the use of graphs. To this end, it is necessary to provide a representation method that supports the storage of historical information of graphs in an incremental manner, thereby greatly reducing the overhead of graph calculation and storage, and thus improving the availability and ease of use of graphs in microservices and other aspects. The embodiments of this specification provide an implementable technical solution, which may specifically include the following contents.

[0026] When a certain graph (i.e., a target graph) needs to be stored in a storage component, a graph identifier of the target graph and first data of the target graph can be obtained through a terminal device, or the graph identifier and an identifier of the first data can be obtained, and a storage request for the first data of the target graph can be generated based on the obtained graph identifier and the first data, or a storage request for the first data of the target graph can be generated based on the obtained graph identifier and the identifier of the first data, and then, a storage request for the first data of the target graph can be received or obtained.

[0027] It should be noted that the above-mentioned storage request may be generated by a component in the terminal device (such as memory, cache, CPU, etc.), and sent to a designated management component or processing component (specifically, a storage engine that can be used for graph structured data, etc.). In this embodiment, the storage engine that can be used for graph structured data in the terminal device can receive the above-mentioned storage request and perform further processing. In addition, the above-mentioned storage request may be generated by another device and sent to a storage engine that can be used for graph structured data in a designated terminal device or a storage engine that can be used for graph structured data in a server. The storage engine can receive the above-mentioned storage request and perform further processing, etc. The specific setting can be based on actual conditions, and the embodiments of this specification do not limit this.

[0028] In step S104, based on the above-mentioned graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from the storage component, and the target data whose first data of the target graph has changed relative to the historical data is determined, and version information corresponding to the target data is generated. The target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph.

[0029] Among them, the storage component can be a component for storing data. In practical applications, the storage component can be a persistent storage component, such as a CD, a hard disk or a USB flash drive, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this. The version information can be represented by one or more characters, such as V1, V2, or 123, 234, etc., and can also be constructed in a variety of other ways, which can be set according to actual conditions. The data of the node can include multiple, for example, it can include the node's identification, attribute information (for example, the version information of the graph to which the node belongs, the relationship between other nodes, etc.), etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this.

[0030] In implementation, taking into account factors such as graphs that are often prone to change and the use of graphs sometimes needs to be traced back to previous versions, multiple different versions of a graph structure data will be stored in the storage component. Therefore, after obtaining a storage request in the above manner, the graph identifier of the target graph can be extracted from the above storage request, and based on the graph identifier, relevant data of the target graph with the graph identifier can be obtained from the storage component, and the obtained data can be used as historical data of the target graph. Then, the first data of the target graph can be obtained, and the first data can be compared with the above-mentioned historical data item by item. Specifically, the nodes contained in the first data can be compared with each node in the historical data, and the edges contained in the first data can be compared with each edge in the historical data, so as to determine the target data that has changed relative to the historical data. For example, the first data includes three nodes a, b, and c, and two edges ab and ac, and the historical data includes three nodes a, b, and d, and two edges ab and bd. By comparing the first data with the historical data, the target data that has changed between the two can be obtained, that is, the node c is added, the node d in the historical data is deleted, the edge bd in the historical data is deleted, the edge ac is added, the weight of the edge ab is modified, etc. The specific setting can be based on the actual situation, and the embodiments of this specification do not limit this. Afterwards, version information corresponding to the target data can be generated according to a preset encoding mechanism. For example, version information of data related to the most recently stored graph of the target graph is obtained, and based on the obtained version information, version information corresponding to the target data is generated through the encoding mechanism. For example, if the version information of data related to the most recently stored graph of the target graph is V3, then the generated version information corresponding to the target data can be V4. The version information can indicate the partial order relationship between the corresponding graph structure data, such as V4 is the version information of a version of data after V3, etc. It can be set specifically according to actual conditions, and the embodiments of this specification do not limit this.

[0031] In step S106, the nodes and / or edges of the target graph associated with the target data are mapped, and the target data is stored in the storage component in combination with the above version information.

[0032] In implementation, a mapping mechanism or dynamic mapping protocol between the graph and the changing data can be pre-set according to actual conditions. The storage engine can map the nodes and / or edges of the target graph associated with the target data through the mapping mechanism or dynamic mapping protocol, and then store the target data in the storage component in combination with the version information obtained above.

[0033] The embodiments of the present specification provide a method for processing graph structured data, which can be implemented by a storage engine for graph structured data, that is, a storage request for first data of a target graph is received by the storage engine for graph structured data, the storage request includes a graph identifier and the first data of the target graph, then, based on the graph identifier, the storage engine obtains historical data of the target graph corresponding to the graph identifier from a storage component, and determines target data that has changed in the first data of the target graph relative to the historical data through the storage engine, generates version information corresponding to the target data, the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph, and finally, the storage engine can map the nodes of the target graph associated with the target data and / or edges, and stores the target data in the storage component in combination with the above version information. In this way, different versions of graph structure data can be stored in the storage component at a lower cost through the storage engine for graph structure data, and the storage engine can subsequently restore a specific version of the graph structure data from the storage component. The above processing of the storage engine not only ensures the integrity of the data, but also reduces the storage engine's overhead in graph calculation and storage, especially in scenarios with frequent local changes in large-scale or ultra-large-scale graphs. Moreover, the producer of the graph only needs to determine the nodes and edges of the historical graph structure data that have changed compared to the previous version or a certain version, and store them through the storage engine, which simplifies the data storage process and logic and improves data storage efficiency.

[0034] Embodiment 2

[0035] like Figure 2 As shown, the embodiment of this specification provides a method for processing graph structure data, and the execution subject of the method can be a terminal device or a storage engine for graph structure data in the terminal device, wherein the terminal device can be a mobile terminal device such as a mobile phone, a tablet computer, or a computer device such as a laptop or a desktop computer, or an IoT device (specifically, a smart watch, a car device, etc.). The method can specifically include the following steps:

[0036] In step S202, whenever a preset cycle is reached, a storage request for first data of a target graph sent by a memory is received, where the storage request includes a graph identifier and the first data of the target graph.

[0037] Among them, the preset period can be set according to actual conditions, such as the preset period is a specified time point or time period every day, or it can be a time point or time period with an interval of one or more days, or it can also be a specified time point or time period every month, etc.

[0038] In implementation, Figure 3 The diagram depicts a diagram of a storage engine for graph structure data storing a graph, wherein the left part is a snapshot of different versions of the graph in memory, that is, the version information V1 is the version information of the first version of the target graph, the version information V2 is the version information of the second version of the target graph, and the version information V1 is the version information of the target graph before the version information V2. The right part is the representation of the graph in the persistent storage component. The storage engine in the middle is used to manage the definition, indexing, storage, loading and cleaning of the graph structure data in the memory snapshot and the persistent storage component. The execution subject in this embodiment can be the storage engine described above in the terminal device or server, wherein the definition of the graph structure data can be the graph in the memory snapshot, which can represent the complete state of a certain version of the graph in the memory, and the states of different versions of the graph are completely independent. Based on this, whenever a preset cycle is reached, the memory can obtain the graph identifier and the first data of the target graph, and can generate a storage request for the first data of the target graph based on the obtained graph identifier and the first data of the target graph, and can send the storage request to the storage engine, which can receive the storage request for the first data of the target graph sent by the memory.

[0039] In step S204, based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from the storage component.

[0040] In implementation, when the storage component stores data, it will store the data in the memory snapshot in the persistent storage component. The graph can be stored in the persistent storage component in the form of an attribute graph, that is, any member of the nodes and edges in the memory snapshot exists in the nodes and edges of the persistent storage component in the form of attributes. The above storage process first needs to determine the changed nodes and / or edges, and store their latest states as the attribute information of the current version information. Figure 3In the example shown, when the memory snapshot V1 of the target graph is stored, the data of the edge ab is {V1:{w:0.2}}, where V1 represents the version information of the target graph, and w:0.2 represents the weight (i.e., attribute information) of the edge ab. Based on the above content, the historical data of the target graph corresponding to the graph identifier can be obtained from the storage component based on the above graph identifier. The specific processing process can refer to the above related content, which will not be repeated here.

[0041] In step S206, if the first sub-data exists in the first data but does not exist in the historical data, the first sub-data is set as the data to be added; if the second sub-data does not exist in the first data but exists in the historical data, the second sub-data is set as the data to be deleted; if the third sub-data exists in both the first data and the historical data, and the attribute information of the third sub-data is modified, the third sub-data is set as the data to be updated; if the first data is the same as the fourth sub-data in the historical data, the fourth sub-data is ignored.

[0042] The first sub-data, the second sub-data, the third sub-data and the fourth sub-data are different data, and the target data includes the first sub-data, the second sub-data and the third sub-data. The target data includes the data of the nodes in the first data of the target graph and / or the data of the edges in the first data of the target graph.

[0043] In implementation, Figure 3 As shown in the figure, after the graph structure data with version information V1 is stored, the data of the edge ab is {V1:{w:0.2}}. When the graph structure data with version information V2 is stored, the data of the edge ab is updated to {V1:{w:0.2},V2:{w:0.3}}. In addition, after the graph structure data with version information V1 is stored, there is a node c{V1:{}}, and the data of the edge cd is {V1:{w:0.6}}. When the graph structure data with version information V2 is stored, there is no node c{V1:{},V2:{m:1}}, and the data of the edge cd is updated to {V1:{w:0.6},V2:{m:1}}. At the same time, the data of the node e{V2:{}} and the edge de{V2:{w:0.1}} are added, and so on. For details, please refer to Figure 3 As shown in , the corresponding target data can be finally obtained.

[0044] In step S208, version information corresponding to the target data is generated.

[0045] In implementation, Figure 3For example, the target data may be data in memory snapshot V2 that has changed relative to memory snapshot V1, and the corresponding version information may be set in a variety of ways, such as incremental data K1 or incremental data 1, etc., which may be set specifically according to actual conditions, and this specification does not limit this.

[0046] It should be noted that the generated version information corresponding to the target data may be the same as the version information of the graph structure data received in the memory, or may be different from the version information of the graph structure data received in the memory. For example, new version information may be regenerated based on the version information of the graph structure data received in the memory as the version information corresponding to the target data, or the corresponding version information may be generated by specified version information generation rules, etc. The specific setting may be based on actual conditions, and the embodiments of this specification do not limit this.

[0047] In step S210, the nodes and / or edges of the target graph associated with the target data are mapped, and in combination with the above-mentioned version information, the target data is stored in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing the storage unit.

[0048] In the implementation, in the persistent storage component, nodes and edges that are logically the same but may have different versions can share storage units, the in-memory format and the persistent format of the graph can be separated, and the conversion between the two formats can be completed through data definition. The data definition also needs to provide a way to determine whether the nodes and edges are logically the same. Figure 3 Take the memory snapshots V1 and V2 of the target graph in as an example. If the condition for determining the logical identity of the nodes is that the node identifiers are the same, and the condition for determining the logical identity of the edges is that the nodes on both sides of the edges are the same, then nodes a, b, and d are logically the same nodes, and ab and ad are logically the same edges. Therefore, the storage unit can be shared in the persistent storage component. When storing the data in the memory snapshot in the persistent storage component, the storage of the target graph in the persistent storage component adopts the form of a property graph, that is, any members of the nodes and edges in the memory snapshot exist in the form of attributes in the nodes and edges of the persistent storage component. The above process needs to determine the nodes and edges that have changed and store their latest states. Figure 3 In the example, when the memory snapshot V1 of the target graph is stored, the data of the edge ab is {V1:{w:0.2}}. When the memory snapshot V2 is stored, the data of the edge ab is updated to {V1:{w:0.2},V2:{w:0.3}}. For details, please refer to the above related content and Figure 3 The specific content will not be repeated here.

[0049] In step S212, if it is detected that the target data of the target graph that has changed relative to the historical data of the target graph has reached a preset validity period, the target data is deleted from the storage component.

[0050] The validity period can be set according to actual conditions, such as 1 month or 24 hours.

[0051] In implementation, the historical information of the graph can be time-sensitive, and the validity period of different versions of graph structure data can be set according to different needs. Graph structure data that has exceeded the validity period can be cleaned up regularly or irregularly through background tasks. This can not only reduce the time for data indexing, but also further reduce the amount of data in the persistent storage component.

[0052] In practical applications, the storage component may include multiple different versions of target data of the target graph that have changed relative to historical data, and may also manage multiple different versions of target data. For details, see the processing of step S214 below.

[0053] In step S214, when the number of the stored target data of multiple different versions reaches a preset number, one or more target data of the target data of multiple different versions are discarded.

[0054] The preset number can be set according to actual conditions, such as 1,000 pieces of data or 10,000 pieces of data.

[0055] In implementation, when discarding data, the storage engine may randomly select one or more different versions of target data to discard, or discard one or more different versions of target data whose storage time exceeds a first preset time threshold, or discard one or more different versions of target data whose time from reaching the validity period of each graph structure data exceeds a second preset time threshold, or discard one or more different versions of target data whose validity period is less than (or greater than) the preset validity period threshold, etc. The specific settings can be made according to actual conditions, and the embodiments of this specification are not limited to this.

[0056] In actual applications, in addition to storing the changed graph structure data in the storage component, the storage engine can also load the specified version of the graph structure data from the storage component to components or devices such as memory. For details, please refer to the processing of steps S216 to S220 below.

[0057] In step S216 , version information of the first data to be read is received.

[0058] In step S218, based on the received version information, the changed target data corresponding to the received version information is acquired from the storage component.

[0059] In step S220 , first data corresponding to the received version information is generated based on the acquired changed target data.

[0060] Regarding the specific processing of the above steps S218 and S220, in implementation, as Figure 3 As shown, taking the loading of memory snapshot V2 as an example, firstly, the order between the different versions of the target graph is determined through the data index in the storage engine, that is, V2 is after V1, and which nodes and edges belong to the target graph are determined. Then, the storage engine restores the nodes and edges in the target graph to the state of V2. For example, for the three nodes a, b and d, V2 has not been modified compared to V1, so the state of the last version closest to V2 (i.e. V1) is loaded. For node c, it is deleted in V2, so there is no need to load it. For node e, it is a newly added node in V2, so V2 is loaded. The edge loading method can also be loaded in a similar manner to the above method, which will not be repeated here. Finally, the storage engine can generate the first data corresponding to the received version information (i.e. the data of the target graph of version V2), and can provide the generated first data corresponding to the received version information to the reader.

[0061] like Figure 3 The five functional modules in the storage engine shown form an organism that can store different versions of graph structure data in a persistent storage component at a low cost, and can also restore a specific version of graph structure data from a persistent storage component. The storage engine not only ensures data integrity, but also reduces the storage engine's overhead in graph computing and storage, and is particularly suitable for scenarios with frequent local changes in large or ultra-large graphs. For graph consumers, the storage engine is completely transparent; for graph producers, they only need to determine the nodes and edges that have changed compared to the previous version or a certain version of the historical graph structure data, and store them through the storage engine.

[0062] The embodiments of the present specification provide a method for processing graph structured data, which can be implemented by a storage engine for graph structured data, that is, a storage request for first data of a target graph is received by the storage engine for graph structured data, the storage request includes a graph identifier and the first data of the target graph, then, based on the graph identifier, the storage engine obtains historical data of the target graph corresponding to the graph identifier from a storage component, and determines, through the storage engine, target data that has changed in the first data of the target graph relative to the historical data, and generates version information corresponding to the target data, the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph, and finally, the storage engine can map the target graph associated with the target data 's nodes and / or edges, and stores the target data in the storage component in combination with the above version information. In this way, different versions of graph structure data can be stored in the storage component at a lower cost through the storage engine for graph structure data, and a specific version of the graph structure data can be restored from the storage component later. The above processing of the storage engine not only ensures the integrity of the data, but also reduces the storage engine's overhead in graph calculation and storage, especially in scenarios with frequent local changes in large-scale or ultra-large-scale graphs. Moreover, the producer of the graph only needs to determine the nodes and edges of the historical graph structure data that have changed compared to the previous version or a certain version, and store them through the storage engine, which simplifies the data storage process and logic and improves data storage efficiency.

[0063] Embodiment 3

[0064] The above is a method for processing graph structure data provided by an embodiment of this specification. Based on the same idea, an embodiment of this specification also provides a storage engine for graph structure data, which can be used to implement the processing of the above-mentioned method for processing graph structure data. The storage engine can be as follows: Figure 4 shown.

[0065] The storage engine for graph structure data includes: a storage request module 401, a graph data processing module 402 and a graph data storage module 403, wherein:

[0066] A storage request module 401 receives a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data;

[0067] A graph data processing module 402, based on the graph identifier, obtains historical data of the target graph corresponding to the graph identifier from a storage component, determines target data that has changed from the first data of the target graph relative to the historical data, and generates version information corresponding to the target data, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph;

[0068] The graph data storage module 403 maps the nodes and / or edges of the target graph associated with the target data, and stores the target data in the storage component in combination with the version information.

[0069] In the embodiment of this specification, the graph data processing module 402 includes:

[0070] a first processing unit, which sets the first sub-data as data to be added if the first sub-data exists in the first data but does not exist in the historical data;

[0071] a second processing unit, which sets the second sub-data as data to be deleted if the second sub-data does not exist in the first data but exists in the historical data;

[0072] a third processing unit, which sets the third sub-data as data to be updated if the third sub-data exists in both the first data and the historical data and the attribute information of the third sub-data is modified;

[0073] a fourth processing unit, ignoring the fourth sub-data if the first data is identical to the fourth sub-data in the historical data;

[0074] The first sub-data, the second sub-data, the third sub-data and the fourth sub-data are different data, and the target data includes the first sub-data, the second sub-data and the third sub-data.

[0075] In the embodiment of this specification, the storage engine for graph structure data further includes:

[0076] A read request module receives version information of the first data to be read;

[0077] A first data acquisition module, which acquires, from the storage component, the changed target data corresponding to the received version information according to the received version information;

[0078] The second data acquisition module generates first data corresponding to the received version information based on the acquired changed target data.

[0079] In an embodiment of the present specification, the graph data storage module 403 maps the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, stores the target data in the storage component by determining nodes with the same identifiers as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units.

[0080] In the embodiment of this specification, the storage engine for graph structure data further includes:

[0081] The data deletion module deletes the target data from the storage component if it is detected that the target data of the target graph that has changed relative to the historical data of the target graph has reached a preset validity period.

[0082] In the embodiment of the present specification, the storage request module 401 receives a storage request for the first data of the target graph sent by the memory every time a preset period is reached, and the storage component is a persistent storage component.

[0083] In the embodiment of the present specification, the storage component includes a plurality of different versions of target data of the target graph that have changed relative to the historical data, and the storage engine for graph structure data further includes:

[0084] The discarding module discards one or more target data among the multiple different versions of the target data when the number of the stored target data of the multiple different versions reaches a preset number.

[0085] The embodiment of the present specification provides a storage engine for graph-structured data, which receives a storage request for first data of a target graph, wherein the storage request includes a graph identifier and the first data of the target graph, and then, based on the graph identifier, obtains historical data of the target graph corresponding to the graph identifier from a storage component, determines target data that has changed in the first data of the target graph relative to the historical data, and generates version information corresponding to the target data, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph. Finally, the nodes and / or edges of the target graph associated with the target data can be mapped, and the target graph can be stored in the storage component in combination with the above-mentioned version information. Data, in this way, different versions of graph structure data can be stored in the storage component at a lower cost through the storage engine for graph structure data, and the storage engine can subsequently restore a specific version of the graph structure data from the storage component. The above processing of the storage engine not only ensures the integrity of the data, but also reduces the storage engine's overhead in graph calculation and storage, especially in scenarios with frequent local changes in large-scale or ultra-large-scale graphs. Moreover, the producer of the graph only needs to determine the nodes and edges of the historical graph structure data that have changed compared to the previous version or a certain version, and store them through the storage engine, which simplifies the data storage process and logic and improves data storage efficiency.

[0086] Embodiment 4

[0087] The above is a storage engine for graph structured data provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a storage device for graph structured data. The storage device for graph structured data includes the storage engine for graph structured data as described above. The storage device for graph structured data can be as follows: Figure 5 shown.

[0088] The storage device for graph structure data may be the terminal device provided in the above embodiment or may be a storage device in the terminal device, etc.

[0089] The storage device for graph structured data may vary greatly due to different configurations or performances, and may include one or more processors 501 and memory 502, and the memory 502 may store one or more storage applications or data. Among them, the memory 502 may be a short-term storage or a persistent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the storage device for graph structured data. Furthermore, the processor 501 may be configured to communicate with the memory 502 and execute a series of computer executable instructions in the memory 502 on the storage device for graph structured data. The storage device for graph structured data may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input and output interfaces 505, and one or more keyboards 506.

[0090] Specifically, in this embodiment, the storage device for graph structured data includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the storage device for graph structured data, and is configured to be executed by one or more storage engines that can be used for graph structured data. The one or more programs include computer executable instructions for performing the following:

[0091] receiving a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data;

[0092] Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph;

[0093] The nodes and / or edges of the target graph associated with the target data are mapped, and the target data is stored in the storage component in combination with the version information.

[0094] In the embodiment of this specification, the determining of the target data of the first data of the target graph that has changed relative to the historical data includes:

[0095] If the first sub-data exists in the first data but does not exist in the historical data, setting the first sub-data as data to be added;

[0096] If the second sub-data does not exist in the first data but exists in the historical data, setting the second sub-data as data to be deleted;

[0097] If the third sub-data exists in both the first data and the historical data, and the attribute information of the third sub-data is modified, setting the third sub-data as data to be updated;

[0098] If the first data is identical to the fourth sub-data in the historical data, ignoring the fourth sub-data;

[0099] The first sub-data, the second sub-data, the third sub-data and the fourth sub-data are different data, and the target data includes the first sub-data, the second sub-data and the third sub-data.

[0100] In the embodiments of this specification, it also includes:

[0101] Receiving version information of the first data to be read;

[0102] According to the received version information, acquiring the changed target data corresponding to the received version information from the storage component;

[0103] First data corresponding to the received version information is generated based on the acquired changed target data.

[0104] In the embodiment of this specification, mapping the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information, includes:

[0105] Map the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, store the target data in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units.

[0106] In the embodiments of this specification, it also includes:

[0107] If it is detected that target data of the target graph that has changed relative to historical data of the target graph has reached a preset validity period, the target data is deleted from the storage component.

[0108] In the embodiment of this specification, the receiving a storage request for the first data of the target graph includes:

[0109] Whenever a preset period is reached, a storage request for first data of a target graph sent by the memory is received, and the storage component is a persistent storage component.

[0110] In the embodiment of the present specification, the storage component includes target data of multiple different versions of the target graph that have changed relative to the historical data, and further includes:

[0111] When the number of the stored target data of multiple different versions reaches a preset number, one or more target data of the target data of the multiple different versions are discarded.

[0112] An embodiment of the present specification provides a storage device for graph-structured data, including a storage engine for graph-structured data, through which a storage request for first data of a target graph can be received, the storage request including a graph identifier and first data of the target graph, then, based on the graph identifier, the storage engine obtains historical data of the target graph corresponding to the graph identifier from a storage component, and determines through the storage engine target data that has changed in the first data of the target graph relative to the historical data, generates version information corresponding to the target data, the target data including data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph, and finally, the storage engine can map the nodes and / or edges of the target graph associated with the target data , and stores the target data in the storage component in combination with the above version information. In this way, different versions of graph structure data can be stored in the storage component at a lower cost through the storage engine for graph structure data. The storage engine can also restore a specific version of the graph structure data from the storage component later. The above processing of the storage engine not only ensures the integrity of the data, but also reduces the storage engine's overhead in graph calculation and storage, especially in scenarios with frequent local changes in large-scale or ultra-large-scale graphs. Moreover, the producer of the graph only needs to determine the nodes and edges of the historical graph structure data that have changed compared to the previous version or a certain version, and store them through the storage engine, which simplifies the data storage process and logic and improves data storage efficiency.

[0113] Embodiment 5

[0114] Furthermore, based on the above Figures 1A to 3In one or more embodiments of the present specification, a storage medium is provided for storing computer executable instruction information. In a specific embodiment, the storage medium may be a USB flash drive, a CD, a hard disk, etc. When the computer executable instruction information stored in the storage medium is executed, the corresponding storage engine for graph structure data can implement the following process:

[0115] receiving a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data;

[0116] Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph;

[0117] The nodes and / or edges of the target graph associated with the target data are mapped, and the target data is stored in the storage component in combination with the version information.

[0118] In the embodiment of this specification, the determining of the target data of the first data of the target graph that has changed relative to the historical data includes:

[0119] If the first sub-data exists in the first data but does not exist in the historical data, setting the first sub-data as data to be added;

[0120] If the second sub-data does not exist in the first data but exists in the historical data, setting the second sub-data as data to be deleted;

[0121] If the third sub-data exists in both the first data and the historical data, and the attribute information of the third sub-data is modified, setting the third sub-data as data to be updated;

[0122] If the first data is identical to the fourth sub-data in the historical data, ignoring the fourth sub-data;

[0123] The first sub-data, the second sub-data, the third sub-data and the fourth sub-data are different data, and the target data includes the first sub-data, the second sub-data and the third sub-data.

[0124] In the embodiments of this specification, it also includes:

[0125] Receiving version information of the first data to be read;

[0126] According to the received version information, acquiring the changed target data corresponding to the received version information from the storage component;

[0127] First data corresponding to the received version information is generated based on the acquired changed target data.

[0128] In the embodiment of this specification, mapping the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information, includes:

[0129] Map the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, store the target data in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units.

[0130] In the embodiments of this specification, it also includes:

[0131] If it is detected that target data of the target graph that has changed relative to historical data of the target graph has reached a preset validity period, the target data is deleted from the storage component.

[0132] In the embodiment of this specification, the receiving a storage request for the first data of the target graph includes:

[0133] Whenever a preset period is reached, a storage request for first data of a target graph sent by the memory is received, and the storage component is a persistent storage component.

[0134] In the embodiment of the present specification, the storage component includes target data of multiple different versions of the target graph that have changed relative to the historical data, and further includes:

[0135] When the number of the stored target data of multiple different versions reaches a preset number, one or more target data of the target data of the multiple different versions are discarded.

[0136] An embodiment of the present specification provides a storage medium, which receives a storage request for first data of a target graph by triggering a storage engine for graph structured data, wherein the storage request includes a graph identifier and first data of the target graph, and then triggers the storage engine to obtain historical data of the target graph corresponding to the graph identifier from a storage component based on the graph identifier, and determines through the storage engine the target data that has changed in the first data of the target graph relative to the historical data, and generates version information corresponding to the target data, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph, and finally, triggers the storage engine to map the nodes and / or edges of the target graph associated with the target data, and combines the above-mentioned version information with the target data. This information stores the target data in the storage component, so that by triggering the storage engine for graph structure data, different versions of graph structure data can be stored in the storage component at a lower cost. Subsequently, the storage engine can also restore a specific version of the graph structure data from the storage component. The above processing of the storage engine not only ensures the integrity of the data, but also reduces the storage engine's overhead in graph calculation and storage, especially in scenarios with frequent local changes in large-scale or ultra-large-scale graphs. Moreover, the producer of the graph only needs to determine the nodes and edges of the historical graph structure data that have changed compared to the previous version or a certain version, and store them through the storage engine, which simplifies the data storage process and logic and improves data storage efficiency.

[0137] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0138] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0139] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0140] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0141] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0142] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification 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.) that contain computer-usable program code.

[0143] The embodiments of this specification are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 fraud case serial and parallel device to produce a machine, so that the instructions executed by the processor of the computer or other programmable fraud case serial and parallel device produce a device for implementing the function specified in one process or multiple processes of the flowchart and / or one box or multiple boxes of the block diagram.

[0144] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable fraud case serial and parallel device to work 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 functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0145] These computer program instructions may also be loaded onto a computer or other programmable fraud case serial and parallel device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows of the flowchart and / or one or more blocks of the block diagram.

[0146] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0147] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0148] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0149] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0150] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification 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.

[0151] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0152] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system 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.

[0153] The above description is only an embodiment of this specification and is not intended to limit the present application. For those skilled in the art, this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification should be included in the scope of the claims of this specification.

Claims

1. A method for processing graph structure data, the method comprising: receiving a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data; Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph; Mapping nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information; The mapping of the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information, comprises: Map the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, store the target data in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units. The storing of the target data in the storage component is to store the data in the memory snapshot in the persistent storage component, and the storage of the target graph in the persistent storage component is in the form of a property graph. The storage in the form of a property graph is that any members of the nodes and edges in the memory snapshot exist in the nodes and edges of the persistent storage component in the form of attributes. During the storage process, the nodes and edges that have changed are determined, and the latest states of the nodes and edges are stored.

2. The method according to claim 1, wherein determining the target data of the first data of the target graph that has changed relative to the historical data comprises: If the first sub-data exists in the first data but does not exist in the historical data, setting the first sub-data as data to be added; If the second sub-data does not exist in the first data but exists in the historical data, setting the second sub-data as data to be deleted; If the third sub-data exists in both the first data and the historical data, and the attribute information of the third sub-data is modified, setting the third sub-data as data to be updated; If the first data is identical to the fourth sub-data in the historical data, ignoring the fourth sub-data; The first sub-data, the second sub-data, the third sub-data and the fourth sub-data are different data, and the target data includes the first sub-data, the second sub-data and the third sub-data.

3. The method according to claim 1, further comprising: Receiving version information of the first data to be read; According to the received version information, acquiring the changed target data corresponding to the received version information from the storage component; First data corresponding to the received version information is generated based on the acquired changed target data.

4. The method according to claim 1, further comprising: If it is detected that target data of the target graph that has changed relative to historical data of the target graph has reached a preset validity period, the target data is deleted from the storage component.

5. The method according to claim 1, wherein receiving a storage request for first data of a target graph comprises: Whenever a preset period is reached, a storage request for first data of a target graph sent by the memory is received, and the storage component is a persistent storage component.

6. The method according to claim 1, wherein the storage component includes a plurality of different versions of target data of the target graph that have changed relative to the historical data, and the method further comprises: When the number of the stored target data of multiple different versions reaches a preset number, one or more target data of the target data of the multiple different versions are discarded.

7. A storage engine for graph structured data, the storage engine comprising: A storage request module, receiving a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data; A graph data processing module, based on the graph identifier, obtains historical data of the target graph corresponding to the graph identifier from a storage component, determines target data that has changed from the first data of the target graph relative to the historical data, and generates version information corresponding to the target data, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph; A graph data storage module, mapping the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information; The mapping of the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information, comprises: Map the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, store the target data in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units. The storing of the target data in the storage component is to store the data in the memory snapshot in the persistent storage component, and the storage of the target graph in the persistent storage component is in the form of a property graph. The storage in the form of a property graph is that any members of the nodes and edges in the memory snapshot exist in the nodes and edges of the persistent storage component in the form of attributes. During the storage process, the nodes and edges that have changed are determined, and the latest states of the nodes and edges are stored.

8. A storage device for graph structured data, the storage device for graph structured data comprising: Storage engine for graph-structured data; as well as A memory arranged to store computer executable instructions which, when executed, cause the storage engine for graph structured data to: receiving a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data; Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph; Mapping nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information; The mapping of the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information, comprises: Map the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, store the target data in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units. The storing of the target data in the storage component is to store the data in the memory snapshot in the persistent storage component, and the storage of the target graph in the persistent storage component is in the form of a property graph. The storage in the form of a property graph is that any members of the nodes and edges in the memory snapshot exist in the nodes and edges of the persistent storage component in the form of attributes. During the storage process, the nodes and edges that have changed are determined, and the latest states of the nodes and edges are stored.

9. A storage medium for storing computer executable instructions, wherein when the executable instructions are executed, a corresponding storage engine for graph structure data can implement the following process: receiving a storage request for first data of a target graph, wherein the storage request includes a graph identifier of the target graph and the first data; Based on the graph identifier, historical data of the target graph corresponding to the graph identifier is obtained from a storage component, and target data of the target graph that has changed relative to the historical data is determined, and version information corresponding to the target data is generated, wherein the target data includes data of nodes in the first data of the target graph and / or data of edges in the first data of the target graph; Mapping nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information; The mapping of the nodes and / or edges of the target graph associated with the target data, and storing the target data in the storage component in combination with the version information, comprises: Map the nodes and / or edges of the target graph associated with the target data, and in combination with the version information, store the target data in the storage component by determining nodes with the same identifier as logically identical nodes and / or by determining edges with the same nodes on both sides as logically identical edges as conditions for sharing storage units. The storing of the target data in the storage component is to store the data in the memory snapshot in the persistent storage component, and the storage of the target graph in the persistent storage component is in the form of a property graph. The storage in the form of a property graph is that any members of the nodes and edges in the memory snapshot exist in the nodes and edges of the persistent storage component in the form of attributes. During the storage process, the nodes and edges that have changed are determined, and the latest states of the nodes and edges are stored.

Citation Information

Patent Citations

  • Grid topology version management tool and method based on graph database

    CN113610661A