Search in sources :

Example 26 with Specimen

use of org.eol.globi.domain.Specimen 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);
}
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)

Example 27 with Specimen

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

the class ExporterOccurrencesTest method eatWolf.

private Specimen eatWolf(Specimen specimen, Study study) throws NodeFactoryException {
    Specimen otherSpecimen = nodeFactory.createSpecimen(study, new TaxonImpl("Canis lupus", "EOL:328607"));
    otherSpecimen.setVolumeInMilliLiter(124.0);
    nodeFactory.setUnixEpochProperty(otherSpecimen, ExportTestUtil.utcTestDate());
    specimen.ate(otherSpecimen);
    return otherSpecimen;
}
Also used : Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl)

Example 28 with Specimen

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

the class ExporterAssociationsTest method eats.

private void eats(Specimen specimen, String scientificName, String taxonExternalId, Study study) throws NodeFactoryException {
    Specimen otherSpecimen = nodeFactory.createSpecimen(study, new TaxonImpl(scientificName, taxonExternalId));
    otherSpecimen.setVolumeInMilliLiter(124.0);
    specimen.ate(otherSpecimen);
    specimen.ate(otherSpecimen);
}
Also used : Specimen(org.eol.globi.domain.Specimen) TaxonImpl(org.eol.globi.domain.TaxonImpl)

Example 29 with Specimen

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

the class GraphExporterImplTest method exportAll.

@Test
public void exportAll() throws StudyImporterException, IOException {
    File tmpDir = FileUtils.getTempDirectory();
    File tmpDirPath = new File(tmpDir, "test" + new Random().nextLong());
    FileUtils.forceMkdir(tmpDirPath);
    assertThat(tmpDirPath.list().length, is(0));
    Study study = nodeFactory.getOrCreateStudy(new StudyImpl("a study", "a source", "doi:12345L", null));
    Specimen human = nodeFactory.createSpecimen(study, new TaxonImpl("Homo sapiens", "NCBI:123"));
    human.ate(nodeFactory.createSpecimen(study, new TaxonImpl("Canis familiaris", "BLA:444")));
    resolveNames();
    try {
        new GraphExporterImpl().export(getGraphDb(), tmpDirPath.getAbsolutePath() + "/");
        assertThat(tmpDirPath.list().length, is(6));
    } finally {
        FileUtils.deleteQuietly(tmpDirPath);
    }
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) Random(java.util.Random) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) File(java.io.File) Test(org.junit.Test)

Example 30 with Specimen

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

the class ExporterSiteMapForNamesTest method writeSiteMapWithNames.

@Test
public void writeSiteMapWithNames() throws StudyImporterException, IOException {
    taxonIndex = new NonResolvingTaxonIndex(getGraphDb());
    Study study = nodeFactory.getOrCreateStudy(new StudyImpl("title", "source", null, "citation 123"));
    TaxonImpl homoSapiens = new TaxonImpl("Homo sapiens", "homoSapiensId");
    homoSapiens.setPath("one two three");
    final Specimen human = nodeFactory.createSpecimen(study, homoSapiens);
    TaxonImpl dogTaxon = new TaxonImpl("Canis familiaris", null);
    final Specimen dog = nodeFactory.createSpecimen(study, dogTaxon);
    human.ate(dog);
    resolveNames();
    final File baseDirNames = createBaseDir("target/sitemap/names");
    final GraphExporter siteMapForNames = new ExporterSiteMapForNames();
    siteMapForNames.export(getGraphDb(), baseDirNames.getAbsolutePath());
    assertSiteMap(baseDirNames, "http://www.globalbioticinteractions.org/?interactionType=interactsWith&sourceTaxon=Homo%20sapiens", "https://depot.globalbioticinteractions.org/snapshot/target/data/sitemap/names/sitemap.xml.gz");
}
Also used : Study(org.eol.globi.domain.Study) Specimen(org.eol.globi.domain.Specimen) NonResolvingTaxonIndex(org.eol.globi.taxon.NonResolvingTaxonIndex) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) File(java.io.File) Test(org.junit.Test)

Aggregations

Specimen (org.eol.globi.domain.Specimen)91 TaxonImpl (org.eol.globi.domain.TaxonImpl)59 Study (org.eol.globi.domain.Study)38 StudyImpl (org.eol.globi.domain.StudyImpl)34 Location (org.eol.globi.domain.Location)31 LocationImpl (org.eol.globi.domain.LocationImpl)22 Test (org.junit.Test)17 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)15 IOException (java.io.IOException)15 Date (java.util.Date)14 Relationship (org.neo4j.graphdb.Relationship)12 HashMap (java.util.HashMap)11 Taxon (org.eol.globi.domain.Taxon)11 SpecimenNode (org.eol.globi.domain.SpecimenNode)9 TermImpl (org.eol.globi.domain.TermImpl)9 ArrayList (java.util.ArrayList)8 InteractType (org.eol.globi.domain.InteractType)7 LatLng (org.eol.globi.geo.LatLng)6 Map (java.util.Map)5 TaxonNode (org.eol.globi.domain.TaxonNode)5