【发布时间】: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