@Test public void indexInteractions() throws NodeFactoryException { TaxonIndex taxonIndex = getOrCreateTaxonIndex(); StudyImpl study = new StudyImpl("some study", new DOI("123.23", "222"), "some study citation"); NodeFactoryWithDatasetContext factory = new NodeFactoryWithDatasetContext(nodeFactory, new DatasetImpl("some/namespace", URI.create("https: Study interaction = factory.getOrCreateStudy(study); TaxonImpl donaldTaxon = new TaxonImpl("donald duck", "NCBI:1234"); Specimen donald = factory.createSpecimen(interaction, donaldTaxon); donald.classifyAs(taxonIndex.getOrCreateTaxon(donaldTaxon)); TaxonImpl mickeyTaxon = new TaxonImpl("mickey mouse", "NCBI:4444"); Taxon mickeyTaxonNCBI = taxonIndex.getOrCreateTaxon(new TaxonImpl("mickey mouse", "EOL:567")); NodeUtil.connectTaxa(mickeyTaxon, (TaxonNode) mickeyTaxonNCBI, getGraphDb(), RelTypes.SAME_AS); Specimen mickey = factory.createSpecimen(interaction, mickeyTaxon); mickey.classifyAs(taxonIndex.getOrCreateTaxon(mickeyTaxon)); donald.ate(mickey); new IndexInteractions().index(new GraphServiceFactoryProxy(getGraphDb())); NodeFactoryNeo4j nodeFactoryNeo4j = new NodeFactoryNeo4j(getGraphDb()); StudyImpl study1 = new StudyImpl("some study", null, "come citation"); study1.setOriginatingDataset(new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream)); StudyNode someStudy = nodeFactoryNeo4j.getOrCreateStudy(study1); assertThat(interaction.getOriginatingDataset().getNamespace(), is(someStudy.getOriginatingDataset().getNamespace())); assertThat(interaction.getTitle(), is(someStudy.getTitle())); RelationshipType hasParticipant = NodeUtil.asNeo4j(RelTypes.HAS_PARTICIPANT); Set<Long> ids = new HashSet<>(); List<Long> idList = new ArrayList<>(); NodeUtil.handleCollectedRelationships(new NodeTypeDirection(someStudy.getUnderlyingNode()), new NodeUtil.RelationshipListener() { @Override public void on(Relationship specimen) { assertThat(specimen.getEndNode().hasRelationship(Direction.INCOMING, hasParticipant), Is.is(true)); Iterable<Relationship> relationships = specimen.getEndNode().getRelationships(hasParticipant, Direction.INCOMING); for (Relationship relationship : relationships) { long id = relationship.getStartNode().getId(); ids.add(id); idList.add(id); } } }); assertThat(ids.size(), Is.is(1)); assertThat(idList.size(), Is.is(2)); Transaction transaction = getGraphDb().beginTx(); try { Node interactionNode = getGraphDb().getNodeById(idList.get(0)); assertTrue(interactionNode.hasRelationship(Direction.OUTGOING, NodeUtil.asNeo4j(RelTypes.DERIVED_FROM))); assertTrue(interactionNode.hasRelationship(Direction.OUTGOING, NodeUtil.asNeo4j(RelTypes.ACCESSED_AT))); transaction.success(); } finally { transaction.close(); } }
public IndexInteractions() { this(10000); }
IndexInteractions implements IndexerNeo4j { public IndexInteractions() { this(10000); } }
IndexInteractions implements IndexerNeo4j { public IndexInteractions() { this(10000); } IndexInteractions();  IndexInteractions(int batchSize); }
IndexInteractions implements IndexerNeo4j { public IndexInteractions() { this(10000); } IndexInteractions();  IndexInteractions(int batchSize); @Override void index(GraphServiceFactory factory); }
IndexInteractions implements IndexerNeo4j { public IndexInteractions() { this(10000); } IndexInteractions();  IndexInteractions(int batchSize); @Override void index(GraphServiceFactory factory);  }