use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class StudyImporterForArthopodEasyCaptureTest method readRSS.
@Test
public void readRSS() throws StudyImporterException, IOException {
final ParserFactory parserFactory = null;
final NodeFactory nodeFactory = null;
final Dataset dataset = getDatasetGroup();
List<StudyImporter> importers = StudyImporterForArthopodEasyCapture.getStudyImportersForRSSFeed(dataset, parserFactory, nodeFactory);
assertThat(importers.size(), is(3));
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class StudyImporterForArthopodEasyCaptureTest method embeddedDatasetWithConfig.
@Test
public void embeddedDatasetWithConfig() throws IOException {
Dataset embeddedDataset = StudyImporterForArthopodEasyCapture.embeddedDatasetFor(getDatasetGroupWithProperty(), "some other citation", URI.create("http://example.com/archive.zip"));
assertThat(embeddedDataset.getCitation(), is("some other citation"));
assertThat(embeddedDataset.getOrDefault(DatasetConstant.SHOULD_RESOLVE_REFERENCES, "true"), is("false"));
assertThat(DatasetUtil.getNamedResourceURI(embeddedDataset, "archive"), is("http://example.com/archive.zip"));
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class DatasetFinderWithCacheIT method hafnerTest.
@Test
public void hafnerTest() throws DatasetFinderException, IOException {
DatasetFinder finder = new DatasetFinderWithCache(new DatasetFinderGitHubArchive(), cachePath);
Dataset dataset = DatasetFactory.datasetFor("globalbioticinteractions/hafner", finder);
assertNotNull(dataset.getResource("hafner/gopher_lice_int.csv"));
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4j method getOrCreateDataset.
@Override
public Dataset getOrCreateDataset(Dataset originatingDataset) {
Transaction transaction = graphDb.beginTx();
try {
Dataset datasetCreated = getOrCreateDatasetNoTx(originatingDataset);
transaction.success();
return datasetCreated;
} finally {
transaction.finish();
}
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class StudyImporterForArthopodEasyCapture method getStudyImportersForRSSFeed.
public static List<StudyImporter> getStudyImportersForRSSFeed(Dataset datasetOrig, ParserFactory parserFactory, NodeFactory nodeFactory) throws StudyImporterException {
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed;
String rss = getRss(datasetOrig);
try {
feed = input.build(new XmlReader(new URL(rss)));
} catch (FeedException | IOException e) {
throw new StudyImporterException("failed to read rss feed [" + rss + "]", e);
}
List<StudyImporter> importers = new ArrayList<StudyImporter>();
final List entries = feed.getEntries();
for (Object entry : entries) {
if (entry instanceof SyndEntry) {
SyndEntry syndEntry = (SyndEntry) entry;
Dataset dataset = embeddedDatasetFor(datasetOrig, StringUtils.trim(syndEntry.getDescription().getValue()), URI.create(StringUtils.trim(syndEntry.getLink())));
final StudyImporterForSeltmann studyImporter = new StudyImporterForSeltmann(parserFactory, nodeFactory);
studyImporter.setDataset(dataset);
importers.add(studyImporter);
}
}
return importers;
}
Aggregations