public class IdGraph<T extends KeyIndexableGraph> extends Object implements KeyIndexableGraph, WrapperGraph<T>, IndexableGraph, TransactionalGraph
| Modifier and Type | Class and Description |
|---|---|
static interface |
IdGraph.IdFactory
A factory for IDs of newly-created vertices and edges (where an ID is not otherwise specified).
|
TransactionalGraph.Conclusion| Constructor and Description |
|---|
IdGraph(T baseGraph)
Adds custom ID functionality to the given graph,
supporting both custom vertex IDs and custom edge IDs.
|
IdGraph(T baseGraph,
boolean supportVertexIds,
boolean supportEdgeIds)
Adds custom ID functionality to the given graph,
supporting either custom vertex IDs, custom edge IDs, or both.
|
| Modifier and Type | Method and Description |
|---|---|
Edge |
addEdge(Object id,
Vertex outVertex,
Vertex inVertex,
String label)
Add an edge to the graph.
|
Vertex |
addVertex(Object id)
Create a new vertex, add it to the graph, and return the newly created vertex.
|
void |
commit()
Stop the current transaction and successfully apply mutations to the graph.
|
<T extends Element> |
createIndex(String indexName,
Class<T> indexClass,
Parameter... indexParameters)
Generate an index with a particular name for a particular class.
|
<T extends Element> |
createKeyIndex(String key,
Class<T> elementClass,
Parameter... indexParameters)
Create an automatic indexing structure for indexing provided key for element class.
|
void |
dropIndex(String indexName)
Remove an index associated with the graph.
|
<T extends Element> |
dropKeyIndex(String key,
Class<T> elementClass)
Remove an automatic indexing structure associated with indexing provided key for element class.
|
void |
enforceUniqueIds(boolean enforceUniqueIds) |
T |
getBaseGraph()
Get the graph this wrapper delegates to.
|
Edge |
getEdge(Object id)
Return the edge referenced by the provided object identifier.
|
IdGraph.IdFactory |
getEdgeIdFactory()
return the factory for new edge IDs.
|
Iterable<Edge> |
getEdges()
Return an iterable to all the edges in the graph.
|
Iterable<Edge> |
getEdges(String key,
Object value)
Return an iterable to all the edges in the graph that have a particular key/value property.
|
Features |
getFeatures()
Get the particular features of the graph implementation.
|
<T extends Element> |
getIndex(String indexName,
Class<T> indexClass)
Get an index from the graph by its name and index class.
|
<T extends Element> |
getIndexedKeys(Class<T> elementClass)
Return all the index keys associated with a particular element class.
|
Iterable<Index<? extends Element>> |
getIndices()
Get all the indices maintained by the graph.
|
boolean |
getSupportEdgeIds() |
boolean |
getSupportVertexIds() |
Vertex |
getVertex(Object id)
Return the vertex referenced by the provided object identifier.
|
IdGraph.IdFactory |
getVertexIdFactory() |
Iterable<Vertex> |
getVertices()
Return an iterable to all the vertices in the graph.
|
Iterable<Vertex> |
getVertices(String key,
Object value)
Return an iterable to all the vertices in the graph that have a particular key/value property.
|
GraphQuery |
query()
Generate a query object that can be used to fine tune which edges/vertices are retrieved from the graph.
|
void |
removeEdge(Edge edge)
Remove the provided edge from the graph.
|
void |
removeVertex(Vertex vertex)
Remove the provided vertex from the graph.
|
void |
rollback()
Stop the current transaction and drop any mutations applied since the last transaction.
|
void |
setEdgeIdFactory(IdGraph.IdFactory idFactory) |
void |
setVertexIdFactory(IdGraph.IdFactory idFactory) |
void |
shutdown()
A shutdown function is required to properly close the graph.
|
void |
stopTransaction(TransactionalGraph.Conclusion conclusion)
Stop the current transaction.
|
String |
toString() |
public static final String ID
public IdGraph(T baseGraph)
baseGraph - the base graph which does not necessarily support custom IDspublic IdGraph(T baseGraph, boolean supportVertexIds, boolean supportEdgeIds)
baseGraph - the base graph which does not necessarily support custom IDssupportVertexIds - whether to support custom vertex IDssupportEdgeIds - whether to support custom edge IDspublic void setVertexIdFactory(IdGraph.IdFactory idFactory)
idFactory - a factory for new vertex IDs.
When vertices are created using null IDs, the actual IDs are chosen based on this factory.public void setEdgeIdFactory(IdGraph.IdFactory idFactory)
idFactory - a factory for new edge IDs.
When edges are created using null IDs, the actual IDs are chosen based on this factory.public IdGraph.IdFactory getVertexIdFactory()
public IdGraph.IdFactory getEdgeIdFactory()
public Features getFeatures()
GraphgetFeatures in interface Graphpublic Vertex addVertex(Object id)
Graphpublic Vertex getVertex(Object id)
Graphpublic void removeVertex(Vertex vertex)
GraphremoveVertex in interface Graphvertex - the vertex to remove from the graphpublic Iterable<Vertex> getVertices()
GraphgetVertices in interface Graphpublic Iterable<Vertex> getVertices(String key, Object value)
GraphgetVertices in interface Graphkey - the key of vertexvalue - the value of the vertexpublic Edge addEdge(Object id, Vertex outVertex, Vertex inVertex, String label)
Graphpublic Edge getEdge(Object id)
Graphpublic void removeEdge(Edge edge)
GraphremoveEdge in interface Graphedge - the edge to remove from the graphpublic Iterable<Edge> getEdges()
Graphpublic Iterable<Edge> getEdges(String key, Object value)
Graphpublic void stopTransaction(TransactionalGraph.Conclusion conclusion)
TransactionalGraphstopTransaction in interface TransactionalGraphconclusion - whether or not the current transaction was successfulpublic void rollback()
TransactionalGraphrollback in interface TransactionalGraphpublic void commit()
TransactionalGraphcommit in interface TransactionalGraphpublic void shutdown()
Graphpublic <T extends Element> void dropKeyIndex(String key, Class<T> elementClass)
KeyIndexableGraphdropKeyIndex in interface KeyIndexableGraphT - the element class specificationkey - the key to drop the index forelementClass - the element class that the index is forpublic <T extends Element> void createKeyIndex(String key, Class<T> elementClass, Parameter... indexParameters)
KeyIndexableGraphcreateKeyIndex in interface KeyIndexableGraphT - the element class specificationkey - the key to create the index forelementClass - the element class that the index is forindexParameters - a collection of parameters for the underlying index implementationpublic <T extends Element> Set<String> getIndexedKeys(Class<T> elementClass)
KeyIndexableGraphgetIndexedKeys in interface KeyIndexableGraphT - the element class specificationelementClass - the element class that the index is forpublic T getBaseGraph()
WrapperGraphgetBaseGraph in interface WrapperGraph<T extends KeyIndexableGraph>public void enforceUniqueIds(boolean enforceUniqueIds)
public <T extends Element> Index<T> createIndex(String indexName, Class<T> indexClass, Parameter... indexParameters)
IndexableGraphcreateIndex in interface IndexableGraphT - the element class that this index is indexing (can be base class)indexName - the name of the manual indexindexClass - the element class that this index is indexing (can be base class)indexParameters - a collection of parameters for the underlying index implementationpublic <T extends Element> Index<T> getIndex(String indexName, Class<T> indexClass)
IndexableGraphgetIndex in interface IndexableGraphT - the class of the elements being indexed (can be base class)indexName - the name of the index to retrieveindexClass - the class of the elements being indexed (can be base class)public Iterable<Index<? extends Element>> getIndices()
IndexableGraphgetIndices in interface IndexableGraphpublic void dropIndex(String indexName)
IndexableGraphdropIndex in interface IndexableGraphindexName - the name of the index to droppublic GraphQuery query()
Graphpublic boolean getSupportVertexIds()
public boolean getSupportEdgeIds()
Copyright © 2010-2014. All Rights Reserved.