public interface TitanTransaction
extends com.tinkerpop.blueprints.TransactionalGraph, com.tinkerpop.blueprints.KeyIndexableGraph
TitanGraph
. Since TitanGraph is a transactional graph
database, all interactions with the graph are mitigated by a TitanTransaction.
All vertex and edge retrievals are channeled by a graph transaction which bundles all such retrievals, creations and
deletions into one transaction. A graph transaction is analogous to a
database transaction.
The isolation level and ACID support are configured through the storage
backend, meaning whatever level of isolation is supported by the storage backend is mirrored by a graph transaction.
A graph transaction supports:
Modifier and Type | Method and Description |
---|---|
TitanEdge |
addEdge(TitanVertex outVertex,
TitanVertex inVertex,
String label)
Creates a new edge connecting the specified vertices.
|
TitanEdge |
addEdge(TitanVertex outVertex,
TitanVertex inVertex,
TitanLabel label)
Creates a new edge connecting the specified vertices.
|
TitanProperty |
addProperty(TitanVertex vertex,
String key,
Object attribute)
Creates a new property for the given vertex and key with the specified attribute.
|
TitanProperty |
addProperty(TitanVertex vertex,
TitanKey key,
Object attribute)
Creates a new property for the given vertex and key with the specified attribute.
|
TitanVertex |
addVertex()
Creates a new vertex in the graph.
|
void |
commit()
Commits and closes the transaction.
|
boolean |
containsType(String name)
Checks whether a type with the specified name exists.
|
boolean |
containsVertex(long vertexid)
Checks whether a vertex with the specified id exists in the graph database.
|
TitanLabel |
getEdgeLabel(String name)
Returns the edge label with the given name.
|
Iterable<TitanEdge> |
getEdges(TitanKey key,
Object attribute)
Retrieves all edges which have a property of the given key with the specified value.
|
TitanKey |
getPropertyKey(String name)
Returns the property key with the given name.
|
TitanType |
getType(String name)
Returns the type with the given name.
|
TitanVertex |
getVertex(long id)
Retrieves the vertex for the specified id.
|
TitanVertex |
getVertex(String key,
Object attribute) |
TitanVertex |
getVertex(TitanKey key,
Object attribute) |
Iterable<TitanVertex> |
getVertices(TitanKey key,
Object attribute)
Retrieves all vertices which have a property of the given key with the specified value.
|
boolean |
hasModifications()
Checks whether any changes to the graph database have been made in this transaction.
|
boolean |
isClosed()
Checks whether the transaction has been closed.
|
boolean |
isOpen()
Checks whether the transaction is still open.
|
TypeMaker |
makeType()
Returns a new
TypeMaker instance to create types. |
TitanGraphQuery |
query() |
void |
rollback()
Aborts and closes the transaction.
|
shutdown, stopTransaction
TitanVertex addVertex()
TitanEdge addEdge(TitanVertex outVertex, TitanVertex inVertex, TitanLabel label)
TitanEdge
with given label connecting the vertices in the order
specified.label
- label of the edge to be createdoutVertex
- outgoing vertex of the edgeinVertex
- incoming vertex of the edgeTitanEdge addEdge(TitanVertex outVertex, TitanVertex inVertex, String label)
TitanEdge
with given label connecting the vertices in the order
specified.
IllegalArgumentException
.label
- label of the edge to be createdoutVertex
- outgoing vertex of the edgeinVertex
- incoming vertex of the edgeTitanProperty addProperty(TitanVertex vertex, TitanKey key, Object attribute)
TitanProperty
with specified property key and the given object being the attribute.key
- key of the property to be createdvertex
- vertex for which to create the propertyattribute
- attribute of the property to be createdIllegalArgumentException
- if the attribute does not match the data type of the given property key.TitanProperty addProperty(TitanVertex vertex, String key, Object attribute)
TitanProperty
with specified property key and the given object being the attribute.
IllegalArgumentException
.key
- key of the property to be createdvertex
- vertex for which to create the propertyattribute
- attribute of the property to be createdIllegalArgumentException
- if the attribute does not match the data type of the given property key.TitanVertex getVertex(long id)
id
- id of the vertex to retrievecontainsVertex(long)
boolean containsVertex(long vertexid)
vertexid
- vertex idTitanGraphQuery query()
query
in interface com.tinkerpop.blueprints.Graph
TitanVertex getVertex(TitanKey key, Object attribute)
TitanVertex getVertex(String key, Object attribute)
Iterable<TitanVertex> getVertices(TitanKey key, Object attribute)
key
- keyattribute
- attribute valueTypeMaker.indexed(Class)
Iterable<TitanEdge> getEdges(TitanKey key, Object attribute)
key
- keyattribute
- attribute valueTypeMaker.indexed(Class)
boolean containsType(String name)
name
- name of the typeTitanType getType(String name)
name
- name of the type to returnTitanType
TitanKey getPropertyKey(String name)
name
- name of the property key to returnIllegalArgumentException
- if a property key with the given name does not exist or if the
type with the given name is not a property keyTitanKey
TitanLabel getEdgeLabel(String name)
name
- name of the edge label to returnIllegalArgumentException
- if an edge label with the given name does not exist or if the
type with the given name is not an edge labelTitanLabel
TypeMaker makeType()
TypeMaker
instance to create types.
The type constructed with this maker will be created in the context of this transaction.void commit()
commit
in interface com.tinkerpop.blueprints.TransactionalGraph
com.thinkaurelius.titan.diskstorage.StorageException
- if an error arises during persistencevoid rollback()
rollback
in interface com.tinkerpop.blueprints.TransactionalGraph
com.thinkaurelius.titan.diskstorage.StorageException
- if an error arises when releasing the transaction handleboolean isOpen()
boolean isClosed()
boolean hasModifications()
Copyright © 2012-2013. All Rights Reserved.