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,
EdgeLabel label)
Creates a new edge connecting the specified vertices.
|
TitanEdge |
addEdge(TitanVertex outVertex,
TitanVertex inVertex,
String label)
Creates a new edge connecting the specified vertices.
|
TitanProperty |
addProperty(TitanVertex vertex,
PropertyKey key,
Object value)
Creates a new property for the given vertex and key with the specified value.
|
TitanProperty |
addProperty(TitanVertex vertex,
String key,
Object value)
Creates a new property for the given vertex and key with the specified value.
|
TitanVertex |
addVertex()
Creates a new vertex in the graph.
|
TitanVertex |
addVertex(Long id,
VertexLabel vertexLabel)
Creates a new vertex in the graph with the given vertex id and the given vertex label.
|
TitanVertex |
addVertex(String vertexLabel)
Creates a new vertex in the graph with the given vertex label name.
|
TitanVertex |
addVertex(VertexLabel vertexLabel)
Creates a new vertex in the graph with the given vertex label.
|
void |
commit()
Commits and closes the transaction.
|
boolean |
containsRelationType(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.
|
boolean |
containsVertexLabel(String name)
Whether a vertex label with the given name exists in the graph.
|
EdgeLabel |
getEdgeLabel(String name)
Returns the edge label with the given name.
|
Iterable<TitanEdge> |
getEdges(PropertyKey key,
Object value)
Retrieves all vertices which have a property of the given key with the specified value.
|
PropertyKey |
getPropertyKey(String name)
Returns the property key with the given name.
|
RelationType |
getRelationType(String name)
Returns the type with the given name.
|
TitanVertex |
getVertex(long id)
Retrieves the vertex for the specified id.
|
VertexLabel |
getVertexLabel(String name)
Returns the vertex label with the given name.
|
Iterable<TitanVertex> |
getVertices(PropertyKey key,
Object value)
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.
|
TitanIndexQuery |
indexQuery(String indexName,
String query)
Returns a
TitanIndexQuery to query for vertices or edges against the specified indexing backend using
the given query string. |
boolean |
isClosed()
Checks whether the transaction has been closed.
|
boolean |
isOpen()
Checks whether the transaction is still open.
|
EdgeLabelMaker |
makeEdgeLabel(String name)
Returns a
EdgeLabelMaker instance to define a new EdgeLabel with the given name. |
PropertyKeyMaker |
makePropertyKey(String name)
Returns a
PropertyKeyMaker instance to define a new PropertyKey with the given name. |
VertexLabelMaker |
makeVertexLabel(String name)
Returns a
VertexLabelMaker to define a new vertex label with the given name. |
TitanMultiVertexQuery<? extends TitanMultiVertexQuery> |
multiQuery(Collection<TitanVertex> vertices) |
TitanMultiVertexQuery<? extends TitanMultiVertexQuery> |
multiQuery(TitanVertex... vertices) |
TitanGraphQuery<? extends TitanGraphQuery> |
query() |
void |
rollback()
Aborts and closes the transaction.
|
shutdown, stopTransactionTitanVertex addVertex()
TitanVertex addVertex(String vertexLabel)
TitanVertex addVertex(VertexLabel vertexLabel)
TitanVertex addVertex(Long id, VertexLabel vertexLabel)
GraphDatabaseConfiguration.ALLOW_SETTING_VERTEX_ID.
Use TitanId.toVertexId(long) to construct a valid Titan vertex id from a user id.id - vertex id of the vertex to be createdvertexLabel - vertex label for this vertex - can be null if no vertex label should be set.TitanEdge addEdge(TitanVertex outVertex, TitanVertex inVertex, EdgeLabel 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, PropertyKey key, Object value)
TitanProperty with specified property key and the given object being the value.key - key of the property to be createdvertex - vertex for which to create the propertyvalue - value of the property to be createdIllegalArgumentException - if the value does not match the data type of the given property key.TitanProperty addProperty(TitanVertex vertex, String key, Object value)
TitanProperty with specified property key and the given object being the value.
IllegalArgumentException.key - key of the property to be createdvertex - vertex for which to create the propertyvalue - value of the property to be createdIllegalArgumentException - if the value 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<? extends TitanGraphQuery> query()
query in interface com.tinkerpop.blueprints.GraphTitanGraph.query()TitanIndexQuery indexQuery(String indexName, String query)
TitanIndexQuery to query for vertices or edges against the specified indexing backend using
the given query string. The query string is analyzed and answered by the underlying storage backend.
Note, that using indexQuery will may ignore modifications in the current transaction.indexName - Name of the indexing backend to query as configuredquery - Query stringTitanMultiVertexQuery<? extends TitanMultiVertexQuery> multiQuery(TitanVertex... vertices)
TitanGraph.multiQuery(TitanVertex...)TitanMultiVertexQuery<? extends TitanMultiVertexQuery> multiQuery(Collection<TitanVertex> vertices)
TitanGraph.multiQuery(Collection)Iterable<TitanVertex> getVertices(PropertyKey key, Object value)
key - keyvalue - value valueTitanManagement.buildIndex(String, Class)Iterable<TitanEdge> getEdges(PropertyKey key, Object value)
key - keyvalue - value valueTitanManagement.buildIndex(String, Class)boolean containsRelationType(String name)
name - name of the typeRelationType getRelationType(String name)
name - name of the type to returnRelationTypePropertyKey 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 keyPropertyKeyEdgeLabel 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 labelEdgeLabelPropertyKeyMaker makePropertyKey(String name)
PropertyKeyMaker instance to define a new PropertyKey with the given name.
By defining types explicitly (rather than implicitly through usage) one can control various
aspects of the key and associated consistency constraints.
The key constructed with this maker will be created in the context of this transaction.PropertyKeyMaker linked to this transaction.PropertyKeyMaker,
PropertyKeyEdgeLabelMaker makeEdgeLabel(String name)
EdgeLabelMaker instance to define a new EdgeLabel with the given name.
By defining types explicitly (rather than implicitly through usage) one can control various
aspects of the label and associated consistency constraints.
The label constructed with this maker will be created in the context of this transaction.EdgeLabelMaker linked to this transaction.EdgeLabelMaker,
EdgeLabelboolean containsVertexLabel(String name)
name - VertexLabel getVertexLabel(String name)
DefaultSchemaMaker.
Attempting to automatically create a vertex label might cause an exception depending on the configuration.name - VertexLabelMaker makeVertexLabel(String name)
VertexLabelMaker to define a new vertex label with the given name. Note, that the name must
be unique.name - void commit()
commit in interface com.tinkerpop.blueprints.TransactionalGraphStorageException - if an error arises during persistencevoid rollback()
rollback in interface com.tinkerpop.blueprints.TransactionalGraphStorageException - if an error arises when releasing the transaction handleboolean isOpen()
boolean isClosed()
boolean hasModifications()
Copyright © 2012–2014. All rights reserved.