1
g.V().has(id,'xxx').repeat(outE('x').
has('b',gte(1588919200)).has('b',lte(1589128800)).inV())
.times(2).emit().property('a',b)

Edge has a property 'b' and vertex has a property 'a'.

For vertices satisfying certain conditions i want to copy edge's 'b' property value as vertex's 'a' property value.

And this has to be done for all vertices connected by 'x' edge upto 2 levels.

José Pedro
  • 1,097
  • 3
  • 14
  • 24

1 Answers1

0

Not sure if you want value 'b' from the first edge for everyone or each one gets is own edge value.

for first edge value for all:

g.V('xxx').as('v').
  outE('child').has('b', gte(1)).
  has('b', lte(10)).as('e').select('v').
  repeat(out('child')).emit().times(2).
  property(single, 'a', select('e').
    values('b'))

each vertex gets the connected edge value:

g.V().has('root').repeat(outE('child').
has('b',gte(1)).has('b',lte(10)).as('e').inV())
.times(2).emit().property(single, 'a', select('e').
    values('b'))

example: https://gremlify.com/av

noam621
  • 2,766
  • 1
  • 16
  • 26
  • Thanks for that solution @noam621. But when i tried it in application, I'm getting the following error. **Gremlin Query Execution Error: Cannot create ValueField on non-primitive type GraphTraversal.** Can you suggest where i'm going wrong. – Gayathri Thenappan May 24 '20 at 12:55
  • 1
    @GayathriThenappan it seems that cosmos doesn't support update property with traversal. without it I don't see any way to do it in one query. https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/38495785-data-quality-please-allow-for-properties-to-be-se – noam621 May 24 '20 at 14:35