elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/taxonomy/TaxonomyPrinter.java
protected static <T extends ElkEntity> void processTaxomomy(
			final Taxonomy<T> taxonomy, final Appendable writer)
					throws IOException {

		final ElkObject.Factory factory = new ElkObjectEntityRecyclingFactory();

		// Declarations.

		final List<T> members = new ArrayList<T>(
				taxonomy.getNodes().size() * 2);

		for (final TaxonomyNode<T> node : taxonomy.getNodes()) {
			for (final T member : node) {
				// TODO: this should check whether IRIs are predefined!
				if (!member.getIri()
						.equals(taxonomy.getTopNode().getCanonicalMember()
								.getIri())
						&& !member.getIri().equals(taxonomy.getBottomNode()
								.getCanonicalMember().getIri())) {
					members.add(member);
				}
			}
		}

		Collections.sort(members, taxonomy.getKeyProvider().getComparator());

		printDeclarations(members, factory, writer);

		// Relations.

		final TreeSet<T> canonicalMembers = new TreeSet<T>(
				taxonomy.getKeyProvider().getComparator());
		for (final TaxonomyNode<T> node : taxonomy.getNodes()) {
			canonicalMembers.add(node.getCanonicalMember());
		}

		for (final T canonicalMember : canonicalMembers) {
			final TaxonomyNode<T> node = taxonomy.getNode(canonicalMember);

			final ArrayList<T> orderedEquivalentMembers = new ArrayList<T>(
					node.size());
			for (final T member : node) {
				orderedEquivalentMembers.add(member);
			}
			Collections.sort(orderedEquivalentMembers,
					taxonomy.getKeyProvider().getComparator());

			final TreeSet<T> orderedSuperMembers = new TreeSet<T>(
					taxonomy.getKeyProvider().getComparator());
			for (final TaxonomyNode<T> superNode : node.getDirectSuperNodes()) {
				orderedSuperMembers.add(superNode.getCanonicalMember());
			}

			printMemberAxioms(canonicalMember, orderedEquivalentMembers,
					orderedSuperMembers, taxonomy, factory, writer);
		}
	}
protected static <T extends ElkEntity> void processTaxomomy(
			final Taxonomy<T> taxonomy, final Appendable writer)
					throws IOException {

		final ElkObject.Factory factory = new ElkObjectEntityRecyclingFactory();

		// Declarations.

		final List<T> members = new ArrayList<T>(
				taxonomy.getNodes().size() * 2);

		for (final TaxonomyNode<T> node : taxonomy.getNodes()) {
			for (final T member : node) {
				// TODO: this should check whether IRIs are predefined!
				if (!member.getIri()
						.equals(taxonomy.getTopNode().getCanonicalMember()
								.getIri())
						&& !member.getIri().equals(taxonomy.getBottomNode()
								.getCanonicalMember().getIri())) {
					members.add(member);
				}
			}
		}

		Collections.sort(members, taxonomy.getKeyProvider().getComparator());

		printDeclarations(members, factory, writer);

		// Relations.

		final TreeSet<T> canonicalMembers = new TreeSet<T>(
				taxonomy.getKeyProvider().getComparator());
		for (final TaxonomyNode<T> node : taxonomy.getNodes()) {
			canonicalMembers.add(node.getCanonicalMember());
		}

		for (final T canonicalMember : canonicalMembers) {
			final TaxonomyNode<T> node = taxonomy.getNode(canonicalMember);

			final ArrayList<T> orderedEquivalentMembers = new ArrayList<T>(
					node.size());
			for (final T member : node) {
				orderedEquivalentMembers.add(member);
			}
			Collections.sort(orderedEquivalentMembers,
					taxonomy.getKeyProvider().getComparator());

			final TreeSet<T> orderedSuperMembers = new TreeSet<T>(
					taxonomy.getKeyProvider().getComparator());
			for (final TaxonomyNode<T> superNode : node.getDirectSuperNodes()) {
				orderedSuperMembers.add(superNode.getCanonicalMember());
			}

			printMemberAxioms(canonicalMember, orderedEquivalentMembers,
					orderedSuperMembers, taxonomy, factory, writer);
		}
	}
Process a taxonomy and write a normalized serialization.

@param taxonomy
@param writer
@throws IOException