Search in sources :

Example 1 with BatchListener

use of org.eol.globi.util.BatchListener in project eol-globi-data by jhpoelen.

the class NameResolver method resolveNames.

public void resolveNames(Long batchSize, GraphDatabaseService graphService) {
    StopWatch watchForEntireRun = new StopWatch();
    watchForEntireRun.start();
    StopWatch watchForBatch = new StopWatch();
    watchForBatch.start();
    final AtomicLong nameCount = new AtomicLong(0L);
    final TransactionPerBatch batchListener = new TransactionPerBatch(graphService);
    NodeListener listener = node -> nameCount.set(resolveNamesInStudy(batchSize, watchForBatch, nameCount.get(), node, batchListener));
    LOG.info("resolving names...");
    NodeUtil.processNodes(batchSize, graphService, listener, StudyConstant.TITLE, "*", "studies", batchListener);
    watchForEntireRun.stop();
    LOG.info("resolved [" + nameCount + "] names in " + getProgressMsg(nameCount.get(), watchForEntireRun.getTime()));
}
Also used : Taxon(org.eol.globi.domain.Taxon) TaxonIndex(org.eol.globi.data.TaxonIndex) NodeUtil(org.eol.globi.util.NodeUtil) Logger(org.slf4j.Logger) NodeListener(org.eol.globi.util.NodeListener) Direction(org.neo4j.graphdb.Direction) LoggerFactory(org.slf4j.LoggerFactory) StudyConstant(org.eol.globi.domain.StudyConstant) StudyNode(org.eol.globi.domain.StudyNode) RelTypes(org.eol.globi.domain.RelTypes) Node(org.neo4j.graphdb.Node) AtomicLong(java.util.concurrent.atomic.AtomicLong) Relationship(org.neo4j.graphdb.Relationship) GraphServiceFactory(org.eol.globi.db.GraphServiceFactory) GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) NodeFactoryException(org.eol.globi.data.NodeFactoryException) BatchListener(org.eol.globi.util.BatchListener) StopWatch(org.apache.commons.lang.time.StopWatch) SpecimenNode(org.eol.globi.domain.SpecimenNode) Study(org.eol.globi.domain.Study) TaxonNode(org.eol.globi.domain.TaxonNode) AtomicLong(java.util.concurrent.atomic.AtomicLong) NodeListener(org.eol.globi.util.NodeListener) StopWatch(org.apache.commons.lang.time.StopWatch)

Aggregations

AtomicLong (java.util.concurrent.atomic.AtomicLong)1 StopWatch (org.apache.commons.lang.time.StopWatch)1 NodeFactoryException (org.eol.globi.data.NodeFactoryException)1 TaxonIndex (org.eol.globi.data.TaxonIndex)1 GraphServiceFactory (org.eol.globi.db.GraphServiceFactory)1 RelTypes (org.eol.globi.domain.RelTypes)1 SpecimenNode (org.eol.globi.domain.SpecimenNode)1 Study (org.eol.globi.domain.Study)1 StudyConstant (org.eol.globi.domain.StudyConstant)1 StudyNode (org.eol.globi.domain.StudyNode)1 Taxon (org.eol.globi.domain.Taxon)1 TaxonNode (org.eol.globi.domain.TaxonNode)1 BatchListener (org.eol.globi.util.BatchListener)1 NodeListener (org.eol.globi.util.NodeListener)1 NodeUtil (org.eol.globi.util.NodeUtil)1 Direction (org.neo4j.graphdb.Direction)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Node (org.neo4j.graphdb.Node)1 Relationship (org.neo4j.graphdb.Relationship)1 Logger (org.slf4j.Logger)1