Home Database Mysql Tutorial Neo4j数据库简介

Neo4j数据库简介

Jun 07, 2016 pm 04:09 PM
neo4j world database Introduction

作为世界先进的图数据库,Neo4j成为了时下许多互联网公司的首

作为世界先进的图数据库,Neo4j成为了时下许多互联网公司的首选。Neo4j是基于java开发的开源图数据库,也是一种NoSQL数据库。Neo4j在保证对数据关系的良好刻画的同时,还支持传统关系型数据的ACID特性,并且在存储效率,集群支持以及失效备援等等方面都有着不错的表现。近来因为实验室的项目的关系,对Neo4j有了一定的了解。同时,我也对其设计思想和架构都产生了很大的兴趣,所以写下这篇博客,帮助大家更好地了解这一数据库,也分享一下以及的认识。

设计理念

Neo4j的设计动机是为了更好地同时也更高效地描述实体之间的关系。在现实生活中,每一个实体都于周围的其他实体有着千丝万缕的关系,这些关系里面所存储的信息甚至要大于身体本身的属性。然后传统的关系型数据库更注重刻画实体内部的属性,实体与实体之间的关系通常都是利用外键来实现。所以在求解关系的时候通常需要join操作,而join操作通常又是耗时的。互联网尤其是移动互联网的爆发式增长本来就使得传统关系型数据库不堪重负,再加上诸如社交网络等应用对于关系的高需求,可以说关系型数据库已经是毫无优势。而图数据库作为重点描述数据之间关系的数据库应运而生,成为了NoSQL中非常重要的一部分。而Neo4j正是图数据库中最为优秀的之一

Neo4j数据库只有两种类型的数据:

  • 节点Node:节点类似于E-R图种的实体(entity),每个实体可以有0到多个属性,这些属性以key-value对的形式存在,并且对属性没有类别要求,也无需提前定义。另外,还允许给每个节点打上标签,以区别不同类型的节点。
  • 关系Relationship: 关系类似于E-R图种的关系(relationship),一个关系有一个起始节点和一个终止节点构成。另外和node一样,关系也可以有多个属性已经标签

    其具体的结构如下图:Neo4j的数据结构而一个实际的图数据库例子就如下图所示的这样:\

    正是基于这样的设计理念,Neo4j有了以下这些特性:喎?http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHVsPgo8bGk+udjPtdTatLS9qLXEyrG68r7N0tG+rcq1z9bBy6Os0vK2+NTasunRr7nYz7W1xMqxuvL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rN6rPJbm9kZTG1xMv509C52M+1o6y007bTwdDW0M3Ls/Zub2RlMzxsaT7Tw9Payc/OxM/gzay1xLe9t6i3w87Kbm9kZTM8bGk+1+66873hufvI58/Co7oKPGJsb2NrcXVvdGU+Cgo8cHJlIGNsYXNzPQ=="brush:sql;">(1)–[KNOWS,2]–>(4) (1)–[KNOWS,1]–>(3) (1)–[KNOWS,0]–>(2) (1)–[KNOWS,1]–>(3)–[KNOWS,5]–>(7) (1)–[KNOWS,1]–>(3)–[KNOWS,4]–>(6) (1)–[KNOWS,1]–>(3)–[KNOWS,3]–>(5) <h1> Neo4j与关系型数据库的区别</h1> <p>其实通过上述的讲解,相信大家都对neo4j与RDBMS(Relational Database Management System)的区别有了一定的认识,现在再用下面的表格来重新整理一下:</p> <table> <tbody> <tr> <td>Neo4j</td> <td>RDBMS</td> </tr> <tr> <td>允许对数据的简单且多样的管理</td> <td>高度结构化的数据</td> </tr> <tr> <td>数据添加和定义灵活,不受数据类型和数量的限制,无需提前定义</td> <td>表格schema需预定义,修改和添加数据结构和类型复杂,对数据有严格的限制</td> </tr> <tr> <td>常数时间的关系查询操作</td> <td>关系查询操作耗时</td> </tr> <tr> <td>提出全新的查询语言cypher,查询语句更加简单</td> <td>查询语句更为复杂,尤其涉及到join或union操作时</td> </tr> </tbody> </table> <p>最后再以下面两张图来展示一下两者在查询关系时的区别:<img src="/static/imghw/default1.png" data-src="http://www.68idc.cn/help/uploads/allimg/150420/0I52634N-2.png" class="lazy" alt="\">RDBMS<img src="/static/imghw/default1.png" data-src="http://www.68idc.cn/help/uploads/allimg/150420/0I5262926-3.png" class="lazy" alt="\">Neo4j</p> <p>关于Neo4j具体的安装和使用,不是文章的重点,如果想要真正上手用Neo4j,可以到Neo4j官网上面有很多资料</p> <br> <ul class="tag_box inline list-inline"> <li> </li> </ul>

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Return to Omaha Beach! World of Tanks launches Normandy commemoration event Return to Omaha Beach! World of Tanks launches Normandy commemoration event May 31, 2024 pm 10:25 PM

As the D-Day invasion approaches its 80th anniversary, a whole month of World of Tanks events and specials will be centered around Operation Overlord - a new PvE mode, a themed battle pass, the release of a new Frontline mode, and a month-long The Operation Normandy token store is about to open. OPERATION MAP From June 3 to June 30, explore the beaches of Normandy and collect up to 90 Operation Normandy Tokens: 36 from this map and another 54 by completing daily tasks. Check out the interactive map and see the start dates for each event, then start earning tokens now, or unlock special token missions. Use the map to learn more about Operation Normandy related activities. Once you have obtained enough Operation Normandy tokens, you can go to the Operation Normandy token dealer

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Be the first to open the mission treasure house. The new version of 'World of Warships' is now open. Be the first to open the mission treasure house. The new version of 'World of Warships' is now open. Apr 17, 2024 pm 06:04 PM

Be the first to open the mission treasure house and plan the battle one step ahead. The 13.3 version of "World of Warships" is now open. Knowing all the important information about the new version of combat missions and combat types will help captains plan the overall battle and quickly obtain relevant rewards. In version 13.3, the asymmetric combat mode that captains have been waiting for returns. Captains need to control the warships against AI warships that are lower in level but more numerous. This mode is very suitable for team play. Up to 5 players can form a team to fight side by side. More tacit cooperation can help you defeat the opponent quickly. During patch 13.3, all captains will have the opportunity to collect the Somme Collection and obtain this Tier IX destroyer. The requirement for this task is also very simple, that is, win the game before the next version is released.

See all articles