com.thinkaurelius.titan.core.schema

## Interface TitanManagement

- All Superinterfaces:
    TitanConfiguration
  All Known Implementing Classes:
    ManagementSystem

      public interface TitanManagement
      extends TitanConfiguration

  The TitanManagement interface provides methods to define, update, and inspect the schema of a Titan graph. It wraps a `TitanTransaction` and therefore copies many of its methods as they relate to schema inspection and definition.

  TitanManagement behaves like a transaction in that it opens a transactional scope for reading the schema and making changes to it. As such, it needs to be explicitly closed via its `commit()` or `rollback()` methods. A TitanManagement transaction is opened on a graph via `TitanGraph.getManagementSystem()`.

  TitanManagement provides methods to:
  - Schema Types: View, update, and create vertex labels, edge labels, and property keys
  - Relation Type Index: View and create vertex-centric indexes on edge labels and property keys
  - Graph Index: View and create graph-wide indexes for efficient element retrieval
  - Consistency Management: Set the consistency level of individual schema elements
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `TitanManagement.IndexBuilder` Builder for `TitanGraphIndex`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addIndexKey(TitanGraphIndex index, PropertyKey key, Parameter... parameters)`
    `RelationTypeIndex` | `buildEdgeIndex(EdgeLabel label, String name, com.tinkerpop.blueprints.Direction direction, Order sortOrder, RelationType... sortKeys)` Creates a `RelationTypeIndex` for the provided edge label.
    `RelationTypeIndex` | `buildEdgeIndex(EdgeLabel label, String name, com.tinkerpop.blueprints.Direction direction, RelationType... sortKeys)` Identical to `buildEdgeIndex(com.thinkaurelius.titan.core.EdgeLabel, String, com.tinkerpop.blueprints.Direction, com.thinkaurelius.titan.core.Order, com.thinkaurelius.titan.core.RelationType...)` with default sort order `Order.ASC`.
    `TitanManagement.IndexBuilder` | `buildIndex(String indexName, Class<? extends com.tinkerpop.blueprints.Element> elementType)` Returns an `TitanManagement.IndexBuilder` to add a graph index to this Titan graph.
    `RelationTypeIndex` | `buildPropertyIndex(PropertyKey key, String name, Order sortOrder, RelationType... sortKeys)` Creates a `RelationTypeIndex` for the provided property key.
    `RelationTypeIndex` | `buildPropertyIndex(PropertyKey key, String name, RelationType... sortKeys)` Identical to `buildPropertyIndex(com.thinkaurelius.titan.core.PropertyKey, String, com.thinkaurelius.titan.core.Order, com.thinkaurelius.titan.core.RelationType...)` with default sort order `Order.ASC`.
    `void` | `changeName(TitanSchemaElement element, String newName)` Changes the name of a `TitanSchemaElement` to the provided new name.
    `void` | `commit()` Commits this management transaction and persists all schema changes.
    `boolean` | `containsGraphIndex(String name)` Whether the graph has a graph index defined with the given name.
    `boolean` | `containsRelationIndex(RelationType type, String name)` Whether a `RelationTypeIndex` with the given name has been defined for the provided `RelationType`
    `boolean` | `containsRelationType(String name)` Identical to `TitanTransaction.containsRelationType(String)`
    `boolean` | `containsVertexLabel(String name)` Identical to `TitanTransaction.containsVertexLabel(String)`
    `void` | `forceCloseInstance(String instanceId)` Forcefully removes a Titan instance from this graph cluster as identified by its name.
    `ConsistencyModifier` | `getConsistency(TitanSchemaElement element)` Retrieves the consistency modifier for the given `TitanSchemaElement`.
    `EdgeLabel` | `getEdgeLabel(String name)` Identical to `TitanTransaction.getEdgeLabel(String)`
    `TitanGraphIndex` | `getGraphIndex(String name)` Returns the graph index with the given name or null if it does not exist
    `Iterable<TitanGraphIndex>` | `getGraphIndexes(Class<? extends com.tinkerpop.blueprints.Element> elementType)` Returns all graph indexes that index the given element type.
    `Set<String>` | `getOpenInstances()` Returns a set of unique instance ids for all Titan instances that are currently part of this graph cluster.
    `PropertyKey` | `getPropertyKey(String name)` Identical to `TitanTransaction.getPropertyKey(String)`
    `RelationTypeIndex` | `getRelationIndex(RelationType type, String name)` Returns the `RelationTypeIndex` with the given name for the provided `RelationType` or null if it does not exist
    `Iterable<RelationTypeIndex>` | `getRelationIndexes(RelationType type)` Returns an `Iterable` over all `RelationTypeIndex`es defined for the provided `RelationType`
    `RelationType` | `getRelationType(String name)` Identical to `TitanTransaction.getRelationType(String)`
    `<T extends RelationType> Iterable<T>` | `getRelationTypes(Class<T> clazz)` Returns an iterable over all defined types that have the given clazz (either `EdgeLabel` which returns all labels, `PropertyKey` which returns all keys, or `RelationType` which returns all types).
    `Duration` | `getTTL(TitanSchemaType type)` Retrieves the time-to-live for the given `TitanSchemaType` as a `Duration`.
    `VertexLabel` | `getVertexLabel(String name)` Identical to `TitanTransaction.getVertexLabel(String)`
    `Iterable<VertexLabel>` | `getVertexLabels()` Returns an `Iterable` over all defined `VertexLabel`s.
    `boolean` | `isOpen()` Whether this management transaction is open or has been closed (i.e.
    `EdgeLabelMaker` | `makeEdgeLabel(String name)` Identical to `TitanTransaction.makeEdgeLabel(String)`
    `PropertyKeyMaker` | `makePropertyKey(String name)` Identical to `TitanTransaction.makePropertyKey(String)`
    `VertexLabelMaker` | `makeVertexLabel(String name)` Identical to `TitanTransaction.makeVertexLabel(String)`
    `void` | `rollback()` Closes this management transaction and discards all changes.
    `void` | `setConsistency(TitanSchemaElement element, ConsistencyModifier consistency)` Sets the consistency modifier for the given `TitanSchemaElement`.
    `void` | `setTTL(TitanSchemaType type, int ttl, TimeUnit unit)` Sets the time-to-live for the given `TitanSchemaType`.
    `void` | `updateIndex(TitanIndex index, SchemaAction updateAction)` Updates the provided index according to the given `SchemaAction`

    - ### Methods inherited from interface com.thinkaurelius.titan.core.schema.TitanConfiguration

      `get, set`

- - ### Method Detail

    - #### buildEdgeIndex

          RelationTypeIndex buildEdgeIndex(EdgeLabel label,
                                         String name,
                                         com.tinkerpop.blueprints.Direction direction,
                                         RelationType... sortKeys)

      Identical to `buildEdgeIndex(com.thinkaurelius.titan.core.EdgeLabel, String, com.tinkerpop.blueprints.Direction, com.thinkaurelius.titan.core.Order, com.thinkaurelius.titan.core.RelationType...)` with default sort order `Order.ASC`.
      Parameters:
        `label` -
        `name` -
        `direction` -
        `sortKeys` -
      Returns:
        the created `RelationTypeIndex`

    - #### buildEdgeIndex

          RelationTypeIndex buildEdgeIndex(EdgeLabel label,
                                         String name,
                                         com.tinkerpop.blueprints.Direction direction,
                                         Order sortOrder,
                                         RelationType... sortKeys)

      Creates a `RelationTypeIndex` for the provided edge label. That means, that all edges of that label will be indexed according to this index definition which will speed up certain vertex-centric queries.

      An indexed is defined by its name, the direction in which the index should be created (can be restricted to one direction or both), the sort order and - most importantly - the sort keys which define the index key.
      Parameters:
        `label` -
        `name` -
        `direction` -
        `sortOrder` -
        `sortKeys` -
      Returns:
        the created `RelationTypeIndex`

    - #### buildPropertyIndex

          RelationTypeIndex buildPropertyIndex(PropertyKey key,
                                             String name,
                                             RelationType... sortKeys)

      Identical to `buildPropertyIndex(com.thinkaurelius.titan.core.PropertyKey, String, com.thinkaurelius.titan.core.Order, com.thinkaurelius.titan.core.RelationType...)` with default sort order `Order.ASC`.
      Parameters:
        `key` -
        `name` -
        `sortKeys` -
      Returns:
        the created `RelationTypeIndex`

    - #### buildPropertyIndex

          RelationTypeIndex buildPropertyIndex(PropertyKey key,
                                             String name,
                                             Order sortOrder,
                                             RelationType... sortKeys)

      Creates a `RelationTypeIndex` for the provided property key. That means, that all properties of that key will be indexed according to this index definition which will speed up certain vertex-centric queries.

      An indexed is defined by its name, the sort order and - most importantly - the sort keys which define the index key.
      Parameters:
        `key` -
        `name` -
        `sortOrder` -
        `sortKeys` -
      Returns:
        the created `RelationTypeIndex`

    - #### containsRelationIndex

          boolean containsRelationIndex(RelationType type,
                                      String name)

      Whether a `RelationTypeIndex` with the given name has been defined for the provided `RelationType`
      Parameters:
        `type` -
        `name` -
      Returns:

    - #### getRelationIndex

          RelationTypeIndex getRelationIndex(RelationType type,
                                           String name)

      Returns the `RelationTypeIndex` with the given name for the provided `RelationType` or null if it does not exist
      Parameters:
        `type` -
        `name` -
      Returns:

    - #### getRelationIndexes

          Iterable<RelationTypeIndex> getRelationIndexes(RelationType type)

      Returns an `Iterable` over all `RelationTypeIndex`es defined for the provided `RelationType`
      Parameters:
        `type` -
      Returns:

    - #### containsGraphIndex

          boolean containsGraphIndex(String name)

      Whether the graph has a graph index defined with the given name.
      Parameters:
        `name` -
      Returns:

    - #### getGraphIndex

          TitanGraphIndex getGraphIndex(String name)

      Returns the graph index with the given name or null if it does not exist
      Parameters:
        `name` -
      Returns:

    - #### getGraphIndexes

          Iterable<TitanGraphIndex> getGraphIndexes(Class<? extends com.tinkerpop.blueprints.Element> elementType)

      Returns all graph indexes that index the given element type.
      Parameters:
        `elementType` -
      Returns:

    - #### buildIndex

          TitanManagement.IndexBuilder buildIndex(String indexName,
                                                Class<? extends com.tinkerpop.blueprints.Element> elementType)

      Returns an `TitanManagement.IndexBuilder` to add a graph index to this Titan graph. The index to-be-created has the provided name and indexes elements of the given type.
      Parameters:
        `indexName` -
        `elementType` -
      Returns:

    - #### addIndexKey

          void addIndexKey(TitanGraphIndex index,
                         PropertyKey key,
                         Parameter... parameters)

    - #### getConsistency

          ConsistencyModifier getConsistency(TitanSchemaElement element)

      Retrieves the consistency modifier for the given `TitanSchemaElement`. If none has been explicitly defined, `ConsistencyModifier.DEFAULT` is returned.
      Parameters:
        `element` -
      Returns:

    - #### setConsistency

          void setConsistency(TitanSchemaElement element,
                            ConsistencyModifier consistency)

      Sets the consistency modifier for the given `TitanSchemaElement`. Note, that only `RelationType`s and composite graph indexes allow changing of the consistency level.
      Parameters:
        `element` -
        `consistency` -

    - #### getTTL

          Duration getTTL(TitanSchemaType type)

      Retrieves the time-to-live for the given `TitanSchemaType` as a `Duration`. If none has been explicitly defined, a zero-length `Duration` is returned.
      Parameters:
        `type` -
      Returns:

    - #### setTTL

          void setTTL(TitanSchemaType type,
                    int ttl,
                    TimeUnit unit)

      Sets the time-to-live for the given `TitanSchemaType`. The most granular time unit used for TTL values is seconds. Any argument will be rounded to seconds if it is more granular than that.
      Parameters:
        `type` - the affected type
        `ttl` - time-to-live
        `unit` - time unit of the specified ttl

    - #### changeName

          void changeName(TitanSchemaElement element,
                        String newName)

      Changes the name of a `TitanSchemaElement` to the provided new name. The new name must be valid and not already in use, otherwise an `IllegalArgumentException` is thrown.
      Parameters:
        `element` -
        `newName` -

    - #### updateIndex

          void updateIndex(TitanIndex index,
                         SchemaAction updateAction)

      Updates the provided index according to the given `SchemaAction`
      Parameters:
        `index` -
        `updateAction` -

    - #### getOpenInstances

          Set<String> getOpenInstances()

      Returns a set of unique instance ids for all Titan instances that are currently part of this graph cluster.
      Returns:

    - #### forceCloseInstance

          void forceCloseInstance(String instanceId)

      Forcefully removes a Titan instance from this graph cluster as identified by its name.

      This method should be used with great care and only in cases where a Titan instance has been abnormally terminated (i.e. killed instead of properly shut-down). If this happens, the instance will continue to be listed as an open instance which means that 1) a new instance with the same id cannot be started and 2) schema updates will fail because the killed instance cannot acknowledge the schema update.

      Throws an exception if the instance is not part of this cluster or if the instance has been started after the start of this management transaction which is indicative of the instance having been restarted successfully.
      Parameters:
        `instanceId` -

    - #### containsRelationType

          boolean containsRelationType(String name)

      Identical to `TitanTransaction.containsRelationType(String)`
      Parameters:
        `name` -
      Returns:

    - #### getRelationType

          RelationType getRelationType(String name)

      Identical to `TitanTransaction.getRelationType(String)`
      Parameters:
        `name` -
      Returns:

    - #### getPropertyKey

          PropertyKey getPropertyKey(String name)

      Identical to `TitanTransaction.getPropertyKey(String)`
      Parameters:
        `name` -
      Returns:

    - #### getEdgeLabel

          EdgeLabel getEdgeLabel(String name)

      Identical to `TitanTransaction.getEdgeLabel(String)`
      Parameters:
        `name` -
      Returns:

    - #### makePropertyKey

          PropertyKeyMaker makePropertyKey(String name)

      Identical to `TitanTransaction.makePropertyKey(String)`
      Parameters:
        `name` -
      Returns:

    - #### makeEdgeLabel

          EdgeLabelMaker makeEdgeLabel(String name)

      Identical to `TitanTransaction.makeEdgeLabel(String)`
      Parameters:
        `name` -
      Returns:

    - #### getRelationTypes

          <T extends RelationType> Iterable<T> getRelationTypes(Class<T> clazz)

      Returns an iterable over all defined types that have the given clazz (either `EdgeLabel` which returns all labels, `PropertyKey` which returns all keys, or `RelationType` which returns all types).
      Type Parameters:
        `T` -
      Parameters:
        `clazz` - `RelationType` or sub-interface
      Returns:
        Iterable over all types for the given category (label, key, or both)

    - #### containsVertexLabel

          boolean containsVertexLabel(String name)

      Identical to `TitanTransaction.containsVertexLabel(String)`
      Parameters:
        `name` -
      Returns:

    - #### getVertexLabel

          VertexLabel getVertexLabel(String name)

      Identical to `TitanTransaction.getVertexLabel(String)`
      Parameters:
        `name` -
      Returns:

    - #### makeVertexLabel

          VertexLabelMaker makeVertexLabel(String name)

      Identical to `TitanTransaction.makeVertexLabel(String)`
      Parameters:
        `name` -
      Returns:

    - #### getVertexLabels

          Iterable<VertexLabel> getVertexLabels()

      Returns an `Iterable` over all defined `VertexLabel`s.
      Returns:

    - #### isOpen

          boolean isOpen()

      Whether this management transaction is open or has been closed (i.e. committed or rolled-back)
      Returns:

    - #### commit

          void commit()

      Commits this management transaction and persists all schema changes. Closes this transaction.
      See Also:
        `TitanTransaction.commit()`

    - #### rollback

          void rollback()

      Closes this management transaction and discards all changes.
      See Also:
        `TitanTransaction.rollback()`

Copyright © 2012–2014. All rights reserved.