0

I am trying to update edge in my dse graph by extracting properties of another existing edge as below:

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()

but I am getting below error:

InvalidRequest: Error from server: code=2200 [Invalid query] message="The provided traverser does not map to a value: 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]"

What am I doing wrong? Also if there is a better approach please suggest

I tried to update a new edge with the properties of an existing edge in dse graph using gremlinpython and it didnt work. looking for a solution

James Z
  • 12,209
  • 10
  • 24
  • 44
S_R R_G
  • 11
  • 2

1 Answers1

0

As written edgeProperties is a variable, trying to use it in a select step is not going to work as it is not part of the current query. You can inject variables into queries using steps like inject or constant but I don't think that is quite what you need here. Instead, please try something like this:

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()
Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38