use of org.eol.globi.db.GraphService in project eol-globi-data by jhpoelen.
the class NanoPress method createLinkers.
public static List<Linker> createLinkers(CommandLine cmdLine, GraphDatabaseService graphService, File pubDir) {
List<Linker> linkers = new ArrayList<>();
if (!cmdLine.hasOption("nanoOnly")) {
String batchSize = cmdLine.getOptionValue("batchSize", "1000");
linkers.add(new IndexInteractions(graphService, Integer.parseInt(batchSize)));
}
linkers.add(new LinkerTrustyNanoPubs(graphService, nanopub -> {
String code = TrustyUriUtils.getArtifactCode(nanopub.getUri().toString());
OutputStream os = null;
if (StringUtils.isNotBlank(code)) {
try {
os = new GZIPOutputStream(new FileOutputStream(new File(pubDir, code + ".trig.gz")));
} catch (IOException e) {
LOG.error("failed to produce nanopub file for [" + code + "]", e);
}
}
return os == null ? new NullOutputStream() : os;
}));
return linkers;
}
use of org.eol.globi.db.GraphService 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();
}
}
Aggregations