All Implemented Interfaces:
Serializable

public class InstanceGraph extends InstanceElementHeader
InstanceGraph stores a subgraph of entities and relationships and provides methods to access its content. It stores a list of entities and a list of relationships. It is possible to request a list for each of these two lists, or request elements that link to a specific element. For example, request the relationships that link to an entity or the entity at a specific end of a relationship.
See Also:
  • Field Details

    • CURRENT_INSTANCE_GRAPH_HEADER_VERSION

      public static final long CURRENT_INSTANCE_GRAPH_HEADER_VERSION
      Version of the header used in this release
      See Also:
  • Constructor Details

    • InstanceGraph

      public InstanceGraph()
      Default constructor
    • InstanceGraph

      public InstanceGraph(List<EntityDetail> entities, List<Relationship> relationships)
      Typical Constructor creates a graph with the supplied list of elements. It assumes the caller has supplied elements that do link together. However, this graph supports graph fragments.
      Parameters:
      entities - list of entity elements to add to the list
      relationships - list of relationship elements to add to the list
    • InstanceGraph

      public InstanceGraph(InstanceGraph templateGraph)
      Copy/clone constructor.
      Parameters:
      templateGraph - graph to copy; null to create an empty graph
  • Method Details

    • getEntities

      public List<EntityDetail> getEntities()
      Return the list of all the entities (vertices/nodes) in the instance graph. Null means empty graph.
      Returns:
      EntityDetails entity list
    • setEntities

      public void setEntities(List<EntityDetail> entityElementList)
      Set up the list of entities for this instance graph.
      Parameters:
      entityElementList - list of entities
    • getRelationships

      public List<Relationship> getRelationships()
      Return the list of all relationships (edges/links) in the instance graph. Null means a disconnected/empty graph.
      Returns:
      Relationships relationship list
    • setRelationships

      public void setRelationships(List<Relationship> relationshipElementList)
      Set up the list of relationships in this instance graph.
      Parameters:
      relationshipElementList - list of relationships
    • returnRelationshipsForEntity

      public List<Relationship> returnRelationshipsForEntity(String anchorEntityGUID)
      Return a list of relationships that are connected to a specific entity.
      Parameters:
      anchorEntityGUID - unique identifier for an entity
      Returns:
      Relationships relationship iterator
    • returnLinkedEntity

      public EntityDetail returnLinkedEntity(String anchorEntityGUID, String linkingRelationshipGUID)
      Return the entity connected at the far end of an entity's relationship.
      Parameters:
      anchorEntityGUID - unique id for the known entity.
      linkingRelationshipGUID - the relationship to traverse.
      Returns:
      EntityDetail the requested entity at the far end of the relationship. Null if the relationship or entity is not found.
    • returnEntityElementCount

      public int returnEntityElementCount()
      Return the number of entities in the graph.
      Returns:
      elementCount for entities
    • returnRelationshipElementCount

      public int returnRelationshipElementCount()
      Return the number of relationships in the graph.
      Returns:
      elementCount for relationships
    • toString

      public String toString()
      Standard toString method.
      Overrides:
      toString in class Object
      Returns:
      JSON style description of variables.
    • equals

      public boolean equals(Object objectToCompare)
      Validate that an object is equal depending on their stored values.
      Overrides:
      equals in class RepositoryElementHeader
      Parameters:
      objectToCompare - object
      Returns:
      boolean result
    • hashCode

      public int hashCode()
      Return a hash code based on the values of this object.
      Overrides:
      hashCode in class RepositoryElementHeader
      Returns:
      int hash code