use of eu.europeana.enrichment.api.internal.AggregationFieldType in project metis-framework by europeana.
the class RdfEntityUtils method replaceValueWithLinkInAggregation.
/**
* Replace matching aggregation values with their found corresponding links.
*
* @param rdf the rdf to update
* @param link the about value to use
* @param searchTermAggregation the aggregation search term to use for finding the matched values
*/
public static void replaceValueWithLinkInAggregation(RDF rdf, String link, SearchTermContext searchTermAggregation) {
final List<Aggregation> aggregationList = rdf.getAggregationList();
for (FieldType<? extends AboutType> aggregationFieldType : searchTermAggregation.getFieldTypes()) {
aggregationList.stream().flatMap(((AggregationFieldType) aggregationFieldType)::extractFields).filter(resourceOrLiteralType -> resourceOrLiteralAndSearchTermEquality(resourceOrLiteralType, searchTermAggregation)).forEach(resourceOrLiteralType -> {
final Resource resource = new Resource();
resource.setResource(link);
resourceOrLiteralType.setResource(resource);
resourceOrLiteralType.setLang(new Lang());
resourceOrLiteralType.setString("");
});
}
}
Aggregations