使用gremlin npm软件包翻译包含'out'的'by'子句

问题描述

我在获取npm gremlin软件包(https://www.npmjs.com/package/gremlin)来正确转换涉及by和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子句中的diff):

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

我将如何实现?

解决方法

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