gremlin - 更新 gremlin-server 后的问题

标签 gremlin janusgraph gremlin-server

目前我正在使用 janusgraph-0.2.0-hadoop2 服务器并使用 [email protected] 查询库

const Gremlin = require("gremlin");
const client = Gremlin.createClient(8182, "192.168.0.103");

function test(p){
   client.execute(q, {}, (err, results) => {
    if (err) {
      console.error(err);
      client.closeConnection();
    }
    else {
    console.log(results);
    client.closeConnection();
   }
});
}

查询g.V().count()结果为[ 12 ]

查询 g.V().has('name', 'saturn').valueMap() 结果为 [ { name: [ 'saturn' ],age: [ 10000 ] }]

我对此很满意

但是将我的janusgraph更新到janusgraph-0.5.0-hadoop2服务器并使用相同的库 [email protected]

获取不同格式的数据

查询g.V().count()结果为[ { '@type': 'g:Int64', '@value': 12 } ]

查询g.V().has('name', 'saturn').valueMap()结果为

[ { '@type': 'g:Map', '@value': [ '姓名', [对象], '年龄', [对象] ] } ] 正在将库更新为 [email protected]

const gremlin = require('gremlin');
const client = new gremlin.driver.Client('ws://192.168.0.106:8182/gremlin', { traversalSource: 'g' });

async function test(q){
  const res = await client.submit(q, {});
  console.log('res',res)
  client.close();
}

test()

查询g.V().count()结果为[ 12 ]

查询g.V().has('name', 'saturn').valueMap() 结果是[ Map { 'name' => [ 'saturn' ], '年龄' => [ 10000 ] } ]

获取Hashmap中的数据 我想知道

 1. Is it necessary to update gremlin library 3.4.6 getting correct result.
 2. After updating to 3.4.6 get data in hashmap format, Means i want to know i am getting correct data or not.
 3. I want data in object format but got in hashmap. I know i can convert to object but incase data is in nested hashmap, I dont want to repeat and convert it.

请给我建议

最佳答案

我想说,使用当前版本的 Janus Graph 是一个非常好的主意。请注意,您应该使用 Janus graph 附带的 Gremlin 库,而不是独立更新它们。正如您所看到的,最新的 Javascript/Node Gremlin 客户端确实返回 Map 类型。

关于gremlin - 更新 gremlin-server 后的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61015999/

相关文章:

azure-cosmosdb - 返回键/值列表的 Gremlin 查询,其中键是顶点 ID,值是特定属性的值

Gremlin - 根据组键选择顶点

clojure - 在 clojure ogre 中进行文本和字符串搜索以查询 Janusgraph - 找不到任何函数或方法

hadoop - 为 Spark 集群和 Cassandra 设置和配置 JanusGraph

cluster-computing - JanusGraph集群总是返回没有属性的顶点(ReferenceVertex)

azure - 在 CosmosDB 中将顶点存储为 JSON

python - 小 Sprite /球流 : how to get an integer result out of execute()

java - 使用 java 进行 gremlin 事务处理

graph-databases - 如何列出正在运行的 gremlin 查询?如何取消运行缓慢或长时间运行的查询?

java - 按边标签对顶点组的传入顶点进行分组