简体   繁体   中英

Gremlin cosmos: How to copy a property value of edge as vertex property inside a repeat command

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM