com.thinkaurelius.titan.core.olap

## Interface OLAPQueryBuilder<S,M,Q extends OLAPQueryBuilder<S,M,Q>>

- All Superinterfaces:
    BaseVertexQuery<Q>

      public interface OLAPQueryBuilder<S,M,Q extends OLAPQueryBuilder<S,M,Q>>
      extends BaseVertexQuery<Q>

  Builds a vertex-centric query to define the edges and/or properties that will be retrieved for each vertex as part of the OLAP operation and aggregated into a single property on the central vertex which is accessible via `TitanElement.getProperty(String)` in the `OLAPJob`.

  This query builder, just like `BaseVertexQuery`, allows the specification of the edges and properties to be received. However, unlike an OLTP query, the edges are not returned individually but aggregated into one state using the `Gather` and `Combiner` functions specified in `edges(Gather, Combiner)` and `properties(com.google.common.base.Function, Combiner)`, respectively. That state, is then accessible as a property on the central vertex. The key to access that property is the name defined in the `setName(String)` method. If no name is explicitly set, the name of the edge label or property key is used if only one such type is specified - otherwise a missing name exception is thrown.

  In essence, this query defines a subset of each vertex's adjacency list along which to aggregate state information which can include the adjacent vertex's state as well as any edge properties. This query defines the vertex's adjacency sub-list and how to aggregate the state.
  Author:
    Matthias Broecheler (me@matthiasb.com)
  See Also:
    `TitanVertexQuery`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Q` | `adjacent(TitanVertex vertex)` Restricts this query to only those edges that point to the given vertex.
    `Q` | `direction(com.tinkerpop.blueprints.Direction d)` Query only for relations in the given direction.
    `OLAPJobBuilder<S>` | `edges(Combiner<S> combiner)` Identical to `edges(Gather, Combiner)` using the default gather function which simply returns the adjacent vertex's state.
    `<M> OLAPJobBuilder<S>` | `edges(Gather<S,M> gather, Combiner<M> combiner)` Defines an adjacency aggregate over the edges identified by this query.
    `Q` | `has(EdgeLabel label, TitanVertex vertex)` Query only for edges or properties that have a unidirected edge pointing to the given vertex It is expected that this label is unidirected (`EdgeLabel.isUnidirected()` and the query is restricted to edges or properties having an incident unidirectional edge pointing to the given vertex.
    `Q` | `has(PropertyKey key, Object value)` Query only for edges or properties that have an incident property matching the given value.
    `Q` | `has(PropertyKey key, com.tinkerpop.blueprints.Predicate predicate, Object value)` Query only for those edges or properties which have a property for the given key that satisfies the specified predicate relationship to the provided value.
    `Q` | `has(String key)` Query for edges or properties that have defined property with the given key
    `Q` | `has(String type, Object value)` Query only for edges or properties that have an incident property or unidirected edge matching the given value.
    `Q` | `has(String key, com.tinkerpop.blueprints.Predicate predicate, Object value)` Query only for those edges or properties which have a property for the given key that satisfies the specified predicate relationship to the provided value.
    `Q` | `hasNot(String key)` Query for edges or properties that DO NOT have a defined property with the given key
    `Q` | `hasNot(String key, Object value)` Identical to `BaseVertexQuery.has(String, Object)` but negates the condition, i.e.
    `<T extends Comparable<?>> Q` | `interval(PropertyKey key, T start, T end)` Query for those edges or properties that have a property for the given key whose values lies in the interval by [start,end).
    `<T extends Comparable<?>> Q` | `interval(String key, T start, T end)` Query for those edges or properties that have a property for the given key whose values lies in the interval by [start,end).
    `Q` | `keys(String... keys)` Query for only those properties having one of the given property keys.
    `Q` | `labels(String... labels)` Query for only those edges matching one of the given edge labels.
    `Q` | `limit(int limit)` Sets the retrieval limit for this query.
    `Q` | `orderBy(PropertyKey key, Order order)` Orders the relation results of this query according to their property for the given key in the given order (increasing/decreasing).
    `Q` | `orderBy(String key, Order order)` Orders the relation results of this query according to their property for the given key in the given order (increasing/decreasing).
    `OLAPJobBuilder<S>` | `properties()` Identical to `properties(com.google.common.base.Function, Combiner)` using default gather and combiner functions.
    `OLAPJobBuilder<S>` | `properties(Combiner<Object> combiner)` Identical to `properties(com.google.common.base.Function, Combiner)` using a default gather function which simply returns the value of the property.
    `<M> OLAPJobBuilder<S>` | `properties(com.google.common.base.Function<TitanProperty,M> gather, Combiner<M> combiner)` Defines an adjacency aggregate over the properties identified by this query.
    `Q` | `setName(String name)` Set's the name for this query.
    `Q` | `types(RelationType... type)` Query for only those relations matching one of the given relation types.

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

      `describeForEdges, describeForProperties`

- - ### Method Detail

    - #### setName

          Q setName(String name)

      Set's the name for this query. The queries aggregate result will be accessible as a property on each vertex in an `OLAPJob` using this name as the key. Hence, it should be ensured that this name is unique and does not conflict with the names of any types defined in the graph.

      A name must always be specified, unless this query retrieves only one type in which case the name of that type will be used by default unless explicitly overwritten with this method.
      Parameters:
        `name` - Name for this query
      Returns:

    - #### edges

          <M> OLAPJobBuilder<S> edges(Gather<S,M> gather,
                                    Combiner<M> combiner)

      Defines an adjacency aggregate over the edges identified by this query. The gather function is applied to all edges and the adjacent vertex's state in that result set and the returned states are combined with the specified combiner.
      Type Parameters:
        `M` -
      Parameters:
        `gather` - Function used to gather the edges and adjacent states
        `combiner` - Function used to combine the gathered states
      Returns:
        the builder for this OLAPJob

    - #### edges

          OLAPJobBuilder<S> edges(Combiner<S> combiner)

      Identical to `edges(Gather, Combiner)` using the default gather function which simply returns the adjacent vertex's state.
      Parameters:
        `combiner` - Combiner method for combining gathered messages
      Returns:
        the builder for this OLAPJob

    - #### properties

          <M> OLAPJobBuilder<S> properties(com.google.common.base.Function<TitanProperty,M> gather,
                                         Combiner<M> combiner)

      Defines an adjacency aggregate over the properties identified by this query. The gather function is applied to all properties in that result set and the returned states are combined with the specified combiner.
      Type Parameters:
        `M` -
      Parameters:
        `gather` - Function used to gather the properties
        `combiner` - Function used to combine the gathered states
      Returns:
        the builder for this OLAPJob

    - #### properties

          OLAPJobBuilder<S> properties(Combiner<Object> combiner)

      Identical to `properties(com.google.common.base.Function, Combiner)` using a default gather function which simply returns the value of the property.
      Parameters:
        `combiner` - Combiner method for combining the values of all adjacent properties.
      Returns:
        the builder for this OLAPJob

    - #### properties

          OLAPJobBuilder<S> properties()

      Identical to `properties(com.google.common.base.Function, Combiner)` using default gather and combiner functions. The gather function retrieves the values of the adjacent properties. If this query only specifies one single-valued property key, the combiner function just returns that one value. If multiple values are possible, the combiner function aggregates those values into one list.
      Returns:
        the builder for this OLAPJob

    - #### adjacent

          Q adjacent(TitanVertex vertex)

      Description copied from interface: `BaseVertexQuery`
      Restricts this query to only those edges that point to the given vertex.
      Specified by:
        `adjacent` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Returns:
        this query builder

    - #### types

          Q types(RelationType... type)

      Description copied from interface: `BaseVertexQuery`
      Query for only those relations matching one of the given relation types. By default, a query includes all relations in the result set.
      Specified by:
        `types` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `type` - relation types to query for
      Returns:
        this query

    - #### labels

          Q labels(String... labels)

      Description copied from interface: `BaseVertexQuery`
      Query for only those edges matching one of the given edge labels. By default, an edge query includes all edges in the result set.
      Specified by:
        `labels` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `labels` - edge labels to query for
      Returns:
        this query

    - #### keys

          Q keys(String... keys)

      Description copied from interface: `BaseVertexQuery`
      Query for only those properties having one of the given property keys. By default, a query includes all properties in the result set.
      Specified by:
        `keys` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `keys` - property keys to query for
      Returns:
        this query

    - #### direction

          Q direction(com.tinkerpop.blueprints.Direction d)

      Description copied from interface: `BaseVertexQuery`
      Query only for relations in the given direction. By default, both directions are queried.
      Specified by:
        `direction` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `d` - Direction to query for
      Returns:
        this query

    - #### has

          Q has(PropertyKey key,
              Object value)

      Description copied from interface: `BaseVertexQuery`
      Query only for edges or properties that have an incident property matching the given value.

      Specified by:
        `has` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - key
        `value` - Value for the property of the given key to match
      Returns:
        this query

    - #### has

          Q has(EdgeLabel label,
              TitanVertex vertex)

      Description copied from interface: `BaseVertexQuery`
      Query only for edges or properties that have a unidirected edge pointing to the given vertex

      It is expected that this label is unidirected (`EdgeLabel.isUnidirected()` and the query is restricted to edges or properties having an incident unidirectional edge pointing to the given vertex.
      Specified by:
        `has` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `label` - Label
        `vertex` - Vertex to point unidirectional edge to
      Returns:
        this query

    - #### has

          Q has(String key)

      Description copied from interface: `BaseVertexQuery`
      Query for edges or properties that have defined property with the given key
      Specified by:
        `has` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Returns:
        this query

    - #### hasNot

          Q hasNot(String key)

      Description copied from interface: `BaseVertexQuery`
      Query for edges or properties that DO NOT have a defined property with the given key
      Specified by:
        `hasNot` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Returns:
        this query

    - #### has

          Q has(String type,
              Object value)

      Description copied from interface: `BaseVertexQuery`
      Query only for edges or properties that have an incident property or unidirected edge matching the given value.

      If type is a property key, then the query is restricted to edges or properties having an incident property matching this key-value pair. If type is an edge label, then it is expected that this label is unidirected (`EdgeLabel.isUnidirected()` and the query is restricted to edges or properties having an incident unidirectional edge pointing to the value which is expected to be a `TitanVertex`.
      Specified by:
        `has` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `type` - TitanType name
        `value` - Value for the property of the given key to match, or vertex to point unidirectional edge to
      Returns:
        this query

    - #### hasNot

          Q hasNot(String key,
                 Object value)

      Description copied from interface: `BaseVertexQuery`
      Identical to `BaseVertexQuery.has(String, Object)` but negates the condition, i.e. matches those edges or properties that DO NOT satisfy this property condition.
      Specified by:
        `hasNot` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Returns:

    - #### has

          Q has(PropertyKey key,
              com.tinkerpop.blueprints.Predicate predicate,
              Object value)

      Description copied from interface: `BaseVertexQuery`
      Query only for those edges or properties which have a property for the given key that satisfies the specified predicate relationship to the provided value.
      Specified by:
        `has` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - property key
        `predicate` - boolean relationship to satisfy with the given value
        `value` - value
      Returns:

    - #### has

          Q has(String key,
              com.tinkerpop.blueprints.Predicate predicate,
              Object value)

      Description copied from interface: `BaseVertexQuery`
      Query only for those edges or properties which have a property for the given key that satisfies the specified predicate relationship to the provided value.
      Specified by:
        `has` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - property key
        `predicate` - boolean relationship to satisfy with the given value
        `value` - value
      Returns:

    - #### interval

          <T extends Comparable<?>> Q interval(String key,
                                             T start,
                                             T end)

      Description copied from interface: `BaseVertexQuery`
      Query for those edges or properties that have a property for the given key whose values lies in the interval by [start,end).
      Specified by:
        `interval` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - property key
        `start` - value defining the start of the interval (inclusive)
        `end` - value defining the end of the interval (exclusive)
      Returns:
        this query

    - #### interval

          <T extends Comparable<?>> Q interval(PropertyKey key,
                                             T start,
                                             T end)

      Description copied from interface: `BaseVertexQuery`
      Query for those edges or properties that have a property for the given key whose values lies in the interval by [start,end).
      Specified by:
        `interval` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - property key
        `start` - value defining the start of the interval (inclusive)
        `end` - value defining the end of the interval (exclusive)
      Returns:
        this query

    - #### limit

          Q limit(int limit)

      Description copied from interface: `BaseVertexQuery`
      Sets the retrieval limit for this query.

      When setting a limit, executing this query will only retrieve the specified number of relations. Note, that this also applies to counts.
      Specified by:
        `limit` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `limit` - maximum number of relations to retrieve for this query
      Returns:
        this query

    - #### orderBy

          Q orderBy(String key,
                  Order order)

      Description copied from interface: `BaseVertexQuery`
      Orders the relation results of this query according to their property for the given key in the given order (increasing/decreasing). Note, that the ordering always applies to the incident relations (edges/properties) and NOT to the adjacent vertices even if only vertices are being returned.
      Specified by:
        `orderBy` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - The key of the properties on which to order
        `order` - the ordering direction
      Returns:

    - #### orderBy

          Q orderBy(PropertyKey key,
                  Order order)

      Description copied from interface: `BaseVertexQuery`
      Orders the relation results of this query according to their property for the given key in the given order (increasing/decreasing). Note, that the ordering always applies to the incident relations (edges/properties) and NOT to the adjacent vertices even if only vertices are being returned.
      Specified by:
        `orderBy` in interface `BaseVertexQuery<Q extends OLAPQueryBuilder<S,M,Q>>`
      Parameters:
        `key` - The key of the properties on which to order
        `order` - the ordering direction
      Returns:

Copyright © 2012–2014. All rights reserved.