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