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

问题描述 投票:0回答:1

我正在尝试通过提取另一个现有边缘的属性来更新我的 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()

但我遇到以下错误:

InvalidRequest:来自服务器的错误:code=2200 [无效查询] message="提供的遍历器未映射到值: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_number =“7541013100”} -has_policyholder->{~label=person, source_id="SID002250012009", source_system="SAPI"}]->[SelectOneStep(last,edgeProperties), NoOpBarrierStep(2500), PropertyKeyStep]"

我做错了什么?另外如果有更好的方法请推荐

我尝试使用 gremlinpython 使用 dse 图中现有边的属性更新新边,但没有成功。正在寻找解决方案

graph cassandra datastax gremlinpython dse
1个回答
0
投票

如所写,

edgeProperties
是一个变量,尝试在
select
步骤中使用它是行不通的,因为它不是当前查询的一部分。您可以使用
inject
constant
等步骤将变量注入到查询中,但我认为这并不是您所需要的。相反,请尝试这样的事情:

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()
© www.soinside.com 2019 - 2024. All rights reserved.