【发布时间】:2019-09-19 23:29:25
【问题描述】:
尝试保存和重用查询-clone();
我已经尝试过query.clone()、clone(query)、statics.clone(query)、graphPredicate.clone(query)
参考:http://tinkerpop.apache.org/docs/current/recipes/#traversal-component-reuse
const { Graph } = gremlin.structure;
const { P: graphPredicate, statics } = gremlin.process;
const { _ } = gremlin.process.statics;
const g = graph.traversal().withRemote(gremlinConnection);
const query = statics.hasLabel(‘Movie’).hasId(gt(‘C’))
const count = g.V().flatMap(query.clone()).count().next()```
`Exception: TypeError: Cannot read property 'clone' of undefined`
【问题讨论】:
-
你可以只声明查询吗?例如 const 查询。
-
用 gremlin.process.static 别名替换静态变量。也不确定是否应该使用大括号。试试看。
-
@elanochecer 我们尝试了这两件事。在这一点上,我们认为问题出在匿名查询上。你以前用 JS 做过吗?
标签: javascript gremlin