我正在使用海王星和graphql,我得到了以下错误:
"Server error: {\"detailedMessage\":\"The repeat()-traversal was not defined: RepeatStep(until([NeptuneMemoryTrackerStep, NeptuneHasStep([~label.eq("sample"), ~key.eq(id)])]),emit(true))\",\"code\":\"InternalFailureException\",\"requestId\":\"<id>\"}以下是我的疑问:
g
.V(keyId)
.repeat(__.outE('RELATIONSHIP').inV())
.dedup()
.until(__.and(__.hasLabel('sample'),
__.hasKey('id')))
.emit()
.filter(__.label().is('sample'))
.dedup()
.values('id')
.toList();如何正确地重复此查询?
发布于 2022-01-20 21:55:53
主要的问题是,结束的帕伦重复是在错误的地方。它需要在dedup之后和until之前。由于您没有使用来自边缘的属性,如果您愿意的话,可以将outE().inV替换为out()。我对循环终止条件有点好奇,因为你似乎只想找到一个顶点,它有一个“样本”标签和一个名为"id“的属性,但是您并不关心该属性的值。对于查询中的filter,我也不太确定。这实际上重复了在until中所做的工作,如果确实需要,只需将其编写为hasLabel('sample')即可。
g.V(keyId).
repeat(__.outE('RELATIONSHIP').inV().dedup()).
until(__.and(__.hasLabel('sample'), __.hasKey('id'))).emit().
filter(__.label().is('sample')).
dedup().
values('id').
toList();如果我上面写的任何内容都没有意义,或者我遗漏了问题的一些方面,请添加一个评论,我会更新答案。
https://stackoverflow.com/questions/70790961
复制相似问题