Class OrientVertex
java.lang.Object
com.tinkerpop.blueprints.impls.orient.OrientElement
com.tinkerpop.blueprints.impls.orient.OrientVertex
- All Implemented Interfaces:
OIdentifiable,OSerializableStream,com.tinkerpop.blueprints.Element,OrientExtendedVertex,com.tinkerpop.blueprints.Vertex,Externalizable,Serializable,Comparable<OIdentifiable>,Comparator<OIdentifiable>
OrientDB Vertex implementation of TinkerPop Blueprints standard.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com)
- See Also:
-
Field Summary
FieldsFields inherited from class com.tinkerpop.blueprints.impls.orient.OrientElement
classicDetachMode, DEF_ORIGINAL_ID_FIELDNAME, LABEL_FIELD_NAME, rawElement, settings -
Constructor Summary
ConstructorsModifierConstructorDescription(Internal) Called by serialization.OrientVertex(OrientBaseGraph graph, OIdentifiable record) protectedOrientVertex(OrientBaseGraph graph, String className, Object... fields) -
Method Summary
Modifier and TypeMethodDescriptionaddEdge(String label, OrientVertex inVertex, Object[] fields) Creates an edge between current Vertex and a target Vertex setting label as Edge's label.addEdge(String label, OrientVertex inVertex, String iClassName) Creates an edge between current Vertex and a target Vertex setting label as Edge's label.addEdge(String label, OrientVertex inVertex, String iClassName, String iClusterName, Object... fields) Creates an edge between current Vertex and a target Vertex setting label as Edge's label.com.tinkerpop.blueprints.EdgeCreates an edge between current Vertex and a target Vertex setting label as Edge's label.protected voidaddSingleEdge(ODocument doc, OMultiCollectionIterator<com.tinkerpop.blueprints.Edge> iterable, String fieldName, OPair<com.tinkerpop.blueprints.Direction, String> connection, Object fieldValue, OIdentifiable iTargetVertex, String[] iLabels) copy()longcountEdges(com.tinkerpop.blueprints.Direction iDirection, String... iLabels) (Blueprints Extension) Returns the number of edges connected to the current Vertex.static ObjectcreateLink(OrientBaseGraph iGraph, ODocument iFromVertex, OIdentifiable iTo, String iFieldName) (Internal only) Creates a link between a vertices and a Graph Element.execute(OCommandPredicate iPredicate) (Blueprints Extension) Executes the command predicate against current vertex.(Blueprints Extension) Returns "V" as base class name all the vertex sub-classes extend.getConnection(com.tinkerpop.blueprints.Direction iDirection, String iFieldName, String... iClassNames) Determines if a field is a connections or not.getConnectionClass(com.tinkerpop.blueprints.Direction iDirection, String iFieldName) Used to extract the class name from the vertex's field.static com.tinkerpop.blueprints.DirectiongetConnectionDirection(String iConnectionField, boolean useVertexFieldsForEdgeLabels) static StringgetConnectionFieldName(com.tinkerpop.blueprints.Direction iDirection, String iClassName, boolean useVertexFieldsForEdgeLabels) (Internal only) Returns the field name used for the relationship.protected static OrientEdgegetEdge(OrientBaseGraph graph, ODocument doc, String fieldName, OPair<com.tinkerpop.blueprints.Direction, String> connection, Object fieldValue, OIdentifiable iTargetVertex, String[] iLabels) (Internal only)Iterable<com.tinkerpop.blueprints.Edge>Returns the edges connected to the current Vertex.Iterable<com.tinkerpop.blueprints.Edge>getEdges(OrientVertex iDestination, com.tinkerpop.blueprints.Direction iDirection, String... iLabels) (Blueprints Extension) Returns all the edges from the current Vertex to another one.(Blueprints Extension) Returns "Vertex".static StringgetInverseConnectionFieldName(String iFieldName, boolean useVertexFieldsForEdgeLabels) (Internal only)getLabel()(Blueprints Extension) Returns the Vertex's label.(Blueprints Extension) Gets all the properties from a Vertex or Edge in one shot.Returns all the Property names as Set of String.getType()(Blueprints Extension) Returns the Vertex type as OrientVertexType object.Iterable<com.tinkerpop.blueprints.Vertex>getVertices(com.tinkerpop.blueprints.Direction iDirection, String... iLabels) Returns a lazy iterable instance against vertices.Moves current vertex to another class/cluster.moveToClass(String iClassName) Moves current vertex to another class.moveToCluster(String iClusterName) Moves current vertex to another cluster.query()Executes a query against the current vertex.voidremove()Removes the current Vertex from the Graph.static voidreplaceLinks(ODocument iVertex, String iFieldName, OIdentifiable iVertexToRemove, OIdentifiable iNewVertex) (Internal only)toString()Returns a string representation of the vertex.traverse()Returns a OTraverse object to start traversing from the current vertex.Methods inherited from class com.tinkerpop.blueprints.impls.orient.OrientElement
attach, checkClass, checkDeletedInTx, checkForClassInSchema, checkIfAttached, compare, compareTo, copyTo, detach, equals, fromStream, getGraph, getId, getIdentity, getProperty, getRecord, hashCode, isDetached, isLocked, lock, lockingStrategy, readExternal, reload, removeProperty, save, save, setCurrentGraphInThreadLocal, setProperties, setPropertiesInternal, setProperty, setProperty, setPropertyInternal, switchToAutoAttachmentMode, switchToManualAttachmentMode, toStream, unlock, validateProperty, writeExternalMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface com.tinkerpop.blueprints.Element
getId, getProperty, removeProperty, setPropertyMethods inherited from interface com.tinkerpop.blueprints.impls.orient.OrientExtendedVertex
attach, getIdentity, getRecord, reload
-
Field Details
-
CONNECTION_OUT_PREFIX
- See Also:
-
CONNECTION_IN_PREFIX
- See Also:
-
-
Constructor Details
-
OrientVertex
public OrientVertex()(Internal) Called by serialization. -
OrientVertex
-
OrientVertex
-
-
Method Details
-
getConnectionFieldName
public static String getConnectionFieldName(com.tinkerpop.blueprints.Direction iDirection, String iClassName, boolean useVertexFieldsForEdgeLabels) (Internal only) Returns the field name used for the relationship.- Parameters:
iDirection- Direction between IN, OUT or BOTHiClassName- Class name if anyuseVertexFieldsForEdgeLabels- Graph setting about using the edge label as vertex's field
-
createLink
public static Object createLink(OrientBaseGraph iGraph, ODocument iFromVertex, OIdentifiable iTo, String iFieldName) (Internal only) Creates a link between a vertices and a Graph Element. -
getConnectionDirection
public static com.tinkerpop.blueprints.Direction getConnectionDirection(String iConnectionField, boolean useVertexFieldsForEdgeLabels) -
getInverseConnectionFieldName
public static String getInverseConnectionFieldName(String iFieldName, boolean useVertexFieldsForEdgeLabels) (Internal only) -
replaceLinks
public static void replaceLinks(ODocument iVertex, String iFieldName, OIdentifiable iVertexToRemove, OIdentifiable iNewVertex) (Internal only) -
getEdge
protected static OrientEdge getEdge(OrientBaseGraph graph, ODocument doc, String fieldName, OPair<com.tinkerpop.blueprints.Direction, String> connection, Object fieldValue, OIdentifiable iTargetVertex, String[] iLabels) (Internal only) -
copy
- Specified by:
copyin interfaceOrientExtendedVertex
-
getVertexInstance
- Specified by:
getVertexInstancein interfaceOrientExtendedVertex
-
execute
(Blueprints Extension) Executes the command predicate against current vertex. Use OSQLPredicate to execute SQL. Example:IterablefriendsOfFriends = (Iterable ) luca.execute(new OSQLPredicate("out().out('Friend').out('Friend')")); - Parameters:
iPredicate- Predicate to evaluate. Use OSQLPredicate to use SQL
-
getPropertyKeys
Returns all the Property names as Set of String. out, in and label are not returned as properties even if are part of the underlying document because are considered internal properties.- Specified by:
getPropertyKeysin interfacecom.tinkerpop.blueprints.Element
-
getProperties
Description copied from class:OrientElement(Blueprints Extension) Gets all the properties from a Vertex or Edge in one shot.- Specified by:
getPropertiesin classOrientElement- Returns:
- a map containing all the properties of the Vertex/Edge.
-
getVertices
public Iterable<com.tinkerpop.blueprints.Vertex> getVertices(com.tinkerpop.blueprints.Direction iDirection, String... iLabels) Returns a lazy iterable instance against vertices.- Specified by:
getVerticesin interfacecom.tinkerpop.blueprints.Vertex- Parameters:
iDirection- The direction between OUT, IN or BOTHiLabels- Optional varargs of Strings representing edge label to consider
-
query
Executes a query against the current vertex. The returning type is a OrientVertexQuery.- Specified by:
queryin interfacecom.tinkerpop.blueprints.Vertex
-
traverse
Returns a OTraverse object to start traversing from the current vertex. -
remove
public void remove()Removes the current Vertex from the Graph. all the incoming and outgoing edges are automatically removed too.- Specified by:
removein interfacecom.tinkerpop.blueprints.Element
-
moveToClass
Moves current vertex to another class. All edges are updated automatically.- Parameters:
iClassName- New class name to assign- Returns:
- New vertex's identity
- See Also:
-
moveToCluster
Moves current vertex to another cluster. All edges are updated automatically.- Parameters:
iClusterName- Cluster name where to save the new vertex- Returns:
- New vertex's identity
- See Also:
-
moveTo
Moves current vertex to another class/cluster. All edges are updated automatically.- Parameters:
iClassName- New class name to assigniClusterName- Cluster name where to save the new vertex- Returns:
- New vertex's identity
- See Also:
-
addEdge
public com.tinkerpop.blueprints.Edge addEdge(String label, com.tinkerpop.blueprints.Vertex inVertex) Creates an edge between current Vertex and a target Vertex setting label as Edge's label.- Specified by:
addEdgein interfacecom.tinkerpop.blueprints.Vertex- Parameters:
label- Edge's label or classinVertex- Outgoing target vertex- Returns:
- The new Edge created
-
addEdge
Creates an edge between current Vertex and a target Vertex setting label as Edge's label. iClassName is the Edge's class used if different by label.- Parameters:
label- Edge's label or classinVertex- Outgoing target vertexiClassName- Edge's class name- Returns:
- The new Edge created
-
addEdge
Creates an edge between current Vertex and a target Vertex setting label as Edge's label. The fields parameter is an Array of fields to set on Edge upon creation. Fields must be a odd pairs of key/value or a single object as Map containing entries as key/value pairs.- Parameters:
label- Edge's label or classinVertex- Outgoing target vertexfields- Fields must be a odd pairs of key/value or a single object as Map containing entries as key/value pairs- Returns:
- The new Edge created
-
addEdge
public OrientEdge addEdge(String label, OrientVertex inVertex, String iClassName, String iClusterName, Object... fields) Creates an edge between current Vertex and a target Vertex setting label as Edge's label. The fields parameter is an Array of fields to set on Edge upon creation. Fields must be a odd pairs of key/value or a single object as Map containing entries as key/value pairs. iClusterName is the name of the cluster where to store the new Edge.- Parameters:
label- Edge's label or classinVertex- Outgoing target vertexfields- Fields must be a odd pairs of key/value or a single object as Map containing entries as key/value pairsiClassName- Edge's class nameiClusterName- The cluster name where to store the edge record- Returns:
- The new Edge created
-
countEdges
(Blueprints Extension) Returns the number of edges connected to the current Vertex.- Parameters:
iDirection- The direction between OUT, IN or BOTHiLabels- Optional labels as Strings to consider- Returns:
- A long with the total edges found
-
getEdges
public Iterable<com.tinkerpop.blueprints.Edge> getEdges(com.tinkerpop.blueprints.Direction iDirection, String... iLabels) Returns the edges connected to the current Vertex. If you are interested on just counting the edges use @countEdges that it's more efficient for this use case.- Specified by:
getEdgesin interfacecom.tinkerpop.blueprints.Vertex- Parameters:
iDirection- The direction between OUT, IN or BOTHiLabels- Optional labels as Strings to consider- Returns:
-
getEdges
public Iterable<com.tinkerpop.blueprints.Edge> getEdges(OrientVertex iDestination, com.tinkerpop.blueprints.Direction iDirection, String... iLabels) (Blueprints Extension) Returns all the edges from the current Vertex to another one.- Parameters:
iDestination- The target vertexiDirection- The direction between OUT, IN or BOTHiLabels- Optional labels as Strings to consider- Returns:
-
getLabel
(Blueprints Extension) Returns the Vertex's label. By default OrientDB binds the Blueprints Label concept to Vertex Class. To disable this feature execute this at database levelalter database custom useClassForVertexLabel=false- Specified by:
getLabelin classOrientElement
-
getBaseClassName
(Blueprints Extension) Returns "V" as base class name all the vertex sub-classes extend.- Specified by:
getBaseClassNamein classOrientElement
-
getElementType
(Blueprints Extension) Returns "Vertex".- Specified by:
getElementTypein classOrientElement
-
getType
(Blueprints Extension) Returns the Vertex type as OrientVertexType object.- Specified by:
getTypein interfaceOrientExtendedVertex
-
toString
Returns a string representation of the vertex. -
getConnectionClass
Used to extract the class name from the vertex's field.- Parameters:
iDirection- Direction of connectioniFieldName- Full field name- Returns:
- Class of the connection if any
-
getConnection
protected OPair<com.tinkerpop.blueprints.Direction,String> getConnection(com.tinkerpop.blueprints.Direction iDirection, String iFieldName, String... iClassNames) Determines if a field is a connections or not.- Parameters:
iDirection- Direction to checkiFieldName- Field nameiClassNames- Optional array of class names- Returns:
- The found direction if any
-
addSingleEdge
protected void addSingleEdge(ODocument doc, OMultiCollectionIterator<com.tinkerpop.blueprints.Edge> iterable, String fieldName, OPair<com.tinkerpop.blueprints.Direction, String> connection, Object fieldValue, OIdentifiable iTargetVertex, String[] iLabels)
-