public abstract class OrientBaseGraph extends Object implements com.tinkerpop.blueprints.IndexableGraph, com.tinkerpop.blueprints.MetaGraph<ODatabaseDocumentTx>, com.tinkerpop.blueprints.KeyIndexableGraph
| Modifier and Type | Class and Description |
|---|---|
class |
OrientBaseGraph.Settings |
static class |
OrientBaseGraph.THREAD_MODE |
| Modifier and Type | Field and Description |
|---|---|
protected static String |
ADMIN |
static String |
CLASS_PREFIX |
static String |
CLUSTER_PREFIX |
static String |
CONNECTION_IN |
static String |
CONNECTION_OUT |
protected OrientBaseGraph.Settings |
settings |
| Constructor and Description |
|---|
OrientBaseGraph(org.apache.commons.configuration.Configuration configuration)
Builds a OrientGraph instance passing a configuration.
|
OrientBaseGraph(ODatabaseDocumentPool pool) |
OrientBaseGraph(ODatabaseDocumentTx iDatabase)
Constructs a new object using an existent database instance.
|
OrientBaseGraph(String url) |
OrientBaseGraph(String url,
String username,
String password) |
| Modifier and Type | Method and Description |
|---|---|
OrientEdge |
addEdge(Object id,
com.tinkerpop.blueprints.Vertex outVertex,
com.tinkerpop.blueprints.Vertex inVertex,
String label)
Creates an edge between a source Vertex and a destination Vertex setting label as Edge's label.
|
OrientVertex |
addTemporaryVertex(String iClassName,
Object... prop)
(Blueprints Extension) Creates a temporary vertex setting the initial field values.
|
OrientVertex |
addVertex(Object id)
Creates a new unconnected vertex with no fields in the Graph.
|
OrientVertex |
addVertex(Object id,
Object... prop)
(Blueprints Extension) Creates a new unconnected vertex in the Graph setting the initial field values.
|
OrientVertex |
addVertex(String iClassName,
String iClusterName)
(Blueprints Extension) Creates a new unconnected vertex with no fields of specific class in a cluster in the Graph.
|
OrientElement |
attach(OrientElement iElement)
Attaches a previously detached Graph Element to the current Graph.
|
protected void |
autoStartTransaction() |
protected void |
checkForGraphSchema(ODatabaseDocumentTx iDatabase) |
OCommandRequest |
command(OCommandRequest iCommand)
Executes commands against the graph.
|
void |
commit()
Commits the current active transaction.
|
protected Object |
convertKey(OIndex<?> idx,
Object iValue) |
protected Object[] |
convertKeys(OIndex<?> idx,
Object[] iValue) |
long |
countEdges()
Counts the edges in graph.
|
long |
countEdges(String iClassName)
Counts the edges in graph of a particular class.
|
long |
countVertices()
Counts the vertices in graph.
|
long |
countVertices(String iClassName)
Counts the vertices in graph of a particular class.
|
OrientEdgeType |
createEdgeType(String iClassName)
Creates a new Edge persistent class.
|
OrientEdgeType |
createEdgeType(String iClassName,
OClass iSuperClass)
Creates a new Edge persistent class specifying the super class.
|
OrientEdgeType |
createEdgeType(String iClassName,
String iSuperClassName)
Creates a new Edge persistent class specifying the super class.
|
<T extends com.tinkerpop.blueprints.Element> |
createIndex(String indexName,
Class<T> indexClass,
com.tinkerpop.blueprints.Parameter... indexParameters) |
<T extends com.tinkerpop.blueprints.Element> |
createKeyIndex(String key,
Class<T> elementClass,
com.tinkerpop.blueprints.Parameter... indexParameters)
Creates an automatic indexing structure for indexing provided key for element class.
|
OrientVertexType |
createVertexType(String iClassName)
Creates a new Vertex persistent class.
|
OrientVertexType |
createVertexType(String iClassName,
OClass iSuperClass)
Creates a new Vertex persistent class specifying the super class.
|
OrientVertexType |
createVertexType(String iClassName,
String iSuperClassName)
Creates a new Vertex persistent class specifying the super class.
|
static String |
decodeClassName(String iClassName)
(Internal)
|
OrientElement |
detach(OrientElement iElement)
Detaches a Graph Element to be used offline.
|
void |
drop()
(Blueprints Extension) Drops the database
|
void |
dropEdgeType(String iTypeName)
Drops an edge class.
|
void |
dropIndex(String indexName)
Drops an index by name.
|
<T extends com.tinkerpop.blueprints.Element> |
dropKeyIndex(String key,
Class<T> elementClass)
Drops the index against a field name.
|
void |
dropVertexType(String iTypeName)
Drop a vertex class.
|
static String |
encodeClassName(String iClassName)
(Internal)
|
static void |
encodeClassNames(String... iLabels)
(Internal)
|
protected <RET> RET |
executeOutsideTx(OCallable<RET,OrientBaseGraph> iCallable,
String... iOperationStrings) |
protected <T> String |
getClassName(Class<T> elementClass) |
protected com.tinkerpop.blueprints.impls.orient.OrientGraphContext |
getContext(boolean create) |
OrientEdge |
getEdge(Object id)
Returns a edge by an ID.
|
OrientEdgeType |
getEdgeBaseType()
Returns the E persistent class as OrientEdgeType instance.
|
Iterable<com.tinkerpop.blueprints.Edge> |
getEdges()
Returns all the edges in Graph.
|
Iterable<com.tinkerpop.blueprints.Edge> |
getEdges(boolean iPolymorphic)
Get all the Edges in Graph specifying if consider or not sub-classes of E.
|
Iterable<com.tinkerpop.blueprints.Edge> |
getEdges(String iKey,
Object iValue)
Get all the Edges in Graph filtering by field name and value.
|
Iterable<com.tinkerpop.blueprints.Edge> |
getEdgesOfClass(String iClassName)
Get all the Edges in Graph of a specific edge class and all sub-classes.
|
Iterable<com.tinkerpop.blueprints.Edge> |
getEdgesOfClass(String iClassName,
boolean iPolymorphic)
Get all the Edges in Graph of a specific edges class and all sub-classes only if iPolymorphic is true.
|
OrientEdgeType |
getEdgeType(String iTypeName)
Returns the persistent class for type iTypeName as OrientEdgeType instance.
|
OrientElement |
getElement(Object id)
Returns a graph element, vertex or edge, starting from an ID.
|
<T extends com.tinkerpop.blueprints.Element> |
getIndex(String indexName,
Class<T> indexClass)
Returns an index by name and class
|
<T extends com.tinkerpop.blueprints.Element> |
getIndexedKeys(Class<T> elementClass)
Returns the indexed properties.
|
<T extends com.tinkerpop.blueprints.Element> |
getIndexedKeys(Class<T> elementClass,
boolean includeClassNames)
Returns the indexed properties.
|
Iterable<com.tinkerpop.blueprints.Index<? extends com.tinkerpop.blueprints.Element>> |
getIndices()
Returns all the indices.
|
ODatabaseDocumentTx |
getRawGraph()
Returns the underlying Database instance as ODatabaseDocumentTx instance.
|
OrientBaseGraph.THREAD_MODE |
getThreadMode()
Returns the current thread mode:
MANUAL the user has to manually invoke the current database in Thread Local:
ODatabaseRecordThreadLocal.INSTANCE.set(graph.getRawGraph());
AUTOSET_IFNULL (default) each call assures the current graph instance is set in the Thread Local only if no one was
set before
ALWAYS_AUTOSET each call assures the current graph instance is set in the Thread Local
|
OrientVertex |
getVertex(Object id)
Returns a vertex by an ID.
|
OrientVertexType |
getVertexBaseType()
Returns the V persistent class as OrientVertexType instance.
|
OrientVertexType |
getVertexType(String iTypeName)
Returns the persistent class for type iTypeName as OrientVertexType instance.
|
Iterable<com.tinkerpop.blueprints.Vertex> |
getVertices()
Get all the Vertices in Graph.
|
Iterable<com.tinkerpop.blueprints.Vertex> |
getVertices(boolean iPolymorphic)
Get all the Vertices in Graph specifying if consider or not sub-classes of V.
|
Iterable<com.tinkerpop.blueprints.Vertex> |
getVertices(String iKey,
Object iValue)
Get all the Vertices in Graph filtering by field name and value.
|
Iterable<com.tinkerpop.blueprints.Vertex> |
getVertices(String label,
String[] iKey,
Object[] iValue)
Get all the Vertices in Graph filtering by field name and value.
|
Iterable<com.tinkerpop.blueprints.Vertex> |
getVerticesOfClass(String iClassName)
Get all the Vertices in Graph of a specific vertex class and all sub-classes.
|
Iterable<com.tinkerpop.blueprints.Vertex> |
getVerticesOfClass(String iClassName,
boolean iPolymorphic)
Get all the Vertices in Graph of a specific vertex class and all sub-classes only if iPolymorphic is true.
|
boolean |
isClosed()
Checks if the Graph has been closed.
|
boolean |
isKeepInMemoryReferences()
Returns true if the references are kept in memory.
|
boolean |
isSaveOriginalIds()
Returns true if it saves the original Id, otherwise false.
|
boolean |
isStandardElementConstraints()
Returns true if Blueprints standard constraints are applied to elements.
|
boolean |
isUseClassForEdgeLabel()
Returns true if the class are use for Edge labels.
|
boolean |
isUseClassForVertexLabel()
Returns true if the class are use for Vertex labels.
|
boolean |
isUseLightweightEdges()
Returns true if is using lightweight edges, otherwise false.
|
boolean |
isUseVertexFieldsForEdgeLabels()
Returns true if the out/in fields in vertex are post-fixed with edge labels.
|
boolean |
isWarnOnForceClosingTx()
Returns true if the warning is generated on force the graph closing.
|
com.tinkerpop.blueprints.GraphQuery |
query()
Returns a GraphQuery object to execute queries against the Graph.
|
protected void |
removeContext()
Removes the current context.
|
void |
removeEdge(com.tinkerpop.blueprints.Edge edge)
Removes an edge from the Graph.
|
void |
removeVertex(com.tinkerpop.blueprints.Vertex vertex)
Removes a vertex from the Graph.
|
OrientBaseGraph |
reuse(ODatabaseDocumentTx iDatabase)
Reuses the underlying database avoiding to create and open it every time.
|
void |
rollback()
Rollbacks the current active transaction.
|
protected void |
saveIndexConfiguration() |
protected void |
setCurrentGraphInThreadLocal() |
void |
setKeepInMemoryReferences(boolean useReferences)
Changes the setting about using references in memory.
|
void |
setSaveOriginalIds(boolean saveIds)
Changes the setting about usage of lightweight edges.
|
void |
setStandardElementConstraints(boolean allowsPropertyValueNull)
Changes the setting to apply the Blueprints standard constraints against elements.
|
OrientBaseGraph |
setThreadMode(OrientBaseGraph.THREAD_MODE iControl)
Changes the thread mode:
MANUAL the user has to manually invoke the current database in Thread Local:
ODatabaseRecordThreadLocal.INSTANCE.set(graph.getRawGraph());
AUTOSET_IFNULL (default) each call assures the current graph instance is set in the Thread Local only if no one was
set before
ALWAYS_AUTOSET each call assures the current graph instance is set in the Thread Local
|
void |
setUseClassForEdgeLabel(boolean useCustomClassesForEdges)
Changes the setting to use the Edge class for Edge labels.
|
void |
setUseClassForVertexLabel(boolean useCustomClassesForVertex)
Changes the setting to use the Vertex class for Vertex labels.
|
void |
setUseLightweightEdges(boolean useDynamicEdges)
Changes the setting about usage of lightweight edges.
|
void |
setUseVertexFieldsForEdgeLabels(boolean useVertexFieldsForEdgeLabels)
Changes the setting to postfix vertices fields with edge labels.
|
OrientBaseGraph |
setWarnOnForceClosingTx(boolean warnOnSchemaChangeInTx)
Changes the setting to generate a warning if the graph closing has been forced.
|
void |
shutdown()
Closes the Graph.
|
String |
toString()
Returns the Graph URL.
|
OTraverse |
traverse()
Returns a OTraverse object to start traversing the graph.
|
public static final String CONNECTION_OUT
public static final String CONNECTION_IN
public static final String CLASS_PREFIX
public static final String CLUSTER_PREFIX
protected static final String ADMIN
protected OrientBaseGraph.Settings settings
public OrientBaseGraph(ODatabaseDocumentTx iDatabase)
iDatabase - Underlying database object to attachpublic OrientBaseGraph(ODatabaseDocumentPool pool)
public OrientBaseGraph(String url)
public OrientBaseGraph(org.apache.commons.configuration.Configuration configuration)
| Name | Description | Default value |
| blueprints.orientdb.url | Database URL | - |
| blueprints.orientdb.username | User name | admin |
| blueprints.orientdb.password | User password | admin |
| blueprints.orientdb.saveOriginalIds | Saves the original element IDs by using the property origId. This could be useful on import of graph to preserve original ids | false |
| blueprints.orientdb.keepInMemoryReferences | Avoid to keep records in memory but only RIDs | false |
| blueprints.orientdb.useCustomClassesForEdges | Use Edge's label as OrientDB class. If doesn't exist create it under the hood | true |
| blueprints.orientdb.useCustomClassesForVertex | Use Vertex's label as OrientDB class. If doesn't exist create it under the hood | true |
| blueprints.orientdb.useVertexFieldsForEdgeLabels | Store the edge relationships in vertex by using the Edge's class. This allow to use multiple fields and make faster traversal by edge's label (class) | true |
| blueprints.orientdb.lightweightEdges | Uses lightweight edges. This avoid to create a physical document per edge. Documents are created only when they have properties | true |
configuration - of graphpublic static void encodeClassNames(String... iLabels)
public void drop()
public <T extends com.tinkerpop.blueprints.Element> com.tinkerpop.blueprints.Index<T> createIndex(String indexName, Class<T> indexClass, com.tinkerpop.blueprints.Parameter... indexParameters)
createIndex in interface com.tinkerpop.blueprints.IndexableGraphpublic <T extends com.tinkerpop.blueprints.Element> com.tinkerpop.blueprints.Index<T> getIndex(String indexName, Class<T> indexClass)
getIndex in interface com.tinkerpop.blueprints.IndexableGraphindexName - Index nameindexClass - Class as one or subclass of Vertex.class and Edge.classpublic Iterable<com.tinkerpop.blueprints.Index<? extends com.tinkerpop.blueprints.Element>> getIndices()
getIndices in interface com.tinkerpop.blueprints.IndexableGraphpublic void dropIndex(String indexName)
dropIndex in interface com.tinkerpop.blueprints.IndexableGraphindexName - Index namepublic OrientVertex addVertex(Object id)
addVertex in interface com.tinkerpop.blueprints.Graphid - Optional, can contains the Edge's class name by prefixing with "class:"public OrientVertex addVertex(Object id, Object... prop)
id - Optional, can contains the Edge's class name by prefixing with "class:"prop - Fields must be a odd pairs of key/value or a single object as Map containing entries as key/value pairspublic OrientVertex addVertex(String iClassName, String iClusterName)
iClassName - Vertex class nameiClusterName - Vertex cluster namepublic OrientVertex addTemporaryVertex(String iClassName, Object... prop)
iClassName - Vertex's class nameprop - Fields must be a odd pairs of key/value or a single object as Map containing entries as key/value pairspublic OrientEdge addEdge(Object id, com.tinkerpop.blueprints.Vertex outVertex, com.tinkerpop.blueprints.Vertex inVertex, String label)
addEdge in interface com.tinkerpop.blueprints.Graphid - Optional, can contains the Edge's class name by prefixing with "class:"outVertex - Source vertexinVertex - Destination vertexlabel - Edge's labelpublic OrientVertex getVertex(Object id)
getVertex in interface com.tinkerpop.blueprints.Graphid - Can by a String, ODocument or an OIdentifiable object.public void removeVertex(com.tinkerpop.blueprints.Vertex vertex)
removeVertex in interface com.tinkerpop.blueprints.Graphvertex - Vertex to removepublic Iterable<com.tinkerpop.blueprints.Vertex> getVertices()
getVertices in interface com.tinkerpop.blueprints.Graphpublic Iterable<com.tinkerpop.blueprints.Vertex> getVertices(boolean iPolymorphic)
iPolymorphic - If true then get all the vertices of any sub-classpublic Iterable<com.tinkerpop.blueprints.Vertex> getVerticesOfClass(String iClassName)
iClassName - Vertex class name to filterpublic Iterable<com.tinkerpop.blueprints.Vertex> getVerticesOfClass(String iClassName, boolean iPolymorphic)
iClassName - Vertex class name to filteriPolymorphic - If true consider also Vertex iClassName sub-classespublic Iterable<com.tinkerpop.blueprints.Vertex> getVertices(String iKey, Object iValue)
Iterable resultset = getVertices("name", "Jay");
getVertices in interface com.tinkerpop.blueprints.GraphiKey - Field nameiValue - Field valuepublic Iterable<com.tinkerpop.blueprints.Vertex> getVertices(String label, String[] iKey, Object[] iValue)
Iterable resultset = getVertices("Person",new String[] {"name","surname"},new Object[] { "Sherlock" ,"Holmes"});
iKey - Fields nameiValue - Fields valuepublic Iterable<com.tinkerpop.blueprints.Edge> getEdges()
getEdges in interface com.tinkerpop.blueprints.Graphpublic Iterable<com.tinkerpop.blueprints.Edge> getEdges(boolean iPolymorphic)
iPolymorphic - If true then get all the edge of any sub-classpublic Iterable<com.tinkerpop.blueprints.Edge> getEdgesOfClass(String iClassName)
iClassName - Edge class name to filterpublic Iterable<com.tinkerpop.blueprints.Edge> getEdgesOfClass(String iClassName, boolean iPolymorphic)
iClassName - Edge class name to filteriPolymorphic - If true consider also iClassName Edge sub-classespublic Iterable<com.tinkerpop.blueprints.Edge> getEdges(String iKey, Object iValue)
Iterable resultset = getEdges("name", "Jay");
getEdges in interface com.tinkerpop.blueprints.GraphiKey - Field nameiValue - Field valuepublic OrientEdge getEdge(Object id)
getEdge in interface com.tinkerpop.blueprints.Graphid - Can by a String, ODocument or an OIdentifiable object.public void removeEdge(com.tinkerpop.blueprints.Edge edge)
removeEdge in interface com.tinkerpop.blueprints.Graphedge - Edge to removepublic OrientBaseGraph reuse(ODatabaseDocumentTx iDatabase)
iDatabase - Underlying database objectpublic boolean isClosed()
public void shutdown()
shutdown in interface com.tinkerpop.blueprints.Graphpublic ODatabaseDocumentTx getRawGraph()
getRawGraph in interface com.tinkerpop.blueprints.MetaGraph<ODatabaseDocumentTx>public void commit()
public void rollback()
public OrientVertexType getVertexBaseType()
public final OrientVertexType getVertexType(String iTypeName)
iTypeName - Vertex class namepublic OrientVertexType createVertexType(String iClassName)
iClassName - Vertex class namepublic OrientVertexType createVertexType(String iClassName, String iSuperClassName)
iClassName - Vertex class nameiSuperClassName - Vertex class name to extendpublic OrientVertexType createVertexType(String iClassName, OClass iSuperClass)
iClassName - Vertex class nameiSuperClass - OClass Vertex to extendpublic final void dropVertexType(String iTypeName)
iTypeName - Vertex class namepublic OrientEdgeType getEdgeBaseType()
public final OrientEdgeType getEdgeType(String iTypeName)
iTypeName - Edge class namepublic OrientEdgeType createEdgeType(String iClassName)
iClassName - Edge class namepublic OrientEdgeType createEdgeType(String iClassName, String iSuperClassName)
iClassName - Edge class nameiSuperClassName - Edge class name to extendpublic OrientEdgeType createEdgeType(String iClassName, OClass iSuperClass)
iClassName - Edge class nameiSuperClass - OClass Edge to extendpublic final void dropEdgeType(String iTypeName)
iTypeName - Edge class namepublic OrientElement detach(OrientElement iElement)
iElement - Graph element to detachattach(OrientElement)public OrientElement attach(OrientElement iElement)
iElement - Graph element to attachdetach(OrientElement)public OrientElement getElement(Object id)
id - Can by a String, ODocument or an OIdentifiable object.public <T extends com.tinkerpop.blueprints.Element> void dropKeyIndex(String key, Class<T> elementClass)
dropKeyIndex in interface com.tinkerpop.blueprints.KeyIndexableGraphkey - Field nameelementClass - Element class as instances of Vertex and Edgepublic <T extends com.tinkerpop.blueprints.Element> void createKeyIndex(String key, Class<T> elementClass, com.tinkerpop.blueprints.Parameter... indexParameters)
createKeyIndex in interface com.tinkerpop.blueprints.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 implementation:
public <T extends com.tinkerpop.blueprints.Element> Set<String> getIndexedKeys(Class<T> elementClass)
getIndexedKeys in interface com.tinkerpop.blueprints.KeyIndexableGraphelementClass - the element class that the index is forpublic <T extends com.tinkerpop.blueprints.Element> Set<String> getIndexedKeys(Class<T> elementClass, boolean includeClassNames)
elementClass - the element class that the index is forincludeClassNames - If true includes also the class name as prefix of fieldspublic com.tinkerpop.blueprints.GraphQuery query()
query in interface com.tinkerpop.blueprints.Graphpublic OTraverse traverse()
public OCommandRequest command(OCommandRequest iCommand)
iCommand - Command request between SQL, GREMLIN and SCRIPT commandspublic long countVertices()
public long countVertices(String iClassName)
public long countEdges()
public long countEdges(String iClassName)
public boolean isUseLightweightEdges()
public void setUseLightweightEdges(boolean useDynamicEdges)
public boolean isSaveOriginalIds()
public void setSaveOriginalIds(boolean saveIds)
public boolean isKeepInMemoryReferences()
public void setKeepInMemoryReferences(boolean useReferences)
public boolean isUseClassForEdgeLabel()
public void setUseClassForEdgeLabel(boolean useCustomClassesForEdges)
public boolean isUseClassForVertexLabel()
public void setUseClassForVertexLabel(boolean useCustomClassesForVertex)
public boolean isUseVertexFieldsForEdgeLabels()
public void setUseVertexFieldsForEdgeLabels(boolean useVertexFieldsForEdgeLabels)
public boolean isStandardElementConstraints()
public void setStandardElementConstraints(boolean allowsPropertyValueNull)
public boolean isWarnOnForceClosingTx()
public OrientBaseGraph setWarnOnForceClosingTx(boolean warnOnSchemaChangeInTx)
public OrientBaseGraph.THREAD_MODE getThreadMode()
setThreadMode(THREAD_MODE)public OrientBaseGraph setThreadMode(OrientBaseGraph.THREAD_MODE iControl)
iControl - Value to setgetThreadMode()protected void removeContext()
protected void checkForGraphSchema(ODatabaseDocumentTx iDatabase)
protected void autoStartTransaction()
protected void saveIndexConfiguration()
protected com.tinkerpop.blueprints.impls.orient.OrientGraphContext getContext(boolean create)
protected <RET> RET executeOutsideTx(OCallable<RET,OrientBaseGraph> iCallable, String... iOperationStrings) throws RuntimeException
RuntimeExceptionprotected void setCurrentGraphInThreadLocal()
Copyright © 2009-2014 Orient Technologies. All Rights Reserved.