![](/img/trans.png)
[英]How can I find an Edge between two Vertices with Gremlin in CosmosDB
[英]Gremlin query to get the edge between two vertices
嘗試這樣的事情
List<Edge> result = g.traversal().V().hasLabel("contextlabel").where(__.otherV().hasLabel(labelName)).bothE().toList();
但是低於錯誤org.apache.tinkerpop.gremlin.orientdb.OrientVertex無法轉換為org.apache.tinkerpop.gremlin.structure.Edge
因為V()
返回了一個Vertex
,然后嘗試使用where()
進行過濾,所以使用了該錯誤,它將那個Vertex
作為要評估的流中的傳入項。 它試圖調用otherV()
,這不是Vertex
可用的方法...該方法用於邊緣。 我認為您只是在錯誤的位置放置了bothE()
,因此
g.V().hasLabel("contextlabel").
bothE().
where(__.otherV().hasLabel(labelName)).
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.