org.apache.tinkerpop.gremlin.process.traversal.dsl.graph

## Class GraphTraversalSource

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource

- All Implemented Interfaces:
    AutoCloseable, Cloneable, TraversalSource

      public class GraphTraversalSource
      extends Object
      implements TraversalSource

  A `GraphTraversalSource` is the primary DSL of the Gremlin traversal machine. It provides access to all the configurations and steps for Turing complete graph computing. Any DSL can be constructed based on the methods of both `GraphTraversalSource` and `GraphTraversal`.
  Author:
    Marko A. Rodriguez (http://markorodriguez.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GraphTraversalSource.Builder` Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.
    `static class` | `GraphTraversalSource.Symbols`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Bytecode` | `bytecode`
    `protected RemoteConnection` | `connection`
    `protected Graph` | `graph`
    `protected TraversalStrategies` | `strategies`

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalSource

      `GREMLIN_REMOTE, GREMLIN_REMOTE_CONNECTION_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GraphTraversalSource(Graph graph)`
    `GraphTraversalSource(Graph graph, TraversalStrategies traversalStrategies)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `GraphTraversal<Vertex,Vertex>` | `addV()`
    `GraphTraversal<Vertex,Vertex>` | `addV(Object... keyValues)` Deprecated. As of release 3.1.0, replaced by `addV()`
    `GraphTraversal<Vertex,Vertex>` | `addV(String label)`
    `static GraphTraversalSource.Builder` | `build()` Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.
    `GraphTraversalSource` | `clone()` The clone-method should be used to create immutable traversal sources with each call to a configuration "withXXX"-method.
    `void` | `close()`
    `static GraphTraversalSource.Builder` | `computer()` Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.
    `static GraphTraversalSource.Builder` | `computer(Class<? extends GraphComputer> graphComputerClass)` Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.
    `GraphTraversal<Edge,Edge>` | `E(Object... edgesIds)`
    `Optional<Class>` | `getAnonymousTraversalClass()`
    `Bytecode` | `getBytecode()` Get the `Bytecode` associated with the current state of this traversal source.
    `Graph` | `getGraph()` Get the `Graph` associated with this traversal source.
    `TraversalStrategies` | `getStrategies()` Get the `TraversalStrategies` associated with this traversal source.
    `<S> GraphTraversal<S,S>` | `inject(S... starts)`
    `static GraphTraversalSource.Builder` | `standard()` Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.
    `String` | `toString()`
    `Transaction` | `tx()`
    `GraphTraversal<Vertex,Vertex>` | `V(Object... vertexIds)`
    `GraphTraversalSource` | `withBindings(Bindings bindings)` Deprecated.
    `GraphTraversalSource` | `withBulk(boolean useBulk)`
    `GraphTraversalSource` | `withComputer()` Add the standard `GraphComputer` of the graph that will be used to execute the traversal.
    `GraphTraversalSource` | `withComputer(Class<? extends GraphComputer> graphComputerClass)` Add a `GraphComputer` class used to execute the traversal.
    `GraphTraversalSource` | `withComputer(Computer computer)` Add a `Computer` that will generate a `GraphComputer` from the `Graph` that will be used to execute the traversal.
    `GraphTraversalSource` | `withoutStrategies(Class<? extends TraversalStrategy>... traversalStrategyClasses)` Remove an arbitrary collection of `TraversalStrategy` classes from the traversal source.
    `GraphTraversalSource` | `withPath()`
    `GraphTraversalSource` | `withRemote(Configuration conf)` Configures the `TraversalSource` as a "remote" to issue the `Traversal` for execution elsewhere.
    `<A> GraphTraversalSource` | `withSack(A initialValue)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(A initialValue, BinaryOperator<A> mergeOperator)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(A initialValue, UnaryOperator<A> splitOperator)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(A initialValue, UnaryOperator<A> splitOperator, BinaryOperator<A> mergeOperator)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(Supplier<A> initialValue)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(Supplier<A> initialValue, BinaryOperator<A> mergeOperator)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(Supplier<A> initialValue, UnaryOperator<A> splitOperator)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSack(Supplier<A> initialValue, UnaryOperator<A> splitOperator, BinaryOperator<A> mergeOperator)` Add a sack to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSideEffect(String key, A initialValue)` Add a sideEffect to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSideEffect(String key, A initialValue, BinaryOperator<A> reducer)` Add a sideEffect to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSideEffect(String key, Supplier<A> initialValue)` Add a sideEffect to be used throughout the life of a spawned `Traversal`.
    `<A> GraphTraversalSource` | `withSideEffect(String key, Supplier<A> initialValue, BinaryOperator<A> reducer)` Add a sideEffect to be used throughout the life of a spawned `Traversal`.
    `GraphTraversalSource` | `withStrategies(TraversalStrategy... traversalStrategies)` Add an arbitrary collection of `TraversalStrategy` instances to the traversal source.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### connection

          protected transient RemoteConnection connection

    - #### graph

          protected final Graph graph

    - #### strategies

          protected TraversalStrategies strategies

    - #### bytecode

          protected Bytecode bytecode

  - ### Constructor Detail

    - #### GraphTraversalSource

          public GraphTraversalSource(Graph graph,
                                      TraversalStrategies traversalStrategies)

    - #### GraphTraversalSource

          public GraphTraversalSource(Graph graph)

  - ### Method Detail

    - #### getAnonymousTraversalClass

          public Optional<Class> getAnonymousTraversalClass()

      Specified by:
        `getAnonymousTraversalClass` in interface `TraversalSource`

    - #### getStrategies

          public TraversalStrategies getStrategies()

      Description copied from interface: `TraversalSource`
      Get the `TraversalStrategies` associated with this traversal source.
      Specified by:
        `getStrategies` in interface `TraversalSource`
      Returns:
        the traversal strategies of the traversal source

    - #### getGraph

          public Graph getGraph()

      Description copied from interface: `TraversalSource`
      Get the `Graph` associated with this traversal source.
      Specified by:
        `getGraph` in interface `TraversalSource`
      Returns:
        the graph of the traversal source

    - #### getBytecode

          public Bytecode getBytecode()

      Description copied from interface: `TraversalSource`
      Get the `Bytecode` associated with the current state of this traversal source.
      Specified by:
        `getBytecode` in interface `TraversalSource`
      Returns:
        the traversal source byte code

    - #### clone

          public GraphTraversalSource clone()

      Description copied from interface: `TraversalSource`
      The clone-method should be used to create immutable traversal sources with each call to a configuration "withXXX"-method. The clone-method should clone the `Bytecode`, `TraversalStrategies`, mutate the cloned strategies accordingly, and then return the cloned traversal source leaving the original unaltered.
      Specified by:
        `clone` in interface `TraversalSource`
      Overrides:
        `clone` in class `Object`
      Returns:
        the cloned traversal source

    - #### withStrategies

          public GraphTraversalSource withStrategies(TraversalStrategy... traversalStrategies)

      Description copied from interface: `TraversalSource`
      Add an arbitrary collection of `TraversalStrategy` instances to the traversal source.
      Specified by:
        `withStrategies` in interface `TraversalSource`
      Parameters:
        `traversalStrategies` - a collection of traversal strategies to add
      Returns:
        a new traversal source with updated strategies

    - #### withoutStrategies

          public GraphTraversalSource withoutStrategies(Class<? extends TraversalStrategy>... traversalStrategyClasses)

      Description copied from interface: `TraversalSource`
      Remove an arbitrary collection of `TraversalStrategy` classes from the traversal source.
      Specified by:
        `withoutStrategies` in interface `TraversalSource`
      Parameters:
        `traversalStrategyClasses` - a collection of traversal strategy classes to remove
      Returns:
        a new traversal source with updated strategies

    - #### withBindings

          @Deprecated
          public GraphTraversalSource withBindings(Bindings bindings)

      Deprecated.
      Description copied from interface: `TraversalSource`
      Using the provided `Bindings` to create `Bytecode.Binding`. The bindings serve as a relay for ensure bound arguments are encoded as `Bytecode.Binding` in `Bytecode`.
      Specified by:
        `withBindings` in interface `TraversalSource`
      Parameters:
        `bindings` - the bindings instance to use
      Returns:
        a new traversal source with set bindings

    - #### withComputer

          public GraphTraversalSource withComputer(Computer computer)

      Description copied from interface: `TraversalSource`
      Add a `Computer` that will generate a `GraphComputer` from the `Graph` that will be used to execute the traversal. This adds a `VertexProgramStrategy` to the strategies.
      Specified by:
        `withComputer` in interface `TraversalSource`
      Parameters:
        `computer` - a builder to generate a graph computer from the graph
      Returns:
        a new traversal source with updated strategies

    - #### withComputer

          public GraphTraversalSource withComputer(Class<? extends GraphComputer> graphComputerClass)

      Description copied from interface: `TraversalSource`
      Add a `GraphComputer` class used to execute the traversal. This adds a `VertexProgramStrategy` to the strategies.
      Specified by:
        `withComputer` in interface `TraversalSource`
      Parameters:
        `graphComputerClass` - the graph computer class
      Returns:
        a new traversal source with updated strategies

    - #### withComputer

          public GraphTraversalSource withComputer()

      Description copied from interface: `TraversalSource`
      Add the standard `GraphComputer` of the graph that will be used to execute the traversal. This adds a `VertexProgramStrategy` to the strategies.
      Specified by:
        `withComputer` in interface `TraversalSource`
      Returns:
        a new traversal source with updated strategies

    - #### withSideEffect

          public <A> GraphTraversalSource withSideEffect(String key,
                                                         Supplier<A> initialValue,
                                                         BinaryOperator<A> reducer)

      Description copied from interface: `TraversalSource`
      Add a sideEffect to be used throughout the life of a spawned `Traversal`. This adds a `SideEffectStrategy` to the strategies.
      Specified by:
        `withSideEffect` in interface `TraversalSource`
      Parameters:
        `key` - the key of the sideEffect
        `initialValue` - a supplier that produces the initial value of the sideEffect
        `reducer` - a reducer to merge sideEffect mutations into a single result
      Returns:
        a new traversal source with updated strategies

    - #### withSideEffect

          public <A> GraphTraversalSource withSideEffect(String key,
                                                         A initialValue,
                                                         BinaryOperator<A> reducer)

      Description copied from interface: `TraversalSource`
      Add a sideEffect to be used throughout the life of a spawned `Traversal`. This adds a `SideEffectStrategy` to the strategies.
      Specified by:
        `withSideEffect` in interface `TraversalSource`
      Parameters:
        `key` - the key of the sideEffect
        `initialValue` - the initial value of the sideEffect
        `reducer` - a reducer to merge sideEffect mutations into a single result
      Returns:
        a new traversal source with updated strategies

    - #### withSideEffect

          public <A> GraphTraversalSource withSideEffect(String key,
                                                         A initialValue)

      Description copied from interface: `TraversalSource`
      Add a sideEffect to be used throughout the life of a spawned `Traversal`. This adds a `SideEffectStrategy` to the strategies.
      Specified by:
        `withSideEffect` in interface `TraversalSource`
      Parameters:
        `key` - the key of the sideEffect
        `initialValue` - the initial value of the sideEffect
      Returns:
        a new traversal source with updated strategies

    - #### withSideEffect

          public <A> GraphTraversalSource withSideEffect(String key,
                                                         Supplier<A> initialValue)

      Description copied from interface: `TraversalSource`
      Add a sideEffect to be used throughout the life of a spawned `Traversal`. This adds a `SideEffectStrategy` to the strategies.
      Specified by:
        `withSideEffect` in interface `TraversalSource`
      Parameters:
        `key` - the key of the sideEffect
        `initialValue` - a supplier that produces the initial value of the sideEffect
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(Supplier<A> initialValue,
                                                   UnaryOperator<A> splitOperator,
                                                   BinaryOperator<A> mergeOperator)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - a supplier that produces the initial value of the sideEffect
        `splitOperator` - the sack split operator
        `mergeOperator` - the sack merge operator
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(A initialValue,
                                                   UnaryOperator<A> splitOperator,
                                                   BinaryOperator<A> mergeOperator)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - the initial value of the sideEffect
        `splitOperator` - the sack split operator
        `mergeOperator` - the sack merge operator
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(A initialValue)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - the initial value of the sideEffect
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(Supplier<A> initialValue)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - a supplier that produces the initial value of the sideEffect
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(Supplier<A> initialValue,
                                                   UnaryOperator<A> splitOperator)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - a supplier that produces the initial value of the sideEffect
        `splitOperator` - the sack split operator
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(A initialValue,
                                                   UnaryOperator<A> splitOperator)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - the initial value of the sideEffect
        `splitOperator` - the sack split operator
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(Supplier<A> initialValue,
                                                   BinaryOperator<A> mergeOperator)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - a supplier that produces the initial value of the sideEffect
        `mergeOperator` - the sack merge operator
      Returns:
        a new traversal source with updated strategies

    - #### withSack

          public <A> GraphTraversalSource withSack(A initialValue,
                                                   BinaryOperator<A> mergeOperator)

      Description copied from interface: `TraversalSource`
      Add a sack to be used throughout the life of a spawned `Traversal`. This adds a `SackStrategy` to the strategies.
      Specified by:
        `withSack` in interface `TraversalSource`
      Parameters:
        `initialValue` - the initial value of the sideEffect
        `mergeOperator` - the sack merge operator
      Returns:
        a new traversal source with updated strategies

    - #### withBulk

          public GraphTraversalSource withBulk(boolean useBulk)

    - #### withPath

          public GraphTraversalSource withPath()

    - #### withRemote

          public GraphTraversalSource withRemote(Configuration conf)

      Description copied from interface: `TraversalSource`
      Configures the `TraversalSource` as a "remote" to issue the `Traversal` for execution elsewhere. Expects key for `TraversalSource.GREMLIN_REMOTE_CONNECTION_CLASS` as well as any configuration required by the underlying `RemoteConnection` which will be instantiated. Note that the `Configuration` object is passed down without change to the creation of the `RemoteConnection` instance.
      Specified by:
        `withRemote` in interface `TraversalSource`

    - #### addV

          @Deprecated
          public GraphTraversal<Vertex,Vertex> addV(Object... keyValues)

      Deprecated. As of release 3.1.0, replaced by `addV()`

    - #### addV

          public GraphTraversal<Vertex,Vertex> addV(String label)

    - #### addV

          public GraphTraversal<Vertex,Vertex> addV()

    - #### inject

          public <S> GraphTraversal<S,S> inject(S... starts)

    - #### V

          public GraphTraversal<Vertex,Vertex> V(Object... vertexIds)

    - #### E

          public GraphTraversal<Edge,Edge> E(Object... edgesIds)

    - #### tx

          public Transaction tx()

    - #### close

          public void close()
                     throws Exception

      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `TraversalSource`
      Throws:
        `Exception`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### build

          @Deprecated
          public static GraphTraversalSource.Builder build()

      Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.

    - #### standard

          @Deprecated
          public static GraphTraversalSource.Builder standard()

      Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.

    - #### computer

          @Deprecated
          public static GraphTraversalSource.Builder computer()

      Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.

    - #### computer

          @Deprecated
          public static GraphTraversalSource.Builder computer(Class<? extends GraphComputer> graphComputerClass)

      Deprecated. As of release 3.2.0. Please use `Graph.traversal(Class)`.

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.