@Override
    public Void visitTransactionPart(final GremlinParser.TransactionPartContext ctx) {
        // position 4 holds the tx command
        final String cmd = ctx.getChild(4).getText();
        final GraphTraversalSource g = null == source ? antlr.graph.traversal() : source;
        switch (cmd) {
            case "begin":
                // script based transactions are automatic, meaning commit()/rollback() should keep g in a state
                // where the transaction is opened on the next script execution. begin() is a more necessary syntax in
                // remote client-side Gremlin where you need to construct a boundary for the session which hosts the
                // transaction. we support begin() here to at least allow the function to be called without error so
                // as to hold syntax consistency, but it is effectively a no-op.
                // g.tx().begin();
                break;
            case "commit":
                g.tx().commit();
                break;
            case "rollback":
                g.tx().rollback();
                break;
            default:
                notImplemented(ctx);
                break;
        }

        return null;
    }
Handles transactions via calls to {@code tx()}.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceTxVisitor.java