1、概念辨析
Neo4j 中节点名称和节点标签到底是什么关系?
https://www.zhihu.com/question/271886497
2、常用命令
创建节点
CREATE (n:Person{name:‘shannan’}) return n;
要获取所有不同的节点标签:
MATCH (n) RETURN distinct labels(n)
要获取每个标签的节点数:
MATCH (n) RETURN distinct labels(n), count(*)
获取标签名为SubDefect,属性为Defect_name:'串动'的节点
MATCH (n:SubDefect{Defect_name:'串动'}) RETURN n LIMIT 25
但是通过id匹配数据,不能像其它普通属性一样直接match
MATCH (n) WHERE id(n)=680 RETURN n
修改标签名
MATCH (n:OLD_LABEL)
REMOVE n:OLD_LABEL
SET n:NEW_LABEL
对已有节点增加标签名
match (n:OLD_LABEL)
SET n:NEW_LABEL
按标签进行查询
match (n) where n: SubDefect and n: Defect return n
按标签查询后,移除标签名
match (n) where n: Employee and n: EmployeeNew2 REMOVE n:EmployeeNew2
设置节点属性
match (n:FacilityType) set n.schemaorgUrl='http://schema.org/Bridge'
RETURN n
移除属性
match(n:FacilityType)
remove n.Bridge_name
修改属性名,不修改属性值
match (n:Person) set n.Newname=n.Oldname remove n.Oldname
修改关系类型名
MATCH (n:BridgeType)-[r:has_bridge_entity]->(m:BridgeEntity) create(n)-[r2:HasBridgeIndividual]->(m) set r2=r with r delete r
删除关系
MATCH (m:member)-[r]->() delete r
MATCH ()-[r:subclass_of]->() delete r
删除节点
MATCH (m:member) delete m
查询所有标签节点的所有属性
unwind ['ComprehensivePrice','TreatmentMeasure'] as lab
match (n) where any(label in labels(n) WHERE label=lab) with lab,keys(n) as kk
unwind kk as k
return lab,collect(distinct k)
https://blog.csdn.net/qq_38737992/article/details/89035608
Windows10 下 Neo4j 安装 APOC
3、py2neo执行原始CQL
https://zhuanlan.zhihu.com/p/81175725