Search in sources :

Example 26 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl 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 27 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl 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 28 with TaxonImpl

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

the class ExporterMeasurementOrFactTest method noMatchNames.

@Test
public void noMatchNames() throws IOException, NodeFactoryException, ParseException {
    Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
    nodeFactory.createSpecimen(myStudy, new TaxonImpl(PropertyAndValueDictionary.NO_NAME, "externalId1"));
    nodeFactory.createSpecimen(myStudy, new TaxonImpl("Some namus", PropertyAndValueDictionary.NO_MATCH));
    Study myStudy1 = nodeFactory.findStudy("myStudy");
    StringWriter row = new StringWriter();
    new ExporterMeasurementOrFact().exportStudy(myStudy1, row, false);
    assertThat(row.getBuffer().toString(), equalTo(""));
}
Also used : Study(org.eol.globi.domain.Study) StringWriter(java.io.StringWriter) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) Test(org.junit.Test)

Example 29 with TaxonImpl

use of org.eol.globi.domain.TaxonImpl 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 TaxonImpl

use of org.eol.globi.domain.TaxonImpl 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

TaxonImpl (org.eol.globi.domain.TaxonImpl)123 Specimen (org.eol.globi.domain.Specimen)59 Test (org.junit.Test)54 Taxon (org.eol.globi.domain.Taxon)42 StudyImpl (org.eol.globi.domain.StudyImpl)34 Study (org.eol.globi.domain.Study)32 Location (org.eol.globi.domain.Location)16 LocationImpl (org.eol.globi.domain.LocationImpl)15 TaxonNode (org.eol.globi.domain.TaxonNode)13 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)12 IOException (java.io.IOException)11 TermImpl (org.eol.globi.domain.TermImpl)11 StringWriter (java.io.StringWriter)9 ArrayList (java.util.ArrayList)7 Date (java.util.Date)7 HashMap (java.util.HashMap)7 NonResolvingTaxonIndex (org.eol.globi.taxon.NonResolvingTaxonIndex)7 Map (java.util.Map)5 Node (org.neo4j.graphdb.Node)5 File (java.io.File)4