use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method importMinimal.
@Test
public void importMinimal() throws StudyImporterException {
String minimalLines = "sourceTaxonId\tsourceTaxonName\tinteractionTypeId\tinteractionTypeName\ttargetTaxonId\ttargetTaxonName\tlocalityId\tlocalityName\tdecimalLatitude\tdecimalLongitude\tobservationDateTime\treferenceDoi\treferenceCitation\n" + "EOL:123\t\tRO:0002444\t\tEOL:111\t\t\t\t\t\t\t\tGittenberger, A., Gittenberger, E. (2011). Cryptic, adaptive radiation of endoparasitic snails: sibling species of Leptoconchus (Gastropoda: Coralliophilidae) in corals. Org Divers Evol, 11(1), 21–41. doi:10.1007/s13127-011-0039-1\n" + "EOL:456\t\tRO:0002444\t\tEOL:222\t\t\t\t\t\t\t\tGittenberger, A., Gittenberger, E. (2011). Cryptic, adaptive radiation of endoparasitic snails: sibling species of Leptoconchus (Gastropoda: Coralliophilidae) in corals. Org Divers Evol, 11(1), 21–41. doi:10.1007/s13127-011-0039-1\n" + "EOL:678\t\tRO:0002444\t\tEOL:333\t\t\t\t\t\t\t\tGittenberger, A., Gittenberger, E. (2011). Cryptic, adaptive radiation of endoparasitic snails: sibling species of Leptoconchus (Gastropoda: Coralliophilidae) in corals. Org Divers Evol, 11(1), 21–41. doi:10.1007/s13127-011-0039-1\n" + "EOL:912\t\tRO:0002444\t\tEOL:444\t\t\t\t\t\t\t\tGittenberger, A., Gittenberger, E. (2011). Cryptic, adaptive radiation of endoparasitic snails: sibling species of Leptoconchus (Gastropoda: Coralliophilidae) in corals. Org Divers Evol, 11(1), 21–41. doi:10.1007/s13127-011-0039-1\n";
DatasetImpl dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), minimalLines);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
Taxon taxon = taxonIndex.findTaxonById("EOL:123");
assertThat(taxon, is(notNullValue()));
assertThat(taxon.getName(), is("no name"));
assertThat(taxon.getExternalId(), is("EOL:123"));
assertStudyTitles("someRepoGittenberger, A., Gittenberger, E. (2011). Cryptic, adaptive radiation of endoparasitic snails: sibling species of Leptoconchus (Gastropoda: Coralliophilidae) in corals. Org Divers Evol, 11(1), 21–41. doi:10.1007/s13127-011-0039-1");
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method importFewLinesCSVAndTSV.
@Test
public void importFewLinesCSVAndTSV() throws StudyImporterException {
DatasetImpl dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLinesTSV);
put(URI.create("/interactions.csv"), firstFewLinesCSV);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
assertExists("Leptoconchus incycloseris");
assertExists("TESTLeptoconchus incycloseris");
assertExists("Sandalolitha dentata");
assertStudyTitles("someRepodoi:10.1007/s13127-011-0039-1");
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method assertArgumentType.
private void assertArgumentType(String firstFewLines, final RelTypes argumentType) throws StudyImporterException {
DatasetImpl dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLines);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
final AtomicBoolean foundStudy = new AtomicBoolean(false);
NodeUtil.findStudies(getGraphDb(), new NodeListener() {
@Override
public void on(Node node) {
assertTrue(node.hasRelationship(Direction.OUTGOING, NodeUtil.asNeo4j(argumentType)));
foundStudy.set(true);
}
});
assertThat(foundStudy.get(), is(true));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForPlanqueIT method importAll.
@Test
public void importAll() throws StudyImporterException, IOException {
final List<String> errorMessages = new ArrayList<String>();
BaseDatasetImporter importer = new DatasetImporterForPlanque(new ParserFactoryLocal(), nodeFactory);
JsonNode config = new ObjectMapper().readTree("{ \"citation\": \"Benjamin Planque, Raul Primicerio, Kathrine Michalsen, Michaela Aschan, Grégoire Certain, Padmini Dalpadado, Harald Gjøsæater, Cecilie Hansen, Edda Johannesen, Lis Lindal Jørgensen, Ina Kolsum, Susanne Kortsch, Lise-Marie Leclerc, Lena Omli, Mette Skern-Mauritzen, and Magnus Wiedmann 2014. Who eats whom in the Barents Sea: a food web topology from plankton to whales. Ecology 95:1430–1430. https://doi.org/10.1890/13-1062.1\",\n" + " \"doi\": \"https://doi.org/10.1890/13-1062.1\",\n" + " \"format\": \"planque\",\n" + " \"resources\": {\n" + " \"links\": \"http://www.esapubs.org/archive/ecol/E095/124/revised/PairwiseList.txt\",\n" + " \"references\": \"http://www.esapubs.org/archive/ecol/E095/124/revised/References.txt\",\n" + " \"referencesForLinks\": \"http://www.esapubs.org/archive/ecol/E095/124/revised/PairWise2References.txt\"\n" + " }\n" + "}");
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"), inStream -> inStream);
dataset.setConfig(config);
importer.setDataset(dataset);
importer.setLogger(new NullImportLogger() {
@Override
public void warn(LogContext ctx, String message) {
errorMessages.add(message);
}
});
importStudy(importer);
int interactionCount = 0;
List<StudyNode> studies = NodeUtil.findAllStudies(getGraphDb());
for (StudyNode study : studies) {
interactionCount += getSpecimenCount(study);
}
assertThat(interactionCount, is(4900));
int uniqueReference = 236;
// note that the +1 is for all links that had no reference associated to it
assertThat(studies.size(), is(uniqueReference + 1));
assertThat(taxonIndex.findTaxonByName("Trisopterus esmarkii"), is(notNullValue()));
assertThat(errorMessages.size(), is(0));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForJSONLDTest method importStaticInvalid.
@Test(expected = StudyImporterException.class)
public void importStaticInvalid() throws StudyImporterException, URISyntaxException {
DatasetImporter importer = new DatasetImporterForJSONLD(null, nodeFactory);
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"), inStream -> inStream);
dataset.setConfigURI(URI.create("classpath:/org/eol/globi/data/globi-jsonld/globi-dataset.jsonld.invalid"));
importer.setDataset(dataset);
importStudy(importer);
}
Aggregations