neo4j入门教程 

1.进入官网下载http://neo4j.com/developer/get-started/ 

neo4j 入门教学_2_查询

 

neo4j 入门教学_2_sql_02

 

neo4j 入门教学_2_sql_03

 

2.下完后点击安装就可以了 

3.开启软件 

neo4j 入门教学_2_sql_04

 

4.点击链接进入 

neo4j 入门教学_2_图形数据库_05

 

5.进入后就可以看到如下界面 

neo4j 入门教学_2_neo4j_06


6.在界面的顶部就是neo4j的查询语言的编辑窗口,在这里你可以编辑你的代码,当然用的是cypher语言,这里简单写个例子: 

neo4j 入门教学_2_neo4j_07


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

neo4j入门教程 

1.进入官网下载http://neo4j.com/developer/get-started/ 

neo4j 入门教学_2_查询

 

neo4j 入门教学_2_sql_02

 

neo4j 入门教学_2_sql_03

 

2.下完后点击安装就可以了 

3.开启软件 

neo4j 入门教学_2_sql_04

 

4.点击链接进入 

neo4j 入门教学_2_图形数据库_05

 

5.进入后就可以看到如下界面 

neo4j 入门教学_2_neo4j_06


6.在界面的顶部就是neo4j的查询语言的编辑窗口,在这里你可以编辑你的代码,当然用的是cypher语言,这里简单写个例子: 

neo4j 入门教学_2_neo4j_07


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