![](/img/trans.png)
[英]Gremlin on Azure CosmosDB: how to project the related vertices' properties?
[英]How can I find an Edge between two Vertices with Gremlin in CosmosDB
我試圖在我知道 ID 的兩個頂點之間找到一條邊。
我找到了這個線程Gremlin:在兩個頂點之間找到邊的有效方法是什么? . 但這似乎不適用於 Cosmos 實現。
我試過gV('1').outE('isInvited').filter(inV().is('2'))
但這只是給了我這個錯誤。 Gremlin Query Compilation Error: Unable to find any method 'filter'
然后我嘗試了gV('1').outE('isInvited').has('inV', '2')
但這只是一直給我一個空的結果,即使我知道有這樣的邊緣。
有沒有辦法用 CosmosDB gremlin 實現來做到這一點?
我實際上在我這邊提出了你的問題。 使用您提供的線程中的 filter 命令,輸出為:
然后我從Gremlin API 支持的功能中得到線索,你可以使用 Where 而不是 Filter。
命令:
g.V('7c5dbd78-2840-402c-88ca-96e8eab4a33b').outE('knows').where(inV().is('e2d68f31-2ea1-486e-a17f-d3c596ef9245'))
輸出:
gV().has('your_node_label','id','your_from_node_id').outE('edge_label_1','edge_label_2').inV().has('your_node_label','id','your_to_node_id')
您可以在 outE() 方法中指定多個邊標簽。
並且查詢返回“to”節點。
請確保您在查詢中使用標簽名稱。 否則,圖遍歷所有節點,查詢性能會下降
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.