@Test public void testMaterializeVerbatimParents() throws Exception { NormalizerStats stats = normalize(7); assertEquals(3, stats.getRoots()); assertEquals(11, stats.getCount()); assertEquals(2, stats.getSynonyms()); assertEquals(9, stats.getCountByOrigin(Origin.SOURCE)); assertEquals(1, stats.getCountByOrigin(Origin.VERBATIM_ACCEPTED)); assertEquals(1, stats.getCountByOrigin(Origin.VERBATIM_PARENT)); assertEquals(1, stats.getCountByRank(Rank.KINGDOM)); assertEquals(1, stats.getCountByRank(Rank.PHYLUM)); assertEquals(1, stats.getCountByRank(Rank.ORDER)); assertEquals(4, stats.getCountByRank(Rank.SPECIES)); try (Transaction tx = beginTx()) { NameUsage u = getUsageByTaxonId("100"); assertFalse(u.isSynonym()); assertEquals(Rank.SPECIES, u.getRank()); assertEquals("Leptura tinktura Döring, 2011", u.getScientificName()); u = getUsageByKey(u.getParentKey()); Integer coleopteraID = u.getKey(); assertFalse(u.isSynonym()); assertEquals(Rank.ORDER, u.getRank()); assertEquals("Coleoptera", u.getScientificName()); u = getUsageByKey(u.getParentKey()); assertFalse(u.isSynonym()); assertEquals(Rank.CLASS, u.getRank()); assertEquals("Insecta", u.getScientificName()); u = getUsageByKey(u.getParentKey()); assertFalse(u.isSynonym()); assertEquals(Rank.PHYLUM, u.getRank()); assertEquals("Arthropoda", u.getScientificName()); u = getUsageByKey(u.getParentKey()); assertFalse(u.isSynonym()); assertEquals(Rank.KINGDOM, u.getRank()); assertEquals("Animalia", u.getScientificName()); assertNull(u.getParentKey()); u = getUsageByTaxonId("101"); assertTrue(u.isSynonym()); assertEquals(Rank.SPECIES, u.getRank()); assertEquals("Leptura nigrella Adams, 1909", u.getScientificName()); u = getUsageByKey(u.getAcceptedKey()); assertFalse(u.isSynonym()); assertEquals(Rank.SPECIES, u.getRank()); assertEquals("Pygoleptura nigrella", u.getScientificName()); assertEquals(coleopteraID, u.getParentKey()); Integer pNigrellaID = u.getKey(); u = getUsageByTaxonId("102"); assertEquals(pNigrellaID, u.getKey()); u = getUsageByTaxonId("103"); assertFalse(u.isSynonym()); assertEquals(Rank.SPECIES, u.getRank()); assertEquals("Pygoleptura tinktura Döring, 2011", u.getScientificName()); u = getUsageByKey(u.getParentKey()); assertFalse(u.isSynonym()); assertNull(u.getRank()); assertEquals("Pygoleptura", u.getScientificName()); assertNull(u.getParentKey()); u = getUsageByTaxonId("104"); assertEquals(Rank.SUBSPECIES, u.getRank()); assertEquals("Pygoleptura tinktura subsp. synomica Döring, 2011", u.getScientificName()); assertTrue(u.isSynonym()); u = getUsageByKey(u.getAcceptedKey()); assertFalse(u.isSynonym()); assertNull(u.getRank()); assertEquals("Pygoleptura synomica", u.getScientificName()); assertNull(u.getParentKey()); } }
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();  }