需求:
边e包含多种类型,当前需要过滤A0100或者A0110的属性hold_wght_ratio >某个值,该如何实现?
我想到使用:match p = (v) -[e:A0100|A0110|B01001…6]- (v1) where id(v)==“100” and v1.ins_num ==“x04” and all(rel in relationships(p) where rel.hold_wght_ratio >2.0) return e 结果返回的值为空
你好,我看你B0100的schema中有position,这是其他两种边没有的属性,这种情况你可以用 match p = (v) -[e:A0100|A0110|B01001…6]- (v1) where id(v)==“100” AND v1.ins_num ==“x04” AND (e.hold_wght_ratio >2.0 OR e.position!="") return e
我在本地模拟了这个情况没有问题,那你试一下 match p = (v) -[e:A0100|A0110|B01001…6]- (v1) where id(v)==“100” AND v1.ins_num ==“x04” AND e.hold_wght_ratio >2.0 return e
这样预期的结果是只返回A0100类型的边,B0100会被过滤掉
看了下数据,这样找不到是因为走不到你指定的终点。
先尝试个简单点的query吧,从x01出发不限制终点 match (v) -[e:A0100|A0110|B0100]- (v1) where id(v)==“100” AND (e.hold_wght_ratio >2.0 OR e.position!="") return e
我之前本地测试的都是单步情况,多步的话语法要改一下 match p = (v) -[e:A0100|A0110|B01001…6]- (v1) where id(v)==“100” AND v1.ins_num ==“x04” AND ALL(e in e WHERE e.hold_wght_ratio >2.0 OR e.position!="") return e
作为参考,这是我在本地的query: match (v)-[e*1..2]-(v2) where id(v)=="Tim Duncan" and all(e in e where e.likeness < 80 or e.start_year > 0) return e