use of org.globalbioticinteractions.dataset.DatasetRegistry in project eol-globi-data by jhpoelen.
the class IndexerDataset method indexDatasets.
private static void indexDatasets(DatasetRegistry registry, NodeFactory nodeFactory) {
try {
final Collection<String> namespaces = registry.findNamespaces();
String namespacelist = StringUtils.join(namespaces, CharsetConstant.SEPARATOR);
LOG.info("found dataset namespaces: {" + namespacelist + "}");
DatasetImporterForRegistry importer = new DatasetImporterForRegistry(new ParserFactoryLocal(), nodeFactory, registry);
importer.setDatasetFilter(x -> !DatasetUtil.isDeprecated(x));
importer.setDataset(new DatasetLocal(inStream -> inStream));
importer.setLogger(new NullImportLogger());
importer.importStudy();
} catch (DatasetRegistryException | StudyImporterException e) {
LOG.error("problem encountered while importing [" + DatasetImporterForRegistry.class.getName() + "]", e);
}
}
use of org.globalbioticinteractions.dataset.DatasetRegistry in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplIT method defaultTSVImporterCached.
@Test
public void defaultTSVImporterCached() throws StudyImporterException, DatasetRegistryException, IOException {
final DatasetRegistry datasetRegistry = new DatasetRegistryWithCache(new DatasetRegistryGitHubArchive(inStream -> inStream), dataset -> CacheUtil.cacheFor(dataset.getNamespace(), "target/datasets", inStream -> inStream));
DatasetImporter importer = getTemplateImporter(datasetRegistry, "globalbioticinteractions/template-dataset");
DatasetImporterForTSV importerTSV = (DatasetImporterForTSV) importer;
assertThat(importerTSV.getBaseUrl(), startsWith("https://github.com/globalbioticinteractions/template-dataset/"));
assertThat(importerTSV.getDataset().retrieve(URI.create("globi.json")), is(notNullValue()));
}
use of org.globalbioticinteractions.dataset.DatasetRegistry in project eol-globi-data by jhpoelen.
the class CmdImportDatasets method run.
@Override
public void run() throws StudyImporterException {
DatasetRegistry registry = DatasetRegistryUtil.getDatasetRegistry(datasetDir);
new IndexerDataset(registry, nodeFactoryFactory, graphServiceFactory).index();
}
Aggregations