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

org.neo4j.graphdb.schema

## Interface Schema

-     public interface Schema

  Interface for managing the schema of your graph database. This currently includes the indexing support added in Neo4j 2.0. Please see the Neo4j manual for details. Compatibility note: New methods may be added to this interface without notice, backwards compatibility is only guaranteed for clients of this interface, not for implementors.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `Schema.IndexState` The states that an index can be in.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `awaitIndexesOnline(long duration, TimeUnit unit)` Wait until all indices comes online
    `void` | `awaitIndexOnline(IndexDefinition index, long duration, TimeUnit unit)` Wait until an index comes online
    `ConstraintCreator` | `constraintFor(Label label)` Returns a `ConstraintCreator` where details about the constraint can be specified.
    `Iterable<ConstraintDefinition>` | `getConstraints()`
    `Iterable<ConstraintDefinition>` | `getConstraints(Label label)`
    `Iterable<IndexDefinition>` | `getIndexes()`
    `Iterable<IndexDefinition>` | `getIndexes(Label label)`
    `String` | `getIndexFailure(IndexDefinition index)` If `getIndexState(IndexDefinition)` return `Schema.IndexState.FAILED` this method will return the failure description.
    `Schema.IndexState` | `getIndexState(IndexDefinition index)` Poll the database for the state of a given index.
    `IndexCreator` | `indexFor(Label label)` Returns an `IndexCreator` where details about the index to create can be specified.

- - ### Method Detail

    - #### indexFor

          IndexCreator indexFor(Label label)

      Returns an `IndexCreator` where details about the index to create can be specified. When all details have been entered `create` must be called for it to actually be created. Creating an index enables indexing for nodes with the specified label. The index will have the details supplied to the `returned index creator`. All existing and all future nodes matching the index definition will be indexed, speeding up future operations.
      Parameters:
        `label` - `label` on nodes to be indexed
      Returns:
        an `IndexCreator` capable of providing details for, as well as creating an index for the given `label`.

    - #### getIndexes

          Iterable<IndexDefinition> getIndexes(Label label)

      Parameters:
        `label` - the `Label` to get `indexes` for.
      Returns:
        all `indexes` attached to the given `label`.

    - #### getIndexes

          Iterable<IndexDefinition> getIndexes()

      Returns:
        all `indexes` in this database.

    - #### getIndexState

          Schema.IndexState getIndexState(IndexDefinition index)

      Poll the database for the state of a given index. This can be used to track in which state the creation of the index is, for example if it's still `populating` in the background, or has come `online`.
      Parameters:
        `index` - the index that we want to poll state for
      Returns:
        the current `Schema.IndexState` of the index

    - #### getIndexFailure

          String getIndexFailure(IndexDefinition index)

      If `getIndexState(IndexDefinition)` return `Schema.IndexState.FAILED` this method will return the failure description.
      Parameters:
        `index` - the `IndexDescriptor` to get failure from.
      Returns:
        the failure description.
      Throws:
        `IllegalStateException` - if the `index` isn't in a `Schema.IndexState.FAILED` state.

    - #### constraintFor

          ConstraintCreator constraintFor(Label label)

      Returns a `ConstraintCreator` where details about the constraint can be specified. When all details have been entered `ConstraintCreator.create()` must be called for it to actually be created. Creating a constraint will have the transaction creating it block on commit until all existing data has been verified for compliance. If any existing data doesn't comply with the constraint the transaction will not be able to commit, but fail in `Transaction.close()`.
      Parameters:
        `label` - the label this constraint is for.
      Returns:
        a `ConstraintCreator` capable of providing details for, as well as creating a constraint for the given `label`.

    - #### getConstraints

          Iterable<ConstraintDefinition> getConstraints(Label label)

      Parameters:
        `label` - the label to get constraints for.
      Returns:
        all constraints for the given label.

    - #### getConstraints

          Iterable<ConstraintDefinition> getConstraints()

      Returns:
        all constraints

    - #### awaitIndexOnline

          void awaitIndexOnline(IndexDefinition index,
                              long duration,
                              TimeUnit unit)

      Wait until an index comes online
      Parameters:
        `index` - the index that we want to wait for
        `duration` - duration to wait for the index to come online
        `unit` - TimeUnit of duration
      Throws:
        `IllegalStateException` - if the index did not enter the ONLINE state within the given duration or if the index entered the FAILED state

    - #### awaitIndexesOnline

          void awaitIndexesOnline(long duration,
                                TimeUnit unit)

      Wait until all indices comes online
      Parameters:
        `duration` - duration to wait for all indexes to come online
        `unit` - TimeUnit of duration
      Throws:
        `IllegalStateException` - if some index did not enter the ONLINE state within the given duration or if the index entered the FAILED state

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