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);
}
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;
}
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);
}
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);
}
}
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");
}
Aggregations