diff --git a/pom.xml b/pom.xml index 43a49b9..b4a3b08 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.2.4 + 3.2.5 eu.dissco.core diff --git a/src/main/java/eu/dissco/core/translator/terms/BaseDigitalObjectDirector.java b/src/main/java/eu/dissco/core/translator/terms/BaseDigitalObjectDirector.java index 834c67c..994b056 100644 --- a/src/main/java/eu/dissco/core/translator/terms/BaseDigitalObjectDirector.java +++ b/src/main/java/eu/dissco/core/translator/terms/BaseDigitalObjectDirector.java @@ -14,7 +14,7 @@ import eu.dissco.core.translator.schema.DigitalSpecimen.OdsLivingOrPreserved; import eu.dissco.core.translator.schema.DigitalSpecimen.OdsPhysicalSpecimenIdType; import eu.dissco.core.translator.schema.EntityRelationships; -import eu.dissco.core.translator.schema.Georeference; +import eu.dissco.core.translator.schema.GeoReference; import eu.dissco.core.translator.schema.Identifications; import eu.dissco.core.translator.schema.Identifiers; import eu.dissco.core.translator.schema.Occurrences; @@ -46,11 +46,13 @@ import eu.dissco.core.translator.terms.specimen.PhysicalSpecimenIdType; import eu.dissco.core.translator.terms.specimen.Preparations; import eu.dissco.core.translator.terms.specimen.RecordedBy; +import eu.dissco.core.translator.terms.specimen.RecordedById; import eu.dissco.core.translator.terms.specimen.RightsHolder; import eu.dissco.core.translator.terms.specimen.SpecimenName; import eu.dissco.core.translator.terms.specimen.TopicDiscipline; import eu.dissco.core.translator.terms.specimen.TopicDomain; import eu.dissco.core.translator.terms.specimen.TopicOrigin; +import eu.dissco.core.translator.terms.specimen.VerbatimLabel; import eu.dissco.core.translator.terms.specimen.citation.BibliographicCitation; import eu.dissco.core.translator.terms.specimen.citation.CitationRemarks; import eu.dissco.core.translator.terms.specimen.citation.Date; @@ -83,6 +85,7 @@ import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Phylum; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.ScientificName; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.ScientificNameAuthorship; +import eu.dissco.core.translator.terms.specimen.identification.taxonomy.ScientificNameId; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.SpecificEpithet; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subfamily; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subgenus; @@ -93,6 +96,7 @@ import eu.dissco.core.translator.terms.specimen.identification.taxonomy.TaxonRemarks; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.TaxonomicStatus; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Tribe; +import eu.dissco.core.translator.terms.specimen.identification.taxonomy.VerbatimTaxonRank; import eu.dissco.core.translator.terms.specimen.identification.taxonomy.VernacularName; import eu.dissco.core.translator.terms.specimen.location.Continent; import eu.dissco.core.translator.terms.specimen.location.Country; @@ -103,6 +107,7 @@ import eu.dissco.core.translator.terms.specimen.location.IslandGroup; import eu.dissco.core.translator.terms.specimen.location.Locality; import eu.dissco.core.translator.terms.specimen.location.LocationAccordingTo; +import eu.dissco.core.translator.terms.specimen.location.LocationId; import eu.dissco.core.translator.terms.specimen.location.LocationRemarks; import eu.dissco.core.translator.terms.specimen.location.MaximumDepthInMeters; import eu.dissco.core.translator.terms.specimen.location.MaximumDistanceAboveSurfaceInMeters; @@ -112,6 +117,9 @@ import eu.dissco.core.translator.terms.specimen.location.MinimumElevationInMeters; import eu.dissco.core.translator.terms.specimen.location.Municipality; import eu.dissco.core.translator.terms.specimen.location.StateProvince; +import eu.dissco.core.translator.terms.specimen.location.VerbatimDepth; +import eu.dissco.core.translator.terms.specimen.location.VerbatimElevation; +import eu.dissco.core.translator.terms.specimen.location.VerbatimLocality; import eu.dissco.core.translator.terms.specimen.location.VerticalDatum; import eu.dissco.core.translator.terms.specimen.location.WaterBody; import eu.dissco.core.translator.terms.specimen.location.georeference.CoordinatePrecision; @@ -128,8 +136,14 @@ import eu.dissco.core.translator.terms.specimen.location.georeference.GeoreferencedBy; import eu.dissco.core.translator.terms.specimen.location.georeference.GeoreferencedDate; import eu.dissco.core.translator.terms.specimen.location.georeference.PointRadiusSpatialFit; +import eu.dissco.core.translator.terms.specimen.location.georeference.VerbatimCoordinateSystem; +import eu.dissco.core.translator.terms.specimen.location.georeference.VerbatimCoordinates; +import eu.dissco.core.translator.terms.specimen.location.georeference.VerbatimLatitude; +import eu.dissco.core.translator.terms.specimen.location.georeference.VerbatimLongitude; +import eu.dissco.core.translator.terms.specimen.location.georeference.VerbatimSRS; import eu.dissco.core.translator.terms.specimen.occurence.Behavior; import eu.dissco.core.translator.terms.specimen.occurence.Caste; +import eu.dissco.core.translator.terms.specimen.occurence.Day; import eu.dissco.core.translator.terms.specimen.occurence.DegreeOfEstablishment; import eu.dissco.core.translator.terms.specimen.occurence.EstablishmentMeans; import eu.dissco.core.translator.terms.specimen.occurence.EventDate; @@ -139,18 +153,22 @@ import eu.dissco.core.translator.terms.specimen.occurence.GeoreferenceVerificationStatus; import eu.dissco.core.translator.terms.specimen.occurence.Habitat; import eu.dissco.core.translator.terms.specimen.occurence.LifeStage; +import eu.dissco.core.translator.terms.specimen.occurence.Month; import eu.dissco.core.translator.terms.specimen.occurence.OccurrenceAssertions; import eu.dissco.core.translator.terms.specimen.occurence.OccurrenceRemarks; import eu.dissco.core.translator.terms.specimen.occurence.OccurrenceStatus; import eu.dissco.core.translator.terms.specimen.occurence.OrganismQuantity; import eu.dissco.core.translator.terms.specimen.occurence.OrganismQuantityType; import eu.dissco.core.translator.terms.specimen.occurence.Pathway; +import eu.dissco.core.translator.terms.specimen.occurence.RecordNumber; import eu.dissco.core.translator.terms.specimen.occurence.ReproductiveCondition; import eu.dissco.core.translator.terms.specimen.occurence.SampleSizeUnit; import eu.dissco.core.translator.terms.specimen.occurence.SampleSizeValue; import eu.dissco.core.translator.terms.specimen.occurence.SamplingProtocol; import eu.dissco.core.translator.terms.specimen.occurence.Sex; +import eu.dissco.core.translator.terms.specimen.occurence.VerbatimEventDate; import eu.dissco.core.translator.terms.specimen.occurence.Vitality; +import eu.dissco.core.translator.terms.specimen.occurence.Year; import eu.dissco.core.translator.terms.specimen.stratigraphy.biostratigraphic.HighestBiostratigraphicZone; import eu.dissco.core.translator.terms.specimen.stratigraphy.biostratigraphic.LowestBiostratigraphicZone; import eu.dissco.core.translator.terms.specimen.stratigraphy.chronostratigraphic.EarliestAgeOrLowestStage; @@ -189,11 +207,11 @@ public abstract class BaseDigitalObjectDirector { public DigitalSpecimen assembleDigitalSpecimenTerm(JsonNode data, boolean dwc) throws OrganisationException, UnknownPhysicalSpecimenIdType { var ds = assembleDigitalSpecimenTerms(data, dwc); - ds.withOccurrences(assembleOccurrenceTerms(data, dwc)); + ds.withDwcOccurrence(assembleOccurrenceTerms(data, dwc)); ds.withDwcIdentification(assembleIdentifications(data, dwc)); - ds.withIdentifiers(assembleIdentifiers(data)); - ds.withCitations(assembleSpecimenCitations(data, dwc)); - ds.withEntityRelationships(assembleDigitalSpecimenEntityRelationships(ds)); + ds.withIdentifier(assembleIdentifiers(data)); + ds.withCitation(assembleSpecimenCitations(data, dwc)); + ds.withEntityRelationship(assembleDigitalSpecimenEntityRelationships(ds)); setCalculatedFields(ds, data); return ds; } @@ -256,12 +274,14 @@ private DigitalSpecimen assembleDigitalSpecimenTerms(JsonNode data, boolean dwc) .withDwcInstitutionName( getInstitutionName(organisationId)) .withDwcRecordedBy(termMapper.retrieveTerm(new RecordedBy(), data, dwc)) + .withDwcRecordedById(termMapper.retrieveTerm(new RecordedById(), data, dwc)) .withDwcBasisOfRecord(termMapper.retrieveTerm(new BasisOfRecord(), data, dwc)) .withDctermsAccessRights(termMapper.retrieveTerm(new AccessRights(), data, dwc)) .withDctermsRightsHolder(termMapper.retrieveTerm(new RightsHolder(), data, dwc)) .withDwcDatasetName(termMapper.retrieveTerm(new DatasetName(), data, dwc)) .withDwcDisposition(termMapper.retrieveTerm(new Disposition(), data, dwc)) .withDwcInformationWithheld(termMapper.retrieveTerm(new InformationWithheld(), data, dwc)) + .withDwcVerbatimLabel(termMapper.retrieveTerm(new VerbatimLabel(), data, dwc)) .withDwcDataGeneralizations(termMapper.retrieveTerm(new DataGeneralizations(), data, dwc)); } @@ -273,7 +293,8 @@ private String getInstitutionName(String organisationId) throws OrganisationExce var wikidataId = organisationId.replace("https://www.wikidata.org/wiki/", ""); return institutionNameComponent.getWikiDataName(wikidataId); } else { - throw new OrganisationException(organisationId + " is not a valid ror or wikidata identifier"); + throw new OrganisationException( + organisationId + " is not a valid ror or wikidata identifier"); } } @@ -295,8 +316,8 @@ private List assembleDigitalSpecimenEntityRelationships( relationships.add(new EntityRelationships().withEntityRelationshipType("hasLicense") .withObjectEntityIri(ds.getDctermsLicense())); } - if (ds.getCitations() != null) { - for (Citations citation : ds.getCitations()) { + if (ds.getCitation() != null) { + for (Citations citation : ds.getCitation()) { if (citation.getReferenceIri() != null) { relationships.add(new EntityRelationships().withEntityRelationshipType("hasReference") .withObjectEntityIri(citation.getReferenceIri())); @@ -324,12 +345,14 @@ protected Identifications createIdentification(JsonNode data, boolean dwc) { .withDwcTaxonID(termMapper.retrieveTerm(new TaxonId(), data, dwc)) .withDwcKingdom(termMapper.retrieveTerm(new Kingdom(), data, dwc)) .withDwcTaxonRank(termMapper.retrieveTerm(new TaxonRank(), data, dwc)) + .withDwcVerbatimTaxonRank(termMapper.retrieveTerm(new VerbatimTaxonRank(), data, dwc)) .withDwcGenus(termMapper.retrieveTerm(new Genus(), data, dwc)) .withDwcSubgenus(termMapper.retrieveTerm(new Subgenus(), data, dwc)) .withDwcOrder(termMapper.retrieveTerm(new Order(), data, dwc)) .withDwcScientificName(termMapper.retrieveTerm(new ScientificName(), data, dwc)) .withDwcScientificNameAuthorship( termMapper.retrieveTerm(new ScientificNameAuthorship(), data, dwc)) + .withDwcScientificNameId(termMapper.retrieveTerm(new ScientificNameId(), data, dwc)) .withDwcNamePublishedInYear(termMapper.retrieveTerm(new NamePublishedInYear(), data, dwc)) .withDwcClass(termMapper.retrieveTerm(new Class(), data, dwc)) .withDwcFamily(termMapper.retrieveTerm(new Family(), data, dwc)) @@ -364,17 +387,23 @@ protected Identifications createIdentification(JsonNode data, boolean dwc) { .withDwcVerbatimIdentification( termMapper.retrieveTerm(new VerbatimIdentification(), data, dwc)) .withTaxonIdentifications(List.of(mappedTaxonIdentification)) - .withCitations(assembleIdentificationCitations(data, dwc)); + .withCitation(assembleIdentificationCitations(data, dwc)); } private List assembleOccurrenceTerms(JsonNode data, boolean dwc) { - var georeference = new Georeference() + var georeference = new GeoReference() .withDwcDecimalLatitude( parseToDouble(new DecimalLatitude(), data, dwc)) + .withDwcVerbatimLatitude(termMapper.retrieveTerm(new VerbatimLatitude(), data, dwc)) .withDwcDecimalLongitude(parseToDouble(new DecimalLongitude(), data, dwc)) + .withDwcVerbatimLongitude(termMapper.retrieveTerm(new VerbatimLongitude(), data, dwc)) .withDwcGeodeticDatum(termMapper.retrieveTerm(new GeodeticDatum(), data, dwc)) + .withDwcVerbatimCoordinates(termMapper.retrieveTerm(new VerbatimCoordinates(), data, dwc)) + .withDwcVerbatimCoordinateSystem( + termMapper.retrieveTerm(new VerbatimCoordinateSystem(), data, dwc)) + .withDwcVerbatimSRS(termMapper.retrieveTerm(new VerbatimSRS(), data, dwc)) .withDwcGeoreferenceProtocol(termMapper.retrieveTerm(new GeoreferenceProtocol(), data, dwc)) .withDwcCoordinatePrecision(parseToDouble(new CoordinatePrecision(), data, dwc)) .withDwcCoordinateUncertaintyInMeters( @@ -387,7 +416,7 @@ private List assembleOccurrenceTerms(JsonNode data, .withDwcGeoreferenceRemarks(termMapper.retrieveTerm(new GeoreferenceRemarks(), data, dwc)) .withDwcGeoreferenceSources(termMapper.retrieveTerm(new GeoreferenceSources(), data, dwc)) .withDwcPointRadiusSpatialFit(parseToDouble(new PointRadiusSpatialFit(), data, dwc)); - var geologicalContext = new eu.dissco.core.translator.schema.GeologicalContext() + var geologicalContext = new eu.dissco.core.translator.schema.DwcGeologicalContext() .withDwcLowestBiostratigraphicZone( termMapper.retrieveTerm(new LowestBiostratigraphicZone(), data, dwc)) .withDwcHighestBiostratigraphicZone( @@ -419,6 +448,7 @@ private List assembleOccurrenceTerms(JsonNode data, .withDwcGroup(termMapper.retrieveTerm(new Group(), data, dwc)) .withDwcMember(termMapper.retrieveTerm(new Member(), data, dwc)); var location = new eu.dissco.core.translator.schema.Location() + .withDwcLocationID(termMapper.retrieveTerm(new LocationId(), data, dwc)) .withDwcContinent(termMapper.retrieveTerm(new Continent(), data, dwc)) .withDwcCountry(termMapper.retrieveTerm(new Country(), data, dwc)) .withDwcCountryCode(termMapper.retrieveTerm(new CountryCode(), data, dwc)) @@ -427,6 +457,7 @@ private List assembleOccurrenceTerms(JsonNode data, .withDwcIslandGroup(termMapper.retrieveTerm(new IslandGroup(), data, dwc)) .withDwcMunicipality(termMapper.retrieveTerm(new Municipality(), data, dwc)) .withDwcLocality(termMapper.retrieveTerm(new Locality(), data, dwc)) + .withDwcVerbatimLocality(termMapper.retrieveTerm(new VerbatimLocality(), data, dwc)) .withDwcStateProvince(termMapper.retrieveTerm(new StateProvince(), data, dwc)) .withDwcWaterBody(termMapper.retrieveTerm(new WaterBody(), data, dwc)) .withDwcHigherGeography(termMapper.retrieveTerm(new HigherGeography(), data, dwc)) @@ -438,15 +469,21 @@ private List assembleOccurrenceTerms(JsonNode data, .withDwcMinimumDistanceAboveSurfaceInMeters( parseToDouble(new MinimumDistanceAboveSurfaceInMeters(), data, dwc)) .withDwcMinimumElevationInMeters(parseToDouble(new MinimumElevationInMeters(), data, dwc)) + .withDwcVerbatimDepth(termMapper.retrieveTerm(new VerbatimDepth(), data, dwc)) + .withDwcVerbatimElevation(termMapper.retrieveTerm(new VerbatimElevation(), data, dwc)) .withDwcVerticalDatum(termMapper.retrieveTerm(new VerticalDatum(), data, dwc)) .withDwcLocationAccordingTo(termMapper.retrieveTerm(new LocationAccordingTo(), data, dwc)) .withDwcLocationRemarks(termMapper.retrieveTerm(new LocationRemarks(), data, dwc)) - .withGeoreference(georeference) - .withGeologicalContext(geologicalContext); + .withGeoReference(georeference) + .withDwcGeologicalContext(geologicalContext); var assertions = new OccurrenceAssertions().gatherOccurrenceAssertions(mapper, data, dwc); var occurrence = new eu.dissco.core.translator.schema.Occurrences() .withDwcFieldNumber(termMapper.retrieveTerm(new FieldNumber(), data, dwc)) .withDwcEventDate(termMapper.retrieveTerm(new EventDate(), data, dwc)) + .withDwcVerbatimEventDate(termMapper.retrieveTerm(new VerbatimEventDate(), data, dwc)) + .withDwcYear(parseToInteger(new Year(), data, dwc)) + .withDwcMonth(parseToInteger(new Month(), data, dwc)) + .withDwcDay(parseToInteger(new Day(), data, dwc)) .withDwcSex(termMapper.retrieveTerm(new Sex(), data, dwc)) .withDwcOrganismQuantity(termMapper.retrieveTerm(new OrganismQuantity(), data, dwc)) .withDwcOrganismQuantityType(termMapper.retrieveTerm(new OrganismQuantityType(), data, dwc)) @@ -454,6 +491,7 @@ private List assembleOccurrenceTerms(JsonNode data, .withDwcLifeStage(termMapper.retrieveTerm(new LifeStage(), data, dwc)) .withDwcEventRemarks(termMapper.retrieveTerm(new EventRemark(), data, dwc)) .withDwcFieldNumber(termMapper.retrieveTerm(new FieldNumber(), data, dwc)) + .withDwcRecordNumber(termMapper.retrieveTerm(new RecordNumber(), data, dwc)) .withDwcFieldNotes(termMapper.retrieveTerm(new FieldNotes(), data, dwc)) .withDwcHabitat(termMapper.retrieveTerm(new Habitat(), data, dwc)) .withDwcReproductiveCondition( @@ -472,8 +510,8 @@ private List assembleOccurrenceTerms(JsonNode data, .withDwcSampleSizeValue(termMapper.retrieveTerm(new SampleSizeValue(), data, dwc)) .withDwcCaste(termMapper.retrieveTerm(new Caste(), data, dwc)) .withDwcVitality(termMapper.retrieveTerm(new Vitality(), data, dwc)) - .withLocation(location) - .withAssertions(assertions); + .withDctermsLocation(location) + .withAssertion(assertions); return List.of(occurrence); } diff --git a/src/main/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirector.java b/src/main/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirector.java index 58caabf..4028cb4 100644 --- a/src/main/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirector.java +++ b/src/main/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirector.java @@ -73,7 +73,8 @@ protected List assembleIdentifications(JsonNode data, boolean d iterateOverElements = false; } } - if (identifications.size() == 1 && identifications.get(0).getDwcIdentificationVerificationStatus() == null){ + if (identifications.size() == 1 + && identifications.get(0).getDwcIdentificationVerificationStatus() == null) { //If there is only one identification, and it doesn't have a verification status, set it to true identifications.get(0).setDwcIdentificationVerificationStatus(Boolean.TRUE); } diff --git a/src/main/java/eu/dissco/core/translator/terms/License.java b/src/main/java/eu/dissco/core/translator/terms/License.java index c1ea1a7..18d0144 100644 --- a/src/main/java/eu/dissco/core/translator/terms/License.java +++ b/src/main/java/eu/dissco/core/translator/terms/License.java @@ -9,7 +9,7 @@ public class License extends Term { public static final String TERM = DCTERMS_PREFIX + "license"; -// Fall back to dc terms rights if no license is present + // Fall back to dc terms rights if no license is present private final List dwcaTerms = List.of(TERM, "dc:license", "eml:license", "dcterms:rights", "dc:rights"); private final List abcdUnitTerms = List.of( diff --git a/src/main/java/eu/dissco/core/translator/terms/Term.java b/src/main/java/eu/dissco/core/translator/terms/Term.java index 5e3f7e3..d3e0d8e 100644 --- a/src/main/java/eu/dissco/core/translator/terms/Term.java +++ b/src/main/java/eu/dissco/core/translator/terms/Term.java @@ -1,9 +1,9 @@ package eu.dissco.core.translator.terms; -import eu.dissco.core.translator.schema.Identifications; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import eu.dissco.core.translator.schema.Identifications; import java.util.List; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.tuple.Pair; diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/PhysicalSpecimenId.java b/src/main/java/eu/dissco/core/translator/terms/specimen/PhysicalSpecimenId.java index cc44d24..268743c 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/PhysicalSpecimenId.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/PhysicalSpecimenId.java @@ -8,7 +8,8 @@ public class PhysicalSpecimenId extends Term { public static final String TERM = ODS_PREFIX + "physicalSpecimenId"; - private final List dwcaTerms = List.of("dwc:occurrenceID", "dwc:catalogNumber"); + private final List dwcaTerms = List.of("dwc:occurrenceID", "dwc:catalogNumber", + "dwc:materialSampleID", "dwc:materialEntityID"); private final List abcdTerms = List.of("abcd:unitGUID", "abcd:unitID"); @Override diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/Preparations.java b/src/main/java/eu/dissco/core/translator/terms/specimen/Preparations.java index 8277f2f..822e52c 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/Preparations.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/Preparations.java @@ -8,7 +8,8 @@ public class Preparations extends Term { public static final String TERM = DWC_PREFIX + "preparations"; private final List dwcaTerms = List.of("dwc:preparations"); - private final List abcdTerms = List.of("abcd:kindOfUnit/0/value", "abcd:specimenUnit/preparations/preparation/0/preparationType/value"); + private final List abcdTerms = List.of("abcd:kindOfUnit/0/value", + "abcd:specimenUnit/preparations/preparation/0/preparationType/value"); @Override public String retrieveFromDWCA(JsonNode unit) { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/RecordedById.java b/src/main/java/eu/dissco/core/translator/terms/specimen/RecordedById.java new file mode 100644 index 0000000..41639fe --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/RecordedById.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class RecordedById extends Term { + + public static final String TERM = DWC_PREFIX + "recordedByID"; + + private final List dwcaTerms = List.of("dwc:recordedByID"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/SpecimenName.java b/src/main/java/eu/dissco/core/translator/terms/specimen/SpecimenName.java index de5c5b6..fc28422 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/SpecimenName.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/SpecimenName.java @@ -11,7 +11,16 @@ public String calculate(DigitalSpecimen ds) { var acceptedIdentification = retrieveAcceptedIdentification(ds); if (acceptedIdentification != null && acceptedIdentification.getTaxonIdentifications() != null && !acceptedIdentification.getTaxonIdentifications().isEmpty()) { - return acceptedIdentification.getTaxonIdentifications().get(0).getDwcScientificName(); + if (acceptedIdentification.getTaxonIdentifications().get(0) + .getDwcScientificName() != null) { + return acceptedIdentification.getTaxonIdentifications().get(0) + .getDwcScientificName(); + } + if (acceptedIdentification.getTaxonIdentifications().get(0) + .getDwcVernacularName() != null) { + return acceptedIdentification.getTaxonIdentifications().get(0) + .getDwcVernacularName(); + } } return null; } diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/VerbatimLabel.java b/src/main/java/eu/dissco/core/translator/terms/specimen/VerbatimLabel.java new file mode 100644 index 0000000..5b02869 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/VerbatimLabel.java @@ -0,0 +1,28 @@ +package eu.dissco.core.translator.terms.specimen; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimLabel extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimLabel"; + private final List dwcaTerms = List.of(TERM); + private final List abcdUnitTerms = List.of( + "abcd:specimenUnit/marks/mark/0/markText/value"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String retrieveFromABCD(JsonNode unit) { + return searchJsonForTerm(unit, abcdUnitTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/AbcdTypeInformation.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/AbcdTypeInformation.java index b84beef..5292028 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/AbcdTypeInformation.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/AbcdTypeInformation.java @@ -39,8 +39,10 @@ private boolean isNameMatch(Identifications identification, JsonNode node) { } } - private void setAdditionalIdentificationInfo(Identifications identification, JsonNode typeDesignationNodes) { - identification.setTypeDesignatedBy(new TypeDesignatedBy().retrieveFromABCD(typeDesignationNodes)); + private void setAdditionalIdentificationInfo(Identifications identification, + JsonNode typeDesignationNodes) { + identification.setTypeDesignatedBy( + new TypeDesignatedBy().retrieveFromABCD(typeDesignationNodes)); identification.setDwcTypeStatus(new TypeStatus().retrieveFromABCD(typeDesignationNodes)); } diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentificationVerificationStatus.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentificationVerificationStatus.java index ae8ace2..7ae499a 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentificationVerificationStatus.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentificationVerificationStatus.java @@ -15,7 +15,7 @@ public class IdentificationVerificationStatus extends Term { @Override public String retrieveFromDWCA(JsonNode unit) { var result = super.searchJsonForTerm(unit, dwcaTerms); - if (result != null){ + if (result != null) { if (result.equals("1")) { return Boolean.TRUE.toString(); } else { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedBy.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedBy.java index 539d3b2..9c7c674 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedBy.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedBy.java @@ -8,7 +8,7 @@ public class IdentifiedBy extends Term { public static final String TERM = DWC_PREFIX + "identifiedBy"; - private final List dwcaTerms = List.of(TERM, "dwc:identifiedByID"); + private final List dwcaTerms = List.of(TERM); private final List abcdTerms = List.of("identifiers/identifier/0/personName/fullName"); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedById.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedById.java new file mode 100644 index 0000000..5b9c7fd --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedById.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.identification; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class IdentifiedById extends Term { + + public static final String TERM = DWC_PREFIX + "identifiedById"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/TypeDesignatedBy.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/TypeDesignatedBy.java index b2045a2..c1d1828 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/TypeDesignatedBy.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/TypeDesignatedBy.java @@ -5,6 +5,7 @@ import java.util.List; public class TypeDesignatedBy extends Term { + public static final String TERM = "typeDesignatedBy"; private final List abcdTerms = List.of("verifier/fullName/value"); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsage.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsage.java index c72371f..e67b3e4 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsage.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsage.java @@ -5,6 +5,7 @@ import java.util.List; public class AcceptedNameUsage extends Term { + public static final String TERM = DWC_PREFIX + "acceptedNameUsage"; private final List dwcaTerms = List.of(TERM); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsageId.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsageId.java index 634006c..509aee7 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsageId.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/AcceptedNameUsageId.java @@ -5,6 +5,7 @@ import java.util.List; public class AcceptedNameUsageId extends Term { + public static final String TERM = DWC_PREFIX + "acceptedNameUsageId"; private final List dwcaTerms = List.of(TERM); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/CultivarEpithet.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/CultivarEpithet.java index 3ff3bfb..0722f19 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/CultivarEpithet.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/CultivarEpithet.java @@ -5,6 +5,7 @@ import java.util.List; public class CultivarEpithet extends Term { + public static final String TERM = DWC_PREFIX + "cultivarEpithet"; private final List dwcaTerms = List.of(TERM); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/GenericName.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/GenericName.java index f96c50a..4cb05be 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/GenericName.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/GenericName.java @@ -5,6 +5,7 @@ import java.util.List; public class GenericName extends Term { + public static final String TERM = DWC_PREFIX + "genericName"; private final List dwcaTerms = List.of(TERM); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/OriginalNameUsage.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/OriginalNameUsage.java index 2cd49d9..d255da3 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/OriginalNameUsage.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/OriginalNameUsage.java @@ -5,6 +5,7 @@ import java.util.List; public class OriginalNameUsage extends Term { + public static final String TERM = DWC_PREFIX + "originalNameUsage"; private final List dwcaTerms = List.of(TERM); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificName.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificName.java index 251314c..314b64a 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificName.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificName.java @@ -8,7 +8,7 @@ public class ScientificName extends AbstractTaxonomy { public static final String TERM = DWC_PREFIX + "scientificName"; - private final List dwcaTerms = List.of("dwc:scientificName"); + private final List dwcaTerms = List.of(TERM); private final List abcdTerms = List.of( "result/taxonIdentified/scientificName/fullScientificNameString", "result/mineralRockIdentified/classifiedName/fullScientificNameString", diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificNameId.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificNameId.java new file mode 100644 index 0000000..7f19759 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificNameId.java @@ -0,0 +1,21 @@ +package eu.dissco.core.translator.terms.specimen.identification.taxonomy; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class ScientificNameId extends Term { + + public static final String TERM = DWC_PREFIX + "scientificNameID"; + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Subtribe.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Subtribe.java index ef9c469..c005e01 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Subtribe.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Subtribe.java @@ -19,6 +19,7 @@ public String retrieveFromDWCA(JsonNode unit) { public String retrieveFromABCD(JsonNode unit) { return super.searchABCDSplitTerms(unit, abcdSplitTerms); } + @Override public String getTerm() { return TERM; diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Superfamily.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Superfamily.java index c9320e0..9515422 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Superfamily.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Superfamily.java @@ -19,6 +19,7 @@ public String retrieveFromDWCA(JsonNode unit) { public String retrieveFromABCD(JsonNode unit) { return super.searchABCDSplitTerms(unit, abcdSplitTerms); } + @Override public String getTerm() { return TERM; diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/TaxonRank.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/TaxonRank.java index c4ad6a5..5fa8bb1 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/TaxonRank.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/TaxonRank.java @@ -7,7 +7,7 @@ public class TaxonRank extends AbstractTaxonomy { public static final String TERM = DWC_PREFIX + "taxonRank"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimTaxonRank.TERM); private final List abcdTerms = List.of( "result/taxonIdentified/scientificName/nameAtomised/botanical/rank"); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Tribe.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Tribe.java index ebe5164..213fb53 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Tribe.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/Tribe.java @@ -19,6 +19,7 @@ public String retrieveFromDWCA(JsonNode unit) { public String retrieveFromABCD(JsonNode unit) { return super.searchABCDSplitTerms(unit, abcdSplitTerms); } + @Override public String getTerm() { return TERM; diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/VerbatimTaxonRank.java b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/VerbatimTaxonRank.java new file mode 100644 index 0000000..98d4803 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/VerbatimTaxonRank.java @@ -0,0 +1,28 @@ +package eu.dissco.core.translator.terms.specimen.identification.taxonomy; + +import com.fasterxml.jackson.databind.JsonNode; +import java.util.List; + +public class VerbatimTaxonRank extends AbstractTaxonomy { + + public static final String TERM = DWC_PREFIX + "verbatimTaxonRank"; + + private final List dwcaTerms = List.of(TERM); + private final List abcdTerms = List.of( + "result/taxonIdentified/scientificName/nameAtomised/botanical/rank"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String retrieveFromABCD(JsonNode unit) { + return searchJsonForTerm(unit, abcdTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/Locality.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/Locality.java index 6277443..65d2d67 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/Locality.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/Locality.java @@ -8,7 +8,7 @@ public class Locality extends Term { public static final String TERM = DWC_PREFIX + "locality"; - private final List dwcaTerms = List.of(TERM, "dwc:verbatimLocality"); + private final List dwcaTerms = List.of(TERM, VerbatimLocality.TERM); private final List abcdTerms = List.of("abcd:gathering/localityText/value"); @Override diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/LocationId.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/LocationId.java new file mode 100644 index 0000000..0dcb901 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/LocationId.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class LocationId extends Term { + + public static final String TERM = DWC_PREFIX + "locationID"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumDepthInMeters.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumDepthInMeters.java index 1f17e9c..87cd617 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumDepthInMeters.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumDepthInMeters.java @@ -8,9 +8,10 @@ public class MaximumDepthInMeters extends Term { public static final String TERM = DWC_PREFIX + "maximumDepthInMeters"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimDepth.TERM); private final List abcdTerms = List.of( - "abcd:gathering/depth/measurementOrFactAtomised/upperValue/value"); + "abcd:gathering/depth/measurementOrFactAtomised/upperValue/value", + "abcd:gathering/depth/measurementOrFactText/value"); @Override public String retrieveFromDWCA(JsonNode unit) { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumElevationInMeters.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumElevationInMeters.java index 173ecdb..a5e4b6c 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumElevationInMeters.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MaximumElevationInMeters.java @@ -8,9 +8,10 @@ public class MaximumElevationInMeters extends Term { public static final String TERM = DWC_PREFIX + "maximumElevationInMeters"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimElevation.TERM); private final List abcdTerms = List.of( - "abcd:gathering/altitude/measurementOrFactAtomised/upperValue/value", "abcd:gathering/altitude/measurementOrFactText/value"); + "abcd:gathering/altitude/measurementOrFactAtomised/upperValue/value", + "abcd:gathering/altitude/measurementOrFactText/value"); @Override public String retrieveFromDWCA(JsonNode unit) { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumDepthInMeters.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumDepthInMeters.java index 186b132..3d865be 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumDepthInMeters.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumDepthInMeters.java @@ -8,9 +8,10 @@ public class MinimumDepthInMeters extends Term { public static final String TERM = DWC_PREFIX + "minimumDepthInMeters"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimDepth.TERM); private final List abcdTerms = List.of( - "abcd:gathering/depth/measurementOrFactAtomised/lowerValue/value"); + "abcd:gathering/depth/measurementOrFactAtomised/lowerValue/value", + "abcd:gathering/depth/measurementOrFactText/value"); @Override public String retrieveFromDWCA(JsonNode unit) { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumElevationInMeters.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumElevationInMeters.java index 1bfbf8f..03a82f2 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumElevationInMeters.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/MinimumElevationInMeters.java @@ -8,9 +8,10 @@ public class MinimumElevationInMeters extends Term { public static final String TERM = DWC_PREFIX + "minimumElevationInMeters"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimElevation.TERM); private final List abcdTerms = List.of( - "abcd:gathering/altitude/measurementOrFactAtomised/lowerValue/value", "abcd:gathering/altitude/measurementOrFactText/value"); + "abcd:gathering/altitude/measurementOrFactAtomised/lowerValue/value", + "abcd:gathering/altitude/measurementOrFactText/value"); @Override public String retrieveFromDWCA(JsonNode unit) { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimDepth.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimDepth.java new file mode 100644 index 0000000..fd3e846 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimDepth.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimDepth extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimDepth"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimElevation.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimElevation.java new file mode 100644 index 0000000..809596a --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimElevation.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimElevation extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimElevation"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimLocality.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimLocality.java new file mode 100644 index 0000000..9eb56c6 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/VerbatimLocality.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimLocality extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimLocality"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLatitude.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLatitude.java index 6fac7b0..15b2a07 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLatitude.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLatitude.java @@ -7,7 +7,7 @@ public class DecimalLatitude extends Term { public static final String TERM = DWC_PREFIX + "decimalLatitude"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimLatitude.TERM); private final List abcdTerms = List.of( "abcd:gathering/siteCoordinateSets/siteCoordinates/0/coordinatesLatLong/latitudeDecimal"); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLongitude.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLongitude.java index c9ecc05..7b20a5b 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLongitude.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/DecimalLongitude.java @@ -7,7 +7,7 @@ public class DecimalLongitude extends Term { public static final String TERM = DWC_PREFIX + "decimalLongitude"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimLongitude.TERM); private final List abcdTerms = List.of( "abcd:gathering/siteCoordinateSets/siteCoordinates/0/coordinatesLatLong/longitudeDecimal"); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinateSystem.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinateSystem.java new file mode 100644 index 0000000..d548284 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinateSystem.java @@ -0,0 +1,28 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimCoordinateSystem extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimCoordinateSystem"; + private final List dwcaTerms = List.of(TERM); + private final List abcdTerms = List.of( + "abcd:gathering/siteCoordinateSets/siteCoordinates/0/coordinatesGrid/gridCellSystem"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String retrieveFromABCD(JsonNode unit) { + return super.searchJsonForTerm(unit, abcdTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinates.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinates.java new file mode 100644 index 0000000..8de1183 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinates.java @@ -0,0 +1,28 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimCoordinates extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimCoordinates"; + private final List dwcaTerms = List.of(TERM); + private final List abcdTerms = List.of( + "abcd:gathering/siteCoordinateSets/siteCoordinates/0/coordinatesUTM/uTMText"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String retrieveFromABCD(JsonNode unit) { + return super.searchJsonForTerm(unit, abcdTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLatitude.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLatitude.java new file mode 100644 index 0000000..3593887 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLatitude.java @@ -0,0 +1,21 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimLatitude extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimLatitude"; + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLongitude.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLongitude.java new file mode 100644 index 0000000..38fb11d --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLongitude.java @@ -0,0 +1,21 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimLongitude extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimLongitude"; + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimSRS.java b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimSRS.java new file mode 100644 index 0000000..a8ebe20 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimSRS.java @@ -0,0 +1,21 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimSRS extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimSRS"; + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Day.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Day.java new file mode 100644 index 0000000..a660491 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Day.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class Day extends Term { + + public static final String TERM = DWC_PREFIX + "day"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/EventDate.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/EventDate.java index b662030..ba74e99 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/EventDate.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/EventDate.java @@ -8,7 +8,7 @@ public class EventDate extends Term { public static final String TERM = DWC_PREFIX + "eventDate"; - private final List dwcaTerms = List.of(TERM); + private final List dwcaTerms = List.of(TERM, VerbatimEventDate.TERM); private final List abcdTerms = List.of("abcd:gathering/dateTime/isodateTimeBegin", "abcd:gathering/dateTime/isodateTimeEnd", "abcd:gathering/dateTime/dateText"); diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumber.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumber.java index 92d9591..b041b12 100644 --- a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumber.java +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumber.java @@ -8,9 +8,8 @@ public class FieldNumber extends Term { public static final String TERM = DWC_PREFIX + "fieldNumber"; - private final List dwcaTerms = List.of("dwc:recordNumber", "dwc:fieldNumber"); - private final List abcdTerms = List.of("abcd:collectorsFieldNumber", - "abcd:gathering/code"); + private final List dwcaTerms = List.of(TERM); + private final List abcdTerms = List.of("abcd:gathering/code"); @Override public String retrieveFromDWCA(JsonNode unit) { diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Month.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Month.java new file mode 100644 index 0000000..0ccc732 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Month.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class Month extends Term { + + public static final String TERM = DWC_PREFIX + "month"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/RecordNumber.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/RecordNumber.java new file mode 100644 index 0000000..8ac9fcc --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/RecordNumber.java @@ -0,0 +1,29 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class RecordNumber extends Term { + + public static final String TERM = DWC_PREFIX + "recordNumber"; + + private final List dwcaTerms = List.of(TERM); + private final List abcdTerms = List.of("abcd:collectorsFieldNumber"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String retrieveFromABCD(JsonNode unit) { + return super.searchJsonForTerm(unit, abcdTerms); + } + + @Override + public String getTerm() { + return TERM; + } + +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/VerbatimEventDate.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/VerbatimEventDate.java new file mode 100644 index 0000000..ffafec4 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/VerbatimEventDate.java @@ -0,0 +1,29 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class VerbatimEventDate extends Term { + + public static final String TERM = DWC_PREFIX + "verbatimEventDate"; + + private final List dwcaTerms = List.of(TERM); + private final List abcdTerms = List.of("abcd:gathering/dateTime/dateText"); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String retrieveFromABCD(JsonNode unit) { + return super.searchJsonForTerm(unit, abcdTerms); + } + + @Override + public String getTerm() { + return TERM; + } + +} diff --git a/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Year.java b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Year.java new file mode 100644 index 0000000..0e40e11 --- /dev/null +++ b/src/main/java/eu/dissco/core/translator/terms/specimen/occurence/Year.java @@ -0,0 +1,22 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import com.fasterxml.jackson.databind.JsonNode; +import eu.dissco.core.translator.terms.Term; +import java.util.List; + +public class Year extends Term { + + public static final String TERM = DWC_PREFIX + "year"; + + private final List dwcaTerms = List.of(TERM); + + @Override + public String retrieveFromDWCA(JsonNode unit) { + return super.searchJsonForTerm(unit, dwcaTerms); + } + + @Override + public String getTerm() { + return TERM; + } +} diff --git a/src/main/resources/json-schema/agent.json b/src/main/resources/json-schema/agent.json index 7ab402f..236a2b9 100644 --- a/src/main/resources/json-schema/agent.json +++ b/src/main/resources/json-schema/agent.json @@ -1,49 +1,74 @@ { - "$id": "agent", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/shared-models/agent.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "$comment": "", "properties": { "agentRole": { "type": "string", + "description": "Indicates the role of the agent", "examples": [ - "collector" + "collector", + "preparer", + "identifier", + "recorder" ] }, "agentType": { "type": "string", + "description": "Indicates the type of agent", "examples": [ "machine", "human", "organisation" ] }, + "agentId":{ + "type": "string", + "description": "Primary identifier of the agent, additional identifiers can go in the identifiers array", + "examples": [ + "https://orcid.org/0000-0002-1825-0097" + ] + }, "agentName": { "type": "string", + "description": "Full name of the agent", "examples": [ "John Smith" ] }, "agentRoleBegan": { "type": "string", - "format": "date-time" + "description": "Date the agent began the role", + "examples": [ + "2023-10-02T12:31:34.806Z" + ] }, "agentRoleEnded": { "type": "string", - "format": "date-time" + "description": "Date the agent ended the role", + "examples": [ + "2023-09-02T12:31:34.806Z" + ] }, "agentRoleOrder": { "type": "integer", - "minimum": 0 + "description": "Order of the agent in the role. Can be used to indicate the order of importance", + "minimum": 1, + "examples": [ + 1, + 2 + ] }, "identifiers": { "type": "array", "items": { - "$ref": "identifications.json" + "$ref": "./identifiers.json" } } }, "required": [ + "agentRole", "agentType", "agentName" ] diff --git a/src/main/resources/json-schema/assertions.json b/src/main/resources/json-schema/assertions.json index c0370f3..f329996 100644 --- a/src/main/resources/json-schema/assertions.json +++ b/src/main/resources/json-schema/assertions.json @@ -1,5 +1,5 @@ { - "$id": "assertion", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/shared-models/assertions.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "$comment": "Looks like Measurement or Fact but terminology is different, no ontology yet?", @@ -36,6 +36,12 @@ }, "???:assertionRemarks": { "type": "string" + }, + "agents": { + "type": "array", + "items": { + "$ref": "./agent.json" + } } }, "required": [ diff --git a/src/main/resources/json-schema/chronometric_age.json b/src/main/resources/json-schema/chronometric-age.json similarity index 96% rename from src/main/resources/json-schema/chronometric_age.json rename to src/main/resources/json-schema/chronometric-age.json index 5947b2c..b4bae56 100644 --- a/src/main/resources/json-schema/chronometric_age.json +++ b/src/main/resources/json-schema/chronometric-age.json @@ -1,6 +1,7 @@ { - "$id": "chronometric_age", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/digital-specimens/chronometric-age.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment":"DigitalObject Version 0.1.0", "type": "object", "properties": { "chrono:verbatimChronometricAge": { diff --git a/src/main/resources/json-schema/citations.json b/src/main/resources/json-schema/citations.json index 4a5ba66..b3bb3ba 100644 --- a/src/main/resources/json-schema/citations.json +++ b/src/main/resources/json-schema/citations.json @@ -1,5 +1,5 @@ { - "$id": "root", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/shared-models/citations.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { @@ -56,6 +56,12 @@ "type": "boolean", "description": "Unclear yet", "$comment": "Unknown what this field should be" + }, + "agents": { + "type": "array", + "items": { + "$ref": "./agent.json" + } } } } \ No newline at end of file diff --git a/src/main/resources/json-schema/digital_entity.json b/src/main/resources/json-schema/digital-entity.json similarity index 91% rename from src/main/resources/json-schema/digital_entity.json rename to src/main/resources/json-schema/digital-entity.json index 772cf93..83703c3 100644 --- a/src/main/resources/json-schema/digital_entity.json +++ b/src/main/resources/json-schema/digital-entity.json @@ -1,6 +1,7 @@ { - "$id": "digitalEntity", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/digital-media-objects/digital-entity.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment":"DigitalObject Version 0.1.0", "type": "object", "properties": { "ods:id": { @@ -136,25 +137,31 @@ "assertions": { "type": "array", "items": { - "$ref": "assertions.json" + "$ref": "./assertions.json" } }, "citations": { "type": "array", "items": { - "$ref": "citations.json" + "$ref": "./citations.json" } }, "identifiers": { "type": "array", "items": { - "$ref": "identifiers.json" + "$ref": "./identifiers.json" } }, "entityRelationships": { "type": "array", "items": { - "$ref": "entity_relationships.json" + "$ref": "./entity-relationships.json" + } + }, + "agents": { + "type": "array", + "items": { + "$ref": "./agent.json" } } }, diff --git a/src/main/resources/json-schema/digital_specimen.json b/src/main/resources/json-schema/digital-specimen.json similarity index 87% rename from src/main/resources/json-schema/digital_specimen.json rename to src/main/resources/json-schema/digital-specimen.json index 74c8228..a2590fd 100644 --- a/src/main/resources/json-schema/digital_specimen.json +++ b/src/main/resources/json-schema/digital-specimen.json @@ -1,6 +1,7 @@ { - "$id": "root", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.2.0/digital-specimens/digital-specimen.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment":"DigitalObject Version 0.2.0", "type": "object", "properties": { "ods:id": { @@ -24,6 +25,7 @@ "description": "The timestamp that the object version was created in DiSSCo", "format": "date-time", "examples": [ + "2023-10-02T12:31:34.806Z" ] }, "ods:type": { @@ -52,8 +54,7 @@ "Resolvable", "Global", "Local" - ], - "$comment": "Do we need to further distinguish the identifier, for example add 'RESOLVABLE'" + ] }, "ods:topicOrigin": { "type": "string", @@ -66,8 +67,7 @@ ], "example": [ "Natural" - ], - "$comment": "Do we need to add 'UNKNOWN'?" + ] }, "ods:topicDomain": { "type": "string", @@ -83,8 +83,7 @@ ], "example": [ "Life" - ], - "$comment": "Do we need to add 'UNKNOWN'?" + ] }, "ods:topicDiscipline": { "type": "string", @@ -232,10 +231,6 @@ "José E. Crespo" ] }, - "???:recordedByAgent": { - "$ref": "agent.json", - "$comment": "Is this an option for the agent instead of adding a list?" - }, "dwc:recordedById": { "type": "string", "description": "https://rs.tdwg.org/dwc/terms/recordedByID", @@ -264,52 +259,65 @@ "Museu de História Natural e da Ciência da Universidade do Porto" ] }, - "materialEntity": { + "dwc:verbatimLabel": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimLabel", + "examples": [ + "ILL: Union Co. Wolf Lake by Powder Plant Bridge. 1 March 1975 Coll. S. Ketzler, S. Herbert\n\nMonotoma longicollis 4 ♂ Det TC McElrath 2018\n\nINHS Insect Collection 456782" + ] + }, + "dwc:MaterialEntity": { + "type": "array", + "items": { + "$ref": "./material-entity.json" + } + }, + "dwc:Identification": { "type": "array", "items": { - "$ref": "material_entity.json" + "$ref": "./identifications.json" } }, - "dwc:identification": { + "???:Assertion": { "type": "array", "items": { - "$ref": "identifications.json" + "$ref": "./assertions.json" } }, - "assertions": { + "dwc:Occurrence": { "type": "array", "items": { - "$ref": "assertions.json" + "$ref": "./occurrences.json" } }, - "occurrences": { + "???:EntityRelationship": { "type": "array", "items": { - "$ref": "occurrences.json" + "$ref": "./entity-relationships.json" } }, - "entityRelationships": { + "???:Citation": { "type": "array", "items": { - "$ref": "entity_relationships.json" + "$ref": "./citations.json" } }, - "citations": { + "???:Identifier": { "type": "array", "items": { - "$ref": "citations.json" + "$ref": "./identifiers.json" } }, - "identifiers": { + "???:ChronometricAge": { "type": "array", "items": { - "$ref": "identifiers.json" + "$ref": "./chronometric-age.json" } }, - "chronometricAge": { + "???:Agent": { "type": "array", "items": { - "$ref": "chronometric_age.json" + "$ref": "./agent.json" } } }, @@ -323,6 +331,6 @@ "ods:physicalSpecimenIdType", "ods:sourceSystem", "dcterms:license", - "???:institutionId" + "dwc:institutionId" ] } diff --git a/src/main/resources/json-schema/entity_relationships.json b/src/main/resources/json-schema/entity-relationships.json similarity index 85% rename from src/main/resources/json-schema/entity_relationships.json rename to src/main/resources/json-schema/entity-relationships.json index d2f0817..fd66125 100644 --- a/src/main/resources/json-schema/entity_relationships.json +++ b/src/main/resources/json-schema/entity-relationships.json @@ -1,5 +1,5 @@ { - "$id": "entityRelationship", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/shared-models/entity-relationships.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { @@ -29,6 +29,12 @@ "type": "string", "description": "The PID of the creator, this could be a Orcid(user), PID(machine) or ROR(organisation)", "$comment": "Not available in GBIF UM" + }, + "agents": { + "type": "array", + "items": { + "$ref": "./agent.json" + } } }, "required": [ diff --git a/src/main/resources/json-schema/events.json b/src/main/resources/json-schema/events.json index df8a60b..dd7ca3f 100644 --- a/src/main/resources/json-schema/events.json +++ b/src/main/resources/json-schema/events.json @@ -1,6 +1,7 @@ { - "$id": "events", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.2.0/digital-specimens/events.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment": "DigitalObject Version 0.2.0", "type": "object", "properties": { "???:eventName": { @@ -14,6 +15,13 @@ "RV Sol 87-03-08" ] }, + "dwc:recordNumber": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/recordNumber", + "examples": [ + "OPP 7101" + ] + }, "dwc:eventDate": { "type": "string", "description": "https://rs.tdwg.org/dwc/terms/eventDate", @@ -21,6 +29,13 @@ "1963-03-08T14:07-0600" ] }, + "dwc:verbatimEventDate": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimEventDate", + "examples": [ + "Marzo 2002" + ] + }, "dwc:year": { "type": "integer", "description": "https://rs.tdwg.org/dwc/terms/year", @@ -50,9 +65,12 @@ ], "$comment": "Is this necessary for specimens" }, - "???:protocolDescription": { + "eco:protocolDescriptions": { "type": "string", - "comment": "Not sure what this field means" + "description": "https://rs.tdwg.org/eco/terms/protocolDescriptions", + "examples": [ + "Three conventional harp traps (3.2m ht x 2.2m w) were established in flight path zones for a period of 4 hrs at dawn and dusk for a total of 10 trap nights. Traps were visited on an hourly basis during each deployment period and the trap catch recorded for species, size, weight, sex, age and maternal status." + ] }, "dwc:sampleSizeValue": { "type": "string", @@ -94,8 +112,14 @@ "type": "string", "$comment": "Not part of DWC or the UM?" }, - "location": { + "dcterms:Location": { "$ref": "./location.json" + }, + "???:Agent": { + "type": "array", + "items": { + "$ref": "./agent.json" + } } } } \ No newline at end of file diff --git a/src/main/resources/json-schema/identifications.json b/src/main/resources/json-schema/identifications.json index 9221b0b..f677f77 100644 --- a/src/main/resources/json-schema/identifications.json +++ b/src/main/resources/json-schema/identifications.json @@ -1,11 +1,15 @@ { - "$id": "identifications", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.2.0/digital-specimens/identifications.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment": "DigitalObject Version 0.2.0", "type": "object", "properties": { "dwc:identificationID": { "type": "string", - "description": "Check DWC terms" + "description": "https://rs.tdwg.org/dwc/terms/identificationID", + "examples": [ + "9992" + ] }, "???:identificationType": { "type": "string", @@ -79,7 +83,7 @@ "type": "string", "description": "https://rs.tdwg.org/dwc/terms/identificationQualifier", "examples": [ - "cf. var. oxyadenia " + "cf. var. oxyadenia" ] }, "???:typeDesignationType": { @@ -92,10 +96,16 @@ "description": "Unclear yet", "$comment": "Unknown what this field should be" }, - "citations": { + "???:Citation": { "type": "array", "items": { - "$ref": "citations.json" + "$ref": "./citations.json" + } + }, + "???:Agent": { + "type": "array", + "items": { + "$ref": "./agent.json" } }, "taxonIdentifications": { @@ -117,6 +127,13 @@ "Roptrocerus typographi (Györfi, 1952)" ] }, + "dwc:scientificNameId": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/scientificNameID", + "examples": [ + "urn:lsid:ipni.org:names:37829-1:1.3" + ] + }, "ods:scientificNameHtmlLabel": { "type": "string", "description": "A Hyper Text Markup Language (HTML) representation of the scientific name. Includes correct formatting of the name.", @@ -152,6 +169,13 @@ "species" ] }, + "dwc:verbatimTaxonRank": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimTaxonRank", + "examples": [ + "Agamospecies" + ] + }, "???:taxonSource": { "type": "string", "description": "Unclear yet", diff --git a/src/main/resources/json-schema/identifiers.json b/src/main/resources/json-schema/identifiers.json index 3144ea6..3259f63 100644 --- a/src/main/resources/json-schema/identifiers.json +++ b/src/main/resources/json-schema/identifiers.json @@ -1,5 +1,5 @@ { - "$id": "identifiers", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.1.0/shared-models/identifiers.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { diff --git a/src/main/resources/json-schema/location.json b/src/main/resources/json-schema/location.json index d463fb4..d81f7bd 100644 --- a/src/main/resources/json-schema/location.json +++ b/src/main/resources/json-schema/location.json @@ -3,6 +3,13 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { + "dwc:locationID": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/locationID", + "examples": [ + "https://opencontext.org/subjects/768A875F-E205-4D0B-DE55-BAB7598D0FD1" + ] + }, "dwc:continent": { "type": "string", "description": "https://rs.tdwg.org/dwc/terms/continent", @@ -73,6 +80,13 @@ "Zeeuws-Vlaanderen, Hulst, Braakman" ] }, + "dwc:verbatimLocality": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimLocality", + "examples": [ + "25 km NNE Bariloche por R. Nac. 237" + ] + }, "dwc:minimumElevationInMeters": { "type": "number", "description": "https://rs.tdwg.org/dwc/terms/minimumElevationInMeters", @@ -94,6 +108,13 @@ 205 ] }, + "dwc:verbatimElevation": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimElevation", + "examples": [ + "100 - 200 m" + ] + }, "dwc:minimumDistanceAboveSurfaceInMeters": { "type": "number", "description": "https://rs.tdwg.org/dwc/terms/minimumDistanceAboveSurfaceInMeters", @@ -123,6 +144,13 @@ 340 ] }, + "dwc:verbatimDepth": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimDepth", + "examples": [ + "100-200 m" + ] + }, "dwc:verticalDatum": { "type": "string", "description": "https://rs.tdwg.org/dwc/terms/verticalDatum", @@ -144,9 +172,16 @@ "under water since 2005" ] }, - "georeference": { + "???:GeoReference": { "type": "object", "properties": { + "dwc:verbatimCoordinates": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimCoordinates", + "examples": [ + "41 05 54S 121 05 34W" + ] + }, "dwc:decimalLatitude": { "type": "number", "description": "https://rs.tdwg.org/dwc/terms/decimalLatitude", @@ -156,6 +191,13 @@ "minimum": -180, "maximum": 180 }, + "dwc:verbatimLatitude": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimLatitude", + "examples": [ + "41 05 54.03S" + ] + }, "dwc:decimalLongitude": { "type": "number", "description": "https://rs.tdwg.org/dwc/terms/decimalLongitude", @@ -165,6 +207,20 @@ "minimum": -180, "maximum": 180 }, + "dwc:verbatimLongitude": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimLongitude", + "examples": [ + "121d 10' 34\" W" + ] + }, + "dwc:verbatimCoordinateSystem": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimCoordinateSystem", + "examples": [ + "degrees decimal minutes" + ] + }, "dwc:geodeticDatum": { "type": "string", "description": "https://rs.tdwg.org/dwc/terms/geodeticDatum", @@ -208,6 +264,13 @@ "epsg:4326" ] }, + "dwc:verbatimSRS": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimSRS", + "examples": [ + "NAD27" + ] + }, "dwc:footprintSpatialFit": { "type": "integer", "description": "https://rs.tdwg.org/dwc/terms/footprintSpatialFit", @@ -256,7 +319,7 @@ } } }, - "geologicalContext": { + "dwc:GeologicalContext": { "type": "object", "properties": { "dwc:earliestEonOrLowestEonothem": { diff --git a/src/main/resources/json-schema/material_entity.json b/src/main/resources/json-schema/material-entity.json similarity index 73% rename from src/main/resources/json-schema/material_entity.json rename to src/main/resources/json-schema/material-entity.json index 42c8733..1161c25 100644 --- a/src/main/resources/json-schema/material_entity.json +++ b/src/main/resources/json-schema/material-entity.json @@ -1,6 +1,7 @@ { - "$id": "materialEntity", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.2.0/digital-specimens/material-entity.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment":"DigitalObject Version 0.2.0", "type": "object", "$comment": "Only if the part did not get a separate catalogue number, otherwise it will be a separate digital specimen itself", "properties": { @@ -28,7 +29,7 @@ "MNF" ] }, - "???:institutionId": { + "dwc:institutionId": { "type": "string", "description": "ROR or Wikidata identifier, based on https://rs.tdwg.org/dwc/terms/institutionID", "examples": [ @@ -80,40 +81,53 @@ "https://orcid.org/0000-0002-1825-0097" ] }, - "identifications": { + "dwc:verbatimLabel": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimLabel", + "examples": [ + "ILL: Union Co. Wolf Lake by Powder Plant Bridge. 1 March 1975 Coll. S. Ketzler, S. Herbert\n\nMonotoma longicollis 4 ♂ Det TC McElrath 2018\n\nINHS Insect Collection 456782" + ] + }, + "dwc:Identification": { + "type": "array", + "items": { + "$ref": "./identifications.json" + } + }, + "???:Assertion": { "type": "array", "items": { - "$ref": "identifications.json" + "$ref": "./assertions.json" } }, - "assertions": { + "???:EntityRelationship": { "type": "array", "items": { - "$ref": "assertions.json" + "$ref": "./entity-relationships.json" } }, - "entityRelationships": { + "???:Citation": { "type": "array", "items": { - "$ref": "entity_relationships.json" + "$ref": "./citations.json" } }, - "citations": { + "???:Identifier": { "type": "array", "items": { - "$ref": "citations.json" + "$ref": "./identifiers.json" } }, - "identifiers": { + "dwc:Event": { "type": "array", "items": { - "$ref": "identifications.json" + "$ref": "./events.json" } }, - "events": { + "???:Agent": { "type": "array", "items": { - "$ref": "events.json" + "$ref": "./agent.json" } } } diff --git a/src/main/resources/json-schema/occurrences.json b/src/main/resources/json-schema/occurrences.json index bb75a69..c28b55d 100644 --- a/src/main/resources/json-schema/occurrences.json +++ b/src/main/resources/json-schema/occurrences.json @@ -1,6 +1,7 @@ { - "$id": "occurrence", + "$id": "https://schemas.dissco.tech/schemas/digitalobjects/0.2.0/digital-specimens/occurrences.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment":"DigitalObject Version 0.2.0", "type": "object", "properties": { "dwc:organismQuantity": { @@ -117,20 +118,6 @@ "found dead on road" ] }, - "dwc:recordedBy": { - "type": "string", - "description": "https://rs.tdwg.org/dwc/terms/recordedBy", - "examples": [ - "José E. Crespo" - ] - }, - "dwc:recordedById": { - "description": "https://rs.tdwg.org/dwc/terms/recordedByID", - "type": "string", - "examples": [ - "https://orcid.org/0000-0002-1825-0097" - ] - }, "???:eventName": { "type": "string", "comment": "Not sure what this field means" @@ -142,6 +129,13 @@ "RV Sol 87-03-08" ] }, + "dwc:recordNumber": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/recordNumber", + "examples": [ + "OPP 7101" + ] + }, "dwc:eventDate": { "type": "string", "description": "https://rs.tdwg.org/dwc/terms/eventDate", @@ -149,6 +143,13 @@ "1963-03-08T14:07-0600" ] }, + "dwc:verbatimEventDate": { + "type": "string", + "description": "https://rs.tdwg.org/dwc/terms/verbatimEventDate", + "examples": [ + "Marzo 2002" + ] + }, "dwc:year": { "type": "integer", "description": "https://rs.tdwg.org/dwc/terms/year", @@ -183,9 +184,12 @@ ], "$comment": "Is this necessary for specimens" }, - "???:protocolDescription": { + "eco:protocolDescriptions": { "type": "string", - "comment": "Not sure what this field means" + "description": "https://rs.tdwg.org/eco/terms/protocolDescriptions", + "examples": [ + "Three conventional harp traps (3.2m ht x 2.2m w) were established in flight path zones for a period of 4 hrs at dawn and dusk for a total of 10 trap nights. Traps were visited on an hourly basis during each deployment period and the trap catch recorded for species, size, weight, sex, age and maternal status." + ] }, "dwc:sampleSizeValue": { "type": "string", @@ -234,13 +238,13 @@ "type": "string", "$comment": "Not part of DWC or the UM?" }, - "assertions": { + "???:Assertion": { "type": "array", "items": { - "$ref": "assertions.json" + "$ref": "./assertions.json" } }, - "location": { + "dcterms:Location": { "$ref": "./location.json" } } diff --git a/src/test/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirectorTest.java b/src/test/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirectorTest.java index 1fc3a78..875cc33 100644 --- a/src/test/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirectorTest.java +++ b/src/test/java/eu/dissco/core/translator/terms/BiocaseDigitalObjectDirectorTest.java @@ -116,9 +116,9 @@ void testConstructAbcdDigitalSpecimen(ObjectNode identifications, int totalIdent // Then assertThat(result).isNotNull(); - assertThat(result.getEntityRelationships()).asList().hasSize(4); - assertThat(result.getIdentifiers()).asList().hasSize(4); - assertThat(result.getCitations()).asList().hasSize(1); + assertThat(result.getEntityRelationship()).asList().hasSize(4); + assertThat(result.getIdentifier()).asList().hasSize(4); + assertThat(result.getCitation()).asList().hasSize(1); assertThat(result.getDwcIdentification()).asList().hasSize(totalIdentifications); } diff --git a/src/test/java/eu/dissco/core/translator/terms/DwcaDigitalObjectDirectorTest.java b/src/test/java/eu/dissco/core/translator/terms/DwcaDigitalObjectDirectorTest.java index 89f6659..ac7587c 100644 --- a/src/test/java/eu/dissco/core/translator/terms/DwcaDigitalObjectDirectorTest.java +++ b/src/test/java/eu/dissco/core/translator/terms/DwcaDigitalObjectDirectorTest.java @@ -61,9 +61,9 @@ void testConstructDwcaDigitalSpecimen() throws Exception { // Then assertThat(result).isNotNull(); - assertThat(result.getEntityRelationships()).asList().hasSize(3); - assertThat(result.getIdentifiers()).asList().hasSize(3); - assertThat(result.getCitations()).asList().hasSize(2); + assertThat(result.getEntityRelationship()).asList().hasSize(3); + assertThat(result.getIdentifier()).asList().hasSize(3); + assertThat(result.getCitation()).asList().hasSize(2); assertThat(result.getDwcIdentification()).asList().hasSize(2); } @@ -85,9 +85,9 @@ void testConstructDwcaDigitalSpecimenSingleIdentification() throws Exception { // Then assertThat(result).isNotNull(); - assertThat(result.getEntityRelationships()).asList().hasSize(3); - assertThat(result.getIdentifiers()).asList().hasSize(3); - assertThat(result.getCitations()).asList().hasSize(1); + assertThat(result.getEntityRelationship()).asList().hasSize(3); + assertThat(result.getIdentifier()).asList().hasSize(3); + assertThat(result.getCitation()).asList().hasSize(1); assertThat(result.getDwcIdentification()).asList().hasSize(1); assertThat(((eu.dissco.core.translator.schema.Identifications) result.getDwcIdentification() .get(0)).getDwcIdentificationVerificationStatus()).isTrue(); diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/RecordedByIdTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/RecordedByIdTest.java new file mode 100644 index 0000000..41a91eb --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/RecordedByIdTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class RecordedByIdTest { + + private static final String RECORDED_BY_ID_STRING = "https://www.wikidata.org/wiki/Q21338018"; + private final RecordedById recordedBy = new RecordedById(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:recordedByID", RECORDED_BY_ID_STRING); + + // When + var result = recordedBy.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(RECORDED_BY_ID_STRING); + } + + @Test + void testGetTerm() { + // When + var result = recordedBy.getTerm(); + + // Then + assertThat(result).isEqualTo(RecordedById.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/SpecimenNameTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/SpecimenNameTest.java index d7d3876..8b60856 100644 --- a/src/test/java/eu/dissco/core/translator/terms/specimen/SpecimenNameTest.java +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/SpecimenNameTest.java @@ -36,6 +36,38 @@ void testRetrieve() { assertThat(result).isEqualTo(SPECIMEN_NAME); } + + @Test + void testRetrieveVernacular() { + // Given + var ds = new eu.dissco.core.translator.schema.DigitalSpecimen() + .withDwcIdentification(List.of( + new eu.dissco.core.translator.schema.Identifications() + .withDwcIdentificationVerificationStatus(Boolean.TRUE) + .withTaxonIdentifications( + List.of(new TaxonIdentification().withDwcVernacularName(SPECIMEN_NAME))) + )); + + // When + var result = specimenName.calculate(ds); + + // Then + assertThat(result).isEqualTo(SPECIMEN_NAME); + } + + @Test + void testRetrieveNoName() { + // Given + var ds = new eu.dissco.core.translator.schema.DigitalSpecimen() + .withDwcIdentification(List.of()); + + // When + var result = specimenName.calculate(ds); + + // Then + assertThat(result).isNull(); + } + @Test void testGetTerm() { // When diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/VerbatimLabelTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/VerbatimLabelTest.java new file mode 100644 index 0000000..fdc1b5d --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/VerbatimLabelTest.java @@ -0,0 +1,51 @@ +package eu.dissco.core.translator.terms.specimen; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimLabelTest { + + private static final String VERBATIM_LABEL_STRING = "https://www.wikidata.org/wiki/Q21338018"; + private final VerbatimLabel verbatimLabel = new VerbatimLabel(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimLabel", VERBATIM_LABEL_STRING); + + // When + var result = verbatimLabel.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_LABEL_STRING); + } + + @Test + void testRetrieveFromABCD() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("abcd:specimenUnit/marks/mark/0/markText/value", VERBATIM_LABEL_STRING); + + // When + var result = verbatimLabel.retrieveFromABCD(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_LABEL_STRING); + } + + @Test + void testGetTerm() { + // When + var result = verbatimLabel.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimLabel.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedByIdTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedByIdTest.java new file mode 100644 index 0000000..5d816d7 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/identification/IdentifiedByIdTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.identification; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class IdentifiedByIdTest { + + private final IdentifiedById identifiedById = new IdentifiedById(); + + @Test + void testRetrieveFromDWCA() { + // Given + var identifiedByString = "https://orcid.org/0000-0002-5669-2769"; + var unit = MAPPER.createObjectNode(); + unit.put("dwc:identifiedById", identifiedByString); + + // When + var result = identifiedById.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(identifiedByString); + } + + @Test + void testGetTerm() { + // When + var result = identifiedById.getTerm(); + + // Then + assertThat(result).isEqualTo(IdentifiedById.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificNameIdTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificNameIdTest.java new file mode 100644 index 0000000..7077b99 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/ScientificNameIdTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.identification.taxonomy; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class ScientificNameIdTest { + + private final ScientificNameId scientificnameId = new ScientificNameId(); + + @Test + void testRetrieveFromDWCA() { + // Given + var scientificNameString = "urn:lsid:ipni.org:names:37829-1:1.3"; + var unit = MAPPER.createObjectNode(); + unit.put("dwc:scientificNameID", scientificNameString); + + // When + var result = scientificnameId.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(scientificNameString); + } + + @Test + void testGetTerm() { + // When + var result = scientificnameId.getTerm(); + + // Then + assertThat(result).isEqualTo(ScientificNameId.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/VerbatimTaxonRankTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/VerbatimTaxonRankTest.java new file mode 100644 index 0000000..4fc8290 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/identification/taxonomy/VerbatimTaxonRankTest.java @@ -0,0 +1,36 @@ +package eu.dissco.core.translator.terms.specimen.identification.taxonomy; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimTaxonRankTest { + + private final VerbatimTaxonRank verbatimTaxonRank = new VerbatimTaxonRank(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimTaxonRank", "Agamospecies"); + + // When + var result = verbatimTaxonRank.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo("Agamospecies"); + } + + @Test + void testGetTerm() { + // When + var result = verbatimTaxonRank.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimTaxonRank.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/LocationIdTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/LocationIdTest.java new file mode 100644 index 0000000..0fda8d4 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/LocationIdTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class LocationIdTest { + + private static final String LOCATION_ID = "https://opencontext.org/subjects/768A875F-E205-4D0B-DE55-BAB7598D0FD1"; + + private final LocationId locationId = new LocationId(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:locationID", LOCATION_ID); + + // When + var result = locationId.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(LOCATION_ID); + } + + @Test + void testGetTerm() { + // When + var result = locationId.getTerm(); + + // Then + assertThat(result).isEqualTo(LocationId.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimDepthTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimDepthTest.java new file mode 100644 index 0000000..c9ee3ac --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimDepthTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimDepthTest { + + private static final String DEPTH_STRING = "100-200 m"; + + private final VerbatimDepth verbatimDepth = new VerbatimDepth(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimDepth", DEPTH_STRING); + + // When + var result = verbatimDepth.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(DEPTH_STRING); + } + + @Test + void testGetTerm() { + // When + var result = verbatimDepth.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimDepth.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimElevationTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimElevationTest.java new file mode 100644 index 0000000..31069a3 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimElevationTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimElevationTest { + + private static final String ELEVATION_STRING = "100-200 m"; + + private final VerbatimElevation verbatimElevation = new VerbatimElevation(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimElevation", ELEVATION_STRING); + + // When + var result = verbatimElevation.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(ELEVATION_STRING); + } + + @Test + void testGetTerm() { + // When + var result = verbatimElevation.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimElevation.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimLocalityTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimLocalityTest.java new file mode 100644 index 0000000..695be57 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/VerbatimLocalityTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimLocalityTest { + + private static final String VERBATIM_LOCALITY_STRING = "25 km NNE Bariloche por R. Nac. 237"; + + private final VerbatimLocality verbatimLocality = new VerbatimLocality(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimLocality", VERBATIM_LOCALITY_STRING); + + // When + var result = verbatimLocality.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_LOCALITY_STRING); + } + + @Test + void testGetTerm() { + // When + var result = verbatimLocality.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimLocality.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinateSystemTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinateSystemTest.java new file mode 100644 index 0000000..60f463a --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinateSystemTest.java @@ -0,0 +1,53 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimCoordinateSystemTest { + + private static final String VERBATIM_COORDINATE_SYSTEM = "degrees decimal minutes"; + + private final VerbatimCoordinateSystem verbatimCoordinateSystem = new VerbatimCoordinateSystem(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimCoordinateSystem", VERBATIM_COORDINATE_SYSTEM); + + // When + var result = verbatimCoordinateSystem.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_COORDINATE_SYSTEM); + } + + @Test + void testRetrieveFromABCD() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put( + "abcd:gathering/siteCoordinateSets/siteCoordinates/0/coordinatesGrid/gridCellSystem", + VERBATIM_COORDINATE_SYSTEM); + + // When + var result = verbatimCoordinateSystem.retrieveFromABCD(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_COORDINATE_SYSTEM); + } + + @Test + void testGetTerm() { + // When + var result = verbatimCoordinateSystem.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimCoordinateSystem.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinatesTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinatesTest.java new file mode 100644 index 0000000..0f1cb9f --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimCoordinatesTest.java @@ -0,0 +1,53 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimCoordinatesTest { + + private static final String VERBATIM_COORDINATES = "41 05 54S 121 05 34W"; + + private final VerbatimCoordinates verbatimCoordinates = new VerbatimCoordinates(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimCoordinates", VERBATIM_COORDINATES); + + // When + var result = verbatimCoordinates.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_COORDINATES); + } + + @Test + void testRetrieveFromABCD() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put( + "abcd:gathering/siteCoordinateSets/siteCoordinates/0/coordinatesUTM/uTMText", + VERBATIM_COORDINATES); + + // When + var result = verbatimCoordinates.retrieveFromABCD(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_COORDINATES); + } + + @Test + void testGetTerm() { + // When + var result = verbatimCoordinates.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimCoordinates.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLatitudeTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLatitudeTest.java new file mode 100644 index 0000000..7c41264 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLatitudeTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimLatitudeTest { + + private static final String VERBATIM_LATITUDE = "41 05 54.03S"; + + private final VerbatimLatitude verbatimLatitude = new VerbatimLatitude(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimLatitude", VERBATIM_LATITUDE); + + // When + var result = verbatimLatitude.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_LATITUDE); + } + + @Test + void testGetTerm() { + // When + var result = verbatimLatitude.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimLatitude.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLongitudeTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLongitudeTest.java new file mode 100644 index 0000000..7ef3179 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimLongitudeTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimLongitudeTest { + + private static final String VERBATIM_LONGITUDE = "121d 10' 34\" W"; + + private final VerbatimLongitude verbatimLongitude = new VerbatimLongitude(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimLongitude", VERBATIM_LONGITUDE); + + // When + var result = verbatimLongitude.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_LONGITUDE); + } + + @Test + void testGetTerm() { + // When + var result = verbatimLongitude.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimLongitude.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimSRSTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimSRSTest.java new file mode 100644 index 0000000..ad1e1bc --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/location/georeference/VerbatimSRSTest.java @@ -0,0 +1,38 @@ +package eu.dissco.core.translator.terms.specimen.location.georeference; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimSRSTest { + + private static final String VERBATIM_SRS = "NAD27"; + + private final VerbatimSRS verbatimSRS = new VerbatimSRS(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimSRS", VERBATIM_SRS); + + // When + var result = verbatimSRS.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_SRS); + } + + @Test + void testGetTerm() { + // When + var result = verbatimSRS.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimSRS.TERM); + } +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/DayTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/DayTest.java new file mode 100644 index 0000000..d186d97 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/DayTest.java @@ -0,0 +1,39 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class DayTest { + + private static final String DAY_STRING = "12"; + + private final Day day = new Day(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:day", DAY_STRING); + + // When + var result = day.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(DAY_STRING); + } + + @Test + void testGetTerm() { + // When + var result = day.getTerm(); + + // Then + assertThat(result).isEqualTo(Day.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumberTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumberTest.java index 7b0082c..caccb7e 100644 --- a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumberTest.java +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/FieldNumberTest.java @@ -18,7 +18,7 @@ class FieldNumberTest { void testRetrieveFromDWCA() { // Given var unit = MAPPER.createObjectNode(); - unit.put("dwc:recordNumber", NUMBER); + unit.put("dwc:fieldNumber", NUMBER); // When var result = fieldNumber.retrieveFromDWCA(unit); @@ -31,7 +31,7 @@ void testRetrieveFromDWCA() { void testRetrieveFromABCD() { // Given var unit = MAPPER.createObjectNode(); - unit.put("abcd:collectorsFieldNumber", NUMBER); + unit.put("abcd:gathering/code", NUMBER); // When var result = fieldNumber.retrieveFromABCD(unit); diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/MonthTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/MonthTest.java new file mode 100644 index 0000000..21f76e1 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/MonthTest.java @@ -0,0 +1,39 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class MonthTest { + + private static final String MONTH_STRING = "3"; + + private final Month month = new Month(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:month", MONTH_STRING); + + // When + var result = month.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(MONTH_STRING); + } + + @Test + void testGetTerm() { + // When + var result = month.getTerm(); + + // Then + assertThat(result).isEqualTo(Month.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/RecordNumberTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/RecordNumberTest.java new file mode 100644 index 0000000..fa8e656 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/RecordNumberTest.java @@ -0,0 +1,52 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class RecordNumberTest { + + private static final String RECORD_NUMBER_STRING = "OPP 7101"; + + private final RecordNumber recordNumber = new RecordNumber(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:recordNumber", RECORD_NUMBER_STRING); + + // When + var result = recordNumber.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(RECORD_NUMBER_STRING); + } + + @Test + void testRetrieveFromABCD() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("abcd:collectorsFieldNumber", RECORD_NUMBER_STRING); + + // When + var result = recordNumber.retrieveFromABCD(unit); + + // Then + assertThat(result).isEqualTo(RECORD_NUMBER_STRING); + } + + @Test + void testGetTerm() { + // When + var result = recordNumber.getTerm(); + + // Then + assertThat(result).isEqualTo(RecordNumber.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/VerbatimEventDateTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/VerbatimEventDateTest.java new file mode 100644 index 0000000..c61efdd --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/VerbatimEventDateTest.java @@ -0,0 +1,52 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class VerbatimEventDateTest { + + private static final String VERBATIM_EVENT_DATE_STRING = "spring 1910"; + + private final VerbatimEventDate verbatimEventDate = new VerbatimEventDate(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:verbatimEventDate", VERBATIM_EVENT_DATE_STRING); + + // When + var result = verbatimEventDate.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_EVENT_DATE_STRING); + } + + @Test + void testRetrieveFromABCD() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("abcd:gathering/dateTime/dateText", VERBATIM_EVENT_DATE_STRING); + + // When + var result = verbatimEventDate.retrieveFromABCD(unit); + + // Then + assertThat(result).isEqualTo(VERBATIM_EVENT_DATE_STRING); + } + + @Test + void testGetTerm() { + // When + var result = verbatimEventDate.getTerm(); + + // Then + assertThat(result).isEqualTo(VerbatimEventDate.TERM); + } + +} diff --git a/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/YearTest.java b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/YearTest.java new file mode 100644 index 0000000..2f42b48 --- /dev/null +++ b/src/test/java/eu/dissco/core/translator/terms/specimen/occurence/YearTest.java @@ -0,0 +1,39 @@ +package eu.dissco.core.translator.terms.specimen.occurence; + +import static eu.dissco.core.translator.TestUtils.MAPPER; +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class YearTest { + + private static final String YEAR_STRING = "2024"; + + private final Year year = new Year(); + + @Test + void testRetrieveFromDWCA() { + // Given + var unit = MAPPER.createObjectNode(); + unit.put("dwc:year", YEAR_STRING); + + // When + var result = year.retrieveFromDWCA(unit); + + // Then + assertThat(result).isEqualTo(YEAR_STRING); + } + + @Test + void testGetTerm() { + // When + var result = year.getTerm(); + + // Then + assertThat(result).isEqualTo(Year.TERM); + } + +}