Search in sources :

Example 76 with StudyImpl

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

the class ExporterOccurrenceAggregatesTest method exportNoMatchName.

@Test
public void exportNoMatchName() throws NodeFactoryException, IOException {
    Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
    nodeFactory.createSpecimen(myStudy, new TaxonImpl(PropertyAndValueDictionary.NO_MATCH, "some externalid"));
    resolveNames();
    StringWriter row = new StringWriter();
    new ExporterOccurrenceAggregates().exportDistinct(myStudy, row);
    assertThat(row.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 77 with StudyImpl

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

Example 78 with StudyImpl

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

the class ExportNCBIResourceFileTest method init.

@Before
public void init() throws NodeFactoryException {
    taxonIndex = ExportTestUtil.taxonIndexWithEnricher(null, getGraphDb());
    nodeFactory.getOrCreateStudy(new StudyImpl("title", "source", null, "citation"));
    Taxon taxon = new TaxonImpl("Homo sapiens", TaxonomyProvider.NCBI.getIdPrefix() + "9606");
    taxon.setPath("some path");
    taxonIndex.getOrCreateTaxon(taxon);
    taxon = new TaxonImpl("Homo sapiens", "foo:123");
    taxon.setPath("some path");
    taxonIndex.getOrCreateTaxon(taxon);
    taxon = new TaxonImpl("Enhydra lutris", "NCBI:34882");
    taxon.setPath("some path");
    taxonIndex.getOrCreateTaxon(taxon);
}
Also used : Taxon(org.eol.globi.domain.Taxon) TaxonImpl(org.eol.globi.domain.TaxonImpl) StudyImpl(org.eol.globi.domain.StudyImpl) Before(org.junit.Before)

Example 79 with StudyImpl

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

the class LinkerDOITest method createStudyDOIlookupCitationWithURL.

@Test
public void createStudyDOIlookupCitationWithURL() throws NodeFactoryException {
    StudyNode study = getNodeFactory().getOrCreateStudy(new StudyImpl("title", "some source", null, "http://bla"));
    new LinkerDOI(getGraphDb()).linkStudy(new DOIResolverThatFails(), study);
    assertThat(study.getSource(), is("some source"));
    assertThat(study.getCitation(), is("http://bla"));
    assertThat(study.getTitle(), is("title"));
}
Also used : StudyImpl(org.eol.globi.domain.StudyImpl) StudyNode(org.eol.globi.domain.StudyNode) Test(org.junit.Test)

Example 80 with StudyImpl

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

the class LinkerDOITest method createStudyDOIlookupCitationEnabled.

@Test
public void createStudyDOIlookupCitationEnabled() throws NodeFactoryException {
    StudyImpl title = new StudyImpl("title", "some source", null, "some citation");
    DatasetImpl originatingDataset = new DatasetImpl("some/namespace", URI.create("some:uri"));
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put(DatasetConstant.SHOULD_RESOLVE_REFERENCES, true);
    originatingDataset.setConfig(objectNode);
    title.setOriginatingDataset(originatingDataset);
    StudyNode study = getNodeFactory().getOrCreateStudy(title);
    new LinkerDOI(getGraphDb()).linkStudy(new TestDOIResolver(), study);
    assertThat(study.getSource(), is("some source"));
    assertThat(study.getDOI(), is("doi:some citation"));
    assertThat(study.getCitation(), is("some citation"));
    assertThat(study.getTitle(), is("title"));
}
Also used : ObjectNode(org.codehaus.jackson.node.ObjectNode) StudyImpl(org.eol.globi.domain.StudyImpl) DatasetImpl(org.eol.globi.service.DatasetImpl) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) StudyNode(org.eol.globi.domain.StudyNode) Test(org.junit.Test)

Aggregations

StudyImpl (org.eol.globi.domain.StudyImpl)82 Study (org.eol.globi.domain.Study)60 Test (org.junit.Test)40 Specimen (org.eol.globi.domain.Specimen)33 TaxonImpl (org.eol.globi.domain.TaxonImpl)33 IOException (java.io.IOException)20 LabeledCSVParser (com.Ostermiller.util.LabeledCSVParser)17 Location (org.eol.globi.domain.Location)15 StringWriter (java.io.StringWriter)12 LocationImpl (org.eol.globi.domain.LocationImpl)12 Date (java.util.Date)9 HashMap (java.util.HashMap)9 Taxon (org.eol.globi.domain.Taxon)9 StudyNode (org.eol.globi.domain.StudyNode)7 Node (org.neo4j.graphdb.Node)7 File (java.io.File)6 TermImpl (org.eol.globi.domain.TermImpl)6 DatasetImpl (org.eol.globi.service.DatasetImpl)6 InteractType (org.eol.globi.domain.InteractType)5 NonResolvingTaxonIndex (org.eol.globi.taxon.NonResolvingTaxonIndex)5