Query Template

Create Nodes


Label

Property

Value

Relationship

Label

Property

Value

CREATE (a:`Person` { `name`: 'Keanu Reeves' }) RETURN a
CREATE (b:`Movie` { `title`: 'The Matrix' }) RETURN b

Create Relationship


Label

Property

Value

Relationship

Label

Property

Value

MATCH (a:`Person` { `name`: 'Keanu Reeves' })
MATCH (b:`Movie` { `title`: 'The Matrix' })
CREATE (a)-[:`ACTED_IN`]->(b)
RETURN *

Merge Nodes


Label

Property

Value

Relationship

Label

Property

Value

MERGE (a:`Person` { `name`: 'Keanu Reeves' }) RETURN a
MERGE (b:`Movie` { `title`: 'The Matrix' }) RETURN b

Merge Relationship


Label

Property

Value

Relationship

Label

Property

Value

MERGE (a:`Person` { `name`: 'Keanu Reeves' })
MERGE (b:`Movie` { `title`: 'The Matrix' })
MERGE (a)-[:`ACTED_IN`]->(b)
RETURN *

Find Nodes


Label

Property

Value

Relationship

Label

Property

Value

MATCH (a:`Person` { `name`: 'Keanu Reeves' }) RETURN a
MATCH (b:`Movie` { `title`: 'The Matrix' }) RETURN b

Find All Nodes


Label

Property

Value

Relationship

Label

Property

Value

MATCH (a:`Person`) RETURN a LIMIT 100
MATCH (b:`Movie`) RETURN b LIMIT 100

Find Neighbours


Label

Property

Value

Relationship

Label

Property

Value

MATCH (a:`Person` { `name`: 'Keanu Reeves' })-[:`ACTED_IN`]->(b) RETURN * LIMIT 100
MATCH (b:`Movie` { `title`: 'The Matrix' })<--(a) RETURN * LIMIT 100

Find Network


Label

Property

Value

Relationship

Label

Property

Value

MATCH path = (:`Person` { `name`: 'Keanu Reeves' })-[:`ACTED_IN`*1..3]-() RETURN path LIMIT 50
MATCH path = (:`Movie` { `title`: 'The Matrix' })-[*1..3]-() RETURN path LIMIT 50;

Find Network


Label

Property

Value

Relationship

Label

Property

Value

MATCH path = shortestPath((a:`Person` { `name`: 'Keanu Reeves' })-[*]-(b:`Movie` { `title`: 'The Matrix' })) RETURN path LIMIT 50;

Create Unique Constraints


Label

Property

Value

Relationship

Label

Property

Value

CREATE CONSTRAINT ON (a:`Person`) ASSERT a.`name` IS UNIQUE;
CREATE CONSTRAINT ON (b:`Movie`) ASSERT b.`title` IS UNIQUE;

Create Indexes


Label

Property

Value

Relationship

Label

Property

Value

CREATE INDEX ON :`Person`(`name`);
CREATE INDEX ON :`Movie`(`title`);

Create Existence Constraints


Label

Property

Value

Relationship

Label

Property

Value

CREATE CONSTRAINT ON (a:`Person`) ASSERT exists(a.`name`);
CREATE CONSTRAINT ON (b:`Movie`) ASSERT exists(b.`title`);