public void visit (@Nonnull final TaxonomyVisitor visitor) { visit(taxonomy.getTopConcept(), visitor); }
taxon = parentTaxon.createSubTaxon().withScientificName(scientificName). withScientificNameId(scientificNameId). withSpecificEpythet(specificEpythet). withDisplayNames(displayable). withId(id). withRank(rank). withInitializers(initializers). build(); map.put(scientificName, taxon);
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull protected Taxon createAves (final @Nonnull Taxonomy taxonomy, final @Nonnull String idPrefix) throws RepositoryException { return taxonomy.createTopTaxon().withScientificName("Aves"). withSpecificEpythet("Aves"). withId(new Id(idPrefix + "/Animalia/Chordata/Aves")). withRank(Taxon.Rank.CLASS). build(); }
@Override public void preVisit (final @Nonnull Taxon taxon) { final List<? extends Taxon> synonyms = taxon.findSynonyms().results(); if (synonyms.isEmpty()) { // TODO: missing counterpart } else if (synonyms.size() == 1) { final TaxonDifferenceSet taxonDifferenceSet = new TaxonDifferenceSet(taxon, synonyms.iterator().next()); if (!taxonDifferenceSet.isEmpty()) { differenceList.add(taxonDifferenceSet); } } else // FIXME: indeed you should only retain the one of the target taxonomy { System.err.println("WARNING Synonym count > 1 for " + taxon.getDisplayName()); // throw new RuntimeException("Synonym count > 1: " + synonyms); } } });
this.otherTaxon = otherTaxon; final String path1 = getPath(taxon); final String path2 = getPath(otherTaxon); final boolean isSpeciesOrSubSpecies = Character.isLowerCase(taxon.getDisplayName().charAt(0)); if (isSpeciesOrSubSpecies && !nullEquals(taxon.getDisplayName(Locale.ENGLISH), otherTaxon.getDisplayName(Locale.ENGLISH)))
@Override public String toString() { return String.format("%s -> %s", taxon.getDisplayName(Locale.ENGLISH), otherTaxon.getDisplayName(Locale.ENGLISH)); } });
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnull @Override public Taxon.Builder createSubTaxon() { return taxonomy.createTaxon().withInitializer(new Initializer<Taxon>() { public Taxon initialize (final @Nonnull Taxon taxon) { getLookup().lookup(Concept.class).getSkosNarrowers().add(taxon.getLookup().lookup(Concept.class)); // as(Concept.class).getSkosNarrowers().add(taxon.as(Concept.class)); FIXME return taxon; } }); }
public void accept (final @Nonnull TaxonomyVisitor visitor) { accept(taxonomy.getTopTaxon(), visitor); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnull @Override public Taxon.Builder createTopTaxon() { return createTaxon().withInitializer(new Initializer<Taxon>() { @Override @Nonnull public Taxon initialize (final @Nonnull Taxon taxon) { getLookup().lookup(ConceptScheme.class).getSkosHasTopConcepts().add(taxon.getLookup().lookup(Concept.class)); // as(ConceptScheme.class).getSkosHasTopConcepts().add(taxon.as(Concept.class)); return taxon; } }); }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public void import_ (final @Nonnull File file) throws IOException { final TaxonomyManager taxonomyManager = Locator.find(TaxonomyManager.class); final Importer importer = taxonomyManager.as(Importer.class); importer.import_(repository, file); }
final TaxonomyTraverser traverser = new DefaultTaxonomyTraverser(taxonomy); traverser.accept(new TaxonomyVisitorSupport()
private static String getPath (final @Nonnull Taxon taxon) { return taxon.as(Entity.class).getQName().getLocalPart().replaceAll(".*/Aves", "/Aves"); }
@Override public String toString() { final StringBuilder buffer = new StringBuilder(); for (final TaxonDifferenceSet taxonDifference : differenceList) { buffer.append(taxonDifference.toString()).append("\n"); } return buffer.toString(); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull public String findXenoCantoId (final @Nonnull Taxon taxon) throws NotFoundException { final Id id = taxon.getScientificNameId(); final String lsidScientificName = lsidScientificNameMapById.get(id.stringValue()); String xenoCantoScientificName = lsidToXenoCantoScientificNameMap.get(lsidScientificName); xenoCantoScientificName = (xenoCantoScientificName != null) ? xenoCantoScientificName : lsidScientificName; final String xenoCantoId = xenoCantoIdMapByScientificName.get(xenoCantoScientificName); log.info("TRANSLATE: id: {} -> LSID scientific name: {} -> xenoCantoScientificName: {} xenoCantoId: {}", new Object[] { id, lsidScientificName, xenoCantoScientificName, xenoCantoId }); return xenoCantoId; } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override public void init (final @Nonnull Taxonomy.Builder builder) { log.trace("init({}) - @{}", builder, Integer.toHexString(System.identityHashCode(this))); RDFUtils.setDisplayName(entity, builder.getDisplayable().getDisplayName()); }
@Override public String toString() { final StringBuilder buffer = new StringBuilder(); buffer.append(taxon.getDisplayName(Locale.ITALIAN)).append("\n"); // FIXME locale for (final Difference difference : differences) { buffer.append(difference.toString()).append("\n"); } return buffer.toString(); } }