Class AbstractGraphOperation
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractReadOperation
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractGraphOperation
- Direct Known Subclasses:
GetEntityNeighborhood
,GetLinkingEntities
,GetRelatedEntities
Base class that all graph operations should implement.
-
Field Summary
Fields inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractReadOperation
asOfTime, existingDB, xtdb
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractGraphOperation
(XTDBOMRSRepositoryConnector xtdb, String startEntityGUID, List<InstanceStatus> limitResultsByStatus, Date asOfTime) Create a new search operation. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<List<?>>
findDirectNeighbors
(xtdb.api.IXtdbDatasource db, String entityGUID, List<String> entityTypeGUIDs, List<String> relationshipTypeGUIDs, List<InstanceStatus> limitResultsByStatus, List<String> limitResultsByClassification) Find the immediate neighbors (1-degree separated entities and the relationships between) using the provided criteria.protected InstanceGraph
findNeighborhood
(xtdb.api.IXtdbDatasource db, List<String> entityTypeGUIDs, List<String> relationshipTypeGUIDs, List<String> limitResultsByClassification, int level, boolean includeRelationships) Find the entities and relationships that radiate out from the supplied entity GUID.protected String
getEntityRefFromGraphTuple
(List<?> tuple) Retrieve the entity reference from the provided graph query result.getNextLevelNeighbors
(xtdb.api.IXtdbDatasource db, List<String> startingPoints, List<String> entityTypeGUIDs, List<String> relationshipTypeGUIDs, List<InstanceStatus> limitResultsByStatus, List<String> limitResultsByClassification, Set<String> entityGUIDsVisited, Set<String> relationshipGUIDsVisited) Find the entities and relationships that radiate out directly from the supplied list of entity GUIDs.protected InstanceGraph
resultsToGraph
(xtdb.api.IXtdbDatasource db, Collection<List<?>> xtdbResults, Set<String> entityGUIDsVisited, Set<String> relationshipGUIDsVisited, boolean includeRelationships) Translate the collection of XTDB tuple results (from a graph query) into an Egeria InstanceGraph.Methods inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.readops.AbstractReadOperation
getXtdbObjectByReference
-
Field Details
-
startEntityGUID
-
limitResultsByStatus
-
-
Constructor Details
-
AbstractGraphOperation
protected AbstractGraphOperation(XTDBOMRSRepositoryConnector xtdb, String startEntityGUID, List<InstanceStatus> limitResultsByStatus, Date asOfTime) Create a new search operation.- Parameters:
xtdb
- connectivity to XTDBstartEntityGUID
- unique identifier of the starting entity for the traversallimitResultsByStatus
- list of statuses by which to limit resultsasOfTime
- the point-in-time for which to retrieve results
-
-
Method Details
-
findNeighborhood
protected InstanceGraph findNeighborhood(xtdb.api.IXtdbDatasource db, List<String> entityTypeGUIDs, List<String> relationshipTypeGUIDs, List<String> limitResultsByClassification, int level, boolean includeRelationships) throws EntityNotKnownException, RepositoryErrorException Find the entities and relationships that radiate out from the supplied entity GUID. The results are scoped by the provided type GUIDs, other limiters, and the level.- Parameters:
db
- already-opened point-in-time view of the datasource from which to retrieveentityTypeGUIDs
- list of entity types to include in the query results (null means include all)relationshipTypeGUIDs
- list of relationship types to include in the query results (null means include all)limitResultsByClassification
- list of classifications that must be present on all returned entitieslevel
- the number of relationships out from the starting entity thatincludeRelationships
- whether to include relationships in the resulting graph (true) or not (false)- Returns:
- InstanceGraph of the neighborhood
- Throws:
EntityNotKnownException
- if the starting point of the neighborhood traversals cannot be found in the repositoryRepositoryErrorException
- if any issue closing open XTDB resources, or if the query runs longer than the defined threshold (default: 30s)
-
getNextLevelNeighbors
protected Set<List<?>> getNextLevelNeighbors(xtdb.api.IXtdbDatasource db, List<String> startingPoints, List<String> entityTypeGUIDs, List<String> relationshipTypeGUIDs, List<InstanceStatus> limitResultsByStatus, List<String> limitResultsByClassification, Set<String> entityGUIDsVisited, Set<String> relationshipGUIDsVisited) throws RepositoryTimeoutException Find the entities and relationships that radiate out directly from the supplied list of entity GUIDs. The results are scoped by the provided type GUIDs, other limiters, and the level.- Parameters:
db
- already opened point-in-time view of the databasestartingPoints
- list of entity GUIDs from which we should start radiating outwardsentityTypeGUIDs
- list of entity types to include in the query results (null means include all)relationshipTypeGUIDs
- list of relationship types to include in the query results (null means include all)limitResultsByStatus
- list of statuses to restrict results (null means include all)limitResultsByClassification
- list of classifications that must be present on all returned entitiesentityGUIDsVisited
- set of unique identifiers of entities that have already been visitedrelationshipGUIDsVisited
- set of unique identifiers of relationships that have already been visited- Returns:
Set<List<?>>
of the immediate neighbors of the specified starting point GUIDs, as graph tuples [[:entityRef :relationshipRef]]- Throws:
RepositoryTimeoutException
- if the query runs longer than the defined threshold (default: 30s)
-
findDirectNeighbors
protected Collection<List<?>> findDirectNeighbors(xtdb.api.IXtdbDatasource db, String entityGUID, List<String> entityTypeGUIDs, List<String> relationshipTypeGUIDs, List<InstanceStatus> limitResultsByStatus, List<String> limitResultsByClassification) throws TimeoutException Find the immediate neighbors (1-degree separated entities and the relationships between) using the provided criteria.- Parameters:
db
- already opened point-in-view of the databaseentityGUID
- of the entity for which to find immediate relationshipsentityTypeGUIDs
- of the entity type definitions by which to restrict entities in the resultsrelationshipTypeGUIDs
- of the relationship type definitions by which to restrict relationships in the resultslimitResultsByStatus
- by which to limit relationshipslimitResultsByClassification
- by which to limit the entities in the results- Returns:
Collection<List<?>>
of tuples of relationships and entities found in the results- Throws:
TimeoutException
- if the query runs longer than the defined threshold (default: 30s)
-
resultsToGraph
protected InstanceGraph resultsToGraph(xtdb.api.IXtdbDatasource db, Collection<List<?>> xtdbResults, Set<String> entityGUIDsVisited, Set<String> relationshipGUIDsVisited, boolean includeRelationships) Translate the collection of XTDB tuple results (from a graph query) into an Egeria InstanceGraph.- Parameters:
db
- already opened point-in-time view of the databasextdbResults
- list of result tuples, e.g. from a neighborhood or other graph searchentityGUIDsVisited
- the list of entity GUIDs that have already been retrievedrelationshipGUIDsVisited
- the list of relationship GUIDs that have already been retrievedincludeRelationships
- whether to include relationships in the resulting graph (true) or not (false)- Returns:
- InstanceGraph
-
getEntityRefFromGraphTuple
Retrieve the entity reference from the provided graph query result.- Parameters:
tuple
- graph query result- Returns:
- String reference for the entity
-