其他分享
首页 > 其他分享> > neo4j基本操作

neo4j基本操作

作者:互联网

neo4j 安装

docker-compose安装,并且跳过认证

version: "3.2"
services:
  neo4j:
    image: neo4j:4.4
    volumes:
      - ./data:/data
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
      - NEO4J_AUTH=none

界面操作

启动成功,输入http://localhost:7474/browser/进入界面操作台

neo4j操作

create (node:person) 

create (node:person{name:"Tom",address:"China"}) 

再新增一个节点
create (node:person{name:"Jim",address:"USA"})
//创建关系 Jim与Tom的无属性关系
match (node_jim:person{name:"Jim"}),(node_tom:person{name:"Tom"}) create (node_jim) -[link:link]-> (node_tom)

match (node_jim:person{name:"Jim"}),(node_tom:person{name:"Tom"}) create (node_jim) -[link:link{relation:"邻居"}]-> (node_tom)

match(e) where e.name = 'Jim' return e

根据id删除节点
match(e) where id(e) = 10 delete e
根据属性删除节点
match(e) where e.name = xxx delete e

match(e)- [r]-(n)  delete e,r,n
match(e) where e.name = "Jim" set e.age = 30
match(e) where e.name = "Jim" remove e.age 
match(e) where e.name = "Jim" set e.age = 30
match(e) where e.name = "Tom" set e.age = 50
match(e) return e order by e.age desc

标签:node,name,Jim,person,neo4j,基本操作,where,match
来源: https://www.cnblogs.com/tulip-night/p/16427851.html