1、多个属性值的设置语句
match (m:公司{名称:["test3","test2"]}) return m
2、多个属性的查询以及merge的使用
OPTIONAL MATCH (n:公司) where "test3" in n.名称
WITH n
where n is null merge (m:公司{名称:["test3","test2"]})
return m
(1)判断属性是否存在:直接用 "属性值 in 节点.属性名"的形式
(2)merge和where不可以同时使用,所以,先通过match判断,再通过merge的方式创建
参考用法:
OPTIONAL MATCH (existing:TYPE) WHERE existing.propertyA = 'A' OR existing.propertyB = 'B' OR existing.propertyC = 'C' WITH existing WHERE existing IS NOT NULL SET existing.propertyA = 'A', existing.propertyB = 'B', existing.propertyC = 'C' RETURN existing; OPTIONAL MATCH (existing:TYPE) WHERE existing.propertyA = 'ZZ' OR existing.propertyB = 'ZZ' OR existing.propertyC = 'ZZ' WITH existing WHERE existing IS NULL MERGE (newNode:TYPE {propertyA: 'ZZ', propertyB: 'ZZ', propertyC: 'ZZ'}) RETURN newNode
3、模糊查询
match(emp) where emp.name =~'.*haha.*' return emp
4、其他用法
MATCH (n:Test) RETURN distinct keys(n)
5、节点邻居节点的查找
https://neo4j.com/labs/apoc/4.1/graph-querying/neighborhood/
https://www.cnblogs.com/sea520/p/11940400.html
参考: