Skip to content

Instantly share code, notes, and snippets.

@cleishm
Forked from quagly/SameSchoolInfluence
Last active December 27, 2015 10:48
Show Gist options
  • Save cleishm/7313389 to your computer and use it in GitHub Desktop.
Save cleishm/7313389 to your computer and use it in GitHub Desktop.
= graphGist generated from spock test Neo4jCypherSameSchoolInfluence.groovy
graphGist asciiDoc file for use at http://gist.neo4j.org/ [GitHub Gist]
Generated on Sun Jul 28 08:03:44 PDT 2013
//console
Initialize Graph
[source,cypher]
----
CREATE
( plato:Philosopher {name:'Plato', uri: 'http://dbpedia.org/resource/Plato' })
, ( aristotle:Philosopher { name: 'Aristotle' , uri: 'http://dbpedia.org/resource/Aristotle' })
, ( platonism_school:School { name: 'Platonism', uri: 'http://dbpedia.org/resource/Platonism' })
, ( peripatetic_school:School { name: 'Peripatetic school', uri: 'http://dbpedia.org/resource/Peripatetic_school' })
, ( ancient_greek_school:School { name: 'Ancient Greek philosophy', uri: 'http://dbpedia.org/resource/Ancient_Greek_philosophy' })
, (plato)-[:INFLUENCES]->(aristotle)
, (plato)-[:MEMBER_OF]->(platonism_school)
, (plato)-[:MEMBER_OF]->(ancient_greek_school)
, (aristotle)-[:MEMBER_OF]->(peripatetic_school)
, (aristotle)-[:MEMBER_OF]->(ancient_greek_school)
----
//table
query for movements that influenced with philosophers
[source,cypher]
----
MATCH (s2:School)<-[:MEMBER_OF]-(p2:Philosopher)<-[:INFLUENCES]-(p1:Philosopher)-[:MEMBER_OF]->(s1:School)
WHERE s2 = s1 // node equality
RETURN p1.name as p1Name, s1.name as s1Name, p2.name as p2Name, s2.name as s2Name
----
//table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment