com.thinkaurelius.titan.core

## Interface TitanElement

- All Superinterfaces:
    com.tinkerpop.blueprints.Element, Idfiable, Removable
  All Known Subinterfaces:
    EdgeLabel, InternalElement, InternalRelation, InternalRelationType, InternalVertex, InternalVertexLabel, PropertyKey, RelationType, StandardRelation, SystemRelationType, TitanEdge, TitanProperty, TitanRelation, TitanVertex, VertexLabel
  All Known Implementing Classes:
    AbstractEdge, AbstractElement, AbstractProperty, AbstractTypedRelation, AbstractVertex, BaseKey, BaseLabel, BaseRelationType, BaseVertexLabel, CacheEdge, CacheProperty, CacheVertex, EdgeLabelVertex, EmptyRelationType, EmptyVertex, FulgoraNeighborVertex, FulgoraVertex, ImplicitKey, PropertyKeyVertex, RelationTypeVertex, StandardEdge, StandardProperty, StandardVertex, TitanSchemaVertex, VertexLabelVertex

      public interface TitanElement
      extends com.tinkerpop.blueprints.Element, Idfiable, Removable

  TitanElement represents the abstract concept of an entity in the graph and specifies basic methods for interacting with entities. The two basic entities in a graph database are `TitanRelation` and `TitanVertex`. Entities have a life cycle state which reflects the current state of the entity with respect to the `TitanTransaction` in which it occurs. An entity may be in any one of these states and any given time:
  - New: The entity has been created in the current transaction
  - Loaded: The entity has been loaded from disk into the current transaction and has not been modified
  - Modified: The entity has been loaded from disk into the current transaction and has been modified
  - Deleted: The entity has been deleted in the current transaction
  Depending on the concrete type of the entity, an entity may be identifiable, i.e. it has a unique ID which can be retrieved via `getId()` (use `hasId()` to determine if a given entity has a unique ID).
  Author:
    Matthias Bröcheler (http://www.matthiasb.com)
  See Also:
    `TitanVertex`, `TitanRelation`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getId()` Returns a unique identifier for this entity.
    `long` | `getLongId()` Unique identifier for this entity.
    `<O> O` | `getProperty(PropertyKey key)` Retrieves the value associated with the given key on this vertex and casts it to the specified type.
    `<O> O` | `getProperty(String key)` Retrieves the value associated with the given key on this vertex and casts it to the specified type.
    `boolean` | `hasId()` Checks whether this entity has a unique identifier.
    `boolean` | `isLoaded()` Checks whether this entity has been loaded into the current transaction and not yet modified.
    `boolean` | `isNew()` Checks whether this entity has been newly created in the current transaction.
    `boolean` | `isRemoved()` Checks whether this entity has been deleted into the current transaction.
    `void` | `remove()` Deletes this entity and any incident edges or properties from the graph.
    `<O> O` | `removeProperty(RelationType type)` Removes the value associated with the given key for this vertex (if exists).
    `<O> O` | `removeProperty(String key)` Removes the value associated with the given key for this vertex (if exists).
    `void` | `setProperty(PropertyKey key, Object value)` Sets the value for the given key on this element.
    `void` | `setProperty(String key, Object value)` Sets the value for the given key on this element.

    - ### Methods inherited from interface com.tinkerpop.blueprints.Element

      `getPropertyKeys`

- - ### Method Detail

    - #### getId

          Object getId()

      Returns a unique identifier for this entity.

      The unique identifier may only be set when the transaction in which entity is created commits. The Graph Configuration Wiki explains how to configure when entity ids are assigned. Some entities are never assigned a unique identifier if they depend on a parent entity.

      Specified by:
        `getId` in interface `com.tinkerpop.blueprints.Element`
      Returns:
        The unique identifier for this entity
      Throws:
        `IllegalStateException` - if the entity does not (yet) have a unique identifier
      See Also:
        `hasId()`

    - #### getLongId

          long getLongId()

      Unique identifier for this entity. This id can be temporarily assigned and might change. Use `getId()` for the permanent id.
      Specified by:
        `getLongId` in interface `Idfiable`
      Returns:
        Unique long id

    - #### hasId

          boolean hasId()

      Checks whether this entity has a unique identifier.

      Note that some entities may never be assigned an identifier and others will only be assigned an identifier at the end of a transaction.
      Returns:
        true if this entity has been assigned a unique id, else false
      See Also:
        `getLongId()`

    - #### remove

          void remove()

      Deletes this entity and any incident edges or properties from the graph.

      Specified by:
        `remove` in interface `com.tinkerpop.blueprints.Element`
      Specified by:
        `remove` in interface `Removable`
      Throws:
        `IllegalStateException` - if the entity cannot be deleted or if the user does not have permission to remove the entity

    - #### setProperty

          void setProperty(String key,
                         Object value)

      Sets the value for the given key on this element. The key must be defined to have `Cardinality.SINGLE`, otherwise this method throws an exception.
      Specified by:
        `setProperty` in interface `com.tinkerpop.blueprints.Element`
      Parameters:
        `key` - the string identifying the key
        `value` - the object value

    - #### setProperty

          void setProperty(PropertyKey key,
                         Object value)

      Sets the value for the given key on this element. The key must be defined to have `Cardinality.SINGLE`, otherwise this method throws an exception.
      Parameters:
        `key` - the key
        `value` - the object value

    - #### getProperty

          <O> O getProperty(PropertyKey key)

      Retrieves the value associated with the given key on this vertex and casts it to the specified type. If the key has cardinality SINGLE, then there can be at most one value and this value is returned (or null). Otherwise a list of all associated values is returned, or an empty list if non exist.

      Parameters:
        `key` - key
      Returns:
        value or list of values associated with key

    - #### getProperty

          <O> O getProperty(String key)

      Retrieves the value associated with the given key on this vertex and casts it to the specified type. If the key has cardinality SINGLE, then there can be at most one value and this value is returned (or null). Otherwise a list of all associated values is returned, or an empty list if non exist.

      Specified by:
        `getProperty` in interface `com.tinkerpop.blueprints.Element`
      Parameters:
        `key` - string identifying a key
      Returns:
        value or list of values associated with key

    - #### removeProperty

          <O> O removeProperty(String key)

      Removes the value associated with the given key for this vertex (if exists).
      Specified by:
        `removeProperty` in interface `com.tinkerpop.blueprints.Element`
      Parameters:
        `key` - the string identifying the key
      Returns:
        the object value associated with that key prior to removal, or NULL if such does not exist.
      See Also:
        `removeProperty(RelationType)`

    - #### removeProperty

          <O> O removeProperty(RelationType type)

      Removes the value associated with the given key for this vertex (if exists). If the key is list-valued then all values associated with this key are removed and only the last removed value returned.
      Parameters:
        `type` - the key
      Returns:
        the object value associated with that key prior to removal, or NULL if such does not exist.

    - #### isNew

          boolean isNew()

      Checks whether this entity has been newly created in the current transaction.
      Returns:
        True, if entity has been newly created, else false.

    - #### isLoaded

          boolean isLoaded()

      Checks whether this entity has been loaded into the current transaction and not yet modified.
      Returns:
        True, has been loaded and not modified, else false.

    - #### isRemoved

          boolean isRemoved()

      Checks whether this entity has been deleted into the current transaction.
      Returns:
        True, has been deleted, else false.

Copyright © 2012–2014. All rights reserved.