如何在 JanusGraph 中使用枚举值?

How does it possible to use enumeration values in JanusGraph?

如何通过 gremlin 查询在 janus-graph DB 中定义一些枚举类型(如 java-enumeration)?

似乎可以通过 List 输入 属性:

来定义枚举之类的东西

enumProperty = mgmt.makePropertyKey('State').dataType(String).cardinality(Cardinality.LIST).make()

还有别的办法吗?

理想情况下,我希望能够在 creating/updating vertices/edges by gremlin 查询时引用这些枚举值(如 Java SomeEnum.ENUM_VALUE_1) .

如果您使用的图表没有显式模式 API,则可以使用纯 Gremlin 创建 LIST 或 SET 基数 属性。这里有几个例子

g.addV('test').property('p1','one').property('p1','two')
==>v[55985]

g.V(55985).valueMap()
==>[p1:[one,two]]

gremlin> g.V(55985).property(list,'p1','three')
==>v[55985]

gremlin> g.V(55985).valueMap()
==>[p1:[one,two,three]]

希望这对您有所帮助,

我在 book/tutorial 中对这个概念进行了相当详细的介绍,您可以在此处免费阅读 http://kelvinlawrence.net/book/Gremlin-Graph-Guide.pdf or here http://kelvinlawrence.net/book/Gremlin-Graph-Guide.html

干杯 开尔文