use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.
the class ExporterAssociationsTest method createTestData.
private void createTestData(Double length) throws NodeFactoryException, ParseException {
Study myStudy = nodeFactory.getOrCreateStudy(new StudyImpl("myStudy", "data\tsource description", null, ExternalIdUtil.toCitation("contributor", "description", "pubYear")));
Specimen specimen = nodeFactory.createSpecimen(myStudy, new TaxonImpl("Homo sapiens", "EOL:123"));
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, new Date(ExportTestUtil.utcTestTime()));
eats(specimen, "Canis lupus", "EOL:456", myStudy);
eats(specimen, "Felis whateverus", PropertyAndValueDictionary.NO_MATCH, myStudy);
if (null != length) {
specimen.setLengthInMm(length);
}
Location location = nodeFactory.getOrCreateLocation(new LocationImpl(13.0, 45.9, -60.0, null));
specimen.caughtIn(location);
}
use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.
the class ExportUnmatchedTaxonNamesTest method exportOnePredatorNoPathButWithSameAs.
@Test
public void exportOnePredatorNoPathButWithSameAs() throws NodeFactoryException, IOException {
taxonIndex = ExportTestUtil.taxonIndexWithEnricher(null, getGraphDb());
String citation = "cite, study";
Study study = nodeFactory.getOrCreateStudy(new StudyImpl("my, study", "my first, source", null, citation));
Specimen predatorSpecimen = nodeFactory.createSpecimen(study, new TaxonImpl("Homo sapienz", null));
Taxon humanz = taxonIndex.getOrCreateTaxon(new TaxonImpl("Homo sapienz", null));
TaxonImpl taxon = new TaxonImpl("Homo sapiens", "TESTING:123");
taxon.setPath("one | two | Homo sapiens");
NodeUtil.connectTaxa(taxon, (TaxonNode) humanz, getGraphDb(), RelTypes.SIMILAR_TO);
assertNotNull(humanz);
Specimen preySpecimen = nodeFactory.createSpecimen(study, new TaxonImpl("Caniz", null));
predatorSpecimen.interactsWith(preySpecimen, InteractType.ATE);
predatorSpecimen = nodeFactory.createSpecimen(study, new TaxonImpl("Homo sapiens", null));
Node synonymNode = ((NodeBacked) taxonIndex.getOrCreateTaxon(new TaxonImpl("Homo sapiens Synonym", null))).getUnderlyingNode();
Node node = ((NodeBacked) taxonIndex.getOrCreateTaxon(new TaxonImpl("Homo sapiens", null))).getUnderlyingNode();
Transaction tx = getGraphDb().beginTx();
try {
node.createRelationshipTo(synonymNode, NodeUtil.asNeo4j(RelTypes.SAME_AS));
tx.success();
} finally {
tx.finish();
}
preySpecimen = nodeFactory.createSpecimen(study, new TaxonImpl("Canis", null));
predatorSpecimen.ate(preySpecimen);
resolveNames();
StringWriter writer = new StringWriter();
new ExportUnmatchedTaxonNames().exportStudy(study, writer, true);
assertThat(writer.toString(), is("unmatched taxon name\tunmatched taxon id\tname status\tsimilar to taxon name\tsimilar to taxon path\tsimilar to taxon id\tstudy\tsource" + "\nHomo sapienz\t\t\tHomo sapiens\tone | two | Homo sapiens\tTESTING:123\tcite, study\tmy first, source" + "\nCaniz\t\t\t\t\t\tcite, study\tmy first, source" + "\nCanis\t\t\t\t\t\tcite, study\tmy first, source"));
}
use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.
the class ExportFlatInteractionsTest method createTestData.
private void createTestData(Double length) throws NodeFactoryException, ParseException {
Study myStudy = factory.createStudy(new StudyImpl("myStudy", null, null, null));
specimenEatCatAndDog(length, myStudy, "Homo sapiens", "EOL:333");
specimenEatCatAndDog(length, myStudy, "Homo sapiens", "EOL:333");
specimenEatCatAndDog(length, myStudy, "Homo erectus", "EOL:123");
specimenEatCatAndDog(length, myStudy, "Homo erectus", "EOL:123");
specimenEatCatAndDog(length, factory.createStudy(new StudyImpl("yourStudy", null, null, null)), "Homo erectus", "EOL:888");
specimenEatCatAndDog(length, factory.createStudy(new StudyImpl("yourStudy2", null, null, null)), "Homo erectus", "EOL:888");
specimenEatCatAndDog(length, myStudy, "Blo blaaus", PropertyAndValueDictionary.NO_MATCH);
}
use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.
the class ExportCitationsTest method exportCitations.
@Test
public void exportCitations() throws IOException, NodeFactoryException {
StringWriter writer = new StringWriter();
getNodeFactory().getOrCreateStudy(new StudyImpl("some title", "some source", "doi:some/doi", "some citation"));
getNodeFactory().getOrCreateStudy(new StudyImpl("some other title", "some other source", "doi:some/otherdoi", "some other citation"));
new ExportCitations().export(getGraphDb(), writer, "START study = node:studies('*:*') " + "RETURN study.externalId? as uri" + ", study.citation? as citation");
assertThat(writer.toString(), Is.is("uri\tcitation" + "\nhttp://dx.doi.org/some/doi\tsome citation" + "\nhttp://dx.doi.org/some/otherdoi\tsome other citation"));
}
use of org.eol.globi.domain.StudyImpl in project eol-globi-data by jhpoelen.
the class ExporterOccurrenceAggregatesTest method createTestData.
private void createTestData(Double length) throws NodeFactoryException, ParseException {
Study myStudy = nodeFactory.createStudy(new StudyImpl("myStudy", null, null, null));
specimenEatCatAndDog(length, myStudy, "Homo sapiens", "EOL:333");
specimenEatCatAndDog(length, myStudy, "Homo sapiens", "EOL:333");
specimenEatCatAndDog(length, myStudy, "Homo erectus", "EOL:123");
specimenEatCatAndDog(length, myStudy, "Homo erectus", "EOL:123");
specimenEatCatAndDog(length, nodeFactory.createStudy(new StudyImpl("yourStudy", null, null, null)), "Homo erectus", "EOL:888");
specimenEatCatAndDog(length, nodeFactory.createStudy(new StudyImpl("yourStudy2", null, null, null)), "Homo erectus", "EOL:888");
specimenEatCatAndDog(length, myStudy, "Blo blaaus", PropertyAndValueDictionary.NO_MATCH);
}
Aggregations