A mapping method, device and medium for converting relational database into graph database

Through technical means such as entity-edge-attribute data modeling and frequent subgraph mining, the problem of incomplete and redundant data when converting graph databases in relational databases is solved, and efficient and accurate graph database mapping and optimization are achieved, improving the improvement of graph databases The reliability and efficiency of data analysis.

CN118820376BActive Publication Date: 2025-02-25INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411296232.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-02-25
Estimated Expiration
2044-09-18

AI Technical Summary

Technical Problem

In the prior art, there are problems such as incomplete, inaccurate data conversion and insufficient expression ability when converting from a relational database to a graph database. Especially when the data set is huge, it is difficult for existing methods to accurately predict missing links or attribute values, which affects the impact of Graph database reliability and retrieval performance.

Method used

The data modeling method of entity-edge-attributes is used to convert the relational database into the initial graph database, and the frequent mining sub-graph algorithm is executed in the initial graph database to determine the missing links or attribute values, and generate a supplementary graph database through intelligent complementation. . Then, the community structure is processed based on the fusion clustering algorithm, redundant connections are identified and removed, and edge weights are recalculated through the weight calculation model to obtain the converted graph database.

Benefits of technology

It realizes efficient mapping from relational database to graph database, ensures the integrity and coherence of graph database, improves the reliability of data analysis and application, and improves the algorithm efficiency and graph database through frequent subgraph mining and clustering algorithms. Compactness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118820376B_ABST
    Figure CN118820376B_ABST
Patent Text Reader

Abstract

The present application discloses a mapping method, device and medium for converting a relational database into a graph database, and relates to the field of artificial intelligence technology. The method includes: using an entity-edge-attribute data modeling method to convert a relational database into an initial graph database; in the initial graph database, executing a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; traversing the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently completing the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; processing the supplementary graph database based on a preset fusion clustering algorithm to determine the community structure of the supplementary graph database; identifying and removing redundant connections in the supplementary graph database based on the community structure, and recalculating the edge weights in the supplementary graph database through a preset weight calculation model to obtain a converted graph database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a mapping method, device and medium for converting a relational database into a graph database. Background Art

[0002] With the development of big data and artificial intelligence technology, the usage of graph databases has gradually increased due to their ability to intuitively represent complex relationships between entities. Graph databases have been widely used in many fields such as customer relationship management, recommendation systems, and bioinformatics. However, in practical applications, migrating from traditional relational databases to graph databases is not always direct and simple, especially when the data set is very large.

[0003] At present, some methods proposed in studies can assist this migration process, but most methods tend to focus on data mapping and pay less attention to optimization issues after data conversion. In addition, existing conversion methods usually lack intelligent and automated features and require manual intervention to deal with problems such as inconsistency and redundancy in the data. At the same time, traditional methods are difficult to accurately predict missing links or attribute values ​​in relational databases, which will reduce the reliability of the converted graph database. In addition, due to the lack of effective optimization strategies, the converted graph database may contain many redundant connections and unreasonable edge weight distribution, which in turn affects retrieval performance. Summary of the invention

[0004] The embodiments of the present application provide a mapping method, device and medium for converting a relational database into a graph database, which are used to solve the following technical problems: the problems of incomplete and inaccurate data conversion and insufficient expression ability in the prior art of converting a relational database into a graph database.

[0005] In a first aspect, an embodiment of the present application provides a mapping method for converting a relational database into a graph database, characterized in that the method includes: converting a relational database into an initial graph database using an entity-edge-attribute data modeling method; in the initial graph database, executing a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; traversing the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently completing the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; processing the supplementary graph database based on a preset fusion clustering algorithm to determine the community structure of the supplementary graph database; identifying and removing redundant connections in the supplementary graph database based on the community structure, and recalculating the edge weights in the supplementary graph database through a preset weight calculation model to obtain a converted graph database.

[0006] In one implementation of the present application, a relational database is converted into an initial graph database using an entity-edge-attribute data modeling method, specifically including: identifying and extracting tables, fields, and relationships in the relational database; treating each table as an entity node, each row of data in the table as an instance of the entity node, and converting the fields in the table into attributes of the entity node; creating edges to connect corresponding entity nodes based on the relationships between tables; and organizing all entity nodes and edges into a graph structure to form an initial graph database.

[0007] In one implementation of the present application, a preset frequent subgraph mining algorithm is executed in an initial graph database to obtain a corresponding frequent subgraph set, specifically including: setting a frequency threshold min_sup and initializing a frequent subgraph set L_1; generating a candidate k+1 subgraph set C_{k+1} in the current frequent subgraph set L_k, and generating all possible boundary subgraphs for each candidate subgraph c in the candidate k+1 subgraph set C_{k+1}; for each candidate subgraph c, determining the subgraph with the lowest frequency from its boundary subgraphs as its minimum boundary graph; checking the frequency of the minimum boundary graph of each candidate subgraph c, and if it is greater than or equal to the frequency threshold min_sup, incorporating it into a new frequent subgraph set L_{k+1}; traversing the entity nodes in the initial graph database until no new frequent subgraphs can be generated or the preset maximum number of iterations is reached.

[0008] In one implementation of the present application, missing links or attribute values ​​are intelligently completed based on frequent subgraph sets to obtain a supplementary graph database, specifically including: for each missing link or attribute value, determining a number of similar subgraph structures in the frequent subgraph set; for each similar subgraph structure, inferring by combining statistical co-occurrence information with logical reasoning to determine the similar subgraph structure to be applied, and completing the missing links or attribute values ​​based on the similar subgraph structure to be applied to obtain a supplementary graph database.

[0009] In one implementation of the present application, the supplementary graph database is processed based on a preset fusion clustering algorithm to determine the community structure of the supplementary graph database, specifically including: determining the graph data in the supplementary graph database whose dimension is less than a preset dimension value; performing spectral clustering on the graph data in the supplementary graph database whose dimension is less than the preset dimension value to construct a similarity matrix based on a distance metric to determine the clustering clusters contained in the supplementary graph database; performing subspace clustering on the graph data in the supplementary graph database whose dimension is less than the preset dimension value to analyze the association relationship between each entity node, thereby determining the community structure of the supplementary graph database.

[0010] In one implementation of the present application, redundant connections in a supplementary graph database are identified and removed based on the community structure, specifically including: comparing the attributes or weights of each edge in the supplementary graph database to determine the similarity of each edge, and when the attribute or weight similarity of two edges is greater than a preset similarity threshold, determining that either edge is a redundant edge and removing it; and, detecting and determining whether there is a loop in the supplementary graph database, and when a loop is detected, selectively removing the edges in the loop according to preset rules; and, determining the number of directly connected edges of each entity node in the supplementary graph database, and when the number of directly connected edges of an entity node exceeds a preset threshold, treating it as a candidate node for redundant connection, analyzing the connection status of the candidate node, so as to determine and remove redundant connections.

[0011] In one implementation of the present application, the weight calculation model is represented by the following formula:

[0012]

[0013] in, represents the similarity between entity node 𝑖 and entity node 𝑗; α, β, and γ are three adjustment parameters used to balance the contribution of attribute similarity, clustering results, and subgraph connection strength to edge weight; δ ( Ci , Cj ) is an indicator function, indicating whether entity node 𝑖 and entity node 𝑗 belong to the same cluster; σ ( Ekl ) represents the connection strength between subgraph k and subgraph l, expressed as the number of shared edges between the two communities.

[0014] In one implementation of the present application, the method also includes: structurally optimizing the converted graph database, including but not limited to merging duplicate nodes, optimizing the storage structure of edges, and compressing graph data; providing a query interface for the graph database, and constructing graph query logic to meet the needs of different application scenarios; wherein the graph query logic includes shortest path query logic and subgraph matching logic.

[0015] In a second aspect, an embodiment of the present application also provides a mapping device for converting a relational database into a graph database, characterized in that the device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can: convert the relational database into an initial graph database using an entity-edge-attribute data modeling method; in the initial graph database, execute a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; traverse the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently fill in the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; based on a preset fusion clustering algorithm, process the supplementary graph database to determine the community structure of the supplementary graph database; based on the community structure, identify and remove redundant connections in the supplementary graph database, and recalculate the edge weights in the supplementary graph database through a preset weight calculation model to obtain a converted graph database.

[0016] In the third aspect, an embodiment of the present application also provides a non-volatile computer storage medium for mapping a relational database to a graph database, storing computer executable instructions, characterized in that the computer executable instructions are set to: convert the relational database into an initial graph database using an entity-edge-attribute data modeling method; in the initial graph database, execute a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; traverse the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently fill in the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; based on a preset fusion clustering algorithm, process the supplementary graph database to determine the community structure of the supplementary graph database; based on the community structure, identify and remove redundant connections in the supplementary graph database, and recalculate the edge weights in the supplementary graph database through a preset weight calculation model to obtain a converted graph database.

[0017] The mapping method, device and medium for converting a relational database to a graph database provided in the embodiment of the present application overcome the problems of data missing and low efficiency in the prior art when converting from a relational database to a graph database, so that the mapping process from a relational database to a graph database can be completed efficiently. In view of the problem of missing links or attribute values ​​that may be generated during the conversion process from a relational database to a graph database, the present application can automatically detect and supplement the missing information, ensuring the integrity and coherence of the graph database, which is crucial for subsequent data analysis and application. In this way, even if the original data is incomplete, a comprehensive and accurate knowledge graph can be constructed. At the same time, in the process of frequent subgraph mining, by defining and using the minimum boundary graph (MBG), the number of unnecessary detections is effectively reduced, greatly improving the efficiency of the algorithm. Among them, the minimum boundary graph is a special subgraph structure that can help quickly locate frequently occurring patterns and avoid repeated calculations of similar subgraphs during the search process, thereby significantly speeding up the construction of the graph database. Then, a clustering algorithm is used to identify the community structure in the data, and the edge weights are adjusted accordingly and redundant connections are removed. This not only helps improve query efficiency, but also better reflects the strength of association between entities, making the entire graph database more compact and efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0019] Figure 1 A flowchart of a mapping method for converting a relational database into a graph database provided in an embodiment of the present application;

[0020] Figure 2 A schematic diagram of the internal structure of a mapping device for converting a relational database into a graph database provided in an embodiment of the present application;

[0021] Figure 3 An example diagram of converting a relational database provided in an embodiment of the present application into an initial graph database;

[0022] Figure 4 A flow chart of a fusion clustering algorithm provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0024] The embodiments of the present application provide a mapping method, device and medium for converting a relational database into a graph database, which are used to solve the following technical problems: the problems of incomplete and inaccurate data conversion and insufficient expression ability in the prior art of converting a relational database into a graph database.

[0025] The technical solution proposed in the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0026] Figure 1 A flowchart of a mapping method for converting a relational database into a graph database provided in an embodiment of the present application. Figure 1 As shown, a mapping method for converting a relational database into a graph database provided in an embodiment of the present application specifically includes the following steps:

[0027] Step 101: Use the entity-edge-attribute data modeling method to convert the relational database into an initial graph database.

[0028] In one embodiment of the present application, in order to realize the mapping of relational database to graph database, it is first necessary to use the entity-edge-attribute data modeling method to convert the relational database into an initial graph database.

[0029] Specifically, identify and extract tables, fields and relationships in the relational database; regard each table as an entity node, each row of data in the table as an instance of the entity node, and convert the fields in the table into attributes of the entity node; create edges to connect the corresponding entity nodes based on the relationships between the tables; organize all entity nodes and edges into a graph structure to form an initial graph database.

[0030] In one embodiment, the relational database is converted into an initial graph database using the entity-edge-attribute data modeling method, such as Figure 3 shown. Figure 3 An example diagram of converting a relational database into an initial graph database provided in an embodiment of the present application.

[0031] Step 102: In the initial graph database, execute a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set.

[0032] In one embodiment of the present application, after converting the relational database into an initial graph database, a preset frequent subgraph mining algorithm is executed in the initial graph database to obtain a corresponding frequent subgraph set.

[0033] Specifically, a frequency threshold min_sup is set, and a frequent subgraph set L_1 is initialized; a candidate k+1 subgraph set C_{k+1} is generated in the current frequent subgraph set L_k, and all possible boundary subgraphs are generated for each candidate subgraph c in the candidate k+1 subgraph set C_{k+1}; for each candidate subgraph c, the subgraph with the lowest frequency is determined from its boundary subgraphs as its minimum boundary graph; the frequency of the minimum boundary graph of each candidate subgraph c is checked, and if it is greater than or equal to the frequency threshold min_sup, it is included in the new frequent subgraph set L_{k+1}; the entity nodes in the initial graph database are traversed until no new frequent subgraphs can be generated or the preset maximum number of iterations is reached.

[0034] It is understandable that the core idea of ​​the frequent subgraph mining algorithm is to find frequent subgraphs that meet the minimum support threshold in a given graph database. It achieves this goal by constructing candidate subgraphs and checking whether these subgraphs appear frequently in the database. The frequent subgraph mining algorithm adopts a hierarchical strategy, starting from smaller frequent subgraphs and gradually building larger subgraphs until no new frequent subgraphs can be found. However, such a strategy is a computationally intensive process and the computational efficiency is very redundant. Therefore, this method proposes an improvement on the process by introducing the concept of Minimum Boundary Graphs (MBG) to reduce the number of necessary detections and thus improve the efficiency of the algorithm.

[0035] The minimum boundary graph means that for any frequent subgraph, there exists a set of boundary subgraphs, each of which contains exactly one additional node or edge of the frequent subgraph, and the frequency of this boundary subgraph is not less than the frequency of the original frequent subgraph. The minimum boundary graph is the subgraph with the lowest frequency in this set of boundary subgraphs. In each iteration, not only are candidate subgraphs generated, but the boundary subgraphs of these candidate subgraphs are also calculated, and the minimum boundary graph is found from them. If the frequency of the minimum boundary graph of a candidate subgraph is lower than the preset threshold, then this candidate subgraph and all its possible extensions cannot be frequent and can therefore be pruned immediately.

[0036] Step 103: traverse the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently fill in the missing links or attribute values ​​based on the frequent subgraph sets to obtain a supplementary graph database.

[0037] In one embodiment of the present application, after obtaining the corresponding frequent subgraph set, it is first necessary to traverse the initial graph database to determine the missing links or attribute values ​​in the initial graph database.

[0038] Furthermore, the missing links or attribute values ​​are intelligently completed based on the frequent subgraph sets to obtain a supplementary graph database.

[0039] Specifically, for each missing link or attribute value, several similar subgraph structures are determined in the frequent subgraph set; for each similar subgraph structure, inference is performed by combining statistical co-occurrence information with logical reasoning to determine the similar subgraph structure to be applied, and the missing links or attribute values ​​are completed based on the similar subgraph structure to be applied to obtain a supplementary graph database.

[0040] In one embodiment, inference is performed by combining statistical co-occurrence information with logical reasoning to determine the similar subgraph structure to be applied, specifically including:

[0041] 1. Combined with statistical co-occurrence: When looking for similar subgraph structures, statistical co-occurrence information can be combined to measure the similarity between subgraph structures. Subgraph structures that appear more frequently may have higher credibility for inference.

[0042] 2. Logical reasoning:

[0043] 2.1. Define inference rules: Based on the existing knowledge graph and domain knowledge, define a series of inference rules. These rules describe the logical relationships between different relations and attributes, and how to infer missing links or attribute values ​​in specific situations. For example, you can define an inference rule: If there is a relationship R between entity A and entity B, and entity A has attribute X, then it is inferred that entity B also has attribute Y.

[0044] 2.2. Dealing with uncertainty: In the process of inference, you may encounter uncertainty or ambiguity. At this time, you need to consider how to deal with uncertainty, such as introducing probabilistic inference or fuzzy logic methods to quantify the credibility of the inference results.

[0045] Step 104: Process the supplementary graph database based on a preset fusion clustering algorithm to determine the community structure of the supplementary graph database.

[0046] In one embodiment of the present application, after the supplementary graph database is obtained, the supplementary graph database is processed based on a preset fusion clustering algorithm to determine the community structure of the supplementary graph database.

[0047] Specifically, graph data in the supplementary graph database whose dimension is less than a preset dimension value is determined; spectral clustering is performed on the graph data in the supplementary graph database whose dimension is less than the preset dimension value to construct a similarity matrix based on a distance metric to determine the cluster clusters contained in the supplementary graph database; subspace clustering is performed on the graph data in the supplementary graph database whose dimension is less than the preset dimension value to analyze the association relationship between each entity node, thereby determining the community structure of the supplementary graph database.

[0048] It should be noted that before removing redundant connections, the community structure of the graph database needs to be discovered. In graph databases, the data dimensions of different databases span a large range. It is obviously not enough to use only an ordinary single clustering algorithm to correctly find the community structure in databases of various dimensions. Therefore, in order to solve this problem, clustering algorithms are used to process data sets of various dimensions: For databases with low data dimensions, spectral clustering based on distance measurement to build a similarity matrix can usually better maintain the original geometric structure of the data, effectively distinguish different clusters, and thus find the community structure. In high-dimensional databases, subspace clustering discovers the intrinsic connection between samples by considering potential subspace relationships. Therefore, in order to combine the advantages of both, a fusion clustering algorithm is designed to discover community structures.

[0049] Figure 4 A flow chart of a fusion clustering algorithm provided in an embodiment of the present application.

[0050] In one embodiment, the supplementary graph database is processed based on a preset fusion clustering algorithm to determine the community structure of the supplementary graph database, including:

[0051] 1. Get the initial matrix:

[0052] For high-dimensional data, the subspace algorithm (SSC-OMP) is used to find the potential subspace of the data, and on this basis, the subspace-related similarity matrix is ​​constructed. .

[0053] Then, for the low-dimensional data similarity matrix, the construction method is for each sample in the dataset First, we need to define its neighborhood structure. Here we use the K-Nearest Neighbors (KNN) method to determine it, which means that for each sample point , find the k other sample points closest to it as its neighbor set. By selecting locally relevant sample points through k nearest neighbors, the capture of local structural information of the data is strengthened.

[0054] Then calculate any two sample points in the entire data set and The Euclidean distance between:

[0055]

[0056] Directly using distance metrics to define similarity may lead to the "crowding effect", that is, areas with higher density within a cluster are easily considered to be closely connected, so a Gaussian kernel function is used to alleviate this problem.

[0057] The Gaussian kernel function (also called radial basis function RBF) is defined as:

[0058]

[0059] in Representation sample and , σ is the parameter of the Gaussian kernel, which determines the smoothness and localization ability of the kernel function. belong Only when they are k nearest neighbors, they are given non-zero similarity values; otherwise, if Not The k nearest neighbors of .

[0060] Using the Gaussian kernel function as a measure of similarity can not only attenuate the similarity according to the distance, but also play a normalization role, so that the similarity value is always between (0,1], and the closer the distance, the higher the similarity of the samples.

[0061] After calculating the similarity of all sample pairs in the above way, we will get a size of The similarity matrix , where n is the number of samples in the dataset. The elements in the matrix Shows the sample and The similarity of .

[0062] 2. Feature Enhancement:

[0063] In high-dimensional data, relying solely on a similarity measure may be affected by noise or the "curse of dimensionality". Therefore, the Hadamard product is used to enhance the features of the two similarity matrices. The Hadamard product is an operation that multiplies the corresponding elements of two matrices of the same dimension, denoted as .

[0064] Compared with simple weighted summation, Hadamard product provides a nonlinear feature fusion method. For example, in image processing or machine learning applications, if there are two feature matrices describing different attributes or feature spaces, the positions with smaller values ​​in each matrix will naturally decay to a smaller value, while the positions with larger values ​​will be strengthened. This plays a role in screening and highlighting important features to a certain extent, especially in the process of feature selection or denoising, which can effectively suppress inconsistent or irrelevant information.

[0065] At this stage, the two basic similarity matrices and Perform the Hadamard product operation to obtain the new matrix H:

[0066]

[0067] like and If both are not zero, Non-zero and reflects the sample point and Enhanced features with high similarity based on both distance and subspace structure.

[0068] The Hadamard product operation helps integrate the similarity information from two different perspectives, so that the final matrix H contains both the original geometric proximity and the potential subspace correlation. At the same time, since the result is non-zero only when the values ​​of the two matrices at the same position are non-zero, this is actually a screening and focusing process, emphasizing those data points that are more closely connected under different metrics.

[0069] 3. Construct fusion similarity matrix:

[0070] First, the weight parameter The two basic similarity matrices W1 and W2 are weighted and fused to form a preliminary comprehensive similarity matrix S':

[0071]

[0072] By weighting the parameters The choice of can flexibly adjust the role of different similarity metrics in clustering tasks, making this method better adaptable to data of various types, dimensions and complexity. , an empirical formula is given:

[0073]

[0074] in is the dimension of the data set, with the dimension Increase, weight parameter The value of will gradually decrease; on the contrary, when the dimension is small, The value will increase relatively.

[0075] Then, the above preliminary comprehensive similarity matrix S' is added to the feature enhancement matrix H obtained by Hadamard product to generate the final comprehensive similarity matrix This is done to further integrate information from different perspectives and strengthen the connection between data points that appear very similar under multiple similarity measures.

[0076]

[0077] Finally, spectral clustering is used to construct the comprehensive similarity matrix After spectral decomposition, the final clustering division is obtained through K-means.

[0078] Step 105: According to the community structure, redundant connections in the supplementary graph database are identified and removed, and the edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain a converted graph database.

[0079] In one embodiment of the present application, after determining the community structure of the supplementary graph database, redundant connections in the supplementary graph database are identified and removed according to the community structure.

[0080] Specifically, compare the attributes or weights of each edge in the supplementary graph database to determine the similarity of each edge, and when the attribute or weight similarity of two edges is greater than a preset similarity threshold, determine that either edge is a redundant edge and remove it; and, detect and determine whether there is a loop in the supplementary graph database, and when a loop is detected, selectively remove the edges in the loop according to preset rules; and, determine the number of directly connected edges of each entity node in the supplementary graph database, and when the number of directly connected edges of an entity node exceeds a preset threshold, regard it as a candidate node for redundant connection, analyze the connection status of the candidate node, and determine and remove redundant connections.

[0081] Furthermore, the edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain a converted graph database.

[0082] In one embodiment of the present application, the weight calculation model is represented by the following formula:

[0083]

[0084] in, represents the similarity between entity node 𝑖 and entity node 𝑗; α, β, and γ are three adjustment parameters used to balance the contribution of attribute similarity, clustering results, and subgraph connection strength to edge weight; δ ( Ci , Cj ) is an indicator function, indicating whether entity node 𝑖 and entity node 𝑗 belong to the same cluster; σ ( Ekl ) represents the connection strength between subgraph k and subgraph l, expressed as the number of shared edges between the two communities.

[0085] In one embodiment of the present application, the method also includes: structurally optimizing the converted graph database, including but not limited to merging duplicate nodes, optimizing the storage structure of edges, and compressing graph data; providing a query interface for the graph database, and constructing graph query logic to meet the needs of different application scenarios; wherein the graph query logic includes shortest path query logic and subgraph matching logic.

[0086] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, the embodiment of this application also provides a mapping device for converting a relational database into a graph database, and its structure is as follows: Figure 2 shown.

[0087] Figure 2 A schematic diagram of the internal structure of a mapping device for converting a relational database into a graph database provided in an embodiment of the present application. Figure 2 As shown, the device includes:

[0088] at least one processor 201;

[0089] and, a memory 202 communicatively connected to the at least one processor;

[0090] The memory 202 stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor 201 to enable at least one processor 201 to:

[0091] Using the entity-edge-attribute data modeling method, the relational database is converted into an initial graph database;

[0092] In the initial graph database, a preset frequent subgraph mining algorithm is executed to obtain the corresponding frequent subgraph set;

[0093] Traversing the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently filling the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database;

[0094] Based on a preset fusion clustering algorithm, the supplementary graph database is processed to determine the community structure of the supplementary graph database;

[0095] According to the community structure, redundant connections in the supplementary graph database are identified and removed, and the edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain the converted graph database.

[0096] Some embodiments of the present application provide corresponding Figure 1 A non-volatile computer storage medium for converting a relational database into a graph database mapping, storing computer executable instructions, wherein the computer executable instructions are set to:

[0097] Using the entity-edge-attribute data modeling method, the relational database is converted into an initial graph database;

[0098] In the initial graph database, a preset frequent subgraph mining algorithm is executed to obtain the corresponding frequent subgraph set;

[0099] Traversing the initial graph database to determine the missing links or attribute values ​​in the initial graph database, and intelligently filling the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database;

[0100] Based on a preset fusion clustering algorithm, the supplementary graph database is processed to determine the community structure of the supplementary graph database;

[0101] According to the community structure, redundant connections in the supplementary graph database are identified and removed, and the edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain the converted graph database.

[0102] Each embodiment in this application 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 IoT device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0103] The system and medium provided in the embodiments of the present application correspond one-to-one to the method. Therefore, the system and medium also have similar beneficial technical effects to the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the system and medium will not be repeated here.

[0104] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt 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.

[0105] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. 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 data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0106] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

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

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

[0110] 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.

[0111] 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.

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

Claims

1. A mapping method for converting a relational database into a graph database, characterized in that: The method comprises: Using the entity-edge-attribute data modeling method, the relational database is converted into an initial graph database; In the initial graph database, executing a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; Traversing the initial graph database to determine missing links or attribute values ​​in the initial graph database, and intelligently completing the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; Based on a preset fusion clustering algorithm, the supplementary graph database is processed to determine the community structure of the supplementary graph database; According to the community structure, redundant connections in the supplementary graph database are identified and removed, and edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain a converted graph database.

2. A mapping method for converting a relational database into a graph database according to claim 1, characterized in that: Using the entity-edge-attribute data modeling method, the relational database is converted into an initial graph database, including: Identify and extract tables, fields and associations in the relational database; Each table is regarded as an entity node, each row of data in the table is an instance of the entity node, and the fields in the table are converted into attributes of the entity node; According to the association relationship between tables, create edges to connect the corresponding entity nodes; All entity nodes and edges are organized into a graph structure to form an initial graph database.

3. The mapping method for converting a relational database into a graph database according to claim 1, characterized in that: In the initial graph database, a preset frequent subgraph mining algorithm is executed to obtain a corresponding frequent subgraph set, specifically including: Set the frequency threshold min_sup and initialize the frequent subgraph set L_1; Generate a candidate k+1 subgraph set C_{k+1} in the current frequent subgraph set L_k, and generate all possible boundary subgraphs for each candidate subgraph c in the candidate k+1 subgraph set C_{k+1}; For each candidate subgraph c, determine the subgraph with the lowest frequency from its boundary subgraphs as its minimum boundary graph; Check the frequency of the minimum boundary graph of each candidate subgraph c. If it is greater than or equal to the frequency threshold min_sup, include it in the new frequent subgraph set L_{k+1}; The entity nodes in the initial graph database are traversed until no new frequent subgraphs can be generated or a preset maximum number of iterations is reached.

4. The mapping method for converting a relational database into a graph database according to claim 1, characterized in that: Intelligently completing the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database specifically includes: For each of the missing links or attribute values, determining a plurality of similar subgraph structures in the frequent subgraph set; For each of the similar subgraph structures, inference is performed by combining statistical co-occurrence information with logical reasoning to determine the similar subgraph structure to be applied, and the missing links or attribute values ​​are completed based on the similar subgraph structure to be applied to obtain a supplementary graph database.

5. The mapping method for converting a relational database into a graph database according to claim 1, characterized in that: Based on a preset fusion clustering algorithm, the supplementary graph database is processed to determine the community structure of the supplementary graph database, specifically including: Determine the graph data in the supplementary graph database whose dimension is smaller than a preset dimension value; Performing spectral clustering processing on the graph data in the supplementary graph database whose dimension is less than a preset dimension value, so as to construct a similarity matrix based on a distance metric, and determine cluster clusters contained in the supplementary graph database; Subspace clustering is performed on graph data in the supplementary graph database whose dimension is less than a preset dimension value to analyze the association relationship between each entity node, thereby determining the community structure of the supplementary graph database.

6. The mapping method for converting a relational database into a graph database according to claim 1, characterized in that: According to the community structure, redundant connections in the supplementary graph database are identified and removed, specifically comprising: Comparing the attributes or weights of the edges in the supplementary graph database to determine the similarity of the edges, and when the attribute or weight similarity of two edges is greater than a preset similarity threshold, determining that any one edge is a redundant edge and removing it; and, Detecting and determining whether there is a loop in the supplementary graph database, and when a loop is detected, selectively removing edges in the loop according to a preset rule; and, Determine the number of directly connected edges of each entity node in the supplementary graph database, and when the number of directly connected edges of an entity node exceeds a preset threshold, regard it as a candidate node for redundant connection, analyze the connection status of the candidate node to determine and remove redundant connections.

7. The mapping method for converting a relational database into a graph database according to claim 1, characterized in that: The weight calculation model is expressed by the following formula: in, represents the similarity between entity node 𝑖 and entity node 𝑗; α, β, and γ are three adjustment parameters used to balance the contribution of attribute similarity, clustering results, and subgraph connection strength to edge weight; δ ( Ci , Cj ) is an indicator function, indicating whether entity node 𝑖 and entity node 𝑗 belong to the same cluster; σ ( Ekl ) represents the connection strength between subgraph k and subgraph l, expressed as the number of shared edges between the two communities.

8. The mapping method for converting a relational database into a graph database according to claim 1, characterized in that: The method further comprises: Optimize the structure of the converted graph database, including but not limited to merging duplicate nodes, optimizing the storage structure of edges, and compressing graph data; Provide a query interface for the graph database and build graph query logic to meet the needs of different application scenarios; wherein the graph query logic includes the shortest path query logic and subgraph matching logic.

9. A mapping device for converting a relational database into a graph database, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: Using the entity-edge-attribute data modeling method, the relational database is converted into an initial graph database; In the initial graph database, executing a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; Traversing the initial graph database to determine missing links or attribute values ​​in the initial graph database, and intelligently completing the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; Based on a preset fusion clustering algorithm, the supplementary graph database is processed to determine the community structure of the supplementary graph database; According to the community structure, redundant connections in the supplementary graph database are identified and removed, and edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain a converted graph database.

10. A non-volatile computer storage medium for converting a relational database into a graph database, storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Using the entity-edge-attribute data modeling method, the relational database is converted into an initial graph database; In the initial graph database, executing a preset frequent subgraph mining algorithm to obtain a corresponding frequent subgraph set; Traversing the initial graph database to determine missing links or attribute values ​​in the initial graph database, and intelligently completing the missing links or attribute values ​​based on the frequent subgraph set to obtain a supplementary graph database; Based on a preset fusion clustering algorithm, the supplementary graph database is processed to determine the community structure of the supplementary graph database; According to the community structure, redundant connections in the supplementary graph database are identified and removed, and edge weights in the supplementary graph database are recalculated through a preset weight calculation model to obtain a converted graph database.

Citation Information

Patent Citations

  • Relationship graph construction method and device, relation graph query method and device, electronic equipment and storage medium

    CN117764695A

  • Graph database and relational database mapping

    US20200201909A1