【问题标题】:ConfiguredGraphFactory.getGraphNames(); doesn't return results if traversal object not set in gremlin-javascriptConfiguredGraphFactory.getGraphNames();如果未在 gremlin-javascript 中设置遍历对象,则不返回结果
【发布时间】:2021-01-21 19:57:22
【问题描述】:

我有一个 react/node.js 应用程序,它通过 gremlin-javascript 客户端连接到 JanusGraph 远程服务器。如果我建立一个远程连接并提供一个现有的图形名称来建立遍历对象,那么一切正常。

const gremlin = require('gremlin');
const client = new gremlin.driver.Client('ws://'+req.body.graphURL+'/gremlin', {traversalSource:  req.body.graphName+'_traversal'});
let gremlin_query = 'ConfiguredGraphFactory.getGraphNames();';
const result = await client.submit(gremlin_query);
console.log('GetGraphNames raw result: ', result);

只要图形名称存在于远程服务器上,这一切都有效。如果我们不知道远程服务器上存在哪些图形名称,则此调用不会返回任何结果。

我尝试了以下 gremlin 客户端设置来启动匿名遍历对象。他们都没有工作。

const client = new gremlin.driver.Client('ws://'+req.body.graphURL+'/gremlin', {traversalSource: 'g'});
const client = new gremlin.driver.Client('ws://'+req.body.graphURL+'/gremlin', {traversalSource: 'ConfigurationManagementGraph_traversal'});

任何帮助将不胜感激。

【问题讨论】:

    标签: janusgraph gremlin-server


    【解决方案1】:

    您非常接近解决方案。只需从“ConfigurationManagementGraph_traversal”中删除“_traversal”

    const client = new gremlin.driver.Client('ws://'+req.body.graphURL+'/gremlin', {traversalSource: 'ConfigurationManagementGraph'});
    

    【讨论】:

      猜你喜欢
      • 2023-01-15
      • 2019-08-30
      • 2023-02-15
      • 1970-01-01
      • 2011-02-08
      • 1970-01-01
      • 2015-11-25
      • 2020-05-23
      • 1970-01-01
      相关资源
      最近更新 更多