Gremlin:基于两个属性值的比较选择顶点

Gremlin:基于两个属性值的比较选择顶点,gremlin,azure-cosmosdb-gremlinapi,Gremlin,Azure Cosmosdb Gremlinapi,假设我有下面的小精灵图: g.addV('test1').property('pkey', 100).property('v1', 100).property('v2', 150) g.addV('test1').property('pkey', 100).property('v1', 100).property('v2', 75) 我想查询属性值v1大于属性值v2的所有标记为“test1”的顶点。如何在Gremlin中实现这一点?您可以以这种方式使用where()步骤: gremlin>

假设我有下面的小精灵图:

g.addV('test1').property('pkey', 100).property('v1', 100).property('v2', 150)
g.addV('test1').property('pkey', 100).property('v1', 100).property('v2', 75)
我想查询属性值v1大于属性值v2的所有标记为“test1”的顶点。如何在Gremlin中实现这一点?

您可以以这种方式使用
where()
步骤:

gremlin> g.addV('test1').property('pkey', 100).property('v1', 100).property('v2', 150)
==>v[0]
gremlin> g.addV('test1').property('pkey', 100).property('v1', 100).property('v2', 75)
==>v[4]
gremlin> g.V().hasLabel('test1').as('a').where('a',gt('a')).by('v1').by('v2')
==>v[4]
gremlin> g.V().hasLabel('test1').as('a').where(gt('a')).by('v1').by('v2')
==>v[4]

这对您对抗CosmosDB的Gremlin API有效吗?我刚试过,结果它返回了一个空列表。g、 V().hasLabel('test1').valueMap():`g.V().hasLabel('test1').as('a')。其中(gt('a'))。by('v1')。by('v1')。by('v2')):我包括了一个正手版本,在该版本中,您明确指定了
where()
的初始比较步骤标签-这是否适用于CosmosDB?如果这不起作用,您可能需要向他们提交错误报告。