use of org.eol.globi.service.DatasetLocal in project eol-globi-data by jhpoelen.
the class StudyImporterForSPIRETest method createImporter.
private StudyImporterForSPIRE createImporter() {
StudyImporterForSPIRE studyImporterForSPIRE = new StudyImporterForSPIRE(null, nodeFactory);
studyImporterForSPIRE.setDataset(new DatasetLocal());
studyImporterForSPIRE.setGeoNamesService(new GeoNamesService() {
@Override
public boolean hasTermForLocale(String locality) {
return "something".equals(locality);
}
@Override
public LatLng findLatLng(String locality) throws IOException {
return hasTermForLocale(locality) ? new LatLng(1.0, 2.0) : null;
}
});
return studyImporterForSPIRE;
}
use of org.eol.globi.service.DatasetLocal in project eol-globi-data by jhpoelen.
the class Normalizer method importData.
void importData(GraphDatabaseService graphService, String cacheDir) {
NodeFactoryNeo4j factory = new NodeFactoryNeo4j(graphService);
factory.setEcoregionFinder(getEcoregionFinder());
factory.setDoiResolver(new DOIResolverImpl());
try {
CacheFactory cacheFactory = dataset -> new CacheLocalReadonly(dataset.getNamespace(), cacheDir);
DatasetFinder finder = new DatasetFinderLocal(cacheDir, cacheFactory);
StudyImporter importer = new StudyImporterForGitHubData(new ParserFactoryLocal(), factory, finder);
importer.setDataset(new DatasetLocal());
importer.setLogger(new StudyImportLogger());
importer.importStudy();
} catch (StudyImporterException e) {
LOG.error("problem encountered while importing [" + StudyImporterForGitHubData.class.getName() + "]", e);
}
EcoregionFinder regionFinder = getEcoregionFinder();
if (regionFinder != null) {
regionFinder.shutdown();
}
}
use of org.eol.globi.service.DatasetLocal in project eol-globi-data by jhpoelen.
the class StudyImporterTestFactory method instantiateImporter.
public StudyImporter instantiateImporter(Class<? extends StudyImporter> clazz) throws StudyImporterException {
try {
Constructor<? extends StudyImporter> aConstructor = clazz.getConstructor(ParserFactory.class, NodeFactory.class);
StudyImporter studyImporter = aConstructor.newInstance(parserFactory, nodeFactory);
studyImporter.setDataset(new DatasetLocal());
return studyImporter;
} catch (Exception ex) {
throw new StudyImporterException("failed to create study importer for [" + clazz.toString() + "]", ex);
}
}
use of org.eol.globi.service.DatasetLocal 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.DatasetLocal in project eol-globi-data by jhpoelen.
the class StudyImporterForWebOfLifeTest method importSome.
@Test
public void importSome() throws StudyImporterException, IOException {
StudyImporterForWebOfLife importer = new StudyImporterForWebOfLife(null, nodeFactory);
importer.setDataset(new DatasetLocal());
importer.importNetworks("weboflife/web-of-life_2016-01-15_192434.zip", "Web of Life. " + CitationUtil.createLastAccessedString("http://www.web-of-life.es/"));
resolveNames();
List<Study> allStudies = NodeUtil.findAllStudies(getGraphDb());
List<String> references = new ArrayList<>();
for (Study allStudy : allStudies) {
assertThat(allStudy.getSource(), startsWith("Web of Life. Accessed at <http://www.web-of-life.es/>"));
references.add(allStudy.getCitation());
}
assertThat(references, hasItem("Arroyo, M.T.K., R. Primack & J.J. Armesto. 1982. Community studies in pollination ecology in the high temperate Andes of central Chile. I. Pollination mechanisms and altitudinal variation. Amer. J. Bot. 69:82-97."));
assertThat(taxonIndex.findTaxonByName("Diplopterys pubipetala"), is(notNullValue()));
assertThat(taxonIndex.findTaxonByName("Juniperus communis"), is(notNullValue()));
assertThat(taxonIndex.findTaxonByName("Turdus torquatus"), is(notNullValue()));
}
Aggregations