public class StandardJanusGraphTx extends JanusGraphBlueprintsTransaction implements TypeInspector, SchemaInspector, VertexFactory
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.VariablesallowCustomVertexIdType| Constructor and Description |
|---|
StandardJanusGraphTx(StandardJanusGraph graph,
TransactionConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
EdgeLabel |
addConnection(EdgeLabel edgeLabel,
VertexLabel outVLabel,
VertexLabel inVLabel)
Add a constraint on which vertices the given edge label can connect.
|
JanusGraphEdge |
addEdge(JanusGraphVertex outVertex,
JanusGraphVertex inVertex,
EdgeLabel label) |
JanusGraphEdge |
addEdge(Long id,
JanusGraphVertex outVertex,
JanusGraphVertex inVertex,
EdgeLabel label) |
EdgeLabel |
addProperties(EdgeLabel edgeLabel,
PropertyKey... keys)
Add property constraints for a given edge label.
|
VertexLabel |
addProperties(VertexLabel vertexLabel,
PropertyKey... keys)
Add property constraints for a given vertex label.
|
JanusGraphVertexProperty |
addProperty(JanusGraphVertex vertex,
PropertyKey key,
Object value) |
JanusGraphVertexProperty |
addProperty(JanusGraphVertex vertex,
PropertyKey key,
Object value,
Long id) |
JanusGraphVertexProperty |
addProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality cardinality,
JanusGraphVertex vertex,
PropertyKey key,
Object value) |
JanusGraphVertexProperty |
addProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality cardinality,
JanusGraphVertex vertex,
PropertyKey key,
Object value,
Long id) |
JanusGraphEdge |
addSchemaEdge(JanusGraphVertex out,
JanusGraphVertex in,
TypeDefinitionCategory def,
Object modifier) |
JanusGraphVertex |
addVertex(Object vertexId,
VertexLabel label)
Creates a new vertex in the graph with the given vertex id and the given vertex label.
|
JanusGraphVertex |
addVertex(String vertexLabel)
Creates a new vertex in the graph with the vertex label named by the argument.
|
JanusGraphVertex |
addVertex(VertexLabel vertexLabel) |
void |
checkPropertyConstraintForEdgeOrCreatePropertyConstraint(StandardEdge edge,
PropertyKey key) |
void |
commit()
Commits and closes the transaction.
|
boolean |
containsEdgeLabel(String name)
Checks whether an edge label of the given name has been defined in the JanusGraph schema.
|
boolean |
containsPropertyKey(String name)
Checks whether a property key of the given name has been defined in the JanusGraph schema.
|
boolean |
containsRelationType(String name)
Checks whether a type with the specified name exists.
|
boolean |
containsVertex(Object vertexId) |
boolean |
containsVertexLabel(String name)
Whether a vertex label with the given name exists in the graph.
|
void |
executeMultiQuery(Collection<InternalVertex> vertices,
SliceQuery sq,
QueryProfiler profiler) |
void |
executeMultiSliceMultiQuery(Collection<InternalVertex> vertices,
List<BackendQueryHolder<SliceQuery>> queries,
QueryProfiler profiler) |
void |
expireSchemaElement(long id) |
InternalVertex[] |
getAllRepresentatives(JanusGraphVertex partitionedVertex,
boolean restrict2Partitions) |
InternalVertex |
getCanonicalVertex(InternalVertex partitionedVertex) |
TransactionConfiguration |
getConfiguration() |
Function<Object,? extends JanusGraphElement> |
getConversionFunction(ElementCategory elementCategory) |
EdgeLabel |
getEdgeLabel(String name)
Returns the edge label with the given name.
|
Iterable<JanusGraphEdge> |
getEdges(RelationIdentifier... ids) |
EdgeSerializer |
getEdgeSerializer() |
RelationType |
getExistingRelationType(long typeId) |
VertexLabel |
getExistingVertexLabel(long id) |
StandardJanusGraph |
getGraph()
Returns the graph that this transaction is based on
|
IDManager |
getIdInspector() |
InternalVertex |
getInternalVertex(Object vertexId) |
StandardJanusGraphTx |
getNextTx() |
EdgeLabel |
getOrCreateEdgeLabel(String name)
Returns the edge label with the given name.
|
PropertyKey |
getOrCreatePropertyKey(String name)
Returns the property key with the given name.
|
PropertyKey |
getOrCreatePropertyKey(String name,
Object value)
Returns the property key with the given name.
|
PropertyKey |
getOrCreatePropertyKey(String name,
Object value,
org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality cardinality)
Returns the property key with the given name.
|
VertexLabel |
getOrCreateVertexLabel(String name)
Returns the vertex label with the given name.
|
InternalVertex |
getOtherPartitionVertex(JanusGraphVertex partitionedVertex,
long otherPartition) |
PropertyKey |
getPropertyKey(String name)
Returns the property key with the given name.
|
RelationType |
getRelationType(String name)
Returns the type with the given name.
|
JanusGraphSchemaVertex |
getSchemaVertex(String schemaName) |
BackendTransaction |
getTxHandle() |
JanusGraphVertex |
getVertex(Object vertexId)
Retrieves the vertex for the specified id.
|
VertexLabel |
getVertexLabel(String name)
Returns the vertex label with the given name.
|
Iterable<JanusGraphVertex> |
getVertices(Object... ids) |
boolean |
hasModifications()
Checks whether any changes to the graph database have been made in this transaction.
|
JanusGraphIndexQuery |
indexQuery(String indexName,
String query)
Returns a
JanusGraphIndexQuery 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.
|
boolean |
isPartitionedVertex(JanusGraphVertex vertex) |
boolean |
isRemovedRelation(Long relationId) |
EdgeLabelMaker |
makeEdgeLabel(String name)
Returns a
EdgeLabelMaker instance to define a new EdgeLabel with the given name. |
EdgeLabel |
makeEdgeLabel(String name,
TypeDefinitionMap definition) |
PropertyKeyMaker |
makePropertyKey(String name)
Returns a
PropertyKeyMaker instance to define a new PropertyKey with the given name. |
PropertyKey |
makePropertyKey(String name,
TypeDefinitionMap definition) |
JanusGraphSchemaVertex |
makeSchemaVertex(JanusGraphSchemaCategory schemaCategory,
String name,
TypeDefinitionMap definition) |
VertexLabelMaker |
makeVertexLabel(String name)
Returns a
VertexLabelMaker to define a new vertex label with the given name. |
MixedIndexAggQuery |
mixedIndexAggQuery() |
JanusGraphMultiVertexQuery |
multiQuery(Collection<JanusGraphVertex> vertices) |
JanusGraphMultiVertexQuery |
multiQuery(JanusGraphVertex... vertices) |
GraphCentricQueryBuilder |
query() |
VertexCentricQueryBuilder |
query(JanusGraphVertex vertex) |
void |
removeRelation(InternalRelation relation) |
void |
rollback()
Aborts and closes the transaction.
|
void |
setBackendTransaction(BackendTransaction txHandle) |
void |
updateSchemaVertex(JanusGraphSchemaVertex schemaVertex) |
boolean |
validDataType(Class datatype) |
void |
verifyAccess(JanusGraphVertex... vertices) |
Object |
verifyAttribute(PropertyKey key,
Object attribute) |
addVertex, close, compute, compute, configuration, edges, features, io, toString, tx, variables, verticesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetExistingEdgeLabel, getExistingPropertyKeypublic final QueryExecutor<VertexCentricQuery,JanusGraphRelation,SliceQuery> edgeProcessor
public final QueryExecutor<VertexCentricQuery,JanusGraphRelation,SliceQuery> edgeProcessorImpl
public final QueryExecutor<GraphCentricQuery,JanusGraphElement,JointIndexQuery> elementProcessor
public final QueryExecutor<GraphCentricQuery,JanusGraphElement,JointIndexQuery> elementProcessorImpl
public StandardJanusGraphTx(StandardJanusGraph graph, TransactionConfiguration config)
public void setBackendTransaction(BackendTransaction txHandle)
public final void verifyAccess(JanusGraphVertex... vertices)
public StandardJanusGraphTx getNextTx()
public TransactionConfiguration getConfiguration()
public StandardJanusGraph getGraph()
JanusGraphBlueprintsTransactiongetGraph in class JanusGraphBlueprintsTransactionpublic BackendTransaction getTxHandle()
public EdgeSerializer getEdgeSerializer()
public IDManager getIdInspector()
public boolean isPartitionedVertex(JanusGraphVertex vertex)
public InternalVertex getCanonicalVertex(InternalVertex partitionedVertex)
public InternalVertex getOtherPartitionVertex(JanusGraphVertex partitionedVertex, long otherPartition)
public InternalVertex[] getAllRepresentatives(JanusGraphVertex partitionedVertex, boolean restrict2Partitions)
public boolean containsVertex(Object vertexId)
public JanusGraphVertex getVertex(Object vertexId)
JanusGraphTransactionGraph.vertices(Object...) instead.getVertex in interface JanusGraphTransactionvertexId - id of the vertex to retrievepublic Iterable<JanusGraphVertex> getVertices(Object... ids)
getVertices in interface JanusGraphTransactionpublic InternalVertex getInternalVertex(Object vertexId)
getInternalVertex in interface VertexFactorypublic JanusGraphVertex addVertex(Object vertexId, VertexLabel label)
JanusGraphTransaction
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);
addVertex in interface JanusGraphTransactionvertexId - vertex id of the vertex to be createdlabel - vertex label for this vertex - can be null if no vertex label should be set.public JanusGraphVertex addVertex(String vertexLabel)
TransactionaddVertex in interface org.apache.tinkerpop.gremlin.structure.GraphaddVertex in interface TransactionvertexLabel - the name of the vertex label to usepublic JanusGraphVertex addVertex(VertexLabel vertexLabel)
public final boolean validDataType(Class datatype)
public final Object verifyAttribute(PropertyKey key, Object attribute)
public void removeRelation(InternalRelation relation)
public boolean isRemovedRelation(Long relationId)
public void checkPropertyConstraintForEdgeOrCreatePropertyConstraint(StandardEdge edge, PropertyKey key)
public JanusGraphEdge addEdge(JanusGraphVertex outVertex, JanusGraphVertex inVertex, EdgeLabel label)
public JanusGraphEdge addEdge(Long id, JanusGraphVertex outVertex, JanusGraphVertex inVertex, EdgeLabel label)
public JanusGraphVertexProperty addProperty(JanusGraphVertex vertex, PropertyKey key, Object value)
public JanusGraphVertexProperty addProperty(JanusGraphVertex vertex, PropertyKey key, Object value, Long id)
public JanusGraphVertexProperty addProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality cardinality, JanusGraphVertex vertex, PropertyKey key, Object value)
public JanusGraphVertexProperty addProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality cardinality, JanusGraphVertex vertex, PropertyKey key, Object value, Long id)
public Iterable<JanusGraphEdge> getEdges(RelationIdentifier... ids)
getEdges in interface JanusGraphTransactionpublic final JanusGraphSchemaVertex makeSchemaVertex(JanusGraphSchemaCategory schemaCategory, String name, TypeDefinitionMap definition)
public void updateSchemaVertex(JanusGraphSchemaVertex schemaVertex)
public PropertyKey makePropertyKey(String name, TypeDefinitionMap definition)
public EdgeLabel makeEdgeLabel(String name, TypeDefinitionMap definition)
public JanusGraphEdge addSchemaEdge(JanusGraphVertex out, JanusGraphVertex in, TypeDefinitionCategory def, Object modifier)
public VertexLabel addProperties(VertexLabel vertexLabel, PropertyKey... keys)
SchemaManageraddProperties in interface SchemaManagervertexLabel - to which the constraints applies.keys - defines the properties which should be added to the VertexLabel as constraints.VertexLabel edited which contains the added constraints.public EdgeLabel addProperties(EdgeLabel edgeLabel, PropertyKey... keys)
SchemaManageraddProperties in interface SchemaManageredgeLabel - to which the constraints applies.keys - defines the properties which should be added to the EdgeLabel as constraints.EdgeLabel edited which contains the added constraints.public EdgeLabel addConnection(EdgeLabel edgeLabel, VertexLabel outVLabel, VertexLabel inVLabel)
SchemaManageraddConnection in interface SchemaManageredgeLabel - to which the constraint applies.outVLabel - specifies the outgoing vertex for this connection.inVLabel - specifies the incoming vertex for this connection.EdgeLabel edited which contains the added constraint.public JanusGraphSchemaVertex getSchemaVertex(String schemaName)
public boolean containsRelationType(String name)
SchemaInspectorcontainsRelationType in interface SchemaInspectorcontainsRelationType in interface TypeInspectorname - name of the typepublic RelationType getRelationType(String name)
SchemaInspectorgetRelationType in interface SchemaInspectorgetRelationType in interface TypeInspectorname - name of the type to returnRelationTypepublic boolean containsPropertyKey(String name)
SchemaInspectorcontainsPropertyKey in interface SchemaInspectorname - name of the property keypublic boolean containsEdgeLabel(String name)
SchemaInspectorcontainsEdgeLabel in interface SchemaInspectorname - name of the edge labelpublic RelationType getExistingRelationType(long typeId)
getExistingRelationType in interface TypeInspectorpublic PropertyKey getPropertyKey(String name)
SchemaInspectorgetPropertyKey in interface SchemaInspectorpublic PropertyKey getOrCreatePropertyKey(String name, Object value)
SchemaInspectorgetOrCreatePropertyKey methodgetOrCreatePropertyKey in interface SchemaInspectorname - name of the property key to returnvalue - the value of the property key. This param is not used by the default
implementationPropertyKeypublic PropertyKey getOrCreatePropertyKey(String name, Object value, org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality cardinality)
SchemaInspectorgetOrCreatePropertyKey methodgetOrCreatePropertyKey in interface SchemaInspectorname - name of the property key to returnvalue - the value of the property key. This param is not used by the defaultcardinality - the cardinality of the property key. This param is not used by the default
implementationPropertyKeypublic PropertyKey getOrCreatePropertyKey(String name)
SchemaInspectorgetOrCreatePropertyKey in interface SchemaInspectorname - name of the property key to returnPropertyKeypublic EdgeLabel getEdgeLabel(String name)
SchemaInspectorgetEdgeLabel in interface SchemaInspectorpublic EdgeLabel getOrCreateEdgeLabel(String name)
SchemaInspectorgetOrCreateEdgeLabel in interface SchemaInspectorname - name of the edge label to returnEdgeLabelpublic PropertyKeyMaker makePropertyKey(String name)
SchemaManagerPropertyKeyMaker 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.
makePropertyKey in interface SchemaManagerPropertyKeyMaker linked to this transaction.PropertyKeyMaker,
PropertyKeypublic EdgeLabelMaker makeEdgeLabel(String name)
SchemaManagerEdgeLabelMaker 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.
makeEdgeLabel in interface SchemaManagerEdgeLabelMaker linked to this transaction.EdgeLabelMaker,
EdgeLabelpublic VertexLabel getExistingVertexLabel(long id)
getExistingVertexLabel in interface TypeInspectorpublic boolean containsVertexLabel(String name)
SchemaInspectorcontainsVertexLabel in interface SchemaInspectorpublic VertexLabel getVertexLabel(String name)
SchemaInspectorgetVertexLabel in interface SchemaInspectorpublic VertexLabel getOrCreateVertexLabel(String name)
SchemaInspectorDefaultSchemaMaker.
Attempting to automatically create a vertex label might cause an exception depending on the configuration.
getOrCreateVertexLabel in interface SchemaInspectorpublic VertexLabelMaker makeVertexLabel(String name)
SchemaManagerVertexLabelMaker to define a new vertex label with the given name. Note, that the name must
be unique.makeVertexLabel in interface SchemaManagerpublic VertexCentricQueryBuilder query(JanusGraphVertex vertex)
public JanusGraphMultiVertexQuery multiQuery(JanusGraphVertex... vertices)
multiQuery in interface TransactionTransaction.multiQuery(org.janusgraph.core.JanusGraphVertex...)public JanusGraphMultiVertexQuery multiQuery(Collection<JanusGraphVertex> vertices)
multiQuery in interface TransactionTransaction.multiQuery(java.util.Collection)public void executeMultiQuery(Collection<InternalVertex> vertices, SliceQuery sq, QueryProfiler profiler)
public void executeMultiSliceMultiQuery(Collection<InternalVertex> vertices, List<BackendQueryHolder<SliceQuery>> queries, QueryProfiler profiler)
public Function<Object,? extends JanusGraphElement> getConversionFunction(ElementCategory elementCategory)
public GraphCentricQueryBuilder query()
query in interface TransactionTransaction.query()public MixedIndexAggQuery mixedIndexAggQuery()
mixedIndexAggQuery in interface TransactionmixedIndexAggQuery()public JanusGraphIndexQuery indexQuery(String indexName, String query)
TransactionJanusGraphIndexQuery 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 may ignore modifications in the current transaction.
indexQuery in interface TransactionindexName - Name of the index to query as configuredquery - Query stringpublic void commit()
JanusGraphTransaction
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.
commit in interface JanusGraphTransactionpublic void rollback()
JanusGraphTransactionThe 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.
rollback in interface JanusGraphTransactionpublic final boolean isOpen()
JanusGraphTransactionisOpen in interface JanusGraphTransactionpublic final boolean isClosed()
JanusGraphTransactionisClosed in interface JanusGraphTransactionpublic boolean hasModifications()
JanusGraphTransactionA modification may be an edge or vertex update, addition, or deletion.
hasModifications in interface JanusGraphTransactionpublic void expireSchemaElement(long id)
expireSchemaElement in interface JanusGraphTransactionCopyright © 2012–2024. All rights reserved.