Vertex.value()属性未在Gremlin Neptune Java中找到



我正在从Lambda访问neptune数据库实例,我已经使用以下成功地从Lambda配置了neptune数据库的连接

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和一个标签。对于您需要的属性,您应该使用类似valuesprojectvalueMap的步骤明确要求它们。

最新更新