@Test public void buildTaxonInterIndex() throws NodeFactoryException, PropertyEnricherException { Specimen human = nodeFactory.createSpecimen(nodeFactory.createStudy(new StudyImpl("bla", null, null)), new TaxonImpl("Homo sapiens", "NCBI:9606")); Specimen animal = nodeFactory.createSpecimen(nodeFactory.createStudy(new StudyImpl("bla", null, null)), new TaxonImpl("Canis lupus", "WORMS:2")); human.ate(animal); for (int i = 0; i < 10; i++) { Specimen fish = nodeFactory.createSpecimen(nodeFactory.createStudy(new StudyImpl("bla", null, null)), new TaxonImpl("Arius felis", "WORMS:158711")); human.ate(fish); } assertNull(taxonIndex.findTaxonById("WORMS:2")); assertNull(taxonIndex.findTaxonByName("Homo sapiens")); new NameResolver(new NonResolvingTaxonIndex(getGraphDb())) .index(new GraphServiceFactoryProxy(getGraphDb())); new TaxonInteractionIndexer().index(getGraphDb()); Taxon homoSapiens = taxonIndex.findTaxonByName("Homo sapiens"); assertNotNull(homoSapiens); Transaction transaction = getGraphDb().beginTx(); Iterable<Relationship> rels = ((NodeBacked) homoSapiens).getUnderlyingNode().getRelationships(Direction.OUTGOING, NodeUtil.asNeo4j(InteractType.ATE)); List<String> humanFood = new ArrayList<String>(); List<Long> counts = new ArrayList<Long>(); List<String> labels = new ArrayList<>(); for (Relationship rel : rels) { humanFood.add((String) rel.getEndNode().getProperty("name")); counts.add((Long) rel.getProperty("count")); labels.add((String) rel.getProperty("label")); } assertThat(humanFood.size(), is(4)); assertThat(humanFood, hasItems("Arius felis", "Canis lupus")); assertThat(counts, hasItems(10L, 1L)); assertThat(labels, hasItems("eats")); transaction.success(); transaction.close(); }
public void index(GraphDatabaseService graphService) { LOG.info("indexing interactions started..."); indexInteractions(graphService); LOG.info("indexing interactions complete."); }
TaxonInteractionIndexer implements IndexerNeo4j { public void index(GraphDatabaseService graphService) { LOG.info("indexing interactions started..."); indexInteractions(graphService); LOG.info("indexing interactions complete."); } }
TaxonInteractionIndexer implements IndexerNeo4j { public void index(GraphDatabaseService graphService) { LOG.info("indexing interactions started..."); indexInteractions(graphService); LOG.info("indexing interactions complete."); }  }
TaxonInteractionIndexer implements IndexerNeo4j { public void index(GraphDatabaseService graphService) { LOG.info("indexing interactions started..."); indexInteractions(graphService); LOG.info("indexing interactions complete."); }  void index(GraphDatabaseService graphService); void indexInteractions(GraphDatabaseService graphService); void createTaxonInteractions(Map<Fun.Tuple3<Long, String, Long>, Long> taxonInteractions, GraphDatabaseService graphService); void createInteraction(Node sourceTaxon, Node targetTaxon, InteractType relType, boolean inverted, Long interactionCount); void finalizeTx(Transaction tx); void collectTaxonInteractions(Map<Fun.Tuple3<Long, String, Long>, Long> taxonInteractions, GraphDatabaseService graphService); static String getProgressMsg(long count, long duration); @Override void index(GraphServiceFactory graphServiceFactory); }
TaxonInteractionIndexer implements IndexerNeo4j { public void index(GraphDatabaseService graphService) { LOG.info("indexing interactions started..."); indexInteractions(graphService); LOG.info("indexing interactions complete."); }  void index(GraphDatabaseService graphService); void indexInteractions(GraphDatabaseService graphService); void createTaxonInteractions(Map<Fun.Tuple3<Long, String, Long>, Long> taxonInteractions, GraphDatabaseService graphService); void createInteraction(Node sourceTaxon, Node targetTaxon, InteractType relType, boolean inverted, Long interactionCount); void finalizeTx(Transaction tx); void collectTaxonInteractions(Map<Fun.Tuple3<Long, String, Long>, Long> taxonInteractions, GraphDatabaseService graphService); static String getProgressMsg(long count, long duration); @Override void index(GraphServiceFactory graphServiceFactory);  }