I'm writing a gremlin python query with the intention that
- Create an edge if it doesn't exist
- Update the edge properties if it does
I read some answers here already and got the first part figured out using coalesce but I'm not sure how to update the edge if it exists. I would imagine that would happen in the first part of the coalesce but I tried select edge and that didn't work
Here is what I have so far
g.V().
hasLabel('person').as_('p').
V().
hasLabel('house').as_('h').
coalesce(
__.inE('owns').where(__.outV().as_('p')),
__.addE('owns').from_('p').to('h').
property(Cardinality.set_, 'duration', 2)).
iterate()