use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplIT method createSIAD.
@Test
public void createSIAD() throws StudyImporterException, DatasetRegistryException {
final DatasetRegistryGitHubRemote datasetFinderGitHubRemote = new DatasetRegistryGitHubRemote(inStream -> inStream);
DatasetImporter importer = importerFor(datasetFinderGitHubRemote, "globalbioticinteractions/siad");
assertThat(importer, is(notNullValue()));
Dataset dataset = ((BaseDatasetImporter) importer).getDataset();
final JsonNode config = dataset.getConfig();
assertThat(config, is(notNullValue()));
assertThat(dataset.getOrDefault(DatasetConstant.SHOULD_RESOLVE_REFERENCES, "donald"), is("false"));
}
use of org.globalbioticinteractions.dataset.Dataset 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.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplIT method getTemplateImporter.
DatasetImporter getTemplateImporter(DatasetRegistry datasetRegistry, String repo) throws DatasetRegistryException, StudyImporterException {
Dataset dataset = new DatasetFactory(datasetRegistry).datasetFor(repo);
DatasetImporter importer = new StudyImporterFactoryImpl(null).createImporter(dataset);
assertThat(importer, is(notNullValue()));
assertThat(importer, is(instanceOf(DatasetImporterForTSV.class)));
return importer;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class InteractionListenerImplTest method processMessageWithTranslatedInteractionType.
@Test
public void processMessageWithTranslatedInteractionType() throws StudyImporterException, IOException {
ResourceService resourceService = Mockito.mock(ResourceService.class);
when(resourceService.retrieve(URI.create("interaction_types_ignored.csv"))).thenReturn(IOUtils.toInputStream("provided_interaction_type_id\nshouldBeIgnored", StandardCharsets.UTF_8)).thenReturn(IOUtils.toInputStream("provided_interaction_type_id\nshouldBeIgnored", StandardCharsets.UTF_8));
when(resourceService.retrieve(URI.create("interaction_types_mapping.csv"))).thenReturn(IOUtils.toInputStream(getTestMap(), StandardCharsets.UTF_8));
Dataset dataset = new DatasetImpl("bla", resourceService, URI.create("foo:bar"));
InteractionListenerImpl interactionListener = new InteractionListenerImpl(nodeFactory, null, null, dataset);
HashMap<String, String> interaction = new HashMap<>();
interaction.put(SOURCE_TAXON_NAME, "sourceName");
interaction.put(DatasetImporterForTSV.INTERACTION_TYPE_NAME, "shouldBeMapped");
interaction.put(TARGET_TAXON_NAME, "targetName");
interaction.put(REFERENCE_ID, "citation");
assertStudyCount(0L);
interactionListener.on(interaction);
assertStudyCount(1L);
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImplTest method useCitationFromTableDefinition.
@Test
public void useCitationFromTableDefinition() throws IOException {
Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
dataset.setConfig(new ObjectMapper().readTree(getClass().getResourceAsStream("/org/eol/globi/data/test-meta-globi-default-external-schema.json")));
assertThat(dataset.getCitation(), is("Seltzer, Carrie; Wysocki, William; Palacios, Melissa; Eickhoff, Anna; Pilla, Hannah; Aungst, Jordan; Mercer, Aaron; Quicho, Jamie; Voss, Neil; Xu, Man; J. Ndangalasi, Henry; C. Lovett, Jon; J. Cordeiro, Norbert (2015): Plant-animal interactions from Africa. figshare. https://dx.doi.org/10.6084/m9.figshare.1526128"));
}
Aggregations