use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForJSONLDTest method importStatic.
@Test
public void importStatic() 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"));
importer.setDataset(dataset);
importStudy(importer);
List<StudyNode> allStudies = NodeUtil.findAllStudies(getGraphDb());
for (Study study : allStudies) {
assertThat(study.getExternalId(), is("http://arctos.database.museum/guid/CUMV:Bird:25225"));
assertThat(study.getCitation(), is("http://arctos.database.museum/guid/CUMV:Bird:25225"));
}
assertThat(taxonIndex.findTaxonById("NCBI:8782"), not(is(nullValue())));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForCoetzerTest method importSome.
@Test
public void importSome() throws StudyImporterException, IOException {
DatasetImporterForCoetzer importer = new DatasetImporterForCoetzer(null, nodeFactory);
DatasetImpl dataset = new DatasetLocal(inStream -> inStream);
JsonNode config = new ObjectMapper().readTree("{\"citation\": \"source citation\", \"resources\": {\"archive\": \"coetzer/CatalogOfAfrotropicalBees.zip\"}}");
dataset.setConfig(config);
importer.setDataset(dataset);
importStudy(importer);
List<StudyNode> allStudies = NodeUtil.findAllStudies(getGraphDb());
for (Study allStudy : allStudies) {
assertThat(allStudy.getCitation(), is(notNullValue()));
}
assertThat(taxonIndex.findTaxonByName("Agrostis tremula"), is(notNullValue()));
assertThat(taxonIndex.findTaxonByName("Coelioxys erythrura"), is(notNullValue()));
assertThat(taxonIndex.findTaxonByName("Patellapis namaquensis"), is(notNullValue()));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForHurlbertTest method doImport.
public DatasetImporter doImport(final String namespace) throws StudyImporterException {
DatasetImporter importer = new DatasetImporterForHurlbert(null, nodeFactory);
Dataset dataset = new DatasetImpl(namespace, URI.create("some:uri"), inStream -> inStream) {
@Override
public InputStream retrieve(URI name) {
return DatasetImporterForHurlbertTest.getResource();
}
};
importer.setDataset(dataset);
importStudy(importer);
return importer;
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForDunneIT method importStudy.
@Test
public void importStudy() throws StudyImporterException, IOException {
String configJson = "{ \"citation\": \"blabla\",\n" + " \"format\": \"dunne\",\n" + " \"resources\": {\n" + " \"nodes\": \"https://raw.githubusercontent.com/globalbioticinteractions/dunne2016SanakIntertidal/main/nodes.tsv\",\n" + " \"links\": \"https://raw.githubusercontent.com/globalbioticinteractions/dunne2016SanakIntertidal/main/links.tsv\"\n" + " },\n" + " \"location\": {\n" + " \"locality\": {\n" + " \"id\": \"GEONAMES:5873327\",\n" + " \"name\": \"Sanak Island, Alaska, USA\"\n" + " },\n" + " \"latitude\": 60,\n" + " \"longitude\": 60\n" + " }\n" + "}";
JsonNode jsonNode = new ObjectMapper().readTree(configJson);
DatasetImpl dunne2016 = new DatasetImpl("dunne2016", URI.create("http://example.com"), inStream -> inStream);
dunne2016.setConfig(jsonNode);
ParserFactory parserFactory = new ParserFactoryForDataset(dunne2016);
DatasetImporterForDunne importer = new DatasetImporterForDunne(parserFactory, nodeFactory);
importer.setDataset(dunne2016);
importStudy(importer);
StudyNode study = getStudySingleton(getGraphDb());
assertThat(study, is(notNullValue()));
assertThat(getSpecimenCount(study), is(1804 * 2));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForGrayTest method createImporter.
static DatasetImporterForGray createImporter(NodeFactory nodeFactory) throws IOException {
DatasetImporterForGray gray = new DatasetImporterForGray(new ParserFactoryLocal(), nodeFactory);
JsonNode config = new ObjectMapper().readTree("{ \"citation\": \"Gray C, Ma A, Perkins D, Hudson L, Figueroa D, Woodward G (2015). Database of trophic interactions. Zenodo. https://doi.org/10.5281/zenodo.13751\",\n" + " \"doi\": \"https://doi.org/10.5281/zenodo.13751\",\n" + " \"format\": \"gray\",\n" + " \"resources\": {\n" + " \"links\": \"https://zenodo.org/record/13751/files/trophic.links.2014-11-10.csv\" \n" + " }\n" + "}");
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"), inStream -> inStream);
dataset.setConfig(config);
gray.setDataset(dataset);
return gray;
}
Aggregations