Question

Looking for API that helps me with processing of taxonomies. It should be possible to work with taxonomy in object model (loading from xml file), list categories, traverse tree of categories (if it's tree taxonomy), getting name and value for category, etc. Read only mode is sufficient. Google hasn't helped a lot :(

Usage can be as follows:

Taxonomy taxonomy = Taxonomy.loadFromStream(XMLInputStream);

List categories = taxonomy.listAllCategories();

Category rootCategory = taxonomy.getRootCategory();

What's important about it is that I don't want to handle XML directly. It's useless. If there will be some YAML adapter, taxonomy can be in YAML format and my code stays unaffected...

Was it helpful?

Solution

I don't think that you will ever find an XML based library for taxonomy: it is too specific.

However you can implement taxonomy model yourself on top of a library like XStream of JAXB in order to serialize to XML without writing verbose XML manipulation code.

OTHER TIPS

If you cannot find something specifically for taxonomies, try doing the same for ontologies. Then you can create an ontology with only taxonomic relations.

The OWL API (http://owlapi.sourceforge.net/) seems to solve the problem. You can create and OWL ontology and easily convert it to XML and back using their OWL/XML parser and writer. And here is an example of creating a hierarchy with this library: https://github.com/owlcs/owlapi/blob/master/contract/src/test/java/uk/ac/manchester/owl/owlapi/tutorial/examples/SimpleHierarchyExample.java

Hope that helps.

From my recent development, I've got to say I'm impressed with the Flex development environment (there are a lot of online resources about getting started with it). I know it's not really Java because it's similar to Flash, but it's based on ActionScript which is similar to Java. In addition, Flex and has the ability to communicate with external JavaScript resources, and is really intuitive for processing of XML resources.

In Java, I have used the standard DOM parsers that come with Java SDK (which I believe are based on the Xerces parser), but they were a hassle to use to say the least.

I think JDom may help you. Look at Jdom at Wikipedia , JDom javadoc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top