Search in sources :

Example 1 with AggregationFieldType

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("");
        });
    }
}
Also used : Aggregation(eu.europeana.metis.schema.jibx.Aggregation) Arrays(java.util.Arrays) AggregationFieldType(eu.europeana.enrichment.api.internal.AggregationFieldType) SearchTerm(eu.europeana.enrichment.api.internal.SearchTerm) RDF(eu.europeana.metis.schema.jibx.RDF) Supplier(java.util.function.Supplier) StringUtils(org.apache.commons.lang3.StringUtils) Aggregation(eu.europeana.metis.schema.jibx.Aggregation) ResourceOrLiteralType(eu.europeana.metis.schema.jibx.ResourceOrLiteralType) ArrayList(java.util.ArrayList) ProxyFieldType(eu.europeana.enrichment.api.internal.ProxyFieldType) AboutType(eu.europeana.metis.schema.jibx.AboutType) Lang(eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Lang) Resource(eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Resource) FieldType(eu.europeana.enrichment.api.internal.FieldType) SearchTermContext(eu.europeana.enrichment.api.internal.SearchTermContext) Map(java.util.Map) EuropeanaType(eu.europeana.metis.schema.jibx.EuropeanaType) EnumMap(java.util.EnumMap) Collection(java.util.Collection) Set(java.util.Set) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Consumer(java.util.function.Consumer) List(java.util.List) ProxyType(eu.europeana.metis.schema.jibx.ProxyType) Optional(java.util.Optional) Collections(java.util.Collections) Resource(eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Resource) Lang(eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Lang)

Aggregations

AggregationFieldType (eu.europeana.enrichment.api.internal.AggregationFieldType)1 FieldType (eu.europeana.enrichment.api.internal.FieldType)1 ProxyFieldType (eu.europeana.enrichment.api.internal.ProxyFieldType)1 SearchTerm (eu.europeana.enrichment.api.internal.SearchTerm)1 SearchTermContext (eu.europeana.enrichment.api.internal.SearchTermContext)1 AboutType (eu.europeana.metis.schema.jibx.AboutType)1 Aggregation (eu.europeana.metis.schema.jibx.Aggregation)1 EuropeanaType (eu.europeana.metis.schema.jibx.EuropeanaType)1 ProxyType (eu.europeana.metis.schema.jibx.ProxyType)1 RDF (eu.europeana.metis.schema.jibx.RDF)1 ResourceOrLiteralType (eu.europeana.metis.schema.jibx.ResourceOrLiteralType)1 Lang (eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Lang)1 Resource (eu.europeana.metis.schema.jibx.ResourceOrLiteralType.Resource)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 EnumMap (java.util.EnumMap)1 List (java.util.List)1 Map (java.util.Map)1