Installation

  1. Download From official website
  2. Extract in /opt/ path
  3. start server
./opt/neo4j/bin/neo4j
  1. Execute CLI
./opt/neo4j/bin/neo4j-shell

The Property Graph Model

The property graph contains connected entities (the nodes) which can hold any number of attributes (key-value-pairs). Nodes can be tagged with labels representing their different roles in your domain. In addition to contextualizing node and relationship properties, labels may also serve to attach metadata—​index or constraint information—​to certain nodes.

Relationships provide directed, named semantically relevant connections between two node-entities. A relationship always has a direction, a type, a start node, and an end node. Like nodes, relationships can have any properties. In most cases, relationships have quantitative properties, such as weights, costs, distances, ratings, time intervals, or strengths. As relationships are stored efficiently, two nodes can share any number or type of relationships without sacrificing performance. Note that although they are directed, relationships can always be navigated regardless of direction.

Create Node

CREATE (john:Person:Author { name : 'John LE Cane' })
CREATE (lane:Person { name : 'Lane LE Cane' })
CREATE (tinker:Book { title : 'Tinker Tailor, Soldier, Spy' })

Create Relationship

CREATE (john)-[:WROTE]->(tinker)
CREATE (lane)-[:PURCHASED {date: “03-02-2011”}]->(tinker)

Query Data

MATCH (person:Person { name:'John LE Cane' })
RETURN person

Query All Data

MATCH (n)
RETURN n

Data Storage

After restart noe4j server, all saved data are still accessible

Reserved TCP Ports

Default Port Description
7474 Management Web Server
1337 remote shell

References

Neo4j Manual
Neo4j Graph Database

Share:
Reading time: 1 min
Name Aerospike Redis MongoDB Neo4j
Description Flash-optimized In-memory NoSQL Database In-memory data structure store, used as database, cache and message broker One of the most popular document stores Open source graph database
Database model Key-value store Key-value store Document store Graph DBMS
License Open Source – Apache and AGPL Licenses; open sourced in June 2014; commercial Enterprise Edition available Open Source – BSD 3-Clause, commercial license available Open Source – AGPL version3, Commercial Licence available Open Source – AGPL version3, Commercial Licence available
Implementation language C C C++ Java
Server operating systems Linux BSD, Linux, OS X, Windows Linux, OS X, Solaris, Windows Linux, OS X, Windows
Data scheme schema-free schema-free schema-free, Although schema-free, documents of the same collection often follow the same structure schema-free
Typing yes partial => Supported data types are strings, hashes, lists, sets and sorted sets, bit arrays, hyperloglogs and geospatial indexes yes => string, integer, double, boolean, date, object_id yes
Secondary indexes yes no yes yes => pluggable indexing subsystem, by default Apache Lucene
SQL no no no no
APIs and other access methods proprietary protocol proprietary protocol using JSON Cypher query language, Java API, RESTful HTTP API
Supported programming languages C, C#, Erlang, Go, Java, JavaScript (Node.js), Lua, Perl, PHP, Python, Ruby C,C#,C++,Clojure,Crystal,D,Dart,Elixir,Erlang,Fancy,Go,Haskell,Haxe,Java,JavaScript (Node.js),Lisp,Lua,MatLab,Objective-C,OCaml,Perl,PHP,Prolog,Pure Data,Python,R,Rebol,Ruby,Rust,Scala,Scheme,Smalltalk,Tcl Actionscript, C, C#, C++, Clojure, ColdFusion, D, Dart, Delphi, Erlang, Go, Groovy, Haskell, Java, JavaScript, Lisp, Lua, MatLab, Perl, PHP, PowerShell, Prolog, Python, R, Ruby, Scala ,Smalltalk .Net, Clojure, Go, Groovy, Java, JavaScript, Perl, PHP, Python, Ruby, Scala
Server-side scripts user defined functions Lua JavaScript yes
Triggers no no no yes
Partitioning methods Sharding Sharding Sharding none
Replication methods selectable replication factor Master-slave replication Master-slave replication Master-slave replication
Consistency concepts Eventual Consistency in cross-datacenter configuration and Immediate Consistency in local cluster configuration Eventual Consistency Eventual Consistency, Immediate Consistency Eventual Consistency configurable in High Availability Cluster setup, Immediate Consistency
In-memory capabilities yes yes yes no
Durability (data storage) yes yes => Configurable mechanisms for persistence via snapshots and/or operations logs yes => optional yes
Horizontal salable yes yes Yes, with sharding No (Community), Yes (Enterprise)
Data storage RAM,SSD Volatile memory, File System Volatile memory, File System local (community), Data,Persisted to Disk,Volatile memory,Memory-Mapped File (Enterprise)
Memory minimum 2 GB 3 GB depends on several factors 2 GB (Enterprise)
Value size max. 1 MB 512 MB 16 MB 34 B(comunity), 1 TB (Enterprise)
Share:
Reading time: 2 min