Search in sources :

Example 1 with LabelResource

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

the class Converter method convertPlace.

private static Place convertPlace(PlaceEnrichmentEntity placeEnrichmentEntity) {
    Place output = new Place();
    output.setAbout(placeEnrichmentEntity.getAbout());
    output.setPrefLabelList(convert(placeEnrichmentEntity.getPrefLabel()));
    output.setAltLabelList(convert(placeEnrichmentEntity.getAltLabel()));
    output.setHasPartsList(convertResourceOrLiteral(placeEnrichmentEntity.getDcTermsHasPart()));
    output.setNotes(convert(placeEnrichmentEntity.getNote()));
    output.setSameAs(convertToPartsList(placeEnrichmentEntity.getOwlSameAs()));
    if (StringUtils.isNotBlank(placeEnrichmentEntity.getIsPartOf())) {
        output.setIsPartOf(List.of(new LabelResource(placeEnrichmentEntity.getIsPartOf())));
    }
    if ((placeEnrichmentEntity.getLatitude() != null && placeEnrichmentEntity.getLatitude() != 0) && (placeEnrichmentEntity.getLongitude() != null && placeEnrichmentEntity.getLongitude() != 0)) {
        output.setLat(placeEnrichmentEntity.getLatitude().toString());
        output.setLon(placeEnrichmentEntity.getLongitude().toString());
    }
    if (placeEnrichmentEntity.getAltitude() != null && placeEnrichmentEntity.getAltitude() != 0) {
        output.setAlt(placeEnrichmentEntity.getAltitude().toString());
    }
    return output;
}
Also used : LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Place(eu.europeana.enrichment.api.external.model.Place)

Example 2 with LabelResource

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

the class Converter method convertResourceOrLiteral.

private static List<LabelResource> convertResourceOrLiteral(Map<String, List<String>> map) {
    List<LabelResource> parts = new ArrayList<>();
    if (map == null) {
        return parts;
    }
    map.forEach((key, entry) -> entry.stream().map(value -> (isUri(key) ? new LabelResource(key) : new LabelResource(key, value))).forEach(parts::add));
    return parts;
}
Also used : LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) ArrayList(java.util.ArrayList)

Example 3 with LabelResource

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

the class EntityMergeEngineTest method createSecondPlaceWithNullValues.

private static Place createSecondPlaceWithNullValues() {
    Place place = new Place();
    place.setAbout("aboutP2");
    place.setHasPartsList(List.of(new LabelResource()));
    place.setIsPartOf(List.of(new LabelResource("")));
    return place;
}
Also used : LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Place(eu.europeana.enrichment.api.external.model.Place)

Example 4 with LabelResource

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

the class EntityMergeEngineTest method createAgent.

private static Agent createAgent() {
    Agent agent = new Agent();
    agent.setAbout("aboutA1");
    Label label1 = new Label("LangA1", "labelA1");
    agent.setAltLabelList(List.of(label1));
    Label label2 = new Label("labelA2");
    agent.setBeginList(List.of(label2));
    LabelResource label3 = new LabelResource("labelA3");
    LabelResource label4 = new LabelResource("labelA4");
    agent.setBiographicalInformation(List.of(label3, label4));
    LabelResource labelResource1 = new LabelResource("LangA1", "labelResourceA1");
    labelResource1.setResource("resource1");
    agent.setDate(List.of(labelResource1));
    LabelResource labelResource5 = new LabelResource("labelResourceA5");
    labelResource5.setResource("resource5");
    agent.setPlaceOfBirth(List.of(labelResource5));
    LabelResource labelResource6 = new LabelResource("labelResourceA6");
    labelResource6.setResource("resource6");
    agent.setPlaceOfDeath(List.of(labelResource6));
    Label label5 = new Label("LangA5", "labelA5");
    agent.setDateOfBirth(List.of(label5));
    Label label6 = new Label("labelA6");
    Label label19 = new Label("labelA19");
    agent.setDateOfDeath(Arrays.asList(null, label6, label19));
    Label label7 = new Label("labelA7");
    agent.setDateOfEstablishment(Arrays.asList(null, label7));
    Label label8 = new Label("labelA8");
    agent.setDateOfTermination(List.of(label8));
    Label label9 = new Label("labelA9");
    agent.setEndList(List.of(label9));
    Label label18 = new Label("labelA18");
    agent.setFoafName(List.of(label18));
    Label label10 = new Label("labelA10");
    agent.setGender(List.of(label10));
    Resource label11 = new Resource("labelA11");
    agent.setHasMet(List.of(label11));
    Label label12 = new Label("LangA12", "labelA12");
    Label label13 = new Label("LangA13", "labelA13");
    agent.setHiddenLabel(List.of(label12, label13));
    Label label14 = new Label("labelA14");
    agent.setIdentifier(List.of(label14));
    LabelResource labelResource2 = new LabelResource("labelResourceA2");
    labelResource1.setResource("resource2");
    LabelResource labelResource3 = new LabelResource("resource3");
    agent.setIsRelatedTo(List.of(labelResource2, labelResource3));
    Label label15 = new Label("labelA15");
    Label label20 = new Label("labelA20");
    agent.setNotes(List.of(label15, label20));
    Label label16 = new Label("LangA16", "labelA16");
    Label label17 = new Label("labelA17");
    agent.setPrefLabelList(List.of(label16, label17));
    LabelResource labelResource4 = new LabelResource();
    agent.setProfessionOrOccupation(List.of(labelResource4));
    Part part1 = new Part("partP1");
    Part part2 = new Part();
    agent.setSameAs(List.of(part1, part2));
    Resource resource1 = new Resource("resource1");
    Resource resource2 = new Resource();
    agent.setWasPresentAt(List.of(resource1, resource2));
    return agent;
}
Also used : Agent(eu.europeana.enrichment.api.external.model.Agent) LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Part(eu.europeana.enrichment.api.external.model.Part) Label(eu.europeana.enrichment.api.external.model.Label) Resource(eu.europeana.enrichment.api.external.model.Resource) LabelResource(eu.europeana.enrichment.api.external.model.LabelResource)

Example 5 with LabelResource

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

the class EntityMergeEngineTest method createTimeSpan.

private static TimeSpan createTimeSpan() {
    TimeSpan timespan = new TimeSpan();
    timespan.setAbout("aboutT1");
    Label label1 = new Label("labelT1");
    Label label2 = new Label("langT2", "labelT2");
    timespan.setAltLabelList(List.of(label1, label2));
    Label label5 = new Label("labelT5");
    timespan.setBegin(label5);
    Label label6 = new Label("labelT6");
    timespan.setEnd(label6);
    LabelResource part1 = new LabelResource("partT1");
    timespan.setHasPartsList(List.of(part1));
    LabelResource part2 = new LabelResource("partT2");
    timespan.setIsPartOf(List.of(part2));
    Label label7 = new Label("LangT7", "labelT7");
    Label label8 = new Label("LangT8", "labelT8");
    timespan.setHiddenLabel(List.of(label7, label8));
    Label label3 = new Label("labelT3");
    timespan.setNotes(List.of(label3));
    Label label4 = new Label("langT4", "labelT4");
    timespan.setPrefLabelList(List.of(label4));
    Part part3 = new Part("partT3");
    Part part4 = new Part("partT4");
    timespan.setSameAs(List.of(part3, part4));
    return timespan;
}
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) Label(eu.europeana.enrichment.api.external.model.Label)

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