Windows环境下部署neo4j

部署

1. 下载windows环境下的安装包neo4j-community-3.2.0-windows-chs-1.0.0.zip

网址:http://www.we-yun.com/index.php/blog/releases-56.html

2. 解压,比如目录为E:\neo4j

3.设置环境变量

变量名:NEO4J_HOME

变量值:E:\neo4j

再修改变量path,增加%NEO4J_HOME%\bin

4.查看并编辑配置参数

%NEO4J_HOME%\conf\neo4j.conf

5.启动

DOS命令行窗口,切换到主目录%NEO4J_HOME%\bin,执行:

neo4j.bat console

6. 打开neo4j集成的浏览器

http://localhost:7474/

首先输入命令: server connect

之后编写Cypher命令,创建两个节点和两个关系:

CREATE (n:Person { name: 'Andres', title: 'Developer' }) return n;
CREATE (n:Person { name: 'Vic', title: 'Developer' }) return n;
match(n:Person{name:"Vic"}),(m:Person{name:"Andres"}) create (n)-[r:Friend]->(m) return r;
match(n:Person{name:"Vic"}),(m:Person{name:"Andres"}) create (n)<-[r:Friend]-(m) return r;

7. python编程

pip install neo4j-driver

8.在eclipse里编写程序并执行:

# !/usr/bin/python
# -*- coding: utf-8 -*-
from neo4j.v1 import GraphDatabase
uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "520"))
def cyphertx(cypher):
    with driver.session() as session:
        with session.begin_transaction() as tx:
            tx.run(cypher)

cypher = """
            create (Neo:Crew {name:'Neo'}),
                   (Morpheus:Crew {name: 'Morpheus'}),
                   (Trinity:Crew {name: 'Trinity'}),
                   (Cypher:Crew:Matrix {name: 'Cypher'}),
                   (Smith:Matrix {name: 'Agent Smith'}),
                   (Architect:Matrix {name:'The Architect'}),

                   (Neo)-[:KNOWS]->(Morpheus),
                   (Neo)-[:LOVES]->(Trinity),
                   (Morpheus)-[:KNOWS]->(Trinity),
                   (Morpheus)-[:KNOWS]->(Cypher),
                   (Cypher)-[:KNOWS]->(Smith),
                   (Smith)-[:CODED_BY]->(Architect)
         """    
cyphertx(cypher)


9. 登录browser,执行查询:

match(n) return n limit 25

来自:

http://www.cnblogs.com/ljhdo/archive/2017/05/19/5521577.html

http://blog.csdn.net/sweeper_freedoman/article/details/70189153?locationNum=3&fps=1


你可能感兴趣的:(Windows环境下部署neo4j)