1
votes

I want to create a class hierarchy of the classes in an ontology using OWL API, similar to what you might see if you loaded an ontology in a tool such as Protege.

An example of how to do this may be found here: http://sourceforge.net/p/owlapi/mailman/message/27600103/.

As you can see, it seems difficult to reproduce the Protege hierarchy precisely using OWL API, and I am wondering if there is an example which will reproduce Protege's behaviour or if the fundamental reasons for not being able to do so may be clarified so an alternative approach may be found. I have had similar problems to the author of the post above, in that I can't seem to consistently reproduce the hierarchy shown by Protege by recursively going through the classes and subclasses, starting at owl:Thing, in order to create the full class hierarchy.

I need to:

  1. Create not only the class hierarchy structure of the top level ontology being parsed, but also show the hierarchical relationships with classes in dependent ontologies, as Protege does. Protege shows the classes in the top level ('active') ontology in bold, with classes taken from dependent ontologies in normal print.
  2. Create the hierarchy consistent with that shown by Protege for the same active ontology. I am assuming the hierarchy shown by Protege is correct?

I am happy to post code snippets and examples if desired, please do ask.

1
"As you can see, it seems difficult to reproduce the Protege hierarchy precisely using OWL API" - I am not seeing that at all, to be honest. Perhaps this is explained somewhere in that mailinglist thread you posted a link to, but it would be better to actually explain the exact problem you're facing here, in your question. As-is, the question is rather broad and vague.Jeen Broekstra

1 Answers

0
votes

The Protégé hierarchy is not a plain hierarchy - Protégé does some reasoning to enrich it, at the behest of its users.

If you have code snippets you wish to refine, it would be useful to see the code, an ontology snippet and what you wish the result to look like - for example, a Protégé screenshot. Then it will be easier to refine the answer.