0

I am using neptune and graphql and I am getting this error:

"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>\"}

here is my query:

 g
.V(keyId)
.repeat(__.outE('RELATIONSHIP').inV())
.dedup()
.until(__.and(__.hasLabel('sample'),
__.hasKey('id')))
.emit()
.filter(__.label().is('sample'))
.dedup()
.values('id')
.toList();

How do I correctly repeat this query?

Morgan Smith
  • 291
  • 2
  • 12

1 Answers1

2

The main issue is that the closing paren for the repeat is in the wrong place. It needs to be after dedup and before until. As you are not using properties from the edge, outE().inV could be replaced with just out() if you prefer. I'm a bit curious about the loops termination condition as it seems you just want to find a vertex with a "sample" label and a property called "id" but you don't care about the value of that property. I'm also not sure about the filter you have in the query. That really duplicates what was done in the until and if really needed can just be written as 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();

If any of what I wrote above does not make sense or there are aspects to the problem I have missed, please add a comment and I will update the answer.

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • 1
    Thanks for the response, and I should have picked two different names, I am going to edit and update to be something like "parent" and "child". It turns out that the issue was neptune updated and doesn't support the way I had implemented something else. this looks much cleaner though, so i am going to try and use this too – Morgan Smith Feb 22 '22 at 18:59