/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override public synchronized Taxon findOrCreateAnonymousTaxon (final @Nonnull String id) { log.debug("findOrCreateAnonymousTaxon({})", id); final QName qName = new QName(id); InternalElmoTaxon taxon = null; // FIXME anonymousTaxonFactory.find(qName); // InternalElmoAnonymousTaxon taxon = null; // FIXME anonymousTaxonFactory.find(qName); if (taxon == null) { taxon = conceptFactory.create(qName); // taxon = anonymousTaxonFactory.create(qName); taxon.setBindings(repository, this); // taxon.getLookup().lookup(Concept.class).getSkosInSchemes().add(getLookup().lookup(ConceptScheme.class)); // FIXME: use as() } return taxon; }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnull @Override public Taxon getTopTaxon() { log.debug("getTopConcept() - @{}", Integer.toHexString(System.identityHashCode(this))); final Set<Concept> topConcepts = as(ConceptScheme.class).getSkosHasTopConcepts(); final InternalElmoTaxon concept = (InternalElmoTaxon)topConcepts.iterator().next(); concept.setBindings(repository, this); // return concept; return Wrapper.wrap(concept); // FIXME: shouldn't be wrapped by the Proxy? }
@Override @Nonnull public Taxon build() { log.debug("createTaxon().build({})", this); final QName qName = new QName(id.stringValue()); final InternalElmoTaxon taxon = conceptFactory.create(qName); taxon.setBindings(repository, ElmoTaxonomy.this); taxon.init(this, ElmoTaxonomy.this); Taxon taxon2 = taxon; for (final Initializer<Taxon> initializer : getInitializers()) { taxon2 = initializer.initialize(taxon2); } return taxon2; } };
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Nonnull @Override public Finder<Taxon> findSubTaxa() { try { log.debug("findSubTaxa() - {}", getDisplayName()); final List<Taxon> result = new ArrayList<Taxon>(); for (final Concept skosConcept : as(Concept.class).getSkosNarrowers()) { final QName id = skosConcept.getQName(); final InternalElmoTaxon concept = ((ElmoTaxonomy)taxonomy).conceptFactory.find(id); concept.setBindings(repository, taxonomy); result.add(concept); } return new ElmoFinder<Taxon>(result); } catch (NotFoundException e) { throw new RuntimeException(e); } }