Search in sources :

Example 6 with DatasetImporter

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

the class DatasetImporterFactoryImplIT method createHafner.

@Test
public void createHafner() throws StudyImporterException, DatasetRegistryException, IOException {
    final DatasetRegistry datasetRegistryGitHubRemote = new DatasetRegistryGitHubRemote(inStream -> inStream);
    Dataset dataset = new DatasetFactory(datasetRegistryGitHubRemote).datasetFor("globalbioticinteractions/hafner");
    DatasetImporter importer = new StudyImporterFactoryImpl(null).createImporter(dataset);
    assertThat(importer, is(notNullValue()));
    DatasetImporterForHafner haftnerImporter = (DatasetImporterForHafner) importer;
    assertThat(haftnerImporter.getDataset().retrieve(URI.create("hafner/gopher_lice_int.csv")), is(notNullValue()));
}
Also used : DatasetRegistryGitHubRemote(org.globalbioticinteractions.dataset.DatasetRegistryGitHubRemote) Dataset(org.globalbioticinteractions.dataset.Dataset) DatasetRegistry(org.globalbioticinteractions.dataset.DatasetRegistry) DatasetImporterForHafner(org.eol.globi.data.DatasetImporterForHafner) BaseDatasetImporter(org.eol.globi.data.BaseDatasetImporter) DatasetImporter(org.eol.globi.data.DatasetImporter) DatasetFactory(org.globalbioticinteractions.dataset.DatasetFactory) Test(org.junit.Test)

Example 7 with DatasetImporter

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

the class DatasetImporterFactoryImplIT method createAfrotropicalBees.

@Test
public void createAfrotropicalBees() throws StudyImporterException, DatasetRegistryException, IOException {
    final DatasetRegistryGitHubRemote datasetFinderGitHubRemote = new DatasetRegistryGitHubRemote(inStream -> inStream);
    String repo = "globalbioticinteractions/Catalogue-of-Afrotropical-Bees";
    DatasetImporter importer = importerFor(datasetFinderGitHubRemote, repo);
    assertThat(importer, is(notNullValue()));
    assertThat(importer, is(instanceOf(DatasetImporterForCoetzer.class)));
    assertThat(((DatasetImporterForCoetzer) importer).getDataset(), is(notNullValue()));
    assertThat(((DatasetImporterForCoetzer) importer).getDataset().retrieve(URI.create("archive")), is(notNullValue()));
}
Also used : DatasetImporterForCoetzer(org.eol.globi.data.DatasetImporterForCoetzer) DatasetRegistryGitHubRemote(org.globalbioticinteractions.dataset.DatasetRegistryGitHubRemote) Matchers.containsString(org.hamcrest.Matchers.containsString) BaseDatasetImporter(org.eol.globi.data.BaseDatasetImporter) DatasetImporter(org.eol.globi.data.DatasetImporter) Test(org.junit.Test)

Example 8 with DatasetImporter

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

the class DatasetImporterFactoryImplIT method defaultTSVImporterCachedZenodo.

@Test
public void defaultTSVImporterCachedZenodo() throws StudyImporterException, DatasetRegistryException {
    final DatasetRegistry datasetRegistry = new DatasetRegistryWithCache(new DatasetRegistryZenodo(inStream -> inStream), dataset -> CacheUtil.cacheFor(dataset.getNamespace(), "target/datasets", inStream -> inStream));
    DatasetImporter importer = getTemplateImporter(datasetRegistry, "globalbioticinteractions/template-dataset");
    DatasetImporterForTSV importerTSV = (DatasetImporterForTSV) importer;
    assertThat(importerTSV.getSourceCitation(), containsString("doi.org"));
}
Also used : CacheUtil(org.globalbioticinteractions.cache.CacheUtil) DatasetImporterForGoMexSI2(org.eol.globi.data.DatasetImporterForGoMexSI2) DatasetRegistryGitHubRemote(org.globalbioticinteractions.dataset.DatasetRegistryGitHubRemote) IsInstanceOf.instanceOf(org.hamcrest.core.IsInstanceOf.instanceOf) DatasetImporterForHurlbert(org.eol.globi.data.DatasetImporterForHurlbert) DatasetConstant(org.globalbioticinteractions.dataset.DatasetConstant) DatasetImporterForMetaTable(org.eol.globi.data.DatasetImporterForMetaTable) DatasetImporterForHafner(org.eol.globi.data.DatasetImporterForHafner) DatasetImporterForSzoboszlai(org.eol.globi.data.DatasetImporterForSzoboszlai) StudyImporterException(org.eol.globi.data.StudyImporterException) BaseDatasetImporter(org.eol.globi.data.BaseDatasetImporter) Is.is(org.hamcrest.core.Is.is) JsonNode(com.fasterxml.jackson.databind.JsonNode) DatasetImporter(org.eol.globi.data.DatasetImporter) DatasetImporterForJSONLD(org.eol.globi.data.DatasetImporterForJSONLD) URI(java.net.URI) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) StringStartsWith.startsWith(org.hamcrest.core.StringStartsWith.startsWith) DatasetRegistry(org.globalbioticinteractions.dataset.DatasetRegistry) DatasetRegistryZenodo(org.globalbioticinteractions.dataset.DatasetRegistryZenodo) DatasetRegistryException(org.globalbioticinteractions.dataset.DatasetRegistryException) Assert.assertNotNull(org.junit.Assert.assertNotNull) Test(org.junit.Test) IOException(java.io.IOException) DatasetImporterForCoetzer(org.eol.globi.data.DatasetImporterForCoetzer) DatasetRegistryGitHubArchive(org.globalbioticinteractions.dataset.DatasetRegistryGitHubArchive) DatasetImporterForPlanque(org.eol.globi.data.DatasetImporterForPlanque) DatasetImporterForTSV(org.eol.globi.data.DatasetImporterForTSV) DatasetFactory(org.globalbioticinteractions.dataset.DatasetFactory) Dataset(org.globalbioticinteractions.dataset.Dataset) DatasetImporterForRSS(org.eol.globi.data.DatasetImporterForRSS) IsNull.notNullValue(org.hamcrest.core.IsNull.notNullValue) DatasetImporterForWood(org.eol.globi.data.DatasetImporterForWood) DatasetRegistryWithCache(org.globalbioticinteractions.dataset.DatasetRegistryWithCache) Matchers.containsString(org.hamcrest.Matchers.containsString) InputStream(java.io.InputStream) DatasetImporterForTSV(org.eol.globi.data.DatasetImporterForTSV) DatasetRegistryZenodo(org.globalbioticinteractions.dataset.DatasetRegistryZenodo) DatasetRegistry(org.globalbioticinteractions.dataset.DatasetRegistry) DatasetRegistryWithCache(org.globalbioticinteractions.dataset.DatasetRegistryWithCache) BaseDatasetImporter(org.eol.globi.data.BaseDatasetImporter) DatasetImporter(org.eol.globi.data.DatasetImporter) Test(org.junit.Test)

Example 9 with DatasetImporter

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

the class DatasetImporterFactoryImplIT method createArthopodEasyCapture.

@Test
public void createArthopodEasyCapture() throws StudyImporterException, DatasetRegistryException {
    final DatasetRegistryGitHubRemote datasetFinderGitHubRemote = new DatasetRegistryGitHubRemote(inStream -> inStream);
    DatasetImporter importer = importerFor(datasetFinderGitHubRemote, "globalbioticinteractions/arthropodEasyCaptureAMNH");
    assertThat(importer, is(notNullValue()));
    assertThat(importer, is(instanceOf(DatasetImporterForRSS.class)));
    assertThat(((DatasetImporterForRSS) importer).getRssFeedUrlString(), is(notNullValue()));
}
Also used : DatasetRegistryGitHubRemote(org.globalbioticinteractions.dataset.DatasetRegistryGitHubRemote) BaseDatasetImporter(org.eol.globi.data.BaseDatasetImporter) DatasetImporter(org.eol.globi.data.DatasetImporter) Test(org.junit.Test)

Example 10 with DatasetImporter

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

the class NodeFactoryTest method importData.

private static void importData(Class<? extends DatasetImporter> importer, NodeFactory factory) throws StudyImporterException {
    DatasetImporter datasetImporter = createStudyImporter(importer, factory);
    LOG.info("[" + importer + "] importing ...");
    datasetImporter.importStudy();
    LOG.info("[" + importer + "] imported.");
}
Also used : DatasetImporter(org.eol.globi.data.DatasetImporter)

Aggregations

DatasetImporter (org.eol.globi.data.DatasetImporter)21 BaseDatasetImporter (org.eol.globi.data.BaseDatasetImporter)16 Test (org.junit.Test)16 DatasetRegistryGitHubRemote (org.globalbioticinteractions.dataset.DatasetRegistryGitHubRemote)15 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 Dataset (org.globalbioticinteractions.dataset.Dataset)6 StudyImporterException (org.eol.globi.data.StudyImporterException)5 DatasetFactory (org.globalbioticinteractions.dataset.DatasetFactory)5 DatasetRegistry (org.globalbioticinteractions.dataset.DatasetRegistry)5 InputStream (java.io.InputStream)4 URI (java.net.URI)4 DatasetImporterForCoetzer (org.eol.globi.data.DatasetImporterForCoetzer)4 DatasetImporterForGoMexSI2 (org.eol.globi.data.DatasetImporterForGoMexSI2)4 DatasetImporterForHafner (org.eol.globi.data.DatasetImporterForHafner)4 DatasetImporterForMetaTable (org.eol.globi.data.DatasetImporterForMetaTable)4 DatasetImporterForPlanque (org.eol.globi.data.DatasetImporterForPlanque)4 DatasetImporterForSzoboszlai (org.eol.globi.data.DatasetImporterForSzoboszlai)4 DatasetImporterForTSV (org.eol.globi.data.DatasetImporterForTSV)4 DatasetImporterForWood (org.eol.globi.data.DatasetImporterForWood)4 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)4