Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relationship queries #8521

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading