Data calculation method based on graph database and calculation framework and related device
By obtaining graph data and graph calculation requests, converting them into GraphSON data structures, and passing them into the GraphX component for calculation, it solves the integration problem of the graph database and the graph calculation engine, achieves efficient data mining, reduces costs, and maintains the stability of the system. sex.
Patent Information
- Application Number
- CN202410596646.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-09-06
AI Technical Summary
In the application of graph database JanusGraph, there are business scenarios that require complex data or calculation mining. However, there is a lack of mature open source solutions to integrate graph databases and graph computing engines, resulting in high development costs and high technical barriers.
By obtaining the graph data and graph calculation request, analyze and clean it, convert it into startGraph data structure, and convert it into GraphSON data structure, pass it to the GraphX component, use the graph algorithm of GraphX to perform calculations, and generate data calculation results.
It achieves efficient integration of the graph database JanusGraph and the graph computing engine GraphX, reduces the technical threshold and cost, improves data mining efficiency, and maintains the stability and compatibility of the system.
Smart Images

Figure CN118607629A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graph computing technology, and in particular to a data computing method and related devices based on a graph database and a computing framework. Background Art
[0002] In the application practice of the graph database JanusGraph, in addition to performing basic online transaction processing (OLTP) operations such as query, traversal, and graph operations, there are also more complex business scenarios that require data or computational mining. To deal with these scenarios, it is usually necessary to develop specialized graph computing algorithms or integrate existing open source graph computing engines. Although it is feasible to develop graph computing algorithms on your own, this approach faces high technical barriers and corresponding manpower and equipment costs. Relatively speaking, combining a graph database with a graph computing engine and utilizing the rich algorithm library provided by the latter can effectively reduce costs. However, there is currently a lack of mature open source solutions on the market for the integration of mainstream graph databases (JanusGraph) and graph computing engines (GraphX), which require self-design and development. Summary of the invention
[0003] The purpose of the present invention is to provide a data calculation method and related devices based on a graph database and a computing framework to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0004] In a first aspect, the present application provides a data computing method based on a graph database and a computing framework, including:
[0005] Acquire graph data and a graph computing request for the graph data, and analyze the graph data according to the graph computing request to acquire first target data;
[0006] Cleaning the first target data, and converting the cleaned first target data into a startGraph data structure;
[0007] Traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into a GraphSON data structure based on the traversed entities and relationships;
[0008] The GraphSON data structure is passed into the GraphX component, and the GraphSON data structure is parsed to obtain the second target data;
[0009] The graph algorithm of the GraphX component is called according to the graph calculation request, and the second target data is calculated using the graph algorithm to generate a data calculation result.
[0010] In a second aspect, the present application also provides a data computing device based on a graph database and a computing framework, including:
[0011] A graph data analysis module: used for acquiring graph data and a graph computing request about the graph data, and analyzing the graph data according to the graph computing request to acquire first target data;
[0012] Data cleaning and conversion module: used for cleaning the first target data and converting the cleaned first target data into a startGraph data structure;
[0013] Data structure conversion module: used to traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into the GraphSON data structure according to the traversed entities and relationships;
[0014] Parsing module: used for transferring the GraphSON data structure into the GraphX component, parsing the GraphSON data structure to obtain the second target data;
[0015] Graph algorithm calculation module: used to call the graph algorithm of the GraphX component according to the graph calculation request, and use the graph algorithm to calculate the second target data to generate a data calculation result.
[0016] In a third aspect, the present application also provides a data computing device based on a graph database and a computing framework, including:
[0017] Memory for storing computer programs;
[0018] A processor is used to implement the steps of the data calculation method based on the graph database and the computing framework when executing the computer program.
[0019] In a fourth aspect, the present application also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data calculation method based on the graph database and the computing framework are implemented.
[0020] The beneficial effects of the present invention are:
[0021] The present invention proposes an efficient data calculation method by integrating the graph database JanusGraph and the graph calculation engine GraphX. The method solves the data exchange problem between two different systems by converting the startGraph data structure queried by JanusGraph into the GraphSON format that GraphX can parse. The algorithm of GraphX can be directly used for data mining, which improves the efficiency of data mining and reduces the technical threshold and cost. At the same time, the present invention does not involve the adjustment of the GraphX component, and maintains the original stability and compatibility of the system.
[0022] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 It is a schematic diagram of the flow of a data calculation method based on a graph database and a calculation framework according to an embodiment of the present invention;
[0025] Figure 2 It is a data community division result diagram based on the graph database and computing framework described in an embodiment of the present invention;
[0026] Figure 3 It is a schematic diagram of the structure of a data computing device based on a graph database and a computing framework according to an embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of a data computing device based on a graph database and a computing framework as described in an embodiment of the present invention.
[0028] Markings in the figure:
[0029] 800. Data computing device based on graph database and computing framework; 801. Processor; 802. Memory; 803. Multimedia component; 804. I / O interface; 805. Communication component. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0032] Embodiment 1:
[0033] This embodiment provides a data computing method based on a graph database and a computing framework, which is applied to a data computing system. The data computing system consists of a WEB page, GraphX, JanusGraph, and HDFS, wherein:
[0034] WEB page: used for requesting and displaying the results of JanusGraph graph data and GraphX graph algorithms;
[0035] GraphX: supports graph data input in GraphSON format, and is used to perform various graph computing algorithms, including backbone analysis, community division, common neighbors, etc.
[0036] JanusGraph: used for graph data storage and query, as well as converting startGraph data into GraphSON files and storing them in HDFS.
[0037] Hdfs: used to store and query the GraphSON files converted from graph data, and complete the transfer of graph data from startGraph to GraphX in the form of GraphSON files.
[0038] See also Figure 1 , the figure shows that the method includes:
[0039] S1. Obtaining graph data and a graph computing request for the graph data, and analyzing the graph data according to the graph computing request to obtain first target data;
[0040] Specifically, the step S1 includes:
[0041] S11. Construct a query strategy using the graph query language. Specifically, organize the parameters of the WEB page into gremlinSQL query statements and convert form data or query string parameters into key-value pairs;
[0042] S12. Use the query strategy to obtain the nodes in the graph data, the attributes of the nodes, the edges connected to the nodes, and the attributes and weights of the edges. Specifically, gV() is used to obtain nodes, and gE() is used to obtain edges.
[0043] Based on the above embodiments, the method further includes:
[0044] S2. Clean the first target data and convert the cleaned first target data into a startGraph data structure;
[0045] Specifically, step S2 includes:
[0046] S21. Perform format check on the first target data and correct the first target data to a correct format. For example, numeric attributes need to be normalized or standardized, the age attribute should be a numeric type, and the format of the date attribute needs to be unified.
[0047] S22 defines a startGraph structure, wherein the startGraph structure includes entities and relationships;
[0048] S23. Write the nodes and attributes of the nodes in the first target data into entities, the edges connected by vertices, the attributes of the edges and the weights into relationships in turn to obtain the startGraph data structure:
[0049] The startGraph data structure contains a version field to indicate the version of the JSON data, and a graph field to describe the specific content of the graph. The graph field consists of two parts: entities and relations:
[0050] Among them, entities represents an array, which contains all entity objects in the graph. Each entity object contains the following fields:
[0051] id: unique identifier of the entity;
[0052] type: the type of entity, such as "Person" or "Organization";
[0053] name: the name of the entity;
[0054] properties: an optional object containing other properties of the entity. Properties are key-value pairs, where the key is the name of the property and the value is the value of the property. For example, for an entity of type "Person", it may contain properties such as "age" and "gender";
[0055] Relations represents an array that contains all the relationship objects in the graph. Each relationship object contains the following fields:
[0056] subject: The ID of the starting entity of the relationship, pointing to an entity in the entities array;
[0057] predicate: the predicate of the relationship, which describes the relationship between entities, such as "worksFor" (works for...);
[0058] object: the ID of the end entity of the relationship, pointing to an entity in the entities array;
[0059] properties: an optional object containing additional information about the relationship. The information is a key-value pair, where the key is the name of the property and the value is the value of the property. For example, for the "worksFor" relationship, it contains properties such as "startDate" (start date) and "position" (position);
[0060] The specific startGraph data structure example is as follows:
[0061]
[0062]
[0063] Based on the above embodiments, the method further includes:
[0064] S3. traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into a GraphSON data structure according to the traversed entities and relationships;
[0065] Specifically, step S3 includes:
[0066] S31. Constructing a graphSON data structure, wherein the graphSON data structure includes vertices and edges;
[0067] Specifically, vertices include id (unique identifier), label (label), properties (attributes); edges include id (unique identifier), label (label), inV (source vertex), outV (destination node), properties (attributes);
[0068] S32. Identify entities in the startGraph data structure, including id (unique identifier), type (type), name (name) and properties (attributes);
[0069] S33. Assign values to the vertices in the graphSON data structure by using the entities in the startGraph data structure as vertices, the types of entities as labels of vertices, and the attributes of entities as attributes of vertices;
[0070] Specifically, entities are assigned to vertices, ids are assigned to ids, types are assigned to labels, keys with the same properties are assigned, and values corresponding to keys with the same properties are assigned.
[0071] S34. Identify the relationship name, source entity, and target entity in the startGraph data structure;
[0072] Specifically, relations are identified, including subject (source entity), predicate (relationship name), object (target entity), and the direction between the source entity and the target entity indicates the direction of the relationship.
[0073] S35. Assign values to the edges in the graphSON data structure by using the relationship name as the edge label, the source entity as the source vertex of the edge, and the target entity as the target entity of the edge to generate the graphSON data structure;
[0074] Specifically, assign relations to edges, assign id to id, assign predicate to label, assign subject to inV, assign object to outV, assign keys with the same name as properties, and assign values corresponding to keys with the same name as properties. The generated graphSON data structure is as follows:
[0075]
[0076]
[0077] In the graphSON data structure above, there is a graph with two vertices and one edge, where:
[0078] 1. Vertex 1 is a "person" with ID "1" and two attributes "name" and "age";
[0079] Vertex 2 is a "software" with an ID of "2" and two attributes: "name" and "version";
[0080] 3. The ID of edge 9 is "9" and the label is "created", which means that vertex 1 (Alice) created vertex 2 (GraphSON). The edge also has a "date" attribute, which indicates the creation date;
[0081] It should be noted that in GraphSON, the IDs of attributes and edges usually consist of the vertex ID and the name of the attribute, such as "1-name" and "1-age", so that attributes and edges can be uniquely identified in the graph.
[0082] S36. After data cleaning, the graphSON data structure is passed into the hdfs architecture as a json file.
[0083] Based on the above embodiments, the method further includes:
[0084] S4. The GraphSON data structure is passed into the GraphX component, and the GraphSON data structure is parsed to obtain the second target data;
[0085] Specifically, when the graph algorithm is a community partitioning algorithm, it includes:
[0086] S41. Obtain all vertices and edges connecting the vertices in the second target data, and regard each vertex as a community to form a community structure;
[0087] S42. Calculate the modularity gain of the community structure when each vertex moves to other communities, and take the community to which the vertex needs to move when the modularity gain is the largest as the target community;
[0088]
[0089] In the formula, ΔQ(i,C j ) represents the modularity gain when vertex i moves to community j, A ik represents the element in the adjacency matrix A, representing the weight of the edge between vertices i and k, k i represents the number of edges connected to vertex i, kk represents the number of edges connected to vertex k, m represents the total number of edges, and C j represents the set of all vertices in community j;
[0090] When ΔQ(i,C j )>0, it means that moving vertices to other communities can increase the modularity of the community structure.
[0091] S43. After each vertex is moved to its corresponding target community, the modularity of the community structure is calculated based on the edges connecting the vertices;
[0092]
[0093] In the formula, ∑ ab A ab represents the sum of all elements in the adjacency matrix A, ∑ ab P ab represents the expected probability P between all vertex pairs (a, b) ab The sum of P ab represents the expected probability that there is an edge between any nodes a and b;
[0094] S44. When the modularity of the community structure reaches a maximum value, the current community structure is used as the community division of the graph data to obtain a data calculation result;
[0095] When the modularity cannot be increased after all vertices are moved, it means that the current modularity is the maximum value and the current community structure is the optimal community division.
[0096] Specifically, when the graph algorithm is a backbone analysis algorithm, it includes:
[0097] S45. Obtain all vertices and edges connecting the vertices in the second target data;
[0098] S46. Calculate the degree centrality score of the vertex according to the number of edges connected to each vertex;
[0099]
[0100] In the formula, C D (v) represents the degree centrality score of vertex v, n v represents the number of edges connected to vertex v, u represents the maximum number of edges that vertex v can connect to, u=n-1, where n represents the total number of vertices.
[0101] S47. Taking the vertices whose degree centrality scores exceed the first preset threshold as preliminary vertices, and calculating the clustering coefficient of the preliminary vertices according to the degree of association between the preliminary vertices and their neighbor vertices;
[0102]
[0103] Where L(w) represents the clustering coefficient of the initially selected vertex w, E′ represents the set of edges actually existing in the complete graph formed by the adjacent vertices of vertex w, and k(w) represents the number of adjacent vertices of vertex w.
[0104] S48. Calculate the subgraph centrality score of the primary selected vertex based on the clustering coefficient;
[0105]
[0106] Where, L avg (i) represents the average clustering coefficient calculated on all vertices with i neighbor vertices, and S(w) represents the subgraph centrality score of the preliminary vertex w.
[0107] S49. Taking the preliminarily selected vertices whose subgraph centrality scores exceed the second preset value as the backbone, and obtaining the data calculation result;
[0108] The setting of the first preset value and the second preset value in this embodiment will affect the number of backbones. The first preset value and the second preset value can be determined according to actual needs in different usage scenarios.
[0109] Based on the above embodiments, the method further includes:
[0110] S5. Call the graph algorithm of the GraphX component according to the graph calculation request, and use the graph algorithm to calculate the second target data to generate a data calculation result. Figure 2 , Figure 2 The community division diagram calculated by this embodiment is shown.
[0111] Embodiment 2:
[0112] like Figure 3 As shown, this embodiment provides a data computing device based on a graph database and a computing framework, the device comprising:
[0113] A graph data analysis module: used for acquiring graph data and a graph computing request about the graph data, and analyzing the graph data according to the graph computing request to acquire first target data;
[0114] Data cleaning and conversion module: used for cleaning the first target data and converting the cleaned first target data into a startGraph data structure;
[0115] Data structure conversion module: used to traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into the GraphSON data structure according to the traversed entities and relationships;
[0116] Parsing module: used for transferring the GraphSON data structure into the GraphX component, parsing the GraphSON data structure to obtain the second target data;
[0117] Graph algorithm calculation module: used to call the graph algorithm of the GraphX component according to the graph calculation request, and use the graph algorithm to calculate the second target data to generate a data calculation result.
[0118] Based on the above embodiment, the graph data analysis module includes:
[0119] Query strategy building unit: used to build query strategies using graph query language;
[0120] Data acquisition unit: used to use the query strategy to obtain the nodes in the graph data, the attributes of the nodes, the edges connected to the nodes, and the attributes and weights of the edges.
[0121] Based on the above embodiments, the data cleaning and conversion module includes:
[0122] Format checking unit: used for performing format checking on the first target data and correcting the first target data into a correct format;
[0123] startGraph structure definition unit: used to define the startGraph structure, the startGraph structure includes entities and relationships;
[0124] Data writing unit: used to write the nodes in the first target data, the attributes of the nodes into the entities, the edges connecting the vertices, the attributes of the edges and the weights into the relationships in turn to obtain the startGraph data structure.
[0125] Based on the above embodiment, the data structure conversion module includes:
[0126] A graphSON construction unit: used to construct a graphSON data structure, wherein the graphSON data structure includes vertices and edges;
[0127] Entity recognition unit: used to identify entities, entity types and attributes in the startGraph data structure;
[0128] Vertex assignment unit: used to assign values to vertices in the graphSON data structure by taking entities in the startGraph data structure as vertices, entity types as vertex labels, and entity attributes as vertex attributes;
[0129] Relation assignment unit: used to identify the relationship name, source entity and target entity in the startGraph data structure, use the relationship name as the label of the edge, the source entity as the source vertex of the edge, and the target entity as the target entity of the edge, and assign values to the edges in the graphSON data structure to generate the graphSON data structure;
[0130] Data cleaning and transmission unit: used to clean the graphSON data structure and then transfer it to the hdfs architecture as a json file.
[0131] Based on the above embodiment, when the graph computing method is a community division algorithm, the graph algorithm computing module includes:
[0132] Community structure construction unit: used to obtain all vertices and edges connected to the vertices in the second target data, and regard each vertex as a community to form a community structure;
[0133] Modularity gain calculation unit: used to calculate the modularity gain of the community structure when each vertex moves to other communities, and take the community to which the vertex needs to move when the modularity gain is the largest as the target community;
[0134] Community moving unit: used to move each vertex to its corresponding target community and calculate the modularity of the community structure based on the edges connecting the vertices;
[0135] Result determination unit: used to obtain data calculation results by using the current community structure as the community division of the graph data when the modularity of the community structure reaches the maximum value.
[0136] Based on the above embodiment, when the graph computing method is a backbone analysis algorithm, the graph algorithm computing module includes:
[0137] Vertex degree calculation unit: used to obtain all vertices and edges connected to the vertices in the second target data, and calculate the degree centrality score of the vertex according to the number of edges connected to each vertex;
[0138] A preliminary vertex determination unit: used to select vertices whose degree centrality scores exceed a first preset threshold as preliminary vertices, and calculate the clustering coefficient of the preliminary vertices according to the degree of association between the preliminary vertices and their neighbor vertices;
[0139] A subgraph centrality calculation unit: used to calculate the subgraph centrality scores of the preliminary selected vertices based on the clustering coefficient;
[0140] Backbone determination unit: used to select the primary vertices whose subgraph centrality scores exceed the second preset value as backbones to obtain data calculation results.
[0141] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0142] Embodiment 3:
[0143] Corresponding to the above method embodiment, this embodiment also provides a data computing device based on a graph database and a computing framework. The data computing device based on a graph database and a computing framework described below and the data computing method based on a graph database and a computing framework described above can refer to each other.
[0144] Figure 4 FIG. 8 is a block diagram of a data computing device 800 implemented based on a graph database and a computing framework according to an exemplary embodiment. Figure 4 As shown, the data computing device 800 based on the graph database and computing framework may include: a processor 801, a memory 802. The data computing device 800 based on the graph database and computing framework may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.
[0145] The processor 801 is used to control the overall operation of the data computing device 800 based on the graph database and computing framework to complete all or part of the steps in the data computing method based on the graph database and computing framework. The memory 802 is used to store various types of data to support the operation of the data computing device 800 based on the graph database and computing framework. These data may include, for example, instructions for any application or method operating on the data computing device 800 based on the graph database and computing framework, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 802 or sent via the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the data computing device 800 based on the graph database and computing framework and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 805 can include: Wi-Fi module, Bluetooth module, NFC module.
[0146] In an exemplary embodiment, the data computing device 800 implemented based on the graph database and computing framework can be implemented by one or more application-specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned data computing method based on the graph database and computing framework.
[0147] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the data calculation method based on the graph database and the computing framework are implemented. For example, the computer-readable storage medium can be the memory 802 including the program instructions, and the program instructions can be executed by the processor 801 of the data calculation device 800 based on the graph database and the computing framework to complete the data calculation method based on the graph database and the computing framework.
[0148] Embodiment 4:
[0149] Corresponding to the above method embodiment, a readable storage medium is also provided in this embodiment. The readable storage medium described below and the data calculation method based on the graph database and the computing framework described above can refer to each other.
[0150] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the data calculation method based on a graph database and a computing framework in the above-mentioned method embodiment.
[0151] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0152] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0153] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A data calculation method based on a graph database and a computing framework, characterized in that: include: Acquire graph data and a graph computing request for the graph data, and analyze the graph data according to the graph computing request to acquire first target data; Cleaning the first target data, and converting the cleaned first target data into a startGraph data structure; Traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into a GraphSON data structure based on the traversed entities and relationships; The GraphSON data structure is passed into the GraphX component, and the GraphSON data structure is parsed to obtain the second target data; The graph algorithm of the GraphX component is called according to the graph calculation request, and the second target data is calculated using the graph algorithm to generate a data calculation result.
2. The data calculation method based on the graph database and the computing framework according to claim 1 is characterized in that , cleaning the first target data, and converting the cleaned first target data into a startGraph data structure, including: Performing format verification on the first target data to correct the first target data into a correct format; Define a startGraph structure, wherein the startGraph structure includes entities and relationships; The nodes in the first target data, the attributes of the nodes are written into the entities, the edges connecting the vertices, the attributes and weights of the edges are written into the relationships in turn, and the startGraph data structure is obtained.
3. The data calculation method based on the graph database and the computing framework according to claim 1 is characterized in that , traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into a GraphSON data structure according to the traversed entities and relationships, including: Constructing a graphSON data structure, wherein the graphSON data structure includes vertices and edges; Identify entities, entity types, and attributes in the startGraph data structure; Assign values to the vertices in the graphSON data structure by using the entities in the startGraph data structure as vertices, the entity types as vertex labels, and the entity attributes as vertex attributes; Identify the relationship name, source entity, and target entity in the startGraph data structure; Assigning values to the edges in the graphSON data structure by using the relationship name as the edge label, the source entity as the source vertex of the edge, and the target entity as the target entity of the edge to generate the graphSON data structure; After data cleaning, the graphSON data structure is passed into the hdfs architecture as a json file.
4. The data calculation method based on the graph database and the computing framework according to claim 1 is characterized in that , calling the graph algorithm of the GraphX component according to the graph calculation request, and using the graph algorithm to calculate the second target data to generate a data calculation result. When the graph algorithm is a community partitioning algorithm, it includes: Obtain all vertices and edges connected to the vertices in the second target data, and regard each vertex as a community to form a community structure; Calculate the modularity gain of the community structure when each vertex moves to other communities, and take the community to which the vertex needs to move when the modularity gain is the largest as the target community; After moving each vertex to its corresponding target community, the modularity of the community structure is calculated based on the edges connecting the vertices; When the modularity of the community structure reaches its maximum value, the current community structure is used as the community division of the graph data to obtain the data calculation result.
5. A data computing device based on a graph database and a computing framework, characterized in that: include: A graph data analysis module: used for acquiring graph data and a graph computing request about the graph data, and analyzing the graph data according to the graph computing request to acquire first target data; Data cleaning and conversion module: used for cleaning the first target data and converting the cleaned first target data into a startGraph data structure; Data structure conversion module: used to traverse the entities and relationships in the startGraph data structure, and convert the startGraph data structure into the GraphSON data structure according to the traversed entities and relationships; Parsing module: used for transferring the GraphSON data structure into the GraphX component, parsing the GraphSON data structure to obtain the second target data; Graph algorithm calculation module: used to call the graph algorithm of the GraphX component according to the graph calculation request, and use the graph algorithm to calculate the second target data to generate a data calculation result.
6. The data computing device based on the graph database and computing framework according to claim 5, characterized in that: The data cleaning and conversion module includes: Format checking unit: used for performing format checking on the first target data and correcting the first target data into a correct format; startGraph structure definition unit: used to define the startGraph structure, the startGraph structure includes entities and relationships; Data writing unit: used to write the nodes in the first target data, the attributes of the nodes into the entities, the edges connecting the vertices, the attributes of the edges and the weights into the relationships in turn to obtain the startGraph data structure.
7. The data computing device based on the graph database and computing framework according to claim 5, characterized in that: The data structure conversion module includes: A graphSON construction unit: used to construct a graphSON data structure, wherein the graphSON data structure includes vertices and edges; Entity recognition unit: used to identify entities, entity types and attributes in the startGraph data structure; Vertex assignment unit: used to assign values to vertices in the graphSON data structure by taking entities in the startGraph data structure as vertices, entity types as vertex labels, and entity attributes as vertex attributes; Relation assignment unit: used to identify the relationship name, source entity and target entity in the startGraph data structure, use the relationship name as the label of the edge, the source entity as the source vertex of the edge, and the target entity as the target entity of the edge, and assign values to the edges in the graphSON data structure to generate the graphSON data structure; Data cleaning and transmission unit: used to clean the graphSON data structure and then transfer it to the hdfs architecture as a json file.
8. The data computing device based on the graph database and computing framework according to claim 5, characterized in that: The graph algorithm calculation module includes: Community structure construction unit: used to obtain all vertices and edges connected to the vertices in the second target data, and regard each vertex as a community to form a community structure; Modularity gain calculation unit: used to calculate the modularity gain of the community structure when each vertex moves to other communities, and take the community to which the vertex needs to move when the modularity gain is the largest as the target community; Community moving unit: used to move each vertex to its corresponding target community and calculate the modularity of the community structure based on the edges connecting the vertices; Result determination unit: used to obtain data calculation results by using the current community structure as the community division of the graph data when the modularity of the community structure reaches the maximum value.
9. A data computing device based on a graph database and a computing framework, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the data calculation method based on the graph database and the computing framework as described in any one of claims 1 to 4 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the data computing method based on a graph database and a computing framework as described in any one of claims 1 to 4.
