[an error occurred while processing this directive]
USERS
DEVELOPERS


see also:
PROTEGE-OWL FAQ

 managing imports in protégé-owl

OWL supports the sharing and reuse of ontologies by making it possible for one ontology to import another ontology. When an ontology imports another ontology, all of the class, property and individual definitions that are in the imported ontology are available for use in the importing ontology. This guide describes how the owl:imports mechanism works and how Protégé-OWL resolves the location of an ontology given its URI.

The owl:imports mechanism

Ontologies are identified and referenced using URIs. For example, the URI of the CO-ODE pizza ontology is http://www.co-ode.org/ontologies/pizza/2005/05/16/pizza.owl, and the URI of the Dublin Core ontology is http://purl.org/dc/elements/1.1. An ontology URI may be thought of as being a name for a specific ontology.

When an ontology imports another ontology, the URI of the ontology being imported is added to the list of "import statements" in the importing ontology. For example, the figure below shows that the ontology http://www.owl-ontologies.com/ontologies/xyz imports the ontology http://purl.org/dc/elements/1.1 (the Dublin Core ontology). http://www.owl-ontologies.com/ontologies/xyz will contain the statement, owl:imports http://purl.org/dc/elements/1.1.



Where should ontologies be imported from?

OWL imports statements take the form of <owl:imports rdf:resource="XXX">, where XXX is a URI. Such URIs frequently resemble Web addresses (http://...). For example, the URI of the Dublin Core ontology is http://purl.org/dc/elements/1.1, which is a URL (all valid URLs are also URIs). It is therefore easy to see that one strategy for importing ontologies is to simply attempt to resolve the URIs used in imports statements and download the document that the URL points to in the hope that this document contains an ontology. However, it is important to realize that even if an ontology URI appears to be a URL, it is not necessarily resolvable. In other words, it may or may not be the case that if an ontology URI is typed into a Web browser, a document containing the ontology will be displayed.

Despite the fact that there is no formal convention for determining the location of an ontology given its URI, it is generally recommended that ontologies are made available on the Web at a location that corresponds to their URI. So for example, the Dublin Core ontology can be found at http://purl.org/dc/elements/1.1, or the pizza ontology can be found at http://www.co-ode.org/ontologies/pizza/2005/05/16/pizza.owl.

In the case where an ontology URI isn't a URL and therefore doesn't point to a Web location, it is necessary for there to be a mechanism, which given an ontology URI, can point to an alternative location (perhaps a local location) where the ontology can be obtained from. In addition, when editing an ontology that imports other ontologies, a general pattern of work is to maintain local copies of these ontologies, so that imports are redirected to locations in the local file system at edit time, and then to "publish" these local copies to their respective locations on the Web by uploading them to some Web server. Finally, if network connectivity is problematic, local copies of imported ontologies must be used since these imported ontologies can't simply be downloaded from the Web.

In order to deal with these requirements, Protégé-OWL uses a mechanism based on the notion of "ontology repositories" to determine where an ontology should be loaded from. An ontology repsitory can be regarded as "place" where ontologies can be obtained from. Given an ontology URI, a repository can be checked to see whether or not it contains the ontology that is identified by the URI. If the repository does contain the required ontology, then it acts as a gateway for loading and possibly saving the ontology. Protégé-OWL maintains a list of such repositories and searches them when attempting to import an ontology.


The Ontology Repository Manager

The management, creation and deletion of ontology repositories is done via the ontology repository manager, which is accessible from the "Ontology repositories..." item on the OWL menu. The Figure below shows an example of the ontology repository manager dialog.

Protégé-OWL supports the notion of global and project repositories. Global repositories are by default available to every new project and are typically useful for managing commonly used ontologies, such as upper ontologies, that will be imported into most projects. Project repositories are associated with a specific Protégé-OWL project, and must be created/specified for that project. It is important to note that project repositories take precendece over global repositories. In other words, if an ontology is contained in both a project repository and a global repository it will be loaded via the project repository. The order in which repositories are searched is discussed later.




The screen shot below shows an example repository. For each available repository, the type/description of the repository is listed along with the ontologies that the repository contains. For each ontology in the repository, the URI is shown, with a description of the location (in slightly smaller grey text) below. For example, the repository shown below is a local folder repository that provides access to several ontologies. In particular, the ontology http://www.mygrid.org.uk/ontology can be loaded via this repository from the location /Users/matthewhorridge/Desktop/mygrid.owl. In other words, if an ontology is opened in Protégé-OWL that imports the ontology http://www.mygrid.org.uk/ontology, then this ontology will be loaded from /Users/matthewhorridge/Desktop/mygrid.owl.

The order of ontology repositories can be changed by clicking the buttons on the right hand side of the repository. A repository may be removed by clicking the remove button ('-'). Note that removing a repository does not delete the files/ontologies in the repository, since a repository merely acts as a view/retrival mechanism.



Types of Ontology Repositories

At the time of this writing, Protégé-OWL supports the creation of four different types of repositories:
Creating/Specifying Repositories

Repositories are created through the ontology repository manager. In order to create a repository:
  1. Display the repository manager dialog by selecting "Ontology repositories..." from the OWL Menu.
  2. Select either the project repository or global repository tab. For ontologies such as upper ontologies that will typically be used over and over again, a global repository should probably be used. Project repositories should be used for ontologies that are imported on a per project basis and are specific to a particular project. It should be noted that relative folder repositories can only be created as project repositories, since the folder is specified relative to the project OWL File.
  3. Click the "Add repository" button ('+') in the top right hand corner of the selected repository tab. This will invoke the "Add Repository Wizard" shown below.
  4. Choose the type of repository that is required and follow the steps displayed by the wizard that are necessary to create the repository.
The list of repositories is saved when the project is saved.





Searching Strategies

As can be seen from the screenshots above, it is possible to specify multiple ontology repositories. When there are multiple repositories, the ordering of ontology repositories is significant. Protégé-OWL searches project repositories before it searches global repositories, and then repositories are searched in the order that they are listed in the repository manager (i.e. top to bottom).

If a required ontology can be accessed via more than one repository, Protégé-OWL will simply load the ontology from the first repository containing the ontology. If Protégé-OWL does not find the ontology in a repository, it will then attempt to resolve the ontology URI and obtain a corresponding URL that hopefully points to a document on the Web that contains the ontology. Finally, if the ontology still cannot be found, Protégé-OWL will display a dialog that prompts for an ontology repository that contains the ontology to be specified.

In summary, when attempting to obtain a copy of an imported ontology, Protégé-OWL proceeds as follows:


Examples
  1. Download the examples ZIP file and unzip it to a location of your choice. There should be an examples folder which contains Example.owl, pizza.owl and a folder called PizzaV2, which contains another file called pizza.owl.
  2. Launch Protégé and press the "Create new project" button on the welcome dialog.
  3. In the new project wizard, select the "Create from existing sources" check box and press "Next"
  4. Specify the Example.owl file that is contained in the examples folder and press "Finish"
  5. Protégé-OWL will load the ontology that is contained in the Example.owl file. After loading notice that the ontology contains classes from the pizza ontology.
  6. Switch to the "Metadata Tab". The imports panel on the metadata tab should look similar to the picture below. Notice that the ontology imports the pizza ontology, which has an ontology URI of http://www.co-ode.org/ontologies/pizza/2005/05/16/pizza.owl.



  7. In order to determine where Protégé-OWL has imported the pizza ontology from, open the ontology repository manager dialog by selecting the "Ontology repositories..." item from the OWL menu, and ensure that the project repositories tab is selected. The repository manager should appear similar to the picture shown below. Notice how the ontology URI http://www.co-ode.org/ontologies/pizza/2005/05/16/pizza.owl is highlighted in blue. This indicates that this particular ontology has been imported. The slightly smaller grey URL directly below this highlighted URI shows the location description of where the ontology was imported from - in this case the ontology was imported from the URL http://www.co-ode.org/ontologies/pizza/2005/05/16/pizza.owl, which corresponds to the ontology URI of the pizza ontology.



In certain situations, for example, if an internet connection is not available, it may be preferable to to import a local "cached" copy of an ontology. To do this, a type of local repository must be specified. Local repositories can either be Local Folder repositories, Local File repositories, or Relative Folder repositories. In this example a Local File repository will be used to redirect the system to a local copy of the pizza ontology. For the purposes of this example, any connection to the internet should be disabled so that the pizza ontology cannot be imported from the Web.
  1. Restart Protégé and recreate the example project from the Example.owl file.
  2. Since the ontology described in the example.owl file imports the pizza ontology, and no repositories have been specified, Protégé-OWL will attempt to resolve the ontology URI and download a copy of the ontology from the Web. However, this strategy will fail since an internet connection is not available. Protégé-OWL will display the error dialog shown below.



  3. Select "Add Repository" in order to specify a local repository where the system can find the pizza ontology. The "Add Repository" wizard will be displayed.
  4. On the first page of the wizard, select "Local file" as the type of repository to be created and press "Next".
  5. The wizard will display a page that enables a local file path to be entered as shown below. Use the browse button to point to the pizza.owl file in the examples folder. After specifying the local examples/pizza.owl file click the "Finish" button.



  6. Protégé-OWL will continue loading and will import the local copy of the pizza ontology in place of the Web version. Open the repository manager by selecting "Ontology repositories..." from the OWL menu. The Project repositories tab should look like the picture below. Notice that the type of repository is a local file repository that contains the ontology http://www.co-ode.org/ontologies/pizza/2005/05/16/pizza.owl and that this ontology is actually loaded from a local file identified by the location description beneath the ontology URI.



  7. Close the repository manager dialog. The system will ask if it can reload the project automatically - click OK. After any change in the order of repositories the system needs to reload the current project. This is to ensure that the correct ontology is imported.

Repository Files

Protégé-OWL stores repository information in plain text files, with one line per repository. The global repository is saved in a file called global.repository which resides in the Protégé-OWL plugin folder. Project repositories are saved in a file that has the same location and name as the project OWL file but with an extension of .repository. For example, if the OWL file was saved as C:\Ontologies\another.owl then the project repository file would be saved as C:\Ontologies\another.repository.

Project repository files can be move from one Protégé installation to another simply by placing the project .repository file in the same folder as the project .owl file in the new installation. It is recommended that if project repository files will be shared then relative folder repositories should be used in preference to other types of repository. A recommended strategy is to place an appropriately named folder (imports for example) in the same folder as the project .owl file, put all local import files in this folder and then specify a relative folder repository that points to this folder.




[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]