cassandra 从gremlinpython中的另一个现有边更新边属性

b4qexyjb  于 8个月前  发布在  Cassandra
关注(0)|答案(1)|浏览(63)

我试图通过提取另一个现有边的属性来更新我的dse图中的边,如下所示:

edgeProperties = g.E(edge.id).valueMap().next()
g.V(newVertex.id).as_('newV').addE(edge.label).to(neighbor_vertex).as_('newE')
    .sideEffect(select('newE').property(
        select('edgeProperties').key(),
        select('edgeProperties').value())).iterate()

但我得到下面的错误:
无效请求:来自服务器的错误:code=2200 [Invalid query] message=“提供的查询器未Map到值:e[{~label=has_policyholder,~out_vertex={~label=policy,policy_number=“7541013100”},~in_vertex={~label=person,source_id=“SID002250012009”,source_system=“SAPI”},~local_id=ce67baa0-481d-11ee-b4ed-6be00ce11d48}][{~label=policy,policy_number=“7541013100”}-has_policyholder->{~label=person,source_id=“SID002250012009”,source_system=“SAPI”}]->[SelectOneStep(last,edgeProperties),NoOpBarrierStep(2500),PropertyKeyStep]”
我做错了什么?如果有更好的方法,请建议
我尝试使用gremlinpython更新一个新的边,它具有dse图中现有边的属性,但没有工作。寻找一个解决方案

8gsdolmq

8gsdolmq1#

正如所写的那样,edgeProperties是一个变量,试图在select步骤中使用它是行不通的,因为它不是当前查询的一部分。你可以使用像injectconstant这样的步骤将变量注入到查询中,但我不认为这是你在这里需要的。相反,请尝试这样的东西:

g.E(edge.id).as('e').
  V(newVertex.id).
  addE(edge.label).as('newe').to(neighbor_vertex).
  sideEffect(select('e').properties().as('p').
             select('newe').property(select('p').key(),select('p')).value())).
  iterate()

相关问题