Skip to content

Instantly share code, notes, and snippets.

@jexp
Forked from systay/gist:7718178
Last active December 29, 2015 19:49
Show Gist options
  • Select an option

  • Save jexp/7719858 to your computer and use it in GitHub Desktop.

Select an option

Save jexp/7719858 to your computer and use it in GitHub Desktop.
= Merge Examples =
:neo4j-version: 2.0.0-RC1
:author: Andrés Taylor
:twitter: @andres_taylor
:tags: domain:example
//setup
[source,cypher]
----
CREATE (a:Label {name:'A'}), (b:Label {name:'B'}), (c:Label {name:'C'})
RETURN a,b,c
----
This is the start data:
// graph
//table
Now we run this query
//output
[source,cypher]
----
MERGE (a:Label {name:'A'})
MERGE (a)-[:KNOWS]->(b:Label {name:'B'})
RETURN a,b
----
The graph now looks like:
//table
//graph
[source,cypher]
----
MATCH (n)
RETURN n
----
//table
//graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment