【问题标题】:gremlin javascript can't collect the properties of a vertexgremlin javascript无法收集顶点的属性
【发布时间】:2018-11-07 07:37:38
【问题描述】:

在 amazon neptune 中插入一个顶点后,我得到了一个唯一的 id。如果我想打印出顶点的属性,我可以在 gremlin 控制台中轻松完成

但在我的节点 js 应用程序中,如果我尝试做同样的事情,我无法获得顶点的属性

这是我在 javascript 中所做的

const fetchPropertyByVertexId = async (vertexId) => {
  console.log("requsting properties of vertex "+vertexId);
  return await g.V(vertexId).properties();
}

然后,我打电话

   fetchPropertyByVertexId(vertexId).then( property =>{
     console.log(property);
   });

输出是

我正在使用 this 库与 amazon neptune 连接。 如何在键值对中获取顶点的属性,就像在 gremlin 控制台中获取它一样?

【问题讨论】:

    标签: graph-theory gremlin tinkerpop3 gremlin-server amazon-neptune


    【解决方案1】:

    我认为你需要iterate your traversal。这个:

    return await g.V(vertexId).properties();
    

    返回一个不返回结果的Traversal 对象——它只是表示要迭代以获得结果的对象。所以,你需要包含一个像toList()这样的终端步骤:

    return await g.V(vertexId).properties().toList();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-14
      • 2019-01-03
      • 2023-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-29
      相关资源
      最近更新 更多