use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSS method datasetFor.
private static Dataset datasetFor(Dataset datasetOrig, SyndEntry entry, Map<String, String> foreignEntries) {
Dataset dataset;
String title = entry.getTitle();
String citation = StringUtils.trim(title);
dataset = embeddedDatasetFor(datasetOrig, citation, URI.create(foreignEntries.get("dwca")), parseForeignEntriesAndCategories(entry));
return dataset;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForMetaTable method importStudy.
@Override
public void importStudy() throws StudyImporterException {
try {
for (JsonNode tableConfig : collectTables(dataset)) {
Dataset datasetProxy = new DatasetProxy(dataset);
datasetProxy.setConfig(tableConfig);
InteractionListener interactionListener = getInteractionListener();
final InteractionListener listener = new TableInteractionListenerProxy(datasetProxy, interactionListener);
importTable(listener, new TableParserFactoryImpl(), tableConfig, datasetProxy, getLogger());
}
} catch (IOException | NodeFactoryException e) {
String msg = "problem importing from [" + getBaseUrl() + "]";
LogUtil.logError(getLogger(), msg, e);
throw new StudyImporterException(msg, e);
}
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method assertTermValues.
public void assertTermValues(String firstFewLines, Map<String, String> expected) throws StudyImporterException {
AtomicInteger atomicInteger = new AtomicInteger(0);
Dataset dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLines);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importer.setInteractionListener(link -> {
int i = atomicInteger.incrementAndGet();
expected.values().forEach(termName -> {
assertThat(link.get(termName), is(expected.get(termName)));
});
});
importStudy(importer);
assertThat(atomicInteger.get(), greaterThan(0));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method associatedTaxaNotSupported.
@Test
public void associatedTaxaNotSupported() throws StudyImporterException {
AtomicInteger atomicInteger = new AtomicInteger(0);
String firstFewLines = "sourceTaxonName\tassociatedTaxa\n" + "Homo sapiens\teats: Canis lupus | eats: Felis catus";
Dataset dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLines);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importer.setInteractionListener(link -> {
int i = atomicInteger.incrementAndGet();
assertThat(link.get(INTERACTION_TYPE_ID), is(nullValue()));
assertThat(link.get(INTERACTION_TYPE_NAME), is(nullValue()));
assertThat(link.get(TARGET_TAXON_NAME), is(nullValue()));
assertThat(link.get(ASSOCIATED_TAXA), is(notNullValue()));
});
importStudy(importer);
assertThat(atomicInteger.get(), greaterThan(0));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method importFewLinesCSV.
@Test
public void importFewLinesCSV() throws StudyImporterException {
Dataset dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.csv"), firstFewLinesCSV);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
assertExists("TESTLeptoconchus incycloseris");
assertExists("Sandalolitha dentata");
assertStudyTitles("someRepodoi:10.1007/s13127-011-0039-1");
}
Aggregations