java多线程    Java入门    vsftp    ftp    linux配置    centos    FRP教程    HBase    Html5缓存    webp    zabbix    分布式    neo4j图数据库    

09. NEO4j CQL REMOVE

NEO4j CQL REMOVE使用简介

REMOVE用来移除属性和标签

DELETE用来删除节点和关系

image-20221020110318961

CREATE (:Person:Actor:Director {name: '周星驰', born: 1962})
CREATE (:Person:Actor {name: '吴孟达', born: 1952})
MATCH (p1:Person{name:'周星驰'}), (p2:Person{name:'吴孟达'}) 
CREATE (p1)-[:KNOWS{since:[1980]}]->(p2)

1. NEO4j CQL REMOVE 移除一个属性

MATCH (a {name: '周星驰'}) 
REMOVE a.born 
RETURN a.name, a.born

│"a.name"│"a.born"│
╞════════╪════════╡
│"周星驰"   │null    │

2. NEO4j CQL REMOVE 移除一个标签

MATCH (n {name: '吴孟达'}) REMOVE n:Actor RETURN n.name, labels(n)
│"n.name"│"labels(n)"│
╞════════╪═══════════╡
│"吴孟达"   │["Person"] │

3. NEO4j CQL REMOVE 移除多个标签

MATCH (n {name: '周星驰'}) REMOVE n:Actor:Director RETURN n.name, labels(n)
"n.name"│"labels(n)"│
╞════════╪═══════════╡
│"周星驰"   │["Person"] │

4. NEO4j CQL REMOVE 移除关系上的属性

MATCH (n:Person) RETURN n LIMIT 25

image-20221020112002943

鼠标点击到KNOWS这个关系上,看到有个属性since [1980]

MATCH (n {name:'周星驰'})-[r:KNOWS]->() 
REMOVE r.since
RETURN r

返回

{
  "identity": 0,
  "start": 2,
  "end": 3,
  "type": "KNOWS",
  "properties": {
  }
}


This entry was posted in 数据库, 高并发与大数据 and tagged . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/neo4j-cql-remove/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.

Leave a Reply