Class OrientEdge

java.lang.Object
com.tinkerpop.blueprints.impls.orient.OrientElement
com.tinkerpop.blueprints.impls.orient.OrientEdge
All Implemented Interfaces:
OIdentifiable, OSerializableStream, com.tinkerpop.blueprints.Edge, com.tinkerpop.blueprints.Element, Externalizable, Serializable, Comparable<OIdentifiable>, Comparator<OIdentifiable>

public class OrientEdge extends OrientElement implements com.tinkerpop.blueprints.Edge
OrientDB Edge implementation of TinkerPop Blueprints standard. Edges can be classic or lightweight. Lightweight edges have no properties and have no identity on database. Lightweight edges are created by default when an Edge is created without properties. To disable this option execute this command against the database: alter database custom useLightweightEdges=false .
Author:
Luca Garulli (l.garulli--(at)--orientdb.com) (http://orientdb.com)
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getConnection

      public static OIdentifiable getConnection(ODocument iEdgeRecord, com.tinkerpop.blueprints.Direction iDirection)
    • isLabeled

      public static boolean isLabeled(String iEdgeLabel, String[] iLabels)
      (Blueprints Extension) Returns true if the edge is labeled with any of the passed strings.
      Parameters:
      iEdgeLabel - Label of current edge
      iLabels - Labels as array of Strings
      Returns:
      true if the edge is labeled with any of the passed strings
    • getRecordLabel

      public static String getRecordLabel(OIdentifiable iEdge)
      (Blueprints Extension) Returns the record label if any, otherwise NULL.
      Parameters:
      iEdge - Edge instance
    • getType

      public OrientEdgeType getType()
    • getVertex

      public OrientVertex getVertex(com.tinkerpop.blueprints.Direction direction)
      Returns the connected incoming or outgoing vertex.
      Specified by:
      getVertex in interface com.tinkerpop.blueprints.Edge
      Parameters:
      direction - Direction between IN or OUT
    • getOutVertex

      public OIdentifiable getOutVertex()
      (Blueprints Extension) Returns the outgoing vertex in form of record.
    • getInVertex

      public OIdentifiable getInVertex()
      (Blueprints Extension) Returns the incoming vertex in form of record.
    • getLabel

      public String getLabel()
      Returns the Edge's label. By default OrientDB binds the Blueprints Label concept to Edge Class. To disable this feature execute this at database level alter database custom useClassForEdgeLabel=false
      Specified by:
      getLabel in interface com.tinkerpop.blueprints.Edge
      Specified by:
      getLabel in class OrientElement
    • equals

      public boolean equals(Object object)
      Specified by:
      equals in interface Comparator<OIdentifiable>
      Overrides:
      equals in class OrientElement
    • getId

      public Object getId()
      Returns the Edge Id assuring to save it if it's transient yet.
      Specified by:
      getId in interface com.tinkerpop.blueprints.Element
      Overrides:
      getId in class OrientElement
    • getProperty

      public <T> T getProperty(String key)
      Returns a Property value.
      Specified by:
      getProperty in interface com.tinkerpop.blueprints.Element
      Overrides:
      getProperty in class OrientElement
      Parameters:
      key - Property name
      Returns:
      Property value if any, otherwise NULL.
    • isLightweight

      public boolean isLightweight()
    • getPropertyKeys

      public Set<String> 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:
      getPropertyKeys in interface com.tinkerpop.blueprints.Element
    • getProperties

      public Map<String,Object> getProperties()
      Description copied from class: OrientElement
      (Blueprints Extension) Gets all the properties from a Vertex or Edge in one shot.
      Specified by:
      getProperties in class OrientElement
      Returns:
      a map containing all the properties of the Vertex/Edge.
    • setProperty

      public void setProperty(String key, Object value)
      Set a Property value. If the edge is lightweight, it's transparently transformed into a regular edge.
      Specified by:
      setProperty in interface com.tinkerpop.blueprints.Element
      Overrides:
      setProperty in class OrientElement
      Parameters:
      key - Property name
      value - Property value
    • removeProperty

      public <T> T removeProperty(String key)
      Removed a Property.
      Specified by:
      removeProperty in interface com.tinkerpop.blueprints.Element
      Overrides:
      removeProperty in class OrientElement
      Parameters:
      key - Property name
      Returns:
      Old value if any
    • remove

      public void remove()
      Removes the Edge from the Graph. Connected vertices aren't removed.
      Specified by:
      remove in interface com.tinkerpop.blueprints.Element
    • getBaseClassName

      public final String getBaseClassName()
      (Blueprints Extension) Returns "E" as base class name all the edge's sub-classes extend.
      Specified by:
      getBaseClassName in class OrientElement
    • getElementType

      public String getElementType()
      (Blueprints Extension) Returns "Edge".
      Specified by:
      getElementType in class OrientElement
    • toString

      public String toString()
      Returns a string representation of the edge.
      Overrides:
      toString in class Object
    • getRecord

      public ODocument getRecord()
      (Blueprints Extension) Returns the underlying record if it's a regular edge, otherwise it created a document with no identity with the edge properties.
      Specified by:
      getRecord in interface OIdentifiable
      Overrides:
      getRecord in class OrientElement
      Returns:
      ORecord instance
    • convertToDocument

      public void convertToDocument()
      (Blueprints Extension) Converts the lightweight edge to a regular edge creating the underlying document to store edge's properties.
    • getClassName

      public String getClassName(String iLabel)
      (Blueprints Extension) Returns the class name based on graph settings.
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Overrides:
      writeExternal in class OrientElement
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Overrides:
      readExternal in class OrientElement
      Throws:
      IOException
      ClassNotFoundException
    • isLabeled

      public boolean isLabeled(String[] iLabels)
      Returns true if the edge is labeled with any of the passed strings.
      Parameters:
      iLabels - Labels as array of Strings
      Returns:
      true if the edge is labeled with any of the passed strings
    • createDocument

      protected ODocument createDocument(String iLabel)
    • dropEdgeFromVertex

      protected boolean dropEdgeFromVertex(OIdentifiable iEdge, ODocument iVertex, String iFieldName, Object iFieldValue)