0

How to write a Gremlin query when the number of input vertices is unknown?

Scenario:

1. Poll -> Already existing vertex.
2. Poll Question -> User might send multiple questions that are unknown and multiple options to the question (unknown list).

I am using GremlinPython and it's not supporting manual transactions with AWS Neptune. How to write it in a single query?

Or Switch to Java?

Thirumal
  • 8,280
  • 11
  • 53
  • 103
  • could you please clarify your question further? i'm not clear on what not knowing the number of vertices has to do with your "Scenario". – stephen mallette Jun 12 '21 at 10:15
  • Is the question about how to perform both of those operations as a single transaction? – Kelvin Lawrence Jun 15 '21 at 13:58
  • Yes. Currently, I am using submitting script: https://tinkerpop.apache.org/docs/current/reference/#gremlin-python-scripts. Looking for a solution in a single request in Gremlin-python-variant. – Thirumal Jun 15 '21 at 14:05

1 Answers1

1

Without specifics as to what your multiple queries are doing it isn't easy to come up with recommendations for how to make it work as a single query. Setting that aside, however, scripts may be your only solution at this time as the combination of the scripts may be impossible or may make your Gremlin unreadable and hard to maintain. Switching to Java will not help work your way around this issue, because you will still need to submit scripts.

The above statements are true until Neptune (and other graphs) support TinkerPop 3.5.0 and remote transactions.

stephen mallette
  • 45,298
  • 5
  • 67
  • 135