Neo4j 3.5版本apoc.create.vRelationship无法返回虚拟边属性咨询
解决Neo4j 3.5中APOC虚拟边属性无法直接获取的问题
针对你遇到的无法直接通过rel.conprop获取虚拟边属性的问题,这是Neo4j 3.5版本搭配旧版APOC的常见限制——虚拟关系的属性不能像真实关系那样直接通过.语法访问,你可以用以下两种方式解决:
方法1:提前定义属性变量并直接返回
在调用apoc.create.vRelationship前先把属性存为变量,后续直接引用该变量的属性:
match (first1:ent) where first1.nodeid in ['aab40c4d65d5c0a428ed84dc0109b0c4'] match (first2:ent) where first2.nodeid in ['000415fee2b0272cdcc2439f521b2e2e'] WITH first1, first2, {conprop:'11'} as relProps CALL apoc.create.vRelationship(first1,'teninvmerge',relProps,first2) YIELD rel RETURN rel, relProps.conprop
方法2:使用APOC属性提取函数
利用apoc.rel.properties()函数提取虚拟关系的属性:
match (first1:ent) where first1.nodeid in ['aab40c4d65d5c0a428ed84dc0109b0c4'] match (first2:ent) where first2.nodeid in ['000415fee2b0272cdcc2439f521b2e2e'] CALL apoc.create.vRelationship(first1,'teninvmerge',{conprop:'11'},first2) YIELD rel RETURN rel, apoc.rel.properties(rel).conprop
这两种方式都能直接获取到你设置的conprop属性值,无需修改原有的虚拟边创建逻辑。
内容的提问来源于stack exchange,提问作者ning wu
相关产品推荐
相关产品推荐

