【问题标题】:Vertex.value() Property Not found Gremlin Neptune JavaVertex.value() 属性 Not found Gremlin Neptune Java
【发布时间】:2020-03-13 08:03:22
【问题描述】:

我正在从 Lambda 访问海王星数据库实例,我已使用以下命令成功配置了从 lambda 中连接海王星数据库

Cluster.Builder builder = Cluster.build();
builder.addContactPoint("endpoint");
builder.port(8182);
builder.enableSsl(true);
builder.keyCertChainFile("SFSRootCAG2.pem"); 

我什至使用

向数据库发送了更新和插入语句
GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(cluster));
g.addV("Custom Label").property(T.id, "CustomId1").property("name", "Custom id vertex 1").next();

但是当我尝试检索顶点的属性时

Vertex vertex = g.V().has(T.id, "CustomId1").next(); System.out.println((String) vertex.value("name"));

我收到属性名称在该顶点上不存在的错误:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: The property does not exist as the key has no associated value for the provided element: v[CustomId1]:name

有人可以告诉我这是我在这里犯的错误吗?

【问题讨论】:

    标签: java amazon-web-services aws-lambda gremlin amazon-neptune


    【解决方案1】:

    您从查询中返回的顶点称为参考顶点。它只会包含一个 ID 和一个标签。对于您需要的属性,您应该使用valuesprojectvalueMap 之类的步骤明确要求它们。

    【讨论】:

    • 嗨 Kelvin,配置 gremlin 服务器以默认为顶点创建 UUID 的最佳方法是什么?
    • 最好将其作为一个新问题提出,因为这是一个不同的主题。 Gremlin 服务器具有可配置的 ID 管理器。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-14
    • 1970-01-01
    • 2021-02-03
    • 1970-01-01
    • 1970-01-01
    • 2019-08-09
    相关资源
    最近更新 更多