There are many different APIs for ontologies. Even if the Alignment API is independent from these APIs, it is often convenient to interact with them. For that purpose, we have designed the ontowrap API which provides a minimal interaction with
An implementation of ontowrap is a OntologyFactory and an Ontology class. The ontology factory is used for creating a new Ontology object.
The new ontowrap package defines an OntologyFactory class that is used for loading ontologies under a particular API. Depending on the used factory, the API will be different and the kind of ontology will be different. The default factory to use is provided to the abstract OntologyFactory class which is always used for loading ontologies.
There are three interfaces for ontologies:
Ontology provides a minimal interface to ontologies. It only describes the ontology but nothing from its content.
public URI getURI(); public URI getFile(); public URI getFormURI(); // Can be null public String getFormalism(); // Can be null public O getOntology(); public void setURI( URI uri ); public void setFile( URI file ); public void setFormURI( URI u ); public void setFormalism( String name ); public void setOntology( O o );
LoadedOntology
public boolean isEntity( Object o ); public boolean isClass( Object o ); public boolean isProperty( Object o ); public boolean isDataProperty( Object o ); public boolean isObjectProperty( Object o ); public boolean isIndividual( Object o ); public Set extends Object> getEntities(); public Set extends Object> getClasses(); public Set extends Object> getProperties(); public Set extends Object> getObjectProperties(); public Set extends Object> getDataProperties(); public Set extends Object> getIndividuals(); public int nbEntities(); public int nbClasses(); public int nbProperties(); public int nbDataProperties(); public int nbObjectProperties(); public int nbIndividuals(); public void unload();
/* Capability methods */ public boolean getCapabilities( int Direct, int Asserted, int Named ); /* Class methods */ public Set
The proposed solution goes in two ways:
Hence, for instance (dummy):
if ( !onto.getCapabilities( OntologyFactory.GLOBAL, OntologyFactory.INHERITED, 0 ) ) { throw new AlignementException( onto+" : cannot provide both global and inherited answers"); } else { Set<Object> sups = onto.getSuperClasses( class, OntologyFactory.GLOBAL, OntologyFactory.INHERITED, OntologyFactory.DIRECT ); }These primitives always answer, but the answers are only correct if the modalities asked in argument are supported.
Of course, similar reasoning must be applied to the other primitives.
API | Version | Implementation | Availability |
Jena | 2.5 | HeavyLoadedOntology | Since 3.5 |
OWL API | 1.0 | HeavyLoadedOntology | Since /3.5 |
OWL API | 2.0 | HeavyLoadedOntology | Discontinued (3.4-3.6) |
OWL API | 3.0 | HeavyLoadedOntology | Since 4.0 |
SKOS API | LoadedOntology | In progress (4.x) |
The Alignment API was first designed on top of what was the first published OWL API1 (the Manchester/Karlsruhe OWL API). Since it was an API for OWL, I assumed that anybody else would implement it. Too bad, we soon had the Jena API2 and plenty of others3. Instead of implementing a common API (a common set of interfaces like the OWL API), each new player designed its own.
Here are the historical howto notes for starting quickly with OWL-API (Outdated notes about the OWL API and its integration in the Alignment API).
$Id$