use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class StudyImporterForSzoboszlaiTest method importShapes.
@Test
public void importShapes() throws StudyImporterException, IOException {
Dataset testDataset = getTestDataset();
ParserFactory parserFactory = new ParserFactoryForDataset(testDataset);
StudyImporterForSzoboszlai studyImporterForSzoboszlai = new StudyImporterForSzoboszlai(parserFactory, nodeFactory);
studyImporterForSzoboszlai.setDataset(testDataset);
Map<Integer, LatLng> localityMap = studyImporterForSzoboszlai.importShapes();
LatLng centroid = localityMap.get(2361);
assertThat(centroid, is(notNullValue()));
assertThat(centroid.getLat(), is(34.00824202376044));
assertThat(centroid.getLng(), is(-120.72716166720323));
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class DatasetFinderWithCacheIT method gitHubTest.
@Test
public void gitHubTest() throws DatasetFinderException {
DatasetFinder finder = new DatasetFinderWithCache(new DatasetFinderGitHubArchive(), cachePath);
Dataset dataset = DatasetFactory.datasetFor("globalbioticinteractions/Catalogue-of-Afrotropical-Bees", finder);
assertThat(dataset.getArchiveURI().toString(), containsString("github.com"));
assertThat(dataset.getResourceURI("globi.json").toString(), startsWith("jar:file:/"));
assertThat(dataset.getCitation(), startsWith("Shan Kothari, Pers. Comm. 2014."));
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class DatasetFinderWithCacheIT method assertTemplateDataset.
private void assertTemplateDataset(String expectedURIFragment, DatasetFinder datasetFinder, String expectedCitation) throws DatasetFinderException, IOException {
DatasetFinder finder = new DatasetFinderWithCache(datasetFinder, cachePath);
Dataset dataset = DatasetFactory.datasetFor("globalbioticinteractions/template-dataset", finder);
assertThat(dataset.getArchiveURI().toString(), containsString(expectedURIFragment));
assertThat(dataset.getResourceURI("globi.json").toString(), startsWith("jar:file:/"));
assertThat(dataset.getCitation(), startsWith(expectedCitation));
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class StudyImporterForSzoboszlaiTest method getTestDataset.
private Dataset getTestDataset() throws IOException {
JsonNode config = new ObjectMapper().readTree("{ \"citation\": \"Szoboszlai AI, Thayer JA, Wood SA, Sydeman WJ, Koehn LE (2015) Data from: Forage species in predator diets: synthesis of data from the California Current. Dryad Digital Repository. http://dx.doi.org/10.5061/dryad.nv5d2\",\n" + " \"doi\": \"http://dx.doi.org/10.5061/dryad.nv5d2\",\n" + " \"format\": \"szoboszlai\",\n" + " \"resources\": {\n" + " \"links\": \"szoboszlai/CCPDDlinkdata_v2.csv\",\n" + " \"shapes\": \"szoboszlai/CCPDDlocationdata_test.zip\"\n" + " }\n" + "}");
Dataset dataset = new DatasetLocal();
dataset.setConfig(config);
return dataset;
}
use of org.eol.globi.service.Dataset in project eol-globi-data by jhpoelen.
the class StudyImporterForGitHubData method importData.
public void importData(String repository) throws StudyImporterException {
try {
LOG.info("importing github repo [" + repository + "]...");
Dataset dataset = DatasetFactory.datasetFor(repository, getDatasetFinder());
nodeFactory.getOrCreateDataset(dataset);
importData(dataset);
LOG.info("importing github repo [" + repository + "] done.");
} catch (StudyImporterException | DatasetFinderException ex) {
String msg = "failed to import data from repo [" + repository + "]";
LOG.error(msg, ex);
throw new StudyImporterException(msg, ex);
}
}
Aggregations