Skip to content

Commit

Permalink
Merge pull request #8521 from mandy-chessell/oak2024
Browse files Browse the repository at this point in the history
Fix relationship queries
  • Loading branch information
mandy-chessell authored Dec 3, 2024
2 parents 0c09057 + debfcef commit 6d0003a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public List<RelationshipMapper> retrieveRelationships(QueryBuilder queryBuilder,
public List<RelationshipMapper> retrieveRelationshipsByProperties(QueryBuilder queryBuilder,
Date asOfTime) throws RepositoryErrorException
{
final String methodName = "retrieveRelationships";
final String methodName = "retrieveRelationshipsByProperties";

String sqlQuery = queryBuilder.getPropertyJoinQuery(RepositoryTable.RELATIONSHIP.getTableName(),
RepositoryTable.RELATIONSHIP_ATTRIBUTE_VALUE.getTableName(),
Expand Down Expand Up @@ -1159,7 +1159,7 @@ private String getAsOfTimeClause(Date asOfTime)
}
else
{
return " and (" + RepositoryColumn.VERSION_START_TIME.getColumnName() + " < '" + asOfTime + "' and (" + RepositoryColumn.VERSION_END_TIME.getColumnName() + " is null or " + RepositoryColumn.VERSION_END_TIME.getColumnName() + " > '" + asOfTime + "'))";
return " and (" + RepositoryColumn.VERSION_START_TIME.getColumnName() + " <= '" + asOfTime + "' and (" + RepositoryColumn.VERSION_END_TIME.getColumnName() + " is null or " + RepositoryColumn.VERSION_END_TIME.getColumnName() + " > '" + asOfTime + "'))";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,9 @@ private String getSearchPropertiesClause() throws RepositoryErrorException
{
if (searchProperties != null)
{
return this.getPropertyComparisonFromPropertyConditions(searchProperties,
propertyTableName,
null);
return " and " + this.getPropertyComparisonFromPropertyConditions(searchProperties,
propertyTableName,
null);
}

return " ";
Expand Down Expand Up @@ -621,7 +621,7 @@ private String getPropertyComparisonFromPropertyConditions(SearchProperties sear
matchOperand = " or ";
}

StringBuilder stringBuilder = new StringBuilder(" and (");
StringBuilder stringBuilder = new StringBuilder("(");
boolean firstProperty = true;

for (PropertyCondition propertyCondition : searchProperties.getConditions())
Expand Down Expand Up @@ -759,6 +759,7 @@ else if (matchClassifications.getMatchCriteria() == MatchCriteria.NONE)

if (classificationCondition.getMatchProperties() != null)
{
stringBuilder.append(" and ");
stringBuilder.append(this.getPropertyComparisonFromPropertyConditions(classificationCondition.getMatchProperties(),
RepositoryTable.CLASSIFICATION_ATTRIBUTE_VALUE.getTableName(),
null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public enum ViewServiceDescription
"feedback-manager",
"Work with note logs, comments, informal tags, ratings/reviews and likes.",
"https://egeria-project.org/services/omvs/feedback-manager/overview/",
CommonServicesDescription.GAF_METADATA_MANAGEMENT.getServiceName()),
AccessServiceDescription.ASSET_CONSUMER_OMAS.getAccessServiceFullName()),

/**
* Maintain definitions of governance actions such as governance action processes and governance action types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5724,7 +5724,7 @@ public List<Relationship> findAttachmentLinks(String userId,
sequencingOrder,
forDuplicateProcessing,
startingFrom,
pageSize,
queryPageSize,
effectiveTime,
methodName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ public OpenMetadataRelationshipListResponse getRelationshipHistory(String
boolean oldestFirst,
HistoryRequestBody requestBody)
{
final String methodName = "getMetadataElementHistory";
final String methodName = "getRelationshipHistory";
final String guidParameterName = "relationshipGUID";

RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ Content-Type: application/json
}


###
# @name getAnchoredElementsGraph
# Retrieve the metadata element using its unique identifier.
POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/metadata-explorer/metadata-elements/{{elementGUID}}/with-anchored-elements
Authorization: Bearer {{token}}
Content-Type: application/json

{
"class" : "AnyTimeRequestBody",
"effectiveTime" : "{{$isoTimestamp}}"
}


###
# @name getMetadataElementByUniqueName
# Retrieve the metadata element using its unique name (typically the *qualifiedName* attribute but other attributes can be used if they are unique - such as *pathName* for a file).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public OpenMetadataRelationshipListResponse getAllMetadataElementRelationships(@


/**
* Return all the elements that are anchored to an asset plus relationships between these elements and to other elements.
* Return all the elements that are anchored to an element plus relationships between these elements and to other elements.
*
* @param serverName name of the server instances for this request
* @param urlMarker the identifier of the view service (for example runtime-manager for the Runtime Manager OMVS)
Expand All @@ -403,6 +403,11 @@ public OpenMetadataRelationshipListResponse getAllMetadataElementRelationships(@
*/
@PostMapping(path = "/metadata-elements/{elementGUID}/with-anchored-elements")

@Operation(summary="getAnchoredElementsGraph",
description="Return all the elements that are anchored to an element plus relationships between these elements and to other elements.",
externalDocs=@ExternalDocumentation(description="Further Information",
url="https://egeria-project.org/services/omvs/metadata-explorer/overview/"))

public OpenMetadataGraphResponse getAnchoredElementsGraph(@PathVariable String serverName,
@PathVariable String urlMarker,
@PathVariable String elementGUID,
Expand Down

0 comments on commit 6d0003a

Please sign in to comment.