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: