com.thinkaurelius.titan.graphdb.query.vertex

## Class MultiVertexCentricQueryBuilder

- java.lang.Object
- - com.thinkaurelius.titan.graphdb.query.vertex.BaseVertexCentricQueryBuilder<Q>
  - - com.thinkaurelius.titan.graphdb.query.vertex.BasicVertexCentricQueryBuilder<MultiVertexCentricQueryBuilder>
    - - com.thinkaurelius.titan.graphdb.query.vertex.MultiVertexCentricQueryBuilder

- All Implemented Interfaces:
    BaseVertexQuery<MultiVertexCentricQueryBuilder>, TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>

      public class MultiVertexCentricQueryBuilder
      extends BasicVertexCentricQueryBuilder<MultiVertexCentricQueryBuilder>
      implements TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>

  Implementation of `TitanMultiVertexQuery` that extends `BasicVertexCentricQueryBuilder` for all the query building and optimization and adds only the execution logic in `execute(com.thinkaurelius.titan.graphdb.internal.RelationCategory, BasicVertexCentricQueryBuilder.ResultConstructor)`. All other methods just prepare or transform that result set to fit the particular method semantics.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.thinkaurelius.titan.graphdb.query.vertex.BasicVertexCentricQueryBuilder

      `BasicVertexCentricQueryBuilder.RelationConstructor, BasicVertexCentricQueryBuilder.ResultConstructor<Q>, BasicVertexCentricQueryBuilder.VertexConstructor, BasicVertexCentricQueryBuilder.VertexIdConstructor`

  - ### Field Summary

    - ### Fields inherited from class com.thinkaurelius.titan.graphdb.query.vertex.BasicVertexCentricQueryBuilder

      `tx`

    - ### Fields inherited from class com.thinkaurelius.titan.graphdb.query.vertex.BaseVertexCentricQueryBuilder

      `adjacentVertex, constraints, dir, limit, orders, types`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiVertexCentricQueryBuilder(StandardTitanTx tx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `TitanMultiVertexQuery` | `addAllVertices(Collection<TitanVertex> vertices)` Adds the given collection of vertices to the set of vertices against which to execute this query.
    `TitanMultiVertexQuery` | `addVertex(TitanVertex vertex)` Adds the given vertex to the set of vertices against which to execute this query.
    `QueryDescription` | `describeForEdges()` Returns a description of this query for edges as a `QueryDescription` object.
    `QueryDescription` | `describeForProperties()` Returns a description of this query for properties as a `QueryDescription` object.
    `protected <Q> Map<TitanVertex,Q>` | `execute(RelationCategory returnType, BasicVertexCentricQueryBuilder.ResultConstructor<Q> resultConstructor)` Constructs the BaseVertexCentricQuery through `BasicVertexCentricQueryBuilder.constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)`.
    `Map<TitanVertex,Iterable<? extends TitanRelation>>` | `executeImplicitKeyQuery()`
    `protected MultiVertexCentricQueryBuilder` | `getThis()`
    `Map<TitanVertex,Iterable<TitanProperty>>` | `properties()` Returns an iterable over all incident properties that match this query for each vertex
    `Map<TitanVertex,Iterable<TitanRelation>>` | `relations()` Returns an iterable over all incident relations that match this query for each vertex
    `Map<TitanVertex,Iterable<TitanEdge>>` | `titanEdges()` Returns an iterable over all incident edges that match this query for each vertex
    `Map<TitanVertex,VertexList>` | `vertexIds()` Retrieves all vertices connected to each of the query's central vertices by edges matching the conditions defined in this query.
    `Map<TitanVertex,Iterable<TitanVertex>>` | `vertices()` Retrieves all vertices connected to each of the query's base vertices by edges matching the conditions defined in this query.

    - ### Methods inherited from class com.thinkaurelius.titan.graphdb.query.vertex.BasicVertexCentricQueryBuilder

      `allRepresentatives, constructQuery, constructQuery, describe, describeForRelations, edges2VertexIds, edges2Vertices, executeImplicitKeyQuery, executeRelations, executeVertexIds, executeVertices, getVertex, isPartitionedVertex, noPartitionRestriction, queryOnlyLoaded, system, useSimpleQueryProcessor`

    - ### Methods inherited from class com.thinkaurelius.titan.graphdb.query.vertex.BaseVertexCentricQueryBuilder

      `adjacent, direction, getSingleType, has, has, has, has, has, has, has, hasNot, hasNot, hasSingleType, hasTypes, interval, interval, isImplicitKeyQuery, keys, labels, limit, orderBy, orderBy, type, types, types`

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

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

    - ### Methods inherited from interface com.thinkaurelius.titan.core.TitanMultiVertexQuery

      `adjacent, direction, has, has, has, has, has, has, hasNot, hasNot, interval, interval, keys, labels, limit, orderBy, orderBy, types`

- - ### Constructor Detail

    - #### MultiVertexCentricQueryBuilder

          public MultiVertexCentricQueryBuilder(StandardTitanTx tx)

  - ### Method Detail

    - #### getThis

          protected MultiVertexCentricQueryBuilder getThis()

      Specified by:
        `getThis` in class `BaseVertexCentricQueryBuilder<MultiVertexCentricQueryBuilder>`

    - #### addVertex

          public TitanMultiVertexQuery addVertex(TitanVertex vertex)

      Description copied from interface: `TitanMultiVertexQuery`
      Adds the given vertex to the set of vertices against which to execute this query.
      Specified by:
        `addVertex` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        this query builder

    - #### addAllVertices

          public TitanMultiVertexQuery addAllVertices(Collection<TitanVertex> vertices)

      Description copied from interface: `TitanMultiVertexQuery`
      Adds the given collection of vertices to the set of vertices against which to execute this query.
      Specified by:
        `addAllVertices` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        this query builder

    - #### execute

          protected <Q> Map<TitanVertex,Q> execute(RelationCategory returnType,
                                       BasicVertexCentricQueryBuilder.ResultConstructor<Q> resultConstructor)

      Constructs the BaseVertexCentricQuery through `BasicVertexCentricQueryBuilder.constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)`. If the query asks for an implicit key, the resulting map is computed and returned directly. If the query is empty, a map that maps each vertex to an empty list is returned. Otherwise, the query is executed for all vertices through the transaction which will effectively pre-load the return result sets into the associated `CacheVertex` or don't do anything at all if the vertex is new (and hence no edges in the storage backend). After that, a map is constructed that maps each vertex to the corresponding VertexCentricQuery and wrapped into a QueryProcessor. Hence, upon iteration the query will be executed like any other VertexCentricQuery with the performance difference that the SliceQueries will have already been preloaded and not further calls to the storage backend are needed.
      Parameters:
        `returnType` -
      Returns:

    - #### executeImplicitKeyQuery

          public Map<TitanVertex,Iterable<? extends TitanRelation>> executeImplicitKeyQuery()

    - #### titanEdges

          public Map<TitanVertex,Iterable<TitanEdge>> titanEdges()

      Description copied from interface: `TitanMultiVertexQuery`
      Returns an iterable over all incident edges that match this query for each vertex
      Specified by:
        `titanEdges` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        Iterable over all incident edges that match this query for each vertex

    - #### properties

          public Map<TitanVertex,Iterable<TitanProperty>> properties()

      Description copied from interface: `TitanMultiVertexQuery`
      Returns an iterable over all incident properties that match this query for each vertex
      Specified by:
        `properties` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        Iterable over all incident properties that match this query for each vertex

    - #### relations

          public Map<TitanVertex,Iterable<TitanRelation>> relations()

      Description copied from interface: `TitanMultiVertexQuery`
      Returns an iterable over all incident relations that match this query for each vertex
      Specified by:
        `relations` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        Iterable over all incident relations that match this query for each vertex

    - #### vertices

          public Map<TitanVertex,Iterable<TitanVertex>> vertices()

      Description copied from interface: `TitanMultiVertexQuery`
      Retrieves all vertices connected to each of the query's base vertices by edges matching the conditions defined in this query.

      Specified by:
        `vertices` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        An iterable of all vertices connected to each of the query's central vertices by matching edges

    - #### vertexIds

          public Map<TitanVertex,VertexList> vertexIds()

      Description copied from interface: `TitanMultiVertexQuery`
      Retrieves all vertices connected to each of the query's central vertices by edges matching the conditions defined in this query.

      The query engine will determine the most efficient way to retrieve the vertices that match this query.
      Specified by:
        `vertexIds` in interface `TitanMultiVertexQuery<MultiVertexCentricQueryBuilder>`
      Returns:
        A list of all vertices' ids connected to each of the query's central vertex by matching edges

    - #### describeForEdges

          public QueryDescription describeForEdges()

      Description copied from interface: `BaseVertexQuery`
      Returns a description of this query for edges as a `QueryDescription` object. This can be used to inspect the query plan for this query. Note, that calling this method does not actually execute the query but only optimizes it and constructs a query plan.
      Specified by:
        `describeForEdges` in interface `BaseVertexQuery<MultiVertexCentricQueryBuilder>`
      Overrides:
        `describeForEdges` in class `BasicVertexCentricQueryBuilder<MultiVertexCentricQueryBuilder>`
      Returns:
        A description of this query for edges

    - #### describeForProperties

          public QueryDescription describeForProperties()

      Description copied from interface: `BaseVertexQuery`
      Returns a description of this query for properties as a `QueryDescription` object. This can be used to inspect the query plan for this query. Note, that calling this method does not actually execute the query but only optimizes it and constructs a query plan.
      Specified by:
        `describeForProperties` in interface `BaseVertexQuery<MultiVertexCentricQueryBuilder>`
      Overrides:
        `describeForProperties` in class `BasicVertexCentricQueryBuilder<MultiVertexCentricQueryBuilder>`
      Returns:
        A description of this query for properties

Copyright © 2012–2014. All rights reserved.