赞
踩
查看所有图数据
match (n) return n
删除所有图数据
match(n) detach delete n
当时我看书以及找教程,大部分教程和书里的步骤一样,如下图(引用某教程),它是分开创建节点和关系的。
先创建节点
- CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
- CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
- CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967})
- CREATE (Laurence:Person {name:'Laurence Fishburne', born:1961})
- CREATE (Hugo:Person {name:'Hugo Weaving', born:1960})
- CREATE (LillyW:Person {name:'Lilly Wachowski', born:1967})
- CREATE (LanaW:Person {name:'Lana Wachowski', born:1965})
- CREATE (JoelS:Person {name:'Joel Silver', born:1952})
查看所有图数据的结果:
再创建关系
- CREATE
- (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix),
- (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix),
- (Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrix),
- (Hugo)-[:ACTED_IN {roles:['Agent Smith']}]->(TheMatrix),
- (LillyW)-[:DIRECTED]->(TheMatrix),
- (LanaW)-[:DIRECTED]->(TheMatrix),
- (JoelS)-[:PRODUCED]->(TheMatrix)
再查看所有图数据的结果,发现什么??发现新世界,为什么出现了新的空白关系????
电影实战案例的部分语句
- CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
- CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
- CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967})
- CREATE (Laurence:Person {name:'Laurence Fishburne', born:1961})
- CREATE (Hugo:Person {name:'Hugo Weaving', born:1960})
- CREATE (LillyW:Person {name:'Lilly Wachowski', born:1967})
- CREATE (LanaW:Person {name:'Lana Wachowski', born:1965})
- CREATE (JoelS:Person {name:'Joel Silver', born:1952})
- CREATE
- (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix),
- (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix),
- (Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrix),
- (Hugo)-[:ACTED_IN {roles:['Agent Smith']}]->(TheMatrix),
- (LillyW)-[:DIRECTED]->(TheMatrix),
- (LanaW)-[:DIRECTED]->(TheMatrix),
- (JoelS)-[:PRODUCED]->(TheMatrix)
其实同时创建节点和关系,就会得到想要的图数据了
小白,勿喷!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。