@Test public void testDenormedIndexFungorumSmall() throws Exception { NormalizerStats stats = normalize(20); assertEquals(1, stats.getRoots()); assertEquals(9, stats.getCountByOrigin(Origin.SOURCE)); assertEquals(24, stats.getCountByOrigin(Origin.DENORMED_CLASSIFICATION)); assertEquals(33, stats.getCount()); try (Transaction tx = beginTx()) { NameUsage u = getUsageByCanonical("Chaetosphaeria"); assertUsage("970", false, "Chaetosphaeria Tul. & C.Tul.", null, null, Rank.GENUS, "Chaetosphaeriaceae", "Chaetosphaeriales", "Sordariomycetes", "Ascomycota", "Fungi"); Map<String, Rank> expected = Maps.newHashMap(); expected.put("Fungi", Rank.KINGDOM); expected.put("Ascomycota", Rank.PHYLUM); expected.put("Arthoniomycetes", Rank.CLASS); expected.put("Dothideomycetes", Rank.CLASS); expected.put("Incertae sedis", Rank.CLASS); expected.put("Lecanoromycetes", Rank.CLASS); expected.put("Sordariomycetes", Rank.CLASS); expected.put("Arthoniales", Rank.ORDER); expected.put("Capnodiales", Rank.ORDER); expected.put("Chaetosphaeriales", Rank.ORDER); expected.put("Lecanorales", Rank.ORDER); expected.put("Pleosporales", Rank.ORDER); expected.put("Triblidiales", Rank.ORDER); expected.put("Arthoniaceae", Rank.FAMILY); expected.put("Arthopyreniaceae", Rank.FAMILY); expected.put("Chaetosphaeriaceae", Rank.FAMILY); expected.put("Mycosphaerellaceae", Rank.FAMILY); expected.put("Parmeliaceae", Rank.FAMILY); expected.put("Triblidiaceae", Rank.FAMILY); expected.put("Arthopyrenia", Rank.GENUS); expected.put("Blitridium", Rank.GENUS); expected.put("Pseudocercospora", Rank.GENUS); expected.put("Septoria", Rank.GENUS); expected.put("Sphaerella", Rank.GENUS); for (Node n : Iterators.loop(dao.allTaxa())) { u = dao.readUsage(n, true); if (u.getOrigin() == Origin.DENORMED_CLASSIFICATION) { Rank r = expected.remove(u.getScientificName()); if (r == null) { fail("Missing denormed usage " + u.getScientificName()); } else if (!r.equals(u.getRank())) { fail("Wrong rank for denormed usage " + u.getScientificName()); } } } assertTrue(expected.isEmpty()); } }
private void normalize() throws NormalizationFailedException { LOG.info("Start processing explicit relations ..."); int counter = 0; Transaction tx = dao.getNeo().beginTx(); try { for (Node n : dao.getNeo().getAllNodes()) { setupRelation(n); counter++; relationMeter.mark(); tx = renewTx(tx); if (counter % 10000 == 0) { LOG.debug("Processed relations for {} nodes", counter); checkInterrupted(); } } } finally { tx.success(); tx.close(); } applyDenormedClassification(); cleanupRelations(); LOG.info("Relation setup completed, {} nodes processed. Setup rate: {}", counter, relationMeter.getMeanRate()); }
Normalizer extends ImportDb implements Runnable { private void normalize() throws NormalizationFailedException { LOG.info("Start processing explicit relations ..."); int counter = 0; Transaction tx = dao.getNeo().beginTx(); try { for (Node n : dao.getNeo().getAllNodes()) { setupRelation(n); counter++; relationMeter.mark(); tx = renewTx(tx); if (counter % 10000 == 0) { LOG.debug("Processed relations for {} nodes", counter); checkInterrupted(); } } } finally { tx.success(); tx.close(); } applyDenormedClassification(); cleanupRelations(); LOG.info("Relation setup completed, {} nodes processed. Setup rate: {}", counter, relationMeter.getMeanRate()); } }
Normalizer extends ImportDb implements Runnable { private void normalize() throws NormalizationFailedException { LOG.info("Start processing explicit relations ..."); int counter = 0; Transaction tx = dao.getNeo().beginTx(); try { for (Node n : dao.getNeo().getAllNodes()) { setupRelation(n); counter++; relationMeter.mark(); tx = renewTx(tx); if (counter % 10000 == 0) { LOG.debug("Processed relations for {} nodes", counter); checkInterrupted(); } } } finally { tx.success(); tx.close(); } applyDenormedClassification(); cleanupRelations(); LOG.info("Relation setup completed, {} nodes processed. Setup rate: {}", counter, relationMeter.getMeanRate()); } private  Normalizer(UUID datasetKey, UsageDao dao, File dwca, int batchSize,
                     MetricRegistry registry, Map<String, UUID> constituents, IdLookup lookup); }
Normalizer extends ImportDb implements Runnable { private void normalize() throws NormalizationFailedException { LOG.info("Start processing explicit relations ..."); int counter = 0; Transaction tx = dao.getNeo().beginTx(); try { for (Node n : dao.getNeo().getAllNodes()) { setupRelation(n); counter++; relationMeter.mark(); tx = renewTx(tx); if (counter % 10000 == 0) { LOG.debug("Processed relations for {} nodes", counter); checkInterrupted(); } } } finally { tx.success(); tx.close(); } applyDenormedClassification(); cleanupRelations(); LOG.info("Relation setup completed, {} nodes processed. Setup rate: {}", counter, relationMeter.getMeanRate()); } private  Normalizer(UUID datasetKey, UsageDao dao, File dwca, int batchSize,
                     MetricRegistry registry, Map<String, UUID> constituents, IdLookup lookup); static Normalizer create(NormalizerConfiguration cfg, UUID datasetKey, MetricRegistry registry,
                                  Map<String, UUID> constituents, IdLookup lookup); static Normalizer create(UUID datasetKey, UsageDao dao, File dwca, IdLookup lookup, int batchSize); static Normalizer create(NormalizerConfiguration cfg, UUID datasetKey); static Normalizer create(NormalizerConfiguration cfg, MetricRegistry registry, UUID datasetKey); void run(); void run(boolean closeDao); NormalizerStats getStats(); }
Normalizer extends ImportDb implements Runnable { private void normalize() throws NormalizationFailedException { LOG.info("Start processing explicit relations ..."); int counter = 0; Transaction tx = dao.getNeo().beginTx(); try { for (Node n : dao.getNeo().getAllNodes()) { setupRelation(n); counter++; relationMeter.mark(); tx = renewTx(tx); if (counter % 10000 == 0) { LOG.debug("Processed relations for {} nodes", counter); checkInterrupted(); } } } finally { tx.success(); tx.close(); } applyDenormedClassification(); cleanupRelations(); LOG.info("Relation setup completed, {} nodes processed. Setup rate: {}", counter, relationMeter.getMeanRate()); } private  Normalizer(UUID datasetKey, UsageDao dao, File dwca, int batchSize,
                     MetricRegistry registry, Map<String, UUID> constituents, IdLookup lookup); static Normalizer create(NormalizerConfiguration cfg, UUID datasetKey, MetricRegistry registry,
                                  Map<String, UUID> constituents, IdLookup lookup); static Normalizer create(UUID datasetKey, UsageDao dao, File dwca, IdLookup lookup, int batchSize); static Normalizer create(NormalizerConfiguration cfg, UUID datasetKey); static Normalizer create(NormalizerConfiguration cfg, MetricRegistry registry, UUID datasetKey); void run(); void run(boolean closeDao); NormalizerStats getStats();  }