A method and device for generating graph data based on relational database data

A data generation and graph data technology, applied in the database field, can solve the problems of large space consumption and space waste of adjacency matrix, and achieve the effect of reducing duplication, reducing space utilization, and convenient query.

Active Publication Date: 2020-10-02
四川蜀天梦图数据科技有限公司
View PDF9 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] The technical problem to be solved by the present invention is that common graph data storage data structures include adjacency matrix, adjacency linked list, etc., but the problem with these two methods is that the adjacency matrix consumes too much space, especially for sparse graphs, there is a huge Waste of space; the common adjacency linked list saves graph data may have one edge stored multiple times, and there is also a waste of space

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A method and device for generating graph data based on relational database data
  • A method and device for generating graph data based on relational database data
  • A method and device for generating graph data based on relational database data

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0051] Embodiment 1 of the present invention provides a method for generating graph data based on relational database data, such as figure 1 shown, including:

[0052] In step 201, a relational database is loaded into memory as original data.

[0053] Wherein, the traditional relational database includes: one or more of an open source relational database MySQL, an open source relational database Maria DB, a Microsoft SQL Server relational database, and an Oracle relational database.

[0054] In the embodiment of the present invention, in order to improve the determination of the target type of the graph data and the generation of the corresponding data structure in the subsequent steps, preferably, when loading the relational database, for the tables of each attribute, select a specified time period according to the database log Load the relational data that is generated within and covers each relational data table. In this way, it can not only ensure the screening of data r...

Embodiment 2

[0110] An embodiment of the present invention provides a method for converting student information, teacher teaching subject information, and student achievement information into graph data.

[0111] Step S1, obtaining student information, teacher teaching subject information, and student achievement information data in the relational database. The corresponding table data such as Figure 5-Figure 7 shown.

[0112] Step S2, determine the graph data type of the relational database information, in this example, determine the student information as the node type in the graph data, determine the teacher teaching information as the graph data node type, and determine the student achievement information as the graph data relationship type.

[0113] Step S3, constructing a graph data object type data structure.

[0114] The (Java) classes used by graph data nodes are defined as follows:

[0115] classNode

[0116] {

[0117] int id;

[0118] int nextRelationShipId;

[0119] int...

Embodiment 3

[0150] Such as Figure 10 As shown in FIG. 1 , it is a schematic diagram of the structure of the content recommendation device based on the human body state according to the embodiment of the present invention. The device for recommending content based on human body state in this embodiment includes one or more processors 21 and memory 22 . in, Figure 10A processor 21 is taken as an example.

[0151] Processor 21 and memory 22 can be connected by bus or other means, Figure 10 Take connection via bus as an example.

[0152] The memory 22, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs and non-volatile computer-executable programs, such as the method for generating graph data based on relational database data in Embodiment 1 . The processor 21 executes the method for generating graph data based on the relational database data by running the non-volatile software programs and instructions stored in the memory 22 .

...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention relates to the technical field of databases, and provides a method and device for generating graph data based on relational database data. The method comprises the steps: loading a relational database into a memory to serve as original data; determining a graph data target type of the original data; wherein the graph data comprises nodes, relationships, node attributes and relationship attributes; and constructing a data structure of a graph data target type, and filling the data structure of the graph data target type with the original data. According to the technology providedby the invention, the relationships are connected by using the linked list, namely, the nodes in the linked list belong to the relationship of the vertexes, and the links of the forward relationship and the backward relationship are stored in each relationship, so that the query of the relationships is more convenient. Besides, the attributes and the relationships in the method are all identifiedby the IDs, so that the same attributes can adopt an ID reference mode, repeated creation of the same value is reduced, and space utilization is reduced.

Description

【Technical field】 [0001] The invention relates to the technical field of databases, in particular to a method and device for generating graph data based on relational database data. 【Background technique】 [0002] A traditional relational database refers to a database that uses a relational model to organize data, which stores data in the form of rows and columns. At present, most of the data is stored in traditional relational databases. When facing traditional relational databases for storage, it is necessary to establish a clear table structure, which allows each table to store data with a single responsibility, but when it is necessary to query at the same time When some data is related, multiple tables need to be queried at the same time, and a joint query of multiple tables must be used, but the joint query consumes a lot of time and space. When the amount of data in the table or the number of sheets in the table is too large, the joint query cannot even be completed ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Patents(China)
IPC IPC(8): G06F16/28G06F16/901
CPCG06F16/284G06F16/9024
Inventor 金世钰周帆周港平
Owner 四川蜀天梦图数据科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products