ExecutionResult (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.cypher.javacompat

## Class ExecutionResult

- java.lang.Object
- - org.neo4j.cypher.javacompat.ExecutionResult

- All Implemented Interfaces:
    Iterable<Map<String,Object>>, ResourceIterable<Map<String,Object>>

      public class ExecutionResult
      extends Object
      implements ResourceIterable<Map<String,Object>>

  Holds Cypher query result sets, in tabular form. Each row of the result is a map of column name to result object. Each column name correlates directly with the terms used in the "return" clause of the Cypher query. The result objects could be `Nodes`, `Relationships` or java primitives. Either iterate directly over the ExecutionResult to retrieve each row of the result set, or use `columnAs()` to access a single column with result objects cast to a type.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExecutionResult(org.neo4j.cypher.ExecutionResult projection)` Constructor used by the Cypher framework.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> ResourceIterator<T>` | `columnAs(String n)` Returns an iterator with the result objects from a single column of the result set.
    `List<String>` | `columns()` The exact names used to represent each column in the result set.
    `String` | `dumpToString()` Provides a textual representation of the query result.
    `org.neo4j.cypher.javacompat.PlanDescription` | `executionPlanDescription()` Returns a string representation of the query plan used to produce this result.
    `QueryStatistics` | `getQueryStatistics()` Returns statistics about this result.
    `ResourceIterator<Map<String,Object>>` | `iterator()` Returns an iterator over the return clause of the query.
    `String` | `toString()`
    `void` | `toString(PrintWriter writer)`

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

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

- - ### Constructor Detail

    - #### ExecutionResult

          public ExecutionResult(org.neo4j.cypher.ExecutionResult projection)

      Constructor used by the Cypher framework. End-users should not create an ExecutionResult directly, but instead use the result returned from calling `ExecutionEngine.execute(String)`.
      Parameters:
        `projection` -

  - ### Method Detail

    - #### columnAs

          public <T> ResourceIterator<T> columnAs(String n)

      Returns an iterator with the result objects from a single column of the result set. This method is best used for single column results.

      To ensure that any resources, including transactions bound to it, are properly closed, the iterator must either be fully exhausted, or the `close()` method must be called.

      Type Parameters:
        `T` - desired type cast for the result objects
      Parameters:
        `n` - exact name of the column, as it appeared in the original query
      Returns:
        an iterator of the result objects, possibly empty
      Throws:
        `ClassCastException` - when the result object can not be cast to the requested type
        `NotFoundException` - when the column name does not appear in the original query

    - #### columns

          public List<String> columns()

      The exact names used to represent each column in the result set.
      Returns:
        List of the column names.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### dumpToString

          public String dumpToString()

      Provides a textual representation of the query result.

      The execution result represented by this object will be consumed in its entirety after this method is called. Calling any of the other iterating methods on it should not be expected to return any results.

      Returns:
        Returns the execution result

    - #### getQueryStatistics

          public QueryStatistics getQueryStatistics()

      Returns statistics about this result.
      Returns:
        statistics about this result

    - #### executionPlanDescription

          public org.neo4j.cypher.javacompat.PlanDescription executionPlanDescription()

      Returns a string representation of the query plan used to produce this result.
      Returns:
        a string representation of the query plan used to produce this result.

    - #### toString

          public void toString(PrintWriter writer)

    - #### iterator

          public ResourceIterator<Map<String,Object>> iterator()

      Returns an iterator over the return clause of the query. The format is a map that has as keys the names of the columns or their explicit names (set via 'as') and the value is the calculated value. Each iterator item is one row of the query result.

      To ensure that any resources, including transactions bound to it, are properly closed, the iterator must either be fully exhausted, or the `close()` method must be called.

      Specified by:
        `iterator` in interface `Iterable<Map<String,Object>>`
      Specified by:
        `iterator` in interface `ResourceIterable<Map<String,Object>>`
      Returns:
        An iterator over the result of the query as a map from projected column name to value

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.