【问题标题】:Use gremlin npm package to translate 'by' clause containing 'out'使用 gremlin npm 包翻译包含 'out' 的 'by' 子句
【发布时间】:2020-08-16 20:10:13
【问题描述】:

我无法让 npm gremlin 包 (https://www.npmjs.com/package/gremlin) 正确翻译涉及 by and out 子句的查询的字节码。

我的代码(打字稿)是:

import {process, structure} from "gremlin";
const __ = process.statics;


const g = new structure.Graph().traversal();

const bytecode = g.V("aVertexId")
.project("someProp")
.by(
__.out("hasEdgeWith")
.hasLabel("People")
.values("identifier" , "name")
)
.getBytecode();

console.log(new process.Translator("g").translate(bytecode);

// Outputs:
// g.V('aVertexId').project('someProp').by([["out", "hasEdgeWith"], ["hasLabel", "People"], ["values", "identifier", "name"]])

我希望输出是(注意 by 中 out 子句中的差异):

// g.V('aVertexId').project('someProp').by(out('hasEdgeWith').hasLabel('People').values('identifier', 'name'))

我将如何实现这一目标?

【问题讨论】:

    标签: javascript typescript gremlin


    【解决方案1】:

    您发现了一个非常糟糕的错误。我在TINKERPOP-2403 上创建了一个问题。 fix 相当简单,发布时将成为 3.4.9 的一部分。

    【讨论】:

    • 很高兴知道。感谢您跟进修复。我会密切关注这一点,并在 3.4.9 登陆时进行测试!
    猜你喜欢
    • 2016-10-02
    • 1970-01-01
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 2019-02-14
    相关资源
    最近更新 更多