简体   繁体   English

如何在 apache tinkerpop gremlin 中使用 java `OffsetDateTime`?

[英]How to use java `OffsetDateTime` in apache tinkerpop gremlin?

The application can be accessed from a different timezone , so I am trying to store date time using class java.time.OffsetDateTime .该应用程序可以从different timezone访问,因此我尝试使用 class java.time.OffsetDateTime存储日期时间。

startTime: "1996-12-19T16:39:57-08:00",
endTime: "1996-12-19T16:39:57-08:00"

The application/API receives the time in the above format using OffsetDateTime and I am trying to save the same in AWS Neptune using Apache gremlin but I am getting the following error,应用程序/API 使用OffsetDateTime以上述格式接收时间,我正在尝试使用 Apache gremlin 将其保存在 AWS Neptune 中,但出现以下错误,

org.apache.tinkerpop.gremlin.driver.exception.ResponseException: {"detailedMessage":"Unsupported property value type: java.time.OffsetDateTime","code":"UnsupportedOperationException","requestId":"81e402b0-90ab-4c6d-8839-23542da3437b"}
    at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:245) ~[gremlin-driver-3.6.1.jar:3.6.1]
    at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:200) ~[gremlin-driver-3.6.1.jar:3.6.1]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
    at org.apache.tinkerpop.gremlin.driver.Handler$GremlinSaslAuthenticationHandler.channelRead0(Handler.java:126) ~[gremlin-driver-3.6.1.jar:3.6.1]
    at org.apache.tinkerpop.gremlin.driver.Handler$GremlinSaslAuthenticationHandler.channelRead0(Handler.java:68) ~[gremlin-driver-3.6.1.jar:3.6.1]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]

OffsetDateTime is not supported in Gremlin/Neptune? Gremlin/Neptune 不支持OffsetDateTime then how to store, and retrieve in an efficient way from the database?那么如何有效地从数据库中存储和检索呢?

Amazon Neptune is designed to work with any programming language. Amazon Neptune 旨在与任何编程语言一起使用。 As such you cannot store arbitrary Java types/objects into Neptune.因此,您不能将任意 Java 类型/对象存储到 Neptune 中。 You can use the native Date types and they will be converted by the Gremlin GLVs into the appropriate serialization.您可以使用本机Date类型,它们将由 Gremlin GLV 转换为适当的序列化。 To store dates you really have two main options.要存储日期,您实际上有两个主要选择。

  1. Store a Date type or use the datetime helper for text queries.存储 Date 类型或使用datetime帮助器进行文本查询。
  2. Use Epoch offset integers.使用 Epoch 偏移整数。

Using real Dates should be slightly more performant (on Neptune).使用真正的 Dates 应该稍微提高性能(在 Neptune 上)。

If you need to store additional TZ information, you will most likely want to store that as an additional property on a node or edge.如果您需要存储额外的 TZ 信息,您很可能希望将其作为附加属性存储在节点或边上。

More information on Neptune's support for dates when using Gremlin, can be found here .有关 Neptune 在使用 Gremlin 时对日期的支持的更多信息,请参见此处

暂无
暂无

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

相关问题 如何在 Apache TinkerPop Gremlin 中使用分页? - How to use pagination in Apache TinkerPop Gremlin? 如何在 Java 中使用 Gremlin/Tinkerpop? - How do I use Gremlin/Tinkerpop with Java? 如何启动 Apache Tinkerpop 3.0 gremlin 控制台? - How to launch Apache Tinkerpop 3.0 gremlin console? 如何使用 apache tinkerpop gremlin 重新创建顶点? - How to recreate a vertex with apache tinkerpop gremlin? tinkerpop3带有org.apache.tinkerpop.gremlin.structure.Graph集成的Gremlin Java客户端/集群 - tinkerpop3 Gremlin java client/cluster with org.apache.tinkerpop.gremlin.structure.Graph integration 如何修复'java.lang.NoClassDefFoundError:org / apache / tinkerpop / gremlin / process / traversal / dsl / graph / GraphTraversalSource $ GraphTraversalSourceStub'? - How to fix 'java.lang.NoClassDefFoundError: org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource$GraphTraversalSourceStub'? 如何使用Gremlin和Java查询远程Apache Tinkerpop图形数据库? - How can I query a remote Apache Tinkerpop Graph Database with Gremlin and Java? Apache TinkerPop Gremlin顶点平等 - Apache TinkerPop Gremlin Vertex Equality apache TinkerPop gremlin 如何从路径结果中过滤起始顶点 - apache TinkerPop gremlin How to filter starting vertex from path result 如何在 apache tinkerpop gremlin 或图形数据库中实现查找/引用数据? - How to implement lookup/reference data in apache tinkerpop gremlin or graph database?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM