org.apache.tinkerpop.gremlin.neo4j.structure

## Class Neo4jGraph

- java.lang.Object
- - org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph

- All Implemented Interfaces:
    AutoCloseable, Graph, Host, WrappedGraph<Neo4jGraphAPI>

      public final class Neo4jGraph
      extends Object
      implements Graph, WrappedGraph<Neo4jGraphAPI>

  Author:
    Stephen Mallette (http://stephen.genoprime.com), Marko A. Rodriguez (http://markorodriguez.com), Pieter Martin

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Neo4jGraph.Neo4jGraphFeatures`

    - ### Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.Graph

      `Graph.Exceptions, Graph.Features, Graph.Hidden, Graph.OptIn, Graph.OptIns, Graph.OptOut, Graph.OptOuts, Graph.Variables`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Neo4jGraphAPI` | `baseGraph`
    `static String` | `CONFIG_CONF`
    `static String` | `CONFIG_DIRECTORY`
    `static String` | `CONFIG_META_PROPERTIES`
    `static String` | `CONFIG_MULTI_PROPERTIES`
    `protected BaseConfiguration` | `configuration`
    `protected Graph.Features` | `features`
    `static Logger` | `LOGGER`
    `protected Neo4jTrait` | `trait`

    - ### Fields inherited from interface org.apache.tinkerpop.gremlin.structure.Graph

      `GRAPH`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Neo4jGraph(Configuration configuration)`
    `protected` | `Neo4jGraph(Neo4jGraphAPI baseGraph, Configuration configuration)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Vertex` | `addVertex(Object... keyValues)` Add a `Vertex` to the graph given an optional series of key/value pairs.
    `void` | `close()` This implementation of `close` will also close the current transaction on the thread, but it is up to the caller to deal with dangling transactions in other threads prior to calling this method.
    `GraphComputer` | `compute()` Generate a `GraphComputer` using the default engine of the underlying graph system.
    `<C extends GraphComputer> C` | `compute(Class<C> graphComputerClass)` Declare the `GraphComputer` to use for OLAP operations on the graph.
    `Configuration` | `configuration()` Get the `org.apache.commons.configuration.Configuration` associated with the construction of this graph.
    `<S,E> GraphTraversal<S,E>` | `cypher(String query)` Execute the Cypher query and get the result set as a `GraphTraversal`.
    `<S,E> GraphTraversal<S,E>` | `cypher(String query, Map<String,Object> parameters)` Execute the Cypher query with provided parameters and get the result set as a `GraphTraversal`.
    `Iterator<Edge>` | `edges(Object... edgeIds)` Get the `Edge` objects in this graph with the provided edge ids or `Edge` objects.
    `Graph.Features` | `features()` Gets the `Graph.Features` exposed by the underlying `Graph` implementation.
    `Neo4jGraphAPI` | `getBaseGraph()`
    `Neo4jTrait` | `getTrait()`
    `static Neo4jGraph` | `open(Configuration configuration)` Open a new `Neo4jGraph` instance.
    `static Neo4jGraph` | `open(Neo4jGraphAPI baseGraph)` Construct a Neo4jGraph instance using an existing Neo4j raw instance.
    `String` | `toString()`
    `Transaction` | `tx()` Configure and control the transactions for those graphs that support this feature.
    `Graph.Variables` | `variables()` A collection of global `Graph.Variables` associated with the graph.
    `Iterator<Vertex>` | `vertices(Object... vertexIds)` Get the `Vertex` objects in this graph with the provided vertex ids or `Vertex` objects themselves.

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

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

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.structure.Graph

      `addVertex, io, traversal, traversal`

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.structure.util.Host

      `getHostingVertex`

- - ### Field Detail

    - #### LOGGER

          public static final Logger LOGGER

    - #### features

          protected Graph.Features features

    - #### baseGraph

          protected Neo4jGraphAPI baseGraph

    - #### configuration

          protected BaseConfiguration configuration

    - #### CONFIG_DIRECTORY

          public static final String CONFIG_DIRECTORY

      See Also:
        Constant Field Values

    - #### CONFIG_CONF

          public static final String CONFIG_CONF

      See Also:
        Constant Field Values

    - #### CONFIG_META_PROPERTIES

          public static final String CONFIG_META_PROPERTIES

      See Also:
        Constant Field Values

    - #### CONFIG_MULTI_PROPERTIES

          public static final String CONFIG_MULTI_PROPERTIES

      See Also:
        Constant Field Values

    - #### trait

          protected Neo4jTrait trait

  - ### Constructor Detail

    - #### Neo4jGraph

          protected Neo4jGraph(Neo4jGraphAPI baseGraph,
                               Configuration configuration)

    - #### Neo4jGraph

          protected Neo4jGraph(Configuration configuration)

  - ### Method Detail

    - #### open

          public static Neo4jGraph open(Configuration configuration)

      Open a new `Neo4jGraph` instance.
      Parameters:
        `configuration` - the configuration for the instance
      Returns:
        a newly opened `Graph`

    - #### open

          public static Neo4jGraph open(Neo4jGraphAPI baseGraph)

      Construct a Neo4jGraph instance using an existing Neo4j raw instance.

    - #### addVertex

          public Vertex addVertex(Object... keyValues)

      Description copied from interface: `Graph`
      Add a `Vertex` to the graph given an optional series of key/value pairs. These key/values must be provided in an even number where the odd numbered arguments are `String` property keys and the even numbered arguments are the related property values.
      Specified by:
        `addVertex` in interface `Graph`
      Parameters:
        `keyValues` - The key/value pairs to turn into vertex properties
      Returns:
        The newly created vertex

    - #### vertices

          public Iterator<Vertex> vertices(Object... vertexIds)

      Description copied from interface: `Graph`
      Get the `Vertex` objects in this graph with the provided vertex ids or `Vertex` objects themselves. If no ids are provided, get all vertices. Note that a vertex identifier does not need to correspond to the actual id used in the graph. It needs to be a bit more flexible than that in that given the `Graph.Features` around id support, multiple arguments might be applicable here.

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsNumericIds()` then it should support filters as with:
      - g.vertices(v)
      - g.vertices(v.id())
      - g.vertices(1)
      - g.vertices(1L)
      - g.vertices(1.0d)
      - g.vertices(1.0f)
      - g.vertices("1")

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsCustomIds()` ()} then it should support filters as with:
      - g.vertices(v)
      - g.vertices(v.id())
      - g.vertices(v.id().toString())

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsAnyIds()` ()} then it should support filters as with:
      - g.vertices(v)
      - g.vertices(v.id())

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsStringIds()` ()} then it should support filters as with:
      - g.vertices(v)
      - g.vertices(v.id().toString())
      - g.vertices("id")

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsStringIds()` ()} then it should support filters as with:
      - g.vertices(v)
      - g.vertices(v.id().toString())
      - g.vertices("id")
      Specified by:
        `vertices` in interface `Graph`
      Parameters:
        `vertexIds` - the ids of the vertices to get
      Returns:
        an `Iterator` of vertices that match the provided vertex ids

    - #### edges

          public Iterator<Edge> edges(Object... edgeIds)

      Description copied from interface: `Graph`
      Get the `Edge` objects in this graph with the provided edge ids or `Edge` objects. If no ids are provided, get all edges. Note that an edge identifier does not need to correspond to the actual id used in the graph. It needs to be a bit more flexible than that in that given the `Graph.Features` around id support, multiple arguments might be applicable here.

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsNumericIds()` then it should support filters as with:
      - g.edges(e)
      - g.edges(e.id())
      - g.edges(1)
      - g.edges(1L)
      - g.edges(1.0d)
      - g.edges(1.0f)
      - g.edges("1")

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsCustomIds()` ()} then it should support filters as with:
      - g.edges(e)
      - g.edges(e.id())
      - g.edges(e.id().toString())

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsAnyIds()` ()} then it should support filters as with:
      - g.edges(e)
      - g.edges(e.id())

      If the graph return `true` for `Graph.Features.ElementFeatures.supportsStringIds()` ()} then it should support filters as with:
      - g.edges(e)
      - g.edges(e.id().toString())
      - g.edges("id")
      Specified by:
        `edges` in interface `Graph`
      Parameters:
        `edgeIds` - the ids of the edges to get
      Returns:
        an `Iterator` of edges that match the provided edge ids

    - #### getTrait

          public Neo4jTrait getTrait()

    - #### compute

          public <C extends GraphComputer> C compute(Class<C> graphComputerClass)

      Description copied from interface: `Graph`
      Declare the `GraphComputer` to use for OLAP operations on the graph. If the graph does not support graph computer then an `UnsupportedOperationException` is thrown.
      Specified by:
        `compute` in interface `Graph`
      Parameters:
        `graphComputerClass` - The graph computer class to use.
      Returns:
        A graph computer for processing this graph

    - #### compute

          public GraphComputer compute()

      Description copied from interface: `Graph`
      Generate a `GraphComputer` using the default engine of the underlying graph system. This is a shorthand method for the more involved method that uses `Graph.compute(Class)`.
      Specified by:
        `compute` in interface `Graph`
      Returns:
        A default graph computer

    - #### tx

          public Transaction tx()

      Description copied from interface: `Graph`
      Configure and control the transactions for those graphs that support this feature. Note that this method does not indicate the creation of a "transaction" object. A `Transaction` in the TinkerPop context is a transaction "factory" or "controller" that helps manage transactions owned by the underlying graph database.
      Specified by:
        `tx` in interface `Graph`

    - #### variables

          public Graph.Variables variables()

      Description copied from interface: `Graph`
      A collection of global `Graph.Variables` associated with the graph. Variables are used for storing metadata about the graph.
      Specified by:
        `variables` in interface `Graph`
      Returns:
        The variables associated with this graph

    - #### configuration

          public Configuration configuration()

      Description copied from interface: `Graph`
      Get the `org.apache.commons.configuration.Configuration` associated with the construction of this graph. Whatever configuration was passed to `GraphFactory#open(org.apache.commons.configuration.Configuration)` is what should be returned by this method.
      Specified by:
        `configuration` in interface `Graph`
      Returns:
        the configuration used during graph construction.

    - #### close

          public void close()
                     throws Exception

      This implementation of `close` will also close the current transaction on the thread, but it is up to the caller to deal with dangling transactions in other threads prior to calling this method.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Graph`
      Throws:
        `Exception`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### features

          public Graph.Features features()

      Description copied from interface: `Graph`
      Gets the `Graph.Features` exposed by the underlying `Graph` implementation.
      Specified by:
        `features` in interface `Graph`

    - #### getBaseGraph

          public Neo4jGraphAPI getBaseGraph()

      Specified by:
        `getBaseGraph` in interface `WrappedGraph<Neo4jGraphAPI>`

    - #### cypher

          public <S,E> GraphTraversal<S,E> cypher(String query)

      Execute the Cypher query and get the result set as a `GraphTraversal`.
      Parameters:
        `query` - the Cypher query to execute
      Returns:
        a fluent Gremlin traversal

    - #### cypher

          public <S,E> GraphTraversal<S,E> cypher(String query,
                                                  Map<String,Object> parameters)

      Execute the Cypher query with provided parameters and get the result set as a `GraphTraversal`.
      Parameters:
        `query` - the Cypher query to execute
        `parameters` - the parameters of the Cypher query
      Returns:
        a fluent Gremlin traversal

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