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

1 Answer 1

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()
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the above reply., However, below code snippet is also working for me : for edge in outgoing_edges: label = edge.label neighbor_vertex = edge.inV.id edgeProperties = g.E(edge.id).valueMap().next() pprint(edgeProperties) new_edge = g.V(newVertex.id).addE(label).to(g.V(neighbor_vertex)).next() for property_key, property_value_list in edgeProperties.items(): g.E(new_edge).property(property_key,property_value_list).iterate()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.