use of org.eol.globi.domain.Specimen in project eol-globi-data by jhpoelen.
the class StudyImporterForGoMexSI2 method createSpecimen.
private Specimen createSpecimen(Study study, Map<String, String> properties) throws StudyImporterException {
Specimen specimen = nodeFactory.createSpecimen(study, new TaxonImpl(properties.get(PropertyAndValueDictionary.NAME), null));
specimen.setLengthInMm(doubleValueOrNull(properties, SpecimenConstant.LENGTH_IN_MM));
specimen.setFrequencyOfOccurrence(doubleValueOrNull(properties, SpecimenConstant.FREQUENCY_OF_OCCURRENCE));
setSpecimenProperty(specimen, SpecimenConstant.FREQUENCY_OF_OCCURRENCE_PERCENT, properties);
specimen.setTotalCount(integerValueOrNull(properties, SpecimenConstant.TOTAL_COUNT));
setSpecimenProperty(specimen, SpecimenConstant.TOTAL_COUNT_PERCENT, properties);
specimen.setTotalVolumeInMl(doubleValueOrNull(properties, SpecimenConstant.TOTAL_VOLUME_IN_ML));
setSpecimenProperty(specimen, SpecimenConstant.TOTAL_VOLUME_PERCENT, properties);
addLifeStage(properties, specimen);
addPhysiologicalState(properties, specimen);
addBodyPart(properties, specimen);
// add all original GoMexSI properties for completeness
for (Map.Entry<String, String> entry : properties.entrySet()) {
if (entry.getKey().startsWith(GOMEXSI_NAMESPACE)) {
specimen.setProperty(entry.getKey(), entry.getValue());
}
}
return specimen;
}
use of org.eol.globi.domain.Specimen in project eol-globi-data by jhpoelen.
the class StudyImporterForINaturalist method createAssociation.
private Specimen createAssociation(long observationId, String interactionDataType, InteractType interactType, JsonNode observation, Taxon targetTaxon, Taxon sourceTaxonName, Study study, Date observationDate) throws StudyImporterException, NodeFactoryException {
Specimen sourceSpecimen = getSourceSpecimen(observationId, interactionDataType, sourceTaxonName, study);
setBasisOfRecord(sourceSpecimen);
Specimen targetSpecimen = nodeFactory.createSpecimen(study, targetTaxon);
setBasisOfRecord(targetSpecimen);
sourceSpecimen.interactsWith(targetSpecimen, interactType);
setCollectionDate(sourceSpecimen, targetSpecimen, observationDate);
setCollectionDate(sourceSpecimen, sourceSpecimen, observationDate);
Location location = parseLocation(observation);
sourceSpecimen.caughtIn(location);
targetSpecimen.caughtIn(location);
return sourceSpecimen;
}
use of org.eol.globi.domain.Specimen in project eol-globi-data by jhpoelen.
the class ExporterOccurrenceAggregatesTest method collectSpecimen.
private Specimen collectSpecimen(Study myStudy, String scientificName, String externalId) throws NodeFactoryException {
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(scientificName, externalId));
specimen.setStomachVolumeInMilliLiter(666.0);
specimen.setLifeStage(new TermImpl("GLOBI:JUVENILE", "JUVENILE"));
specimen.setPhysiologicalState(new TermImpl("GLOBI:DIGESTATE", "DIGESTATE"));
specimen.setBodyPart(new TermImpl("GLOBI:BONE", "BONE"));
nodeFactory.setUnixEpochProperty(specimen, new Date(ExportTestUtil.utcTestTime()));
return specimen;
}
use of org.eol.globi.domain.Specimen in project eol-globi-data by jhpoelen.
the class ExporterOccurrenceAggregatesTest method eatPrey.
private Specimen eatPrey(Specimen specimen, String scientificName, String externalId, Study study) throws NodeFactoryException {
Specimen otherSpecimen = nodeFactory.createSpecimen(study, new TaxonImpl(scientificName, externalId));
otherSpecimen.setVolumeInMilliLiter(124.0);
specimen.ate(otherSpecimen);
return otherSpecimen;
}
use of org.eol.globi.domain.Specimen in project eol-globi-data by jhpoelen.
the class ExporterOccurrencesTest method dontExportToCSVSpecimenEmptyStomach.
@Test
public void dontExportToCSVSpecimenEmptyStomach() throws NodeFactoryException, IOException {
Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:123"));
specimen.setBasisOfRecord(new TermImpl("test:123", "aBasisOfRecord"));
resolveNames();
StringWriter row = new StringWriter();
exportOccurrences().exportStudy(myStudy, row, true);
String expected = "";
expected += getExpectedHeader();
expected += "\nglobi:occur:2\tEOL:123\t\t\t\t\t\t\t\t\t\t\t\t\taBasisOfRecord\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
assertThat(row.getBuffer().toString(), equalTo(expected));
}
Aggregations