簡體   English   中英

使用Gremlin API cosmosDB返回簡單路徑中頂點的特定屬性

[英]Return specific properties of vertices in a simplepath using Gremlin API cosmosDB

我正在基於屬性選擇一個頂點,然后要查找從起始頂點到路徑“上游”中具有鏈接的所有頂點。 我可以做的很好,但是我只想返回頂點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

simplePath()是一個過濾步驟,僅過濾頂點,因此只需使用valueMap()project()等:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM