Protege Best Practices: Export Inferred Axioms
Updated: 3 days ago
One of the most useful options in Protege that I find many new users aren't aware of is the command:
File>Export inferred axioms as ontology
This is useful in many situations. The reasoner can make all sorts of changes to your ontology. It can make individuals instances of different classes, infer new values for individuals, etc. However, these changes are not saved when you save your ontology in the standard way. You need to re-run the reasoner every time you open the ontology.
For many uses this is not an issue but there are often times when you want to save your inferences. For example, there are tools such as WebVOWL that provide enhanced visualization of your ontology. I don't typically use WebVOWL when I design an ontology. However, when I want to display an ontology to a wider group, some of whom may not have a deep understanding of OWL or Protege, WebVOWL presents a very nice graphical way to do this. Usually you don't just want to show the ontology without the inferences, you want to include all the inferred values.
Another example is when uploading files to WebProtege. As of this post date WebProtege does not include reasoners. So if you upload a file into WebProtege for others to view and comment on they will often be missing a great deal of information that would be provided by the reasoner.
Another example is the Individuals Matrix tab. This is a very useful tab for displaying individuals and the values of their object and data properties in a spreadsheet style table. However, this tab only displays values that are declared by the user, not those inferred by the reasoner.
In these cases and others the Export command solves the problem. It saves all the inferences as if they are user axioms so that these various tools will display them.
When using this option you will be presented with a Wizard that walks you through generating the export file (see the picture below for the first screen in this wizard). The wizard will present you with several options, e.g, what type of inferences (subclasses, object properties, etc.) to export. The default is that not all the inferences are checked however I typically check all the boxes. You will receive a warning for the last two check boxes that saving those may take a while but for most ontologies this is not the case. My strategy is to always try to save everything and then on the rare occasion when saving takes a long time, go back and uncheck those last two boxes and perhaps other options.
One other thing to be aware of is that the dialog for saving the inferred axioms file looks like a standard file saving dialog that will include the ".owl" extension to the file. Unfortunately, as of the time of this post (Protege version 5.5.0) this is not the case. The saved file does not have an extension so if you try to open it with Protege or some other tool it will not be recognized as an OWL file. There is a simple work around. Either include ".owl" at the end of the file name when you enter it into the Wizard (normally this would cause the file to be named "File.owl.owl" but in this case it will just have the normal ".owl" extension) or after you save the exported file navigate to the file in your operating system and edit the name and add the ".owl" extension. You will get a warning that this will change the way the file can be processed but of course this is what you want, you want it to be recognized by the OS and applications as an OWL file.
One final note (this is an update since I wrote this original post): when you use this option the third dialog in the Wizard will prompt you for an IRI for your exported ontology. It will give you a default which is just the default Protege generates for any new ontology. Often you don't want this. If you use SPARQL for example, you will have mappings in the Active Ontology tab for your ontology that you use as prefixes at the beginning of your SPARQL queries. If you accept the default IRI then these mappings have to be changed every time you do an export. What I usually do is to copy the existing IRI for the ontology before I start the Export command. Then when I get to that part of the Wizard I paste the existing IRI into the field for the IRI for the exported ontology.