use of org.eol.globi.service.DOIResolverCache in project eol-globi-data by jhpoelen.
the class Normalizer method resolveAndLinkTaxa.
private void resolveAndLinkTaxa(CommandLine cmdLine, GraphDatabaseService graphService) {
if (cmdLine == null || !cmdLine.hasOption(OPTION_SKIP_RESOLVE_CITATIONS)) {
LOG.info("resolving citations to DOIs ...");
new LinkerDOI(graphService, new DOIResolverCache()).link();
new LinkerDOI(graphService).link();
} else {
LOG.info("skipping citation resolving ...");
}
if (cmdLine == null || !cmdLine.hasOption(OPTION_SKIP_TAXON_CACHE)) {
LOG.info("resolving names with taxon cache ...");
final TaxonCacheService taxonCacheService = new TaxonCacheService("/taxa/taxonCache.tsv.gz", "/taxa/taxonMap.tsv.gz");
try {
ResolvingTaxonIndex index = new ResolvingTaxonIndex(taxonCacheService, graphService);
index.setIndexResolvedTaxaOnly(true);
TaxonFilter taxonCacheFilter = new TaxonFilter() {
private KnownBadNameFilter knownBadNameFilter = new KnownBadNameFilter();
@Override
public boolean shouldInclude(Taxon taxon) {
return taxon != null && knownBadNameFilter.shouldInclude(taxon);
}
};
new NameResolver(graphService, index, taxonCacheFilter).resolve();
LOG.info("adding same and similar terms for resolved taxa...");
List<Linker> linkers = new ArrayList<>();
linkers.add(new LinkerTermMatcher(graphService, taxonCacheService));
appendOpenTreeTaxonLinker(graphService, linkers);
linkers.forEach(LinkUtil::doTimedLink);
LOG.info("adding same and similar terms for resolved taxa done.");
} finally {
taxonCacheService.shutdown();
}
LOG.info("resolving names with taxon cache done.");
} else {
LOG.info("skipping taxon cache ...");
}
if (cmdLine == null || !cmdLine.hasOption(OPTION_SKIP_RESOLVE)) {
new NameResolver(graphService, new NonResolvingTaxonIndex(graphService)).resolve();
new TaxonInteractionIndexer(graphService).index();
} else {
LOG.info("skipping taxa resolving ...");
}
if (cmdLine == null || !cmdLine.hasOption(OPTION_SKIP_LINK)) {
List<Linker> linkers = new ArrayList<>();
linkers.add(new LinkerTaxonIndex(graphService));
linkers.forEach(LinkUtil::doTimedLink);
} else {
LOG.info("skipping linking ...");
}
if (cmdLine == null || !cmdLine.hasOption(OPTION_SKIP_LINK_THUMBNAILS)) {
LinkUtil.doTimedLink(new ImageLinker(graphService, null));
} else {
LOG.info("skipping linking of taxa to thumbnails ...");
}
}
Aggregations