Introduction to neo4j
Neo4j is a high-performance, nosql graphic database that stores structured data on the network rather than on tables. Neo4j can also be seen as a high-performance graph engine with all the features of mature databases. Programmers work in an object-oriented, flexible network structure instead of a strict, static table-but they can enjoy all the benefits of having full transaction characteristics and enterprise-level databases.
Due to its embedded, high-performance, lightweight, and other advantages, neo4j has received more and more attention.
Graph Data Structure
A graph contains two basic data types: nodes and relationships ). Nodes and relationships contain attributes in the key/value format. Nodes are connected through the relationship defined by relationships to form a relational network structure.
Install neo4j
Neo4j can be installed into an independently running server program, which is accessed through the rest API. It can also be installed in an embedded system, that is, a third-party class library installed in the programming language. Currently, only Java and Python languages are supported.
Because neo4j is developed in Java, ensure that JRE or JDK is installed on the machine to be installed.
Install as a service
This installation method is simple, and the installation process for each platform is basically the same
- Download the latest platform from http://neo4j.org/downloadand select the appropriate platform.
- Decompress the installation package, decompress the package, and run the terminal. Enter the bin folder in the decompressed folder.
- Run commands on the terminal to complete installation
Linux/MACOs Systemneo4j install
WindowsNeo4j.bat install
- Run commands on the terminal to enable the Service
Linux/MACOs Systemservice neo4j-service start
WindowsNeo4j.bat start
Passstop
Command to close the service,status
Command to view the running status
Support for python embedded Installation
Step 1: Install jpype
Download the latest version from the http://sourceforge.net/projects/jpype/files/JPype/, Windows EXE format direct installation program, Linux platform to download the source package, unzip and runsudo python setup.py install
Complete installation
Step 2: Install neo4j-embedded
If Python package management tool Pip or easy_install is installed, run
Pip install neo4j-embedded easy_install neo4j-embedded
You can also download the corresponding installation package from http://pypi.python.org/pypi/neo4j-embedded/to complete the installation.
Neo4j instance
There is a relational network formed by the following user relationship:
Now, we use the graphic database to store data, get fans of user1, and recommend friends for user4.
Sample Code:
?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |