public interface JanusGraphTransaction extends Transaction
JanusGraph
. Since JanusGraph is a transactional graph
database, all interactions with the graph are mitigated by a JanusGraphTransaction.
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:
org.apache.tinkerpop.gremlin.structure.Graph.Exceptions, org.apache.tinkerpop.gremlin.structure.Graph.Features, org.apache.tinkerpop.gremlin.structure.Graph.Hidden, org.apache.tinkerpop.gremlin.structure.Graph.OptIn, org.apache.tinkerpop.gremlin.structure.Graph.OptIns, org.apache.tinkerpop.gremlin.structure.Graph.OptOut, org.apache.tinkerpop.gremlin.structure.Graph.OptOuts, org.apache.tinkerpop.gremlin.structure.Graph.Variables
Modifier and Type | Method and Description |
---|---|
JanusGraphVertex |
addVertex(Object id,
VertexLabel vertexLabel)
Creates a new vertex in the graph with the given vertex id and the given vertex label.
|
void |
commit()
Commits and closes the transaction.
|
void |
expireSchemaElement(long id) |
Iterable<JanusGraphEdge> |
getEdges(RelationIdentifier... ids) |
JanusGraphVertex |
getVertex(Object id)
Retrieves the vertex for the specified id.
|
Iterable<JanusGraphVertex> |
getVertices(Object... ids) |
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.
|
void |
rollback()
Aborts and closes the transaction.
|
addVertex, addVertex, close, indexQuery, mixedIndexAggQuery, multiQuery, multiQuery, query
compute, compute, configuration, edges, features, getServiceRegistry, io, traversal, traversal, tx, tx, variables, vertices
addConnection, addProperties, addProperties, makeEdgeLabel, makePropertyKey, makeVertexLabel
containsEdgeLabel, containsPropertyKey, containsRelationType, containsVertexLabel, getEdgeLabel, getOrCreateEdgeLabel, getOrCreatePropertyKey, getOrCreatePropertyKey, getOrCreatePropertyKey, getOrCreateVertexLabel, getPropertyKey, getRelationType, getVertexLabel
JanusGraphVertex addVertex(Object id, VertexLabel vertexLabel)
Custom id setting must be enabled via the configuration option GraphDatabaseConfiguration.ALLOW_SETTING_VERTEX_ID
and valid JanusGraph vertex ids must be provided. Use IDManager.toVertexId(long)
to construct a valid JanusGraph vertex id from a user id, where idManager
can be obtained through
StandardJanusGraph.getIDManager()
.
long vertexId = ((StandardJanusGraph) graph).getIDManager().toVertexId(userVertexId);
id
- vertex id of the vertex to be createdvertexLabel
- vertex label for this vertex - can be null if no vertex label should be set.JanusGraphVertex getVertex(Object id)
Graph.vertices(Object...)
instead.id
- id of the vertex to retrieveIterable<JanusGraphVertex> getVertices(Object... ids)
Iterable<JanusGraphEdge> getEdges(RelationIdentifier... ids)
void commit()
Will attempt to persist all modifications which may result in exceptions in case of persistence failures or
lock contention.
The call releases data structures if possible. All element references (e.g. vertex objects) retrieved
through this transaction are stale after the transaction closes and should no longer be used.
void rollback()
The call releases data structures if possible. All element references (e.g. vertex objects) retrieved through this transaction are stale after the transaction closes and should no longer be used.
boolean isOpen()
boolean isClosed()
boolean hasModifications()
A modification may be an edge or vertex update, addition, or deletion.
void expireSchemaElement(long id)
Copyright © 2012–2023. All rights reserved.