Question: I am trying to submit a batch like operation for creating multiple vertices and edges in the same query.

```
g.addV('os').property('name', 'linux').as('linux').
  addV('os').property('name', 'windows').as('windows').
  addV('os').property('name', 'mac').as('mac').
  addE('competitor').from('linux').to('UNEXISTING OS').      # fail here
  addE('competitor').from('linux').to('windows').
  addE('competitor').from('windows').to('mac').
  addE('competitor').from('linux').to('mac').
  iterate()

```

The query is constructed to intentionally fail, however all vertices before the failing line are being created.  

Is it possible to achieve a kind of transaction for the whole query? So that if one subquery fails, it should rollback the ones that were previously executed.

Thanks!

Answer: 
The query could not be executed in the Gremlin Console using TinkerGraph,
as per TinkerPop [documentation](http://tinkerpop.apache.org/docs/3.4.1/reference/#connecting-gremlin-server-limitations), there isn't support for transactions for built-in TinkerGraph object.

But, as cygri pointed out, AWS Neptune offers support for transactions ([see here](https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html)), that can be executed under the form of original query from OP or by separating queries by a semicolon (;) or a newline character (\n)

```
g.addV('os').property('name', 'linux').next();
g.addV('os').property('name', 'windows').next();
g.addE('competitor').from('1101').to('1102')

```
You can also use [Gremlin Sessions](https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-sessions.html); create a sessioned-connection and it'll rollback queries in case of an error.