简体   繁体   English

在 TinkerGraph 中使用字符串 ID

[英]Using String IDs with TinkerGraph

I'm pointing some .Net code at Tinkergraph, for testing purposes, that uses Neptune when deployed.我将一些 .Net 代码指向 Tinkergraph,用于测试目的,在部署时使用 Neptune。 Our Neptune database uses Strings as IDs (always UUIDs, but string objects)我们的 Neptune 数据库使用字符串作为 ID(总是 UUID,但字符串对象)

When I query the graph features from the console (I'm using the standard docker image with some tweaks) I see:-当我从控制台查询图形功能时(我使用的是标准 docker 图像并进行了一些调整),我看到:-

NumericIds: true,
StringIds: true,
UuidIds: true

I have been unable to find a way to get the graph to use strings as IDs.我一直无法找到让图形使用字符串作为 ID 的方法。 The best I've managed is to switch it to UUIDs.我管理的最好的方法是将其切换为 UUID。

gremlin.tinkergraph.vertexIdManager=UUID

gremlin.tinkergraph.edgeIdManager=UUID

gremlin.tinkergraph.vertexPropertyIdManager=UUID

This can work, but has meant I've had to change a lot of casts in the original C# code to .ToString() and do a bit of extra work around code that uses dymanics.这可以工作,但这意味着我必须将原始 C# 代码中的许多强制转换更改为 .ToString() 并围绕使用动态的代码做一些额外的工作。

Ideally, I'd like the returned Ids to be strings, not System.Guid.理想情况下,我希望返回的 Id 是字符串,而不是 System.Guid。

I have looked through the Java code at the IdManagers and I can't see a STRING one.我在 IdManagers 上查看了 Java 代码,但看不到 STRING 代码。 Is there one in the default implementation?默认实现中有一个吗?

Rather than specify UUID or LONG use ANY to enable String IDs with TinkerGraph.而不是指定 UUID 或 LONG 使用 ANY 来启用 TinkerGraph 的字符串 ID。

The possible values are defined in this file: https://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.DefaultIdManager.html此文件中定义了可能的值: https : //tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.DefaultIdManager.html

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

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