# Initial map database

2022-01-27 04:15:13

# First knowledge of map database

## 1 Preface

My friends have heard of " Graph database - Graph Database" Do you ？ Is a database used to store pictures ？ Or use pictures to store data ？？（ By mistake ） If you are fooled by these two sentences , Then hurry into today's article ~

## 2 Nodes and relationships

Unlike traditional relational databases , The graph database consists of nodes and relationships （ The relationship between nodes ） form . Here's the picture ：

### 2.1 node

A node represents an entity . A node is similar to a record in a relational database . The circular patterns in the above figure are nodes . The orange node represents the movie entity , Blue nodes represent specific people .

### 2.2 Relationship

The connection between two nodes is the relationship . As shown in the above figure, there are three 【 people - The movie 】 The relationship between ：

• ACTED_IN - Keanu · Reeves 、 Laurence · Fishburn 、 kelly · Amos and Hugo · Viven and others participated in
• DIRECTED - The wodrowski sisters guide
• PRODUCED - Joe · Supervised by Seaver

### 2.3 The direction of the relationship

stay Neo4J in , Relationships must have a direction . For a node , Relationships can have two directions . Point to its relationship , And the relationship it points to other nodes . Above picture , All relationships are directed by people to movies .

### 2.4 label

A tag is the kind of node or relationship （Type). As shown in the picture above , When defining blue nodes , their Label yes Person; When defining orange nodes , their Label yes Movie. The function of the label is , When you query, only certain types of nodes are returned . For example, just query Person node .

### 2.5 attribute

Both nodes and relationships can add attributes . Attribute is based on name-value Added to the form of . such as , Return to all... In the above figure Person Of name and born attribute . Attribute makes the information in the graph database richer , You can also use these properties when querying , If the query is in 1970 People born after .

## 3 Why Graph database

Let's see the general introduction to the graph database , Maybe I think this technology is cool , That's in the specific business , What value can graph database bring that relational database can't bring ？ The following two aspects can be used as a reference .

• Efficiently query the relationship between data , Especially when the relationship is complex
• At the same time, it can also easily visualize the relationship between data

When you see the following query results , Isn't it very pleasing to the eye ？ The relationship between film and people can be seen at a glance . Of course , This is only the result of a small number of data queries .

When there is more data , The result of visualization is ...

Of course, no one will get valuable information from such visualization results , How should the graph database be applied in business ？ Please look forward to the actual combat series of figure database in the future , It will definitely give you a more specific understanding of this new and trendy technology ！ I hope this sharing will help you , Welcome to comment and discuss ！