com.thinkaurelius.titan.graphdb.query.vertex

## Class BaseVertexCentricQueryBuilder<Q extends BaseVertexQuery<Q>>

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

- All Implemented Interfaces:
    BaseVertexQuery<Q>
  Direct Known Subclasses:
    BasicVertexCentricQueryBuilder

      public abstract class BaseVertexCentricQueryBuilder<Q extends BaseVertexQuery<Q>>
      extends Object
      implements BaseVertexQuery<Q>

  Builds a `BaseVertexQuery`, optimizes the query and compiles the result into a `BaseVertexCentricQuery` which is then executed by one of the extending classes.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TitanVertex` | `adjacentVertex` The vertex to be used for the adjacent vertex constraint.
    `protected List<PredicateCondition<String,TitanRelation>>` | `constraints` The constraints added to this query.
    `protected com.tinkerpop.blueprints.Direction` | `dir` The direction of this query.
    `protected int` | `limit` The limit of this query.
    `protected OrderList` | `orders` The order in which the relations should be returned.
    `protected String[]` | `types` The relation types (labels or keys) to query for.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BaseVertexCentricQueryBuilder(TypeSource typeSource)`

  - ### 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.
    `protected RelationType` | `getSingleType()`
    `protected abstract Q` | `getThis()`
    `protected abstract TitanVertex` | `getVertex(long vertexid)`
    `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.
    `<T extends Comparable<T>> Q` | `has(String key, T value, com.tinkerpop.blueprints.Query.Compare compare)` Deprecated.
    `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.
    `protected boolean` | `hasSingleType()`
    `protected boolean` | `hasTypes()`
    `<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).
    `protected boolean` | `isImplicitKeyQuery(RelationCategory returnType)` Whether this query is asking for the value of an `ImplicitKey`.
    `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).
    `Q` | `type(RelationType type)`
    `Q` | `types(RelationType... types)` Query for only those relations matching one of the given relation types.
    `Q` | `types(String... 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.BaseVertexQuery

      `describeForEdges, describeForProperties`

- - ### Field Detail

    - #### dir

          protected com.tinkerpop.blueprints.Direction dir

      The direction of this query. BOTH by default

    - #### types

          protected String[] types

      The relation types (labels or keys) to query for. None by default which means query for any relation type.

    - #### constraints

          protected List<PredicateCondition<String,TitanRelation>> constraints

      The constraints added to this query. None by default.

    - #### adjacentVertex

          protected TitanVertex adjacentVertex

      The vertex to be used for the adjacent vertex constraint. If null, that means no such constraint. Null by default.

    - #### orders

          protected OrderList orders

      The order in which the relations should be returned. None by default.

    - #### limit

          protected int limit

      The limit of this query. No limit by default.

  - ### Constructor Detail

    - #### BaseVertexCentricQueryBuilder

          protected BaseVertexCentricQueryBuilder(TypeSource typeSource)

  - ### Method Detail

    - #### getThis

          protected abstract Q getThis()

    - #### getVertex

          protected abstract TitanVertex getVertex(long vertexid)

    - #### adjacent

          public 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 BaseVertexQuery<Q>>`
      Returns:
        this query builder

    - #### has

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `key` - key
        `value` - Value for the property of the given key to match
      Returns:
        this query

    - #### has

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `label` - Label
        `vertex` - Vertex to point unidirectional edge to
      Returns:
        this query

    - #### has

          public 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 BaseVertexQuery<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

          public 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 BaseVertexQuery<Q>>`
      Returns:

    - #### has

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `key` - property key
        `predicate` - boolean relationship to satisfy with the given value
        `value` - value
      Returns:

    - #### has

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `key` - property key
        `predicate` - boolean relationship to satisfy with the given value
        `value` - value
      Returns:

    - #### has

          public 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 BaseVertexQuery<Q>>`
      Returns:
        this query

    - #### hasNot

          public 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 BaseVertexQuery<Q>>`
      Returns:
        this query

    - #### interval

          public <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 BaseVertexQuery<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

          public <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 BaseVertexQuery<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

    - #### has

          @Deprecated
          public <T extends Comparable<T>> Q has(String key,
                                                   T value,
                                                   com.tinkerpop.blueprints.Query.Compare compare)

      Deprecated.

    - #### types

          public Q types(RelationType... types)

      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 BaseVertexQuery<Q>>`
      Parameters:
        `types` - relation types to query for
      Returns:
        this query

    - #### labels

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `labels` - edge labels to query for
      Returns:
        this query

    - #### keys

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `keys` - property keys to query for
      Returns:
        this query

    - #### type

          public Q type(RelationType type)

    - #### types

          public Q types(String... types)

    - #### direction

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `d` - Direction to query for
      Returns:
        this query

    - #### limit

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `limit` - maximum number of relations to retrieve for this query
      Returns:
        this query

    - #### orderBy

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `key` - The key of the properties on which to order
        `order` - the ordering direction
      Returns:

    - #### orderBy

          public 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 BaseVertexQuery<Q>>`
      Parameters:
        `key` - The key of the properties on which to order
        `order` - the ordering direction
      Returns:

    - #### hasTypes

          protected final boolean hasTypes()

    - #### hasSingleType

          protected final boolean hasSingleType()

    - #### getSingleType

          protected final RelationType getSingleType()

    - #### isImplicitKeyQuery

          protected final boolean isImplicitKeyQuery(RelationCategory returnType)

      Whether this query is asking for the value of an `ImplicitKey`. Handling of implicit keys is completely distinct from "normal" query execution and handled extra for completeness reasons.
      Parameters:
        `returnType` -
      Returns:

Copyright © 2012–2014. All rights reserved.