简体   繁体   English

Gremlin cosmos:如何在重复命令中将边缘的属性值复制为顶点属性

[英]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'.边有一个属性“b”,顶点有一个属性“a”。

For vertices satisfying certain conditions i want to copy edge's 'b' property value as vertex's 'a' property value.对于满足某些条件的顶点,我想将边缘的“b”属性值复制为顶点的“a”属性值。

And this has to be done for all vertices connected by 'x' edge upto 2 levels.并且必须对由“x”边缘连接的所有顶点执行此操作,最多 2 个级别。

Not sure if you want value 'b' from the first edge for everyone or each one gets is own edge value.不确定您是否想要每个人的第一个边缘的值“b”,或者每个人获得的都是自己的边缘值。

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例如: https://gremlify.com/av

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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