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
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Version of the header used in this release -
Constructor Summary
ConstructorsConstructorDescriptionDefault 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
Modifier and TypeMethodDescriptionboolean
Validate that an object is equal depending on their stored values.Return the list of all the entities (vertices/nodes) in the instance graph.Return the list of all relationships (edges/links) in the instance graph.int
hashCode()
Return a hash code based on the values of this object.int
Return the number of entities in the graph.returnLinkedEntity
(String anchorEntityGUID, String linkingRelationshipGUID) Return the entity connected at the far end of an entity's relationship.int
Return the number of relationships in the graph.returnRelationshipsForEntity
(String anchorEntityGUID) Return a list of relationships that are connected to a specific entity.void
setEntities
(List<EntityDetail> entityElementList) Set up the list of entities for this instance graph.void
setRelationships
(List<Relationship> relationshipElementList) Set up the list of relationships in this instance graph.toString()
Standard toString method.Methods inherited from class org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.RepositoryElementHeader
getHeaderVersion, setHeaderVersion
-
Field Details
-
CURRENT_INSTANCE_GRAPH_HEADER_VERSION
public static final long CURRENT_INSTANCE_GRAPH_HEADER_VERSIONVersion of the header used in this release- See Also:
-
-
Constructor Details
-
InstanceGraph
public InstanceGraph()Default constructor -
InstanceGraph
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
Copy/clone constructor.- Parameters:
templateGraph
- graph to copy; null to create an empty graph
-
-
Method Details
-
getEntities
Return the list of all the entities (vertices/nodes) in the instance graph. Null means empty graph.- Returns:
- EntityDetails entity list
-
setEntities
Set up the list of entities for this instance graph.- Parameters:
entityElementList
- list of entities
-
getRelationships
Return the list of all relationships (edges/links) in the instance graph. Null means a disconnected/empty graph.- Returns:
- Relationships relationship list
-
setRelationships
Set up the list of relationships in this instance graph.- Parameters:
relationshipElementList
- list of relationships
-
returnRelationshipsForEntity
Return a list of relationships that are connected to a specific entity.- Parameters:
anchorEntityGUID
- unique identifier for an entity- Returns:
- Relationships relationship iterator
-
returnLinkedEntity
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
Standard toString method. -
equals
Validate that an object is equal depending on their stored values.- Overrides:
equals
in classRepositoryElementHeader
- Parameters:
objectToCompare
- object- Returns:
- boolean result
-
hashCode
public int hashCode()Return a hash code based on the values of this object.- Overrides:
hashCode
in classRepositoryElementHeader
- Returns:
- int hash code
-