Search in sources :

Example 16 with TermImpl

use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.

the class InteractionListenerImpl method setBodyPartIfAvailable.

private void setBodyPartIfAvailable(Map<String, String> link, Specimen specimen, String name, String id) {
    final String bodyPartName = link.get(name);
    final String bodyPartId = link.get(id);
    if (StringUtils.isNotBlank(bodyPartName) || StringUtils.isNotBlank(bodyPartId)) {
        specimen.setBodyPart(new TermImpl(bodyPartId, bodyPartName));
    }
}
Also used : TermImpl(org.eol.globi.domain.TermImpl)

Example 17 with TermImpl

use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.

the class ExporterAssociationsTest method createTestData.

private void createTestData(Double length) throws NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.getOrCreateStudy(new StudyImpl("myStudy", "data\tsource description", null, ExternalIdUtil.toCitation("contributor", "description", "pubYear")));
    Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:123"));
    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()));
    eats(specimen, "Canis lupus", "EOL:456", myStudy);
    eats(specimen, "Felis whateverus", PropertyAndValueDictionary.NO_MATCH, myStudy);
    if (null != length) {
        specimen.setLengthInMm(length);
    }
    Location location = nodeFactory.getOrCreateLocation(new LocationImpl(13.0, 45.9, -60.0, null));
    specimen.caughtIn(location);
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) LocationImpl(org.eol.globi.domain.LocationImpl) Date(java.util.Date) TermImpl(org.eol.globi.domain.TermImpl) Location(org.eol.globi.domain.Location)

Example 18 with TermImpl

use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.

the class ExportFlatInteractionsTest method collectSpecimen.

private Specimen collectSpecimen(Study myStudy, String scientificName, String externalId) throws NodeFactoryException {
    final TaxonImpl taxon = new TaxonImpl(scientificName, externalId);
    taxon.setPath("pathElem1 | pathElem 2");
    Specimen specimen = factory.createSpecimen(myStudy, taxon);
    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"));
    factory.setUnixEpochProperty(specimen, new Date(ExportTestUtil.utcTestTime()));
    return specimen;
}
Also used : Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl) Date(java.util.Date) TermImpl(org.eol.globi.domain.TermImpl)

Example 19 with TermImpl

use of org.eol.globi.domain.TermImpl in project eol-globi-data by jhpoelen.

the class ExporterMeasurementOrFactTest method createTestData.

private void createTestData(Double length, String targetTaxonName, String sourceTaxonName) throws NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
    Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(sourceTaxonName, "externalId1"));
    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());
    Specimen otherSpecimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(targetTaxonName, "externalId2"));
    otherSpecimen.setVolumeInMilliLiter(124.0);
    specimen.ate(otherSpecimen);
    otherSpecimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl(targetTaxonName, "externalId2"));
    otherSpecimen.setVolumeInMilliLiter(18.0);
    specimen.ate(otherSpecimen);
    if (null != length) {
        specimen.setLengthInMm(length);
    }
    Location location = nodeFactory.getOrCreateLocation(new LocationImpl(22.0, 129.9, -60.0, null));
    specimen.caughtIn(location);
    resolveNames();
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) LocationImpl(org.eol.globi.domain.LocationImpl) TermImpl(org.eol.globi.domain.TermImpl) Location(org.eol.globi.domain.Location)

Aggregations

TermImpl (org.eol.globi.domain.TermImpl)19 TaxonImpl (org.eol.globi.domain.TaxonImpl)11 Specimen (org.eol.globi.domain.Specimen)9 Study (org.eol.globi.domain.Study)7 StudyImpl (org.eol.globi.domain.StudyImpl)7 Location (org.eol.globi.domain.Location)6 LocationImpl (org.eol.globi.domain.LocationImpl)6 Date (java.util.Date)5 HashMap (java.util.HashMap)3 Taxon (org.eol.globi.domain.Taxon)3 Term (org.eol.globi.domain.Term)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 LatLng (org.eol.globi.geo.LatLng)2 CSVParse (com.Ostermiller.util.CSVParse)1 Database (com.healthmarketscience.jackcess.Database)1 DatabaseBuilder (com.healthmarketscience.jackcess.DatabaseBuilder)1 Table (com.healthmarketscience.jackcess.Table)1 Record (com.univocity.parsers.common.record.Record)1 TsvParser (com.univocity.parsers.tsv.TsvParser)1