@Test public void createTaxonWithExplicitRanks() throws NodeFactoryException { Taxon taxon1 = new TaxonImpl("foo", "foo:123"); taxon1.setPath("a kingdom name | a phylum name | boo name | a class name | an order name | a family name | a genus name | a species name"); taxon1.setPathIds("a kingdom id | a phylum id | boo id | a class id | an order id | a family id | a genus id | a species id"); taxon1.setPathNames("kingdom | phylum | boo | class | order | family | genus | species"); TaxonNode taxon = taxonService.getOrCreateTaxon(taxon1); assertThat(propertyOf(taxon, "kingdomName"), is("a kingdom name")); assertThat(propertyOf(taxon, "kingdomId"), is("a kingdom id")); assertThat(propertyOf(taxon, "phylumName"), is("a phylum name")); assertThat(propertyOf(taxon, "phylumId"), is("a phylum id")); assertThat(propertyOf(taxon, "orderName"), is("an order name")); assertThat(propertyOf(taxon, "orderId"), is("an order id")); assertThat(propertyOf(taxon, "className"), is("a class name")); assertThat(propertyOf(taxon, "classId"), is("a class id")); assertThat(propertyOf(taxon, "familyName"), is("a family name")); assertThat(propertyOf(taxon, "familyId"), is("a family id")); assertThat(propertyOf(taxon, "genusName"), is("a genus name")); assertThat(propertyOf(taxon, "genusId"), is("a genus id")); assertThat(propertyOf(taxon, "speciesName"), is("a species name")); assertThat(propertyOf(taxon, "speciesId"), is("a species id")); }
@Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { TaxonNode taxonNode = findTaxon(taxon); if (taxonNode == null) { taxonNode = TaxonUtil.isResolved(taxon) ? createAndIndexTaxon(taxon, taxon) : addNoMatchTaxon(taxon); } return taxonNode == null ? createAndIndexTaxon(taxon, taxon) : taxonNode; }
NonResolvingTaxonIndex implements TaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { TaxonNode taxonNode = findTaxon(taxon); if (taxonNode == null) { taxonNode = TaxonUtil.isResolved(taxon) ? createAndIndexTaxon(taxon, taxon) : addNoMatchTaxon(taxon); } return taxonNode == null ? createAndIndexTaxon(taxon, taxon) : taxonNode; } }
NonResolvingTaxonIndex implements TaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { TaxonNode taxonNode = findTaxon(taxon); if (taxonNode == null) { taxonNode = TaxonUtil.isResolved(taxon) ? createAndIndexTaxon(taxon, taxon) : addNoMatchTaxon(taxon); } return taxonNode == null ? createAndIndexTaxon(taxon, taxon) : taxonNode; } NonResolvingTaxonIndex(GraphDatabaseService graphDbService); }
NonResolvingTaxonIndex implements TaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { TaxonNode taxonNode = findTaxon(taxon); if (taxonNode == null) { taxonNode = TaxonUtil.isResolved(taxon) ? createAndIndexTaxon(taxon, taxon) : addNoMatchTaxon(taxon); } return taxonNode == null ? createAndIndexTaxon(taxon, taxon) : taxonNode; } NonResolvingTaxonIndex(GraphDatabaseService graphDbService); @Override TaxonNode getOrCreateTaxon(Taxon taxon); @Override TaxonNode findTaxonById(String externalId); @Override TaxonNode findTaxonByName(String name); IndexHits<Node> findCloseMatchesForTaxonName(String taxonName); }
NonResolvingTaxonIndex implements TaxonIndex { @Override public TaxonNode getOrCreateTaxon(Taxon taxon) throws NodeFactoryException { TaxonNode taxonNode = findTaxon(taxon); if (taxonNode == null) { taxonNode = TaxonUtil.isResolved(taxon) ? createAndIndexTaxon(taxon, taxon) : addNoMatchTaxon(taxon); } return taxonNode == null ? createAndIndexTaxon(taxon, taxon) : taxonNode; } NonResolvingTaxonIndex(GraphDatabaseService graphDbService); @Override TaxonNode getOrCreateTaxon(Taxon taxon); @Override TaxonNode findTaxonById(String externalId); @Override TaxonNode findTaxonByName(String name); IndexHits<Node> findCloseMatchesForTaxonName(String taxonName);  }