Class InstanceGraph
- java.lang.Object
-
- org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.RepositoryElementHeader
-
- org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceElementHeader
-
- org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceGraph
-
- 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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceElementHeader
CURRENT_INSTANCE_HEADER_VERSION
-
-
Constructor Summary
Constructors Constructor Description InstanceGraph()Default constructorInstanceGraph(List<EntityDetail> entities, List<Relationship> relationships)Typical Constructor creates a graph with the supplied list of elements.InstanceGraph(InstanceGraph templateGraph)Copy/clone constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object objectToCompare)Validate that an object is equal depending on their stored values.List<EntityDetail>getEntities()Return the list of all of the entities (vertices/nodes) in the instance graph.List<Relationship>getRelationships()Return the list of all relationships (edges/links) in the instance graph.inthashCode()Return a hash code based on the values of this object.intreturnEntityElementCount()Return the number of entities in the graph.EntityDetailreturnLinkedEntity(String anchorEntityGUID, String linkingRelationshipGUID)Return the entity connected at the far end of an entity's relationship.intreturnRelationshipElementCount()Return the number of relationships in the graph.List<Relationship>returnRelationshipsForEntity(String anchorEntityGUID)Return a list of relationships that are connected to a specific entity.voidsetEntities(List<EntityDetail> entityElementList)Set up the list of entities for this instance graph.voidsetRelationships(List<Relationship> relationshipElementList)Set up the list of relationships in this instance graph.StringtoString()Standard toString method.-
Methods inherited from class org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.RepositoryElementHeader
getHeaderVersion, setHeaderVersion
-
-
-
-
Constructor Detail
-
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 listrelationships- 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 Detail
-
getEntities
public List<EntityDetail> getEntities()
Return the list of all of 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.
-
equals
public boolean equals(Object objectToCompare)
Validate that an object is equal depending on their stored values.
-
-