【问题标题】:Return specific properties of vertices in a simplepath using Gremlin API cosmosDB使用 Gremlin API cosmosDB 返回简单路径中顶点的特定属性
【发布时间】:2018-10-30 14:11:11
【问题描述】:

我正在根据一个属性选择一个顶点,然后想要在起始顶点的“上游”路径中找到所有具有链接的顶点。我可以做得很好,但我只想返回顶点 id 和其他几个属性。

g.V('1').repeat(out('UPSTREAM')).until(outE('UPSTREAM').count().is(0)).simplepath()

以上工作正常,但我如何只返回我想要的属性?

我试过了:

g.V('1').repeat(out('UPSTREAM')).until(outE('UPSTREAM').count().is(0)).simplepath().by('id').by('name')

但得到异常

Error

Failed to execute query: g.V('1').repeat(out('UPSTREAM')).until(outE('UPSTREAM').count().is(0)).simplepath().by('id').by('name'): 
Error with status code: 499. Message: 
ActivityId : 5a41d663-b1f1-41a4-b11e-abd258f17b01 ExceptionType : 
GraphNotYetImplementedException ExceptionMessage :
Not Yet Implemented: ModulateBy(traversal) Source : 
Microsoft.Azure.Graphs GremlinRequestId : 5a41d663-b1f1-41a4-b11e-abd258f17b01 Context : graphcompute Scope : 
graphcmd-invoke GraphInterOpStatusCode : InvalidRequestArguments HResult : 0x80131500

【问题讨论】:

    标签: path azure-cosmosdb gremlin


    【解决方案1】:

    simplePath() 是一个过滤步骤,它只是过滤顶点,所以只需使用valueMap()project() 等:

    g.V('1').
      repeat(out('UPSTREAM')).
        until(outE('UPSTREAM').count().is(0)).
      simplepath().
      valueMap('id','name')
    

    【讨论】:

    • 是的,正是我想要的,它帮助我注意到 simplepath() 实际上并没有遍历路径中的所有节点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-14
    • 1970-01-01
    • 2017-11-30
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 2023-03-10
    相关资源
    最近更新 更多