use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.
the class GitHubImporterFactoryIT method defaultTSVImporterCachedZenodo.
@Test
public void defaultTSVImporterCachedZenodo() throws StudyImporterException, DatasetFinderException {
final DatasetFinder datasetFinder = new DatasetFinderWithCache(new DatasetFinderZenodo());
StudyImporter importer = getTemplateImporter(datasetFinder, "globalbioticinteractions/template-dataset");
StudyImporterForTSV importerTSV = (StudyImporterForTSV) importer;
assertThat(importerTSV.getSourceCitation(), containsString("doi.org"));
}
use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.
the class GitHubImporterFactoryIT method createHurlbert.
@Test
public void createHurlbert() throws StudyImporterException, DatasetFinderException {
final DatasetFinderGitHubRemote datasetFinderGitHubRemote = new DatasetFinderGitHubRemote();
StudyImporter importer = importerFor(datasetFinderGitHubRemote, "hurlbertlab/dietdatabase");
assertThat(importer, is(notNullValue()));
assertThat(importer, is(instanceOf(StudyImporterForHurlbert.class)));
final JsonNode config = ((BaseStudyImporter) importer).getDataset().getConfig();
assertThat(config, is(notNullValue()));
}
use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.
the class Normalizer method importData.
void importData(GraphDatabaseService graphService, String cacheDir) {
NodeFactoryNeo4j factory = new NodeFactoryNeo4j(graphService);
factory.setEcoregionFinder(getEcoregionFinder());
factory.setDoiResolver(new DOIResolverImpl());
try {
CacheFactory cacheFactory = dataset -> new CacheLocalReadonly(dataset.getNamespace(), cacheDir);
DatasetFinder finder = new DatasetFinderLocal(cacheDir, cacheFactory);
StudyImporter importer = new StudyImporterForGitHubData(new ParserFactoryLocal(), factory, finder);
importer.setDataset(new DatasetLocal());
importer.setLogger(new StudyImportLogger());
importer.importStudy();
} catch (StudyImporterException e) {
LOG.error("problem encountered while importing [" + StudyImporterForGitHubData.class.getName() + "]", e);
}
EcoregionFinder regionFinder = getEcoregionFinder();
if (regionFinder != null) {
regionFinder.shutdown();
}
}
use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.
the class NormalizerTest method createStudyImporter.
private static StudyImporter createStudyImporter(Class<? extends StudyImporter> studyImporter, NodeFactoryNeo4j factory) throws StudyImporterException {
StudyImporter importer = new StudyImporterTestFactory(factory).instantiateImporter(studyImporter);
importer.setLogger(new StudyImportLogger());
return importer;
}
use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.
the class GitHubImporterFactory method createImporter.
public StudyImporter createImporter(Dataset dataset, final NodeFactory nodeFactory) throws StudyImporterException {
Class<? extends StudyImporter> anImporter = findImporterFor(dataset);
try {
Constructor<? extends StudyImporter> constructor = anImporter.getConstructor(ParserFactory.class, NodeFactory.class);
ParserFactoryForDataset parserFactory = new ParserFactoryForDataset(dataset);
StudyImporter studyImporter = constructor.newInstance(parserFactory, new NodeFactoryWithDatasetContext(nodeFactory, dataset));
studyImporter.setDataset(dataset);
return studyImporter;
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
throw new StudyImporterException("failed to instantiate importer for [" + dataset.getNamespace() + "]", e);
}
}
Aggregations