Skip to content

Commit

Permalink
Merge pull request #44 from DiSSCo/feature/additional-dwc-terms
Browse files Browse the repository at this point in the history
Add additional dwc properties
  • Loading branch information
samleeflang authored Oct 23, 2023
2 parents b9c83c6 + 4259207 commit a9546ba
Show file tree
Hide file tree
Showing 37 changed files with 1,083 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,35 @@
import eu.dissco.core.translator.terms.specimen.identification.IdentifiedBy;
import eu.dissco.core.translator.terms.specimen.identification.TypeStatus;
import eu.dissco.core.translator.terms.specimen.identification.VerbatimIdentification;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.AcceptedNameUsage;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.AcceptedNameUsageId;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Class;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.CultivarEpithet;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Family;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.GenericName;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Genus;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.InfraGenericEpithet;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.InfraspecificEpithet;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Kingdom;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.NameAccordingTo;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.NamePublishedInYear;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.NomenclaturalCode;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.NomenclaturalStatus;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Order;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.OriginalNameUsage;
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.SpecificEpithet;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subtribe;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subfamily;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subgenus;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Superfamily;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.TaxonId;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.TaxonRank;
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.VernacularName;
import eu.dissco.core.translator.terms.specimen.location.Continent;
import eu.dissco.core.translator.terms.specimen.location.Country;
Expand Down Expand Up @@ -116,7 +127,8 @@
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.occurence.Behavior;
import eu.dissco.core.translator.terms.specimen.occurence.DataGeneralizations;
import eu.dissco.core.translator.terms.specimen.occurence.Caste;
import eu.dissco.core.translator.terms.specimen.DataGeneralizations;
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;
Expand All @@ -125,7 +137,7 @@
import eu.dissco.core.translator.terms.specimen.occurence.FieldNumber;
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.InformationWithheld;
import eu.dissco.core.translator.terms.specimen.InformationWithheld;
import eu.dissco.core.translator.terms.specimen.occurence.LifeStage;
import eu.dissco.core.translator.terms.specimen.occurence.OccurrenceAssertions;
import eu.dissco.core.translator.terms.specimen.occurence.OccurrenceRemarks;
Expand All @@ -138,6 +150,7 @@
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.Vitality;
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;
Expand Down Expand Up @@ -247,7 +260,9 @@ private DigitalSpecimen assembleDigitalSpecimenTerms(JsonNode data, boolean 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));
.withDwcDisposition(termMapper.retrieveTerm(new Disposition(), data, dwc))
.withDwcInformationWithheld(termMapper.retrieveTerm(new InformationWithheld(), data, dwc))
.withDwcDataGeneralizations(termMapper.retrieveTerm(new DataGeneralizations(), data, dwc));
}

private List<EntityRelationships> assembleDigitalSpecimenEntityRelationships(
Expand Down Expand Up @@ -313,7 +328,18 @@ protected Identifications createIdentification(JsonNode data, boolean dwc) {
.withDwcTaxonomicStatus(termMapper.retrieveTerm(new TaxonomicStatus(), data, dwc))
.withDwcNomenclaturalCode(termMapper.retrieveTerm(new NomenclaturalCode(), data, dwc))
.withDwcTaxonRemarks(termMapper.retrieveTerm(new TaxonRemarks(), data, dwc))
.withDwcVernacularName(termMapper.retrieveTerm(new VernacularName(), data, dwc));
.withDwcVernacularName(termMapper.retrieveTerm(new VernacularName(), data, dwc))
.withDwcAcceptedNameUsage(termMapper.retrieveTerm(new AcceptedNameUsage(), data, dwc))
.withDwcAcceptedNameUsageID(termMapper.retrieveTerm(new AcceptedNameUsageId(), data, dwc))
.withDwcCultivarEpithet(termMapper.retrieveTerm(new CultivarEpithet(), data, dwc))
.withDwcGenericName(termMapper.retrieveTerm(new GenericName(), data, dwc))
.withDwcInfragenericEpithet(termMapper.retrieveTerm(new InfraGenericEpithet(), data, dwc))
.withDwcInfraspecificEpithet(termMapper.retrieveTerm(new InfraspecificEpithet(), data, dwc))
.withDwcNomenclaturalStatus(termMapper.retrieveTerm(new NomenclaturalStatus(), data, dwc))
.withDwcOriginalNameUsage(termMapper.retrieveTerm(new OriginalNameUsage(), data, dwc))
.withDwcSubtribe(termMapper.retrieveTerm(new Subtribe(), data, dwc))
.withDwcSuperfamily(termMapper.retrieveTerm(new Superfamily(), data, dwc))
.withDwcTribe(termMapper.retrieveTerm(new Tribe(), data, dwc));
return new Identifications()
.withDwcIdentificationID(termMapper.retrieveTerm(new IdentificationId(), data, dwc))
.withDwcIdentificationVerificationStatus(parseToBoolean(new IdentificationVerificationStatus(), data, dwc))
Expand Down Expand Up @@ -429,10 +455,10 @@ private List<Occurrences> assembleOccurrenceTerms(JsonNode data,
.withDwcOccurrenceStatus(
retrieveEnum(new OccurrenceStatus(), data, dwc, DwcOccurrenceStatus.class))
.withDwcOccurrenceRemarks(termMapper.retrieveTerm(new OccurrenceRemarks(), data, dwc))
.withDwcInformationWithheld(termMapper.retrieveTerm(new InformationWithheld(), data, dwc))
.withDwcDataGeneralizations(termMapper.retrieveTerm(new DataGeneralizations(), data, dwc))
.withDwcSampleSizeUnit(termMapper.retrieveTerm(new SampleSizeUnit(), data, dwc))
.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);
return List.of(occurrence);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package eu.dissco.core.translator.terms.specimen.occurence;
package eu.dissco.core.translator.terms.specimen;

import com.fasterxml.jackson.databind.JsonNode;
import eu.dissco.core.translator.terms.Term;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package eu.dissco.core.translator.terms.specimen.occurence;
package eu.dissco.core.translator.terms.specimen;

import com.fasterxml.jackson.databind.JsonNode;
import eu.dissco.core.translator.terms.Term;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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 IdentificationQualifier extends Term {

public static final String TERM = DWC_PREFIX + "identificationQualifier";

private final List<String> dwcaTerms = List.of(TERM);

private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/identificationQualifier/nameAddendum");

@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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 AcceptedNameUsage extends Term {
public static final String TERM = DWC_PREFIX + "acceptedNameUsage";

private final List<String> dwcaTerms = List.of(TERM);

@Override
public String retrieveFromDWCA(JsonNode unit) {
return super.searchJsonForTerm(unit, dwcaTerms);
}

@Override
public String getTerm() {
return TERM;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 AcceptedNameUsageId extends Term {
public static final String TERM = DWC_PREFIX + "acceptedNameUsageId";

private final List<String> dwcaTerms = List.of(TERM);

@Override
public String retrieveFromDWCA(JsonNode unit) {
return super.searchJsonForTerm(unit, dwcaTerms);
}

@Override
public String getTerm() {
return TERM;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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 CultivarEpithet extends Term {
public static final String TERM = DWC_PREFIX + "cultivarEpithet";

private final List<String> dwcaTerms = List.of(TERM);

private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/cultivarName",
"result/taxonIdentified/scientificName/nameAtomised/botanical/cultivarGroupName");

@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;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 GenericName extends Term {
public static final String TERM = DWC_PREFIX + "genericName";

private final List<String> dwcaTerms = List.of(TERM);

@Override
public String retrieveFromDWCA(JsonNode unit) {
return super.searchJsonForTerm(unit, dwcaTerms);
}

@Override
public String getTerm() {
return TERM;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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 InfraGenericEpithet extends Term {

public static final String TERM = DWC_PREFIX + "infragenericEpithet";

private final List<String> dwcaTerms = List.of(TERM);
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/firstEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/subgenus",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/subgenus");

@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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ public class InfraspecificEpithet extends AbstractTaxonomy {

private final List<String> dwcaTerms = List.of(TERM);
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/infraspecificEpithet");
"result/taxonIdentified/scientificName/nameAtomised/botanical/infraspecificEpithet",
"result/taxonIdentified/scientificName/nameAtomised/botanical/secondEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/subspeciesEpithet",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/subspeciesEpithet");

@Override
public String retrieveFromDWCA(JsonNode unit) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 NomenclaturalStatus extends Term {

public static final String TERM = DWC_PREFIX + "nomenclaturalStatus";

private final List<String> dwcaTerms = List.of(TERM);

@Override
public String retrieveFromDWCA(JsonNode unit) {
return super.searchJsonForTerm(unit, dwcaTerms);
}

@Override
public String getTerm() {
return TERM;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 OriginalNameUsage extends Term {
public static final String TERM = DWC_PREFIX + "originalNameUsage";

private final List<String> dwcaTerms = List.of(TERM);

@Override
public String retrieveFromDWCA(JsonNode unit) {
return super.searchJsonForTerm(unit, dwcaTerms);
}

@Override
public String getTerm() {
return TERM;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class SpecificEpithet extends AbstractTaxonomy {
public static final String TERM = DWC_PREFIX + "specificEpithet";
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/firstEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/speciesEpithet");
"result/taxonIdentified/scientificName/nameAtomised/zoological/speciesEpithet",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/speciesEpithet");
private final List<String> dwcaTerms = List.of(TERM);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class Subgenus extends AbstractTaxonomy {

private final List<String> dwcaTerms = List.of(TERM);
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/zoological/subgenus");
"result/taxonIdentified/scientificName/nameAtomised/zoological/subgenus",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/subgenus");

@Override
public String retrieveFromDWCA(JsonNode unit) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package eu.dissco.core.translator.terms.specimen.identification.taxonomy;

import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;

public class Subtribe extends AbstractTaxonomy {

public static final String TERM = DWC_PREFIX + "subtribe";

private final List<String> dwcaTerms = List.of(TERM);
private final List<String> abcdSplitTerms = List.of("subtribus", "subtribe");

@Override
public String retrieveFromDWCA(JsonNode unit) {
return super.searchJsonForTerm(unit, dwcaTerms);
}

@Override
public String retrieveFromABCD(JsonNode unit) {
return super.searchABCDSplitTerms(unit, abcdSplitTerms);
}
@Override
public String getTerm() {
return TERM;
}
}
Loading

0 comments on commit a9546ba

Please sign in to comment.