use of org.eol.globi.domain.TaxonImpl 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.TaxonImpl 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.TaxonImpl 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.TaxonImpl 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));
}
use of org.eol.globi.domain.TaxonImpl in project eol-globi-data by jhpoelen.
the class ExporterOccurrencesTest method createTestData.
private void createTestData(Double length) throws NodeFactoryException, ParseException {
Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:327955"));
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, ExportTestUtil.utcTestDate());
if (null != length) {
specimen.setLengthInMm(length);
}
Location location = nodeFactory.getOrCreateLocation(new LocationImpl(12.0, -1.0, -60.0, null));
specimen.caughtIn(location);
Specimen wolf1 = eatWolf(specimen, myStudy);
wolf1.caughtIn(location);
Specimen wolf2 = eatWolf(specimen, myStudy);
wolf2.caughtIn(location);
}
Aggregations