barrier

Causes all steps prior to the barrier step to be executed before moving onto additional steps.

Synopsis

barrier()
Table 1. Legend
Syntax conventions Description
Lowercase and uppercase Literal keyword. Includes ().
Italics Variable value. Replace with a user-defined value.
[] Optional. Square brackets ( [] ) surround optional command arguments. Do not type the square brackets.
{} Group. Braces ( {} ) identify a group to choose from. Do not type the braces.
| Or. A vertical bar ( | ) separates alternative elements. Type any one of the elements. Do not type the vertical bar.
... Repeatable. An ellipsis ( ... ) indicates that you can repeat the syntax element as often as required.

Description

The barrier() step is a bulk optimizing step that can create a single traverser for a repeated step.

Examples

Repeat this traversal with the barrier() step and then without, to see the effect the barrier step has on the operation. The basic query starts at a particular book, then traverses to the includedIn edges that point to that book to
g.V().has('book','bookId',1004).
  in('includedIn').
  in('includedIn').
  groupCount('x').
    by('name').
  barrier().
  project('a','b').
    by('name').
    by(select('x'))