本文主要是介绍neo4j使用之超神之旅,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.查询整个链路中任意一段的关系类型是“department”的链路数据
MATCH path= (n)-[r1 *0..7 {`relation_type`:'once2once'}]-(m)
where id(n)=0 and any(x in relationships(path) where type(x)='department')
return path
效果图:
2.查询整个链路中最后一段的关系类型是“”的链路数据信息
MATCH path= (n)-[r1 *0..7 {`relation_type`:'once2once'}]-(m)
where id(n)=0 and type(last(relationships(path)))='competition'
return path
效果图:
3.查询与指定节点有关联的所有关系链数据(链路存在方向)
MATCH (p)<-[r0 *0..6 {`relation_type`:'once2once'}]- (n)<-[r1 *0..6 {`relation_type`:'once2once'}]-(m)-[r2 *0..1 {`relation_type`:'many2many'}]-(o) where id(n)=%s unwind (r0+r1+r2) as rel1 with distinct id(rel1) as id,type(rel1) as code, rel1.name as name return code,name,count(id) as num
效果图:
4.模糊匹配节点属性包含检索字符的数据(忽略大小写)
match (n) where n:mm_yg and(n.name=~'(?i).*柴.*' or n.code=~'(?i).*柴.*' or n.dh=~'(?i).*柴.*')
RETURN n order by n.name skip 0 limit 10
效果图
5.检索节点属性是列表时的列表项值包含指定字符的数据
match (n) where n.name=~'(?i).*高.*' and any(x in n.ls where x =~'(?i).*高.*') return n;
效果图
这篇关于neo4j使用之超神之旅的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!