我正在从 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
有人可以告诉我这是我在这里犯的错误吗?
最佳答案
您从查询中返回的顶点称为引用顶点。它只包含一个 ID 和一个标签。对于您需要的属性,您应该使用 values
、project
或 valueMap
等步骤明确请求它们。
关于java - Vertex.value() 属性未找到 Gremlin Neptune Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60666855/