in Research

Serializing an OWL ontology in DL-syntax

One  month ago I was finishing my contribution to a paper and I had to include some of the axioms defined in the ontology we designed. I knew DL-syntax but I did not want to spent time to rewrite the entire ontology (in RDF/XML format) from the scratch so I decided to look for a method or conversion tool (preferably on-line) to serialize a DL ontology using this syntax. I was surprised that most of the tools do not have support to this feature (on the best of my knowledge) but I went into the OWL-API (version 3.2.4) documentation and source code and I finally found a class, coded by Matthew Horridge, in which the load and serialization of ontologies were explained. After that I was checking more documentation about some packages for serialization and I could customize the previous code to get a DL-syntax serialization of the ontology.

...
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology localOntology = manager.loadOntologyFromOntologyDocument(file);
OWLOntologyFormat format = manager.getOntologyFormat(localOntology);
DLSyntaxOntologyFormat dlFormat = new DLSyntaxOntologyFormat();
DLSyntaxOntologyStorer storer = new DLSyntaxOntologyStorer();
//IRI documentIRI: file to save the DL version
if (storer.canStoreOntology(dlFormat)){
  storer.storeOntology(manager, localOntology, documentIRI, dlFormat);
}
...

It is just a code snippet…but I spent some time  to get a representation of an OWL ontology in DL-syntax when I thought that it was trivial!

Finally, these are the tools I checked:

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.