![](/img/trans.png)
[英]apache TinkerPop gremlin How to filter starting vertex from path result
[英]Amazon Neptune: How to create custom vertex id in Python using tinkerpop/gremlinpython package?
如此處所述https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html自定義頂點 id 只能使用未引用的id
屬性設置,即g.addV('label1').property(id, 'customid')
。 如何使用 gremlinpython package 實現這一目標? 我在 gremlin_python.process.graph_traversal 中看到一個id
gremlin_python.process.graph_traversal
,但是在嘗試使用它時我得到一個UnsupportedOperationException
(如預期的那樣)。
您應該只需要導入T
這是包含id
和label
成員的 class :
from gremlin_python.process.traversal import T
然后將其用作:
g.addV('label1').property(T.id, 'customid').iterate()
您當然可以選擇從T
導入id
以使語法與問題中的示例 Gremlin 同義,這樣您就可以省略T
- 有些人更喜歡這種風格。
可能值得查看 Gremlin 使用的其他常見導入的參考文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.