Skip to content

Instantly share code, notes, and snippets.

@Yomguithereal
Last active August 29, 2015 14:26
Show Gist options
  • Save Yomguithereal/48c81d185a84f39f27a8 to your computer and use it in GitHub Desktop.
Save Yomguithereal/48c81d185a84f39f27a8 to your computer and use it in GitHub Desktop.
Hyphe-related cypher queries
// Getting the related nodes and avoiding irrelevant children belonging
// to other WEs.
MATCH (we:WE {name: "SCPO"})-[:PREFIX]->(:Node)-[rels:PARENT*0..]->(n:Node)
WHERE ALL(n IN extract(rel in rels | endNode(rel)) WHERE NOT (n)<-[:PREFIX]-())
RETURN n;
// Computing the WEs graph
MATCH (we:WE {name: "SCPO"})-[:PREFIX]->(:Node)-[rels:PARENT*0..]->(n:Node)
WHERE ALL(n IN extract(rel in rels | endNode(rel)) WHERE NOT (n)<-[:PREFIX]-())
MATCH (n)-[:LINK]-()<-[:PARENT*0..]-()<-[:PREFIX]-(twe:WE)
WHERE twe <> we
RETURN DISTINCT twe;
# Run into the neo4j folder
./bin/neo4j-import --into graph.db --nodes ~/whatever/nodes.csv --relationships ~/whatever/edges.csv
# Then stop the server, replace the db, check user rights
./bin/neo4j stop
rm -rf ./data/graph.db
mv graph.db ./data/
./bin/neo4j start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment