neo4j 入门教学_2

来源:互联网 发布:夜来听雨声,花落知多少 编辑:程序博客网 时间:2024/04/29 07:24

neo4j入门教程 
1.进入官网下载http://neo4j.com/developer/get-started/ 
这里写图片描述 
这里写图片描述 
这里写图片描述 
2.下完后点击安装就可以了 
3.开启软件 
这里写图片描述 
4.点击链接进入 
这里写图片描述 
5.进入后就可以看到如下界面 
这里写图片描述
6.在界面的顶部就是neo4j的查询语言的编辑窗口,在这里你可以编辑你的代码,当然用的是cypher语言,这里简单写个例子: 
这里写图片描述
7.代码如下 
CREATE (shakespeare:Author {firstname:’William’, lastname:’Shakespeare’}), 
(juliusCaesar:Play {title:’Julius Caesar’}), 
(shakespeare)-[:WROTE_PLAY {year:1599}]->(juliusCaesar), 
(theTempest:Play {title:’The Tempest’}), 
(shakespeare)-[:WROTE_PLAY {year:1610}]->(theTempest), 
(rsc:Company {name:’RSC’}), 
(production1:Production {name:’Julius Caesar’}), 
(rsc)-[:PRODUCED]->(production1), 
(production1)-[:PRODUCTION_OF]->(juliusCaesar), 
(performance1:Performance {date:20120729}), 
(performance1)-[:PERFORMANCE_OF]->(production1), 
(production2:Production {name:’The Tempest’}), 
(rsc)-[:PRODUCED]->(production2), 
(production2)-[:PRODUCTION_OF]->(theTempest), 
(performance2:Performance {date:20061121}), 
(performance2)-[:PERFORMANCE_OF]->(production2), 
(performance3:Performance {date:20120730}), 
(performance3)-[:PERFORMANCE_OF]->(production1), 
(billy:User {name:’Billy’}), 
(review:Review {rating:5, review:’This was awesome!’}), 
(billy)-[:WROTE_REVIEW]->(review), 
(review)-[:RATED]->(performance1), 
(theatreRoyal:Venue {name:’Theatre Royal’}), 
(performance1)-[:VENUE]->(theatreRoyal), 
(performance2)-[:VENUE]->(theatreRoyal), 
(performance3)-[:VENUE]->(theatreRoyal), 
(greyStreet:Street {name:’Grey Street’}), 
(theatreRoyal)-[:STREET]->(greyStreet), 
(newcastle:City {name:’Newcastle’}), 
(greyStreet)-[:CITY]->(newcastle), 
(tyneAndWear:County {name:’Tyne and Wear’}), 
(newcastle)-[:COUNTY]->(tyneAndWear), 
(england:Country {name:’England’}), 
(tyneAndWear)-[:COUNTRY]->(england), 
(stratford:City {name:’Stratford upon Avon’}), 
(stratford)-[:COUNTRY]->(england), 
(rsc)-[:BASED_IN]->(stratford), 
(shakespeare)-[:BORN_IN]->stratford

0 0