OWL API, Jena API, Protege API, which one to use

Sabina picture Sabina · Jul 10, 2013 · Viewed 12.5k times · Source

I am trying to implement an eclipse based application working with ontologies. (My topic is semantic annotation). I will need to display the ontology to the user (as a tree) and to establish links between ontology classes and some schema.

As I only have basic programming skills, I am kind of overwhelmed right now, as to how design the application... 1. Question: Which APIs to use? I found OWL API and Jena API. In one of the posts (Is there any library that could easily change and update OWL files?) Michael stated that " OWLAPI over Jena. Jena has OWL support, but it's not designed for OWL, which makes it a bit cumbersome to use. " How do you see this? 2. Additionally, there also exists the Protégé API. At a first glance, it seems to be more suitable for me, because it already provides some GUI utilities etc. But I am a bit confused: when trying to find more information I found this http://protegewiki.stanford.edu/wiki/P4APIOverview . There it says "Work in progress", but the page was last changed in 2009. How to make sense of this? Has anybody worked with Protégé API and can share his / her experiences?

Thanks a lot in advance!

Answer

Joshua Taylor picture Joshua Taylor · Jul 10, 2013

Though this question is probably off-topic for StackOverflow, it's still an important question in general, so here are some general thoughts about the difference between the Jena API and the OWL API that, even if they don't make you prefer one over the other, might give you a better idea of what you're getting into in either case. I'm marking it community wiki so that others can update this, too.

The relationship between OWL and RDF

RDF is a graph-based representation format. An RDF graph is a directed graph whose nodes are Resources (which can be anonymous, or identified by IRIs) and Literals, and whose edges are directed links identified by IRIs. This is amazingly simple, but because the identifiers are IRIs and can often be deferenced, also amazingly useful. There's really not much more to say about RDF, because this is all there is to it. It's very flexible, and you can represent just about anything.

OWL, although designed to be used in the Semantic Web, and thus with RDF data, is really a logical language that only incidentally happens to be related to RDF. An OWL ontology consists of a set of OWL axioms, some of which declare that certain identifiers refer to individuals, some of which assert relationships between individuals (and non-individual data, such as literals), some of which express the structure of classes, and so on. The utility of OWL arises from the fact that, like RDF, it uses IRIs as identifiers, but the logical structure could exist entirely separately from RDF. In fact, though OWL ontologies can be serialized using RDF and, indeed, this is probably the most common serialization used, OWL can also be serialized in OWL/XML, the OWL Functional Syntax, the Manchester OWL Syntax, and any other serialization format that someone invents. These formats tend to focus on the OWL-level constructs, and it is clearer that an ontology is a set of axioms.

The Jena API is RDF-centric

The Jena API is very firmly rooted in RDF. The basic concept is the Model (which is more primitive than the OntModel, which is used for doing more complicated OWL-related work) which provides a convenient API for constructing RDF graphs. Using Models, you'll create resources, add properties, and so on. Jena also includes a rules-based reasoner that is quite handy for working with RDF graphs.

Now, OWL can be serialized using RDF, so it's feasible to create a wrapper layer over an RDF graph so that you could say “create for me the class that is the intersection of A and B” and get back the resource identifying that class and transparently adding to the class whatever RDF triples are needed in the OWL serialization to assert that the new class is (equivalent to) the intersection of A and B. This is what the Jena OntModel API does. It does it in a generic way, which means that Jena can handle other ontology languages that can be serialized in RDF, too. Jena OntModels, at the time of writing, only support OWL1; new constructs introduced in OWL2 are not supported yet.

The fact that OWL-level constructs in Jena are simply wrappers over the RDF serialization means that rule-based reasoning is limited in what it can achieve. In particular, the Jena rule-based reasoners for OWL are logically incomplete (i.e., they can't infer everything that the OWL specs say should be inferred). They still do fairly well for day to day work, though. Jena does provide a Reasoner interface, which allows other (possibly non rule-based) reasoners, such as Pellet to be used.

The OWL API is OWL-centric

The OWL-API is OWL-centric, and you pretty much won't have to worry about RDF at all (aside from identifying things by IRIs and creating Literals as appropriate). Using the OWL API, you'll actually treat an ontology as a set of axioms rather than as a set of triples that happen to encode some axiom. If you're already familiar with the OWL specs, and are comfortable talking about things like ObjectPropertyAssertions, then you may find the OWL API a bit more natural.

The Protégé-OWL API is also OWL- and RDF(S)- centric

From The Protégé-OWL API Programmer's Guide:

The Protege-OWL API is an open-source Java library for the Web Ontology Language (OWL) and RDF(S). The API provides classes and methods to load and save OWL files, to query and manipulate OWL data models, and to perform reasoning based on Description Logic engines. Furthermore, the API is optimized for the implementation of graphical user interfaces.

The main page for the Protégé-OWL API also has some nice diagrams of the classes that it provides. The fullest one of these shows that there are classes for both RDF(S) and OWL entities.

Protégé-OWL (the tool, not the API) is a graphical ontology editor built on the top of the Protégé-OWL API. You can develop plugins for it, which might be the best alternative in your case.