You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 20:03:14