简体   繁体   English

AWS Neptune - gremlin 财产顺序

[英]AWS Neptune - gremlin property order

i create the property for a vertex, as g.addV('sth').property('p1', '1').property('p2', '2').property('p3', '3')我为顶点创建属性,如g.addV('sth').property('p1', '1').property('p2', '2').property('p3', '3')

however when I query the vertex, like gV().hasLabel('sth').valueMap(true) or gV().hasLabel('sth').properties()但是,当我查询顶点时,例如gV().hasLabel('sth').valueMap(true)gV().hasLabel('sth').properties()

the order of the properties is lost, I get p3, p1, p2, how can I make sure I can order the property like the order I created.属性的顺序丢失了,我得到 p3、p1、p2,我如何确保我可以像我创建的顺序一样订购属性。

Gremlin does not guarantee order for any result stream so if you need a specific order then you need to sort yourself: Gremlin 不保证任何结果流的顺序,因此如果您需要特定顺序,则需要自己排序:

gremlin> g.V().hasLabel('sth').valueMap().order(local).by(keys,desc)
==>[p3:[3],p2:[2],p1:[1]]

Of course, that isn't insertion order and I'm not sure how you would be able to achieve that as Gremlin does not have that information available to it - only the underlying graph database does.当然,这不是插入顺序,我不确定您将如何实现这一点,因为 Gremlin 没有可用的信息 - 只有底层图形数据库可以。 You may be beholden to what the underlying graph allows with respect to this.您可能会感谢底层图表在这方面允许的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM