Busy Developer's Guide to Neo4J

ted.neward@newardassociates.com | Blog: http://blogs.newardassociates.com | Github: tedneward | LinkedIn: tedneward

Objectives

What are we here to do?

Data models

The 'shape' of data

Data models

Definition

Data models

What is a data model?

Data models

Different "shapes" of data

Data models

Different "shapes" of data

Data models

Different "shapes" of data

Data models

Database vs Language "shapes"

Data Models: Graph-Oriented Data

What does that mean?

Data Models: Graph-Oriented Data

What is a graph-oriented data model?

Data Models: Graph-Oriented Data

Advantages

Data Models: Graph-Oriented Data

Disadvantages

Data Models: Graph-Oriented Data

Examples

Neo4J

Whoa... I know kung-fu --Neo ('The Matrix')

Neo4J

Graph-oriented

Neo4J

Neo4J: graph-oriented

Getting Started w/Neo4J

From 0 to HelloWorld

Getting Started w/Neo4J

Installing Neo4J

Getting Started w/Neo4J

Starting up

Getting Started w/Neo4J

Browser Editor (aka Editor)

Getting Started w/Neo4J

Initial databases

Cypher Basics

A graph-oriented query language

Cypher Basics

Syntax

Cypher Basics

Create a node

Cypher Basics

Create a node

Cypher Basics

Node labels

Cypher Basics

Create multiple nodes at once

CREATE (fred:Person { name: 'Fred' }),
(wilma:Person { name: 'Wilma' }),
(barney:Person { name: 'Barney' }),
(betty:Person { name: 'Betty' })
CREATE (ee:Person { name: 'Emil', from: 'Sweden' }), 
(js:Person { name: 'Johan', from: 'Sweden', learn: 'surfing' }),
(ir:Person { name: 'Ian', from: 'England', title: 'author' }),
(rvb:Person { name: 'Rik', from: 'Belgium', pet: 'Orval' }),
(ally:Person { name: 'Allison', from: 'California', hobby: 'surfing' }),
(ee)-[:KNOWS {since: 2001}]->(js),(ee)-[:KNOWS {rating: 5}]->(ir),
(js)-[:KNOWS]->(ir),(js)-[:KNOWS]->(rvb),
(ir)-[:KNOWS]->(js),(ir)-[:KNOWS]->(ally),
(rvb)-[:KNOWS]->(ally)

Cypher Basics

Find a node

Cypher Basics

Find a set of nodes

Cypher Basics

Create a relationship

Cypher Basics

Fred is married to Wilma (and vice versa)

MATCH (fred:Person), (wilma:Person) 
WHERE fred.name = 'Fred' AND wilma.name = 'Wilma'
CREATE (fred)-[:MARRIED {since:1959}]->(wilma),
(wilma)-[:MARRIED {since:1959}]->(fred)

Summary

What have you learned?

Summary

What have you learned?

Credentials

Who is this guy?