java - Vertex.value() 属性未找到 Gremlin Neptune Java

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

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

关于java - Vertex.value() 属性未找到 Gremlin Neptune Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60666855/

相关文章:

Java - JSplitPane 重量监听器的大小

java - java中(double)(1/2)和(double)1/2之间的区别

Java - 访问组件信息

amazon-web-services - Amazon AWS ECS Docker 端口未正确绑定(bind)

amazon-ec2 - 对于 AWS,如何使用 ruby​​ aws-sdk 为资源设置标签?

python(boto3)程序删除aws中的旧快照

amazon-web-services - 如何在不删除现有内容的情况下向 AWS Lambda 添加环境变量?

ssl - ERR_SSL_VERSION_OR_CIPHER_MISMATCH 从 AWS API 网关到 Lambda

Java数组多个数组

mysql - 在 Amazon ec2 实例上安装 wordpress 的正确方法(如 BiTnami 包)