Search in sources :

Example 11 with LabelResource

use of eu.europeana.enrichment.api.external.model.LabelResource in project metis-framework by europeana.

the class EntityMergeEngineTest method createPlace.

private static Place createPlace() {
    Place place = new Place();
    place.setAbout("aboutP0");
    place.setAlt("123.456");
    Label label1 = new Label("labelP1");
    Label label2 = new Label("langP2", "labelP2");
    place.setAltLabelList(List.of(label1, label2));
    LabelResource part1 = new LabelResource("partP1");
    place.setHasPartsList(List.of(part1));
    LabelResource part2 = new LabelResource("partP2");
    place.setIsPartOf(List.of(part2));
    place.setLat("12.34");
    place.setLon("43.21");
    Label label3 = new Label("labelP3");
    place.setNotes(List.of(label3));
    Label label4 = new Label("langP4", "labelP4");
    place.setPrefLabelList(List.of(label4));
    Part part3 = new Part("partP3");
    Part part4 = new Part("partP4");
    place.setSameAs(List.of(part3, part4));
    return place;
}
Also used : LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Part(eu.europeana.enrichment.api.external.model.Part) Label(eu.europeana.enrichment.api.external.model.Label) Place(eu.europeana.enrichment.api.external.model.Place)

Example 12 with LabelResource

use of eu.europeana.enrichment.api.external.model.LabelResource in project metis-framework by europeana.

the class ItemExtractorUtilsTest method testExtractLabelResourceWithoutValue.

@Test
void testExtractLabelResourceWithoutValue() {
    LabelResource label = new LabelResource("lang1", null);
    label.setResource("resource1");
    ResourceOrLiteralType output = ItemExtractorUtils.extractLabelResource(label, ResourceOrLiteralType::new);
    assertNotNull(output);
    assertEquals("", output.getString());
    assertEquals("lang1", output.getLang().getLang());
    assertEquals("resource1", output.getResource().getResource());
}
Also used : LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) ResourceOrLiteralType(eu.europeana.metis.schema.jibx.ResourceOrLiteralType) Test(org.junit.jupiter.api.Test)

Example 13 with LabelResource

use of eu.europeana.enrichment.api.external.model.LabelResource in project metis-framework by europeana.

the class EnrichmentControllerTest method getTimespan.

private TimeSpan getTimespan() {
    final TimeSpan timespan = new TimeSpan();
    timespan.setAbout("http://timespan.org");
    List<Label> altLabels = new ArrayList<>();
    altLabels.add(new Label("en", "labelEn"));
    altLabels.add(new Label("nl", "labelNl"));
    timespan.setAltLabelList(altLabels);
    timespan.setIsPartOf(List.of(new LabelResource("http://timespan_is_part.org")));
    return timespan;
}
Also used : TimeSpan(eu.europeana.enrichment.api.external.model.TimeSpan) LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Label(eu.europeana.enrichment.api.external.model.Label) ArrayList(java.util.ArrayList)

Example 14 with LabelResource

use of eu.europeana.enrichment.api.external.model.LabelResource in project metis-framework by europeana.

the class EnrichmentControllerTest method getPlace.

private Place getPlace() {
    final Place place = new Place();
    place.setAbout("http://place.org");
    List<Label> altLabels = new ArrayList<>();
    altLabels.add(new Label("en", "labelEn"));
    altLabels.add(new Label("nl", "labelNl"));
    place.setAltLabelList(altLabels);
    place.setIsPartOf(List.of(new LabelResource("http://place_is_part.org")));
    return place;
}
Also used : LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Label(eu.europeana.enrichment.api.external.model.Label) ArrayList(java.util.ArrayList) Place(eu.europeana.enrichment.api.external.model.Place)

Example 15 with LabelResource

use of eu.europeana.enrichment.api.external.model.LabelResource in project metis-framework by europeana.

the class Converter method convertTimespan.

private static TimeSpan convertTimespan(TimespanEnrichmentEntity timespanEnrichmentEntity) {
    TimeSpan output = new TimeSpan();
    output.setAbout(timespanEnrichmentEntity.getAbout());
    output.setPrefLabelList(convert(timespanEnrichmentEntity.getPrefLabel()));
    output.setAltLabelList(convert(timespanEnrichmentEntity.getAltLabel()));
    output.setBegin(convert(timespanEnrichmentEntity.getBegin()).get(0));
    output.setEnd(convert(timespanEnrichmentEntity.getEnd()).get(0));
    output.setHasPartsList(convertResourceOrLiteral(timespanEnrichmentEntity.getDctermsHasPart()));
    output.setHiddenLabel(convert(timespanEnrichmentEntity.getHiddenLabel()));
    output.setNotes(convert(timespanEnrichmentEntity.getNote()));
    output.setSameAs(convertToPartsList(timespanEnrichmentEntity.getOwlSameAs()));
    if (StringUtils.isNotBlank(timespanEnrichmentEntity.getIsPartOf())) {
        output.setIsPartOf(List.of(new LabelResource(timespanEnrichmentEntity.getIsPartOf())));
    }
    if (StringUtils.isNotBlank(timespanEnrichmentEntity.getIsNextInSequence())) {
        output.setIsNextInSequence(new Part(timespanEnrichmentEntity.getIsNextInSequence()));
    }
    return output;
}
Also used : TimeSpan(eu.europeana.enrichment.api.external.model.TimeSpan) LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Part(eu.europeana.enrichment.api.external.model.Part)

Aggregations

LabelResource (eu.europeana.enrichment.api.external.model.LabelResource)16 Label (eu.europeana.enrichment.api.external.model.Label)7 ResourceOrLiteralType (eu.europeana.metis.schema.jibx.ResourceOrLiteralType)6 Test (org.junit.jupiter.api.Test)6 Part (eu.europeana.enrichment.api.external.model.Part)5 Place (eu.europeana.enrichment.api.external.model.Place)4 ArrayList (java.util.ArrayList)4 Agent (eu.europeana.enrichment.api.external.model.Agent)3 TimeSpan (eu.europeana.enrichment.api.external.model.TimeSpan)3 Resource (eu.europeana.enrichment.api.external.model.Resource)2 EnrichmentBase (eu.europeana.enrichment.api.external.model.EnrichmentBase)1 AboutType (eu.europeana.metis.schema.jibx.AboutType)1 AltLabel (eu.europeana.metis.schema.jibx.AltLabel)1 Choice (eu.europeana.metis.schema.jibx.Concept.Choice)1 LiteralType (eu.europeana.metis.schema.jibx.LiteralType)1 Lang (eu.europeana.metis.schema.jibx.LiteralType.Lang)1 ResourceType (eu.europeana.metis.schema.jibx.ResourceType)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1