Neo4j – First Steps


Install and Run Neo4j Desktop

Create your First Project

Add a Graph

  • Click Add Graph
  • click Create a Local Graph
  • Name your Graph
  • Set a Password
  • Click Create

Start your Graph

  • Click Start

Launch the Neo4j Browser

  • Click Neo4j Browser

Create your first Nodes

  • always work in the URL box at the top of the window
  • Type MATCH (n) RETURN n in the URL box
  • press Enter to run the Cypher that you entered
  • note the response (no changes, no record) – our database is empty
  • close the window that appeared by clicking the X in the top right

Create a Person

CREATE(jonDoe:Person{firstName:’Jon’,lastName:’Doe’,age:31})

View the Person

MATCH (n) RETURN n

Create a Family for Jon Doe

enter all the following code as a single block – use CTRL-ENTER in the URL box for new lines

MATCH(jonDoe:Person)
CREATE(janeDoe:Person{firstName:'Jane',lastName:'Doe',age:32})
CREATE(jackDoe:Person{firstName:'Jack',lastName:'Doe',age:3})
CREATE(jillDoe:Person{firstName:'Jill',lastName:'Doe',age:1})

CREATE(jonDoe)-[:MARRIEDTO]->(janeDoe)
CREATE(jackDoe)-[:HASCHILD]->(jonDoe)
CREATE(jackDoe)-[:HASCHILD]->(janeDoe)
CREATE(jillDoe)-[:HASCHILD]->(jonDoe)
CREATE(jillDoe)-[:HASCHILD]->(janeDoe)

MATCH (n) RETURN n

Display a Caption in the Nodes

  • click one of the Nodes
    click the arrow in the bottom right of the window
    click firstName
Advertisement

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s