#66 Decouple apibinding from implementations


The available OntologyStorer implementations are currently all hardcoded into the OWLManager class available from the apibinding module. This means that the apibinding module needs to have fixed dependencies on all of the modules providing the OntologyStorer implementations, even if they do not use the module otherwise.

I wrote a patch up that removes the dependency by referring to OntologyStorer implementations using their OWLOntologyFormat's as indirect references. In order to decouple apibinding from the other modules at compile time, this requires that the formats be defined in a different module to the OntologyStorer implementation that they refer to. To fix this, I moved the OWLOntologyFormat instances to a new package inside of the api module. These formats are used as the keys to access factories for each OntologyStorer using a java.util.ServiceLoader (ie, Service Provider Interface/SPI) implementation. After this patch I was able to switch the maven scopes for each of the relevant dependencies to runtime so that they can be excluded as necessary without affecting the operation of the OWLManager class. In addition, alternative implementations of any of the OntologyStorers can now be substituted at runtime and used by the OWLManager class without having to recompile OWLAPI, as the formats are used at runtime to find available implementations.

If other formats are to be included in OWLManager they would need to be added to the api module but the implementation does not have to be available when the format is added, as the system ignores any cases where a format did not have any available OntologyStorerFactory instances available.

You can find a patch at:



  • Peter Ansell

    Peter Ansell - 2012-06-08

    The patch also now abstracts away from OWLManager as a singleton that everyone needs to reference directly in code by creating an OWLOntologyManagerFactoryRegistry (name could be improved) in the api module that will detect OWLManager, or any other implementations, and provide the same methods as OWLManager in an SPI environment.

    The patch also removes the compile time dependencies on reasoners using the reasoner name as the key for the reasoner to identify the available reasoners at runtime.

    Note, the patch is currently on top of two other branches so it might not apply directly, although it has been rebased overall on top of the current trunk. The majority of the changes that it sits on top of are in the duplicated-rdf-classes branch which is the subject of bug number 3516742, although I am thinking about reverting the names of the formats to their previous values and just making the patch move the formats to owlapi-api.jar

  • Peter Ansell

    Peter Ansell - 2012-06-08
    • summary: Decouple OntologyStorer implementations from apibinding --> Decouple apibinding from implementations
  • Ignazio Palmisano

    • assigned_to: nobody --> ignazio1977
  • Peter Ansell

    Peter Ansell - 2012-10-13

    I have started the process of extracting this patch onto its own branch properly, as previously its patches contained references to both the RDF class consolidation patch and the Sesame Rio integration patches.

    I have so far been trying to cherry-pick the relevant patches from the ansellpatches branch where they were put for a while, so I need to do some work to isolate the Sesame Rio patch from this patch as the new OWLOntologyFormat classes in the Sesame Rio patch are in some cases inside patches bound for this bug, where they should be separated onto a special Sesame Rio patch to make it easy for you to integrate it.

    In addition, I have made the format heirarchy changes backwards compatible. The patch still creates a new org.semanticweb.api.formats package to make it possible to easily maintain the formats, but the references in the APIs, and the constructors for the current formats are still there. There are quite a few changes to contract tests that in most cases should not be necessary anymore. I have hopefully isolated them to a single Git commit, and I will go through removing them as I verify the patch.

    The new patches will be at:



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks