Skip to content

Instantly share code, notes, and snippets.

@quagly
Last active December 20, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save quagly/6104546 to your computer and use it in GitHub Desktop.
Save quagly/6104546 to your computer and use it in GitHub Desktop.
= graphGist generated from spock test Neo4jCypherOneRelationship.groovy
graphGist asciiDoc file for use at http://gist.neo4j.org/ [GitHub Gist]
Generated on Mon Jul 29 07:11:04 PDT 2013
//console
query to create plato with philosopher label
[source,cypher]
----
CREATE (n:Philosopher { name : 'Plato' , url : 'http://dbpedia.org/resource/Plato' })
----
//table
query to create Aristotle with philosopher label
[source,cypher]
----
CREATE (n:Philosopher { name : 'Aristotle' , url : 'http://dbpedia.org/resource/Aristotle' })
----
//table
query to get Aristotle and Plato and create influenced relationship
[source,cypher]
----
MATCH p:Philosopher, a:Philosopher
WHERE p.name = 'Plato' AND a.name = 'Aristotle'
CREATE p-[r:INFLUENCED]->a
RETURN r
----
//table
query to delete INFLUENCED relationship between Aristotle and Plato
[source,cypher]
----
MATCH p:Philosopher-[r:INFLUENCED]->a:Philosopher
WHERE p.name = 'Plato' AND a.name = 'Aristotle'
DELETE r
----
//table
query to delete all philosopher Nodes
[source,cypher]
----
MATCH p:Philosopher
DELETE p
----
//table
query to create Plato influenced Aristotle in one statement
[source,cypher]
----
CREATE path = (p:Philosopher {name:'Plato', url : 'http://dbpedia.org/resource/Plato' })
-[:INFLUENCES]->
( a:Philosopher { name : 'Aristotle' , url : 'http://dbpedia.org/resource/Aristotle' })
----
//table
@cleishm
Copy link

cleishm commented Nov 5, 2013

Hi @quagly! This GraphGist no longer works with the latest Neo4j 2.0 milestone build. I've updated it here: https://gist.github.com/cleishm/7313355. Could you update this copy also? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment