<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://protegewiki.stanford.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Swartik</id>
		<title>Protege Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://protegewiki.stanford.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Swartik"/>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/wiki/Special:Contributions/Swartik"/>
		<updated>2026-04-18T03:58:38Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.7</generator>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=CompileProtege4InEclipseFromSvn&amp;diff=9730</id>
		<title>CompileProtege4InEclipseFromSvn</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=CompileProtege4InEclipseFromSvn&amp;diff=9730"/>
				<updated>2011-04-20T13:37:48Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Fixed some lower-case button names.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Instructions for Compiling and Running Protege 4.1 in Eclipse using the sources from SVN =&lt;br /&gt;
&lt;br /&gt;
These instructions will help you set up the Eclipse environment for Protege 4.1. In the first part, we will check out from SVN a Eclipse workspace already configured for Protege 4.1 and its plugins, then in the second part, we will show how to add your own plugin in Eclipse.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Prerequisites == &lt;br /&gt;
&lt;br /&gt;
To follow these directions you will need the following tools:&lt;br /&gt;
* Eclipse (of course) with &lt;br /&gt;
** the Plugin Development tools included.  As indicated [http://www.eclipse.org/downloads/packages/compare-packages here], the plugin development environment comes with the Java EE or the RCP/Plugin versions of eclipse.&lt;br /&gt;
** the [http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/install.php Eclipse Subversive] plugin, though this is only required if you want to do svn updates using eclipse.   Note that there is another similar but different plugin (from Tigris I believe).  I don't know if these plugins interfere with one another if they are both loaded.&lt;br /&gt;
* A tool for extracting a zip file into a directory.&lt;br /&gt;
* A tool for checking out a repository from subversion (e.g. tortoise or the svn command line client). &lt;br /&gt;
These directions are based on a preconfigured workspace which you can use for the build.&lt;br /&gt;
&lt;br /&gt;
== Configuring Eclipse ==&lt;br /&gt;
&lt;br /&gt;
'''Step 1: Checking out the workspace''' Use subversion to checkout the following workspace:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    http://smi-protege.stanford.edu/repos/protege/protege4/ide/eclipse/protege4.1/trunk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you are using command line tools you can do this with the svn command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/ide/eclipse/protege4.1/trunk protege4.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This creates an eclipse workspace but some of the metadata is still missing.  &lt;br /&gt;
&lt;br /&gt;
''Tortoise svn Users:'' Note that when using Tortoise svn, you need to do a full recursive  checkout.  It may appear that there is only one file in the repository but the svn checkout needs to also checkout the external references.&lt;br /&gt;
&lt;br /&gt;
''Using Eclipse svn:'' It is possible to checkout this directory using eclipse but eclipse developers need to understand that they are checking out a workspace and not a project.  If the developer has an alternative method of checking out the directory that method would probably be less confusing.&lt;br /&gt;
&lt;br /&gt;
'''Step 2: Install the Eclipse metadata''' Inside the directory that you just checked out is a file called metadata.zip.  Extract this file into the created directory.  Now the eclipse workspace is ready for eclipse.  Note that on the mac, double-clicking the metadata.zip file does not do the right thing; it does not simple extract the files into the current directory.  So on the mac the command line unzip is probably recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      unzip metadata.zip&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Step 3: Load the Workspace'''  Start eclipse and choose the newly created directory as the workspace.  Since this is a new workspace, eclipse comes up with a welcome screen which you can dismiss.  We now import the projects.  Go to the file menu and click &amp;quot;File-&amp;gt;Import&amp;quot;.  You should get a window as shown below and can open the &amp;quot;General&amp;quot; tree to see and select the &amp;quot;Existing Projects into Workspace&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Once &amp;quot;Existing Projects into Workspace&amp;quot; has been selected click Next.  This should give you the window shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects02.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Click the Browse button to select the workspace directory.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects03.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Once you have selected the workspace you should see the window below that includes the projects that you want to import.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects04.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Click Finish and the files should be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseProjectsImported.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Now all the projects have been loaded into eclipse.&lt;br /&gt;
&lt;br /&gt;
'''Step 4a: Run Protege (The easy and better way)'''  This step can be a bit problematic on the mac but works for linux and windows machines.  Just recently this method seems to have started working with Snow Leopard and the latest eclipse (Helios).  &lt;br /&gt;
&lt;br /&gt;
Click on the down arrow just to the right of the little bug (near the top of the eclipse window perhaps just under the Refactor menu).  Select ''Protege'' (not ''Protege.From.Build'').  This should start Protege.  &lt;br /&gt;
&lt;br /&gt;
Note that when starting Protege in this way, the mechanism by which the plugins are found is different than the mechanism that Protege uses when it is distributed.  When Protege is distributed, it scans the plugin directory and find the plugins there.  When Protege is started in this manner, eclipse is loading the plugins for Protege.  In fact, Protege will report &amp;quot;No Plugins Found&amp;quot; because it does not find a plugin directory and thus did not find any plugins to load.  But if you enter &amp;quot;status&amp;quot; in the console you will see a detailed description of the state of the run including a description of what plugins have been found.&lt;br /&gt;
&lt;br /&gt;
'''Step 4b: Run Protege the Harder Way (use only if the easy way 4a did not work)'''  The second icon to the right of the little bug is a run icon with a suitcase.  Click the little down arrow beside this icon and run the following scripts in this order:&lt;br /&gt;
# Build.Protege.Infrastructure&lt;br /&gt;
# Build.Common&lt;br /&gt;
# Build.Core&lt;br /&gt;
# Build.Jaxb.Lib&lt;br /&gt;
# Build.Owlapi.Lib&lt;br /&gt;
# Build.Owl.Editor&lt;br /&gt;
# Build.OwlViz&lt;br /&gt;
&lt;br /&gt;
If the projects are marked with red in the left project tree view, refresh them all.&lt;br /&gt;
&lt;br /&gt;
Now we have built a Protege distribution.  This distribution is in the Protege directory in the eclipse workspace.  Having created this distribution, we can run the other runnable in the bug menu.  Click the down arrow beside the little bug and select run ''Protege from build''.&lt;br /&gt;
&lt;br /&gt;
== Add your own plugin ==&lt;br /&gt;
&lt;br /&gt;
Just make your plugin into a plugin development project. &lt;br /&gt;
&lt;br /&gt;
'''Easy way'''.  If you are able to run protege the easy way (4a) then your plugin will be included. Hotspot replace works (some of the time as always).&lt;br /&gt;
&lt;br /&gt;
'''Harder way'''. If you run protege the harder way (4b) then you will need to install your plugin into the protege distribution that we have created.  To do this you will need an ant build file.  We have provided a [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-plugin-build.xml template build file] that can easily be filled in.  We will now describe how this script is added as an eclipse build script.  We will turn the fact that I forgot to install the dlquery build script in eclipse into an advantage by showing how this is added here.&lt;br /&gt;
&lt;br /&gt;
To create this new eclipse build script, click on the down arrow to the right of the suitcase runnable and click on &amp;quot;External Tool Configurations&amp;quot;.  Select &amp;quot;Ant Build&amp;quot; and click the &amp;quot;New Launch Configuration&amp;quot; just above the selected &amp;quot;Ant Build&amp;quot; option.  In the resulting window, set the name to &amp;quot;Build.DlQuery&amp;quot; and browse the workspace for the DLQuery build.xml file.  The result should look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Protege4.1InEclipseWIthSvnExternalTools.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Now go to the targets tab and make sure that the install target is chosen.&lt;br /&gt;
&lt;br /&gt;
[[File:Protege4.1InEclipseWIthSvnAntSetTarget.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Finally go to the Environment tab and make sure that PROTEGE_HOME is set to ${workspace_loc}/Protege.&lt;br /&gt;
&lt;br /&gt;
[[File:Protege4.1InEclipseWIthSvnAntEnvironment.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Now the new build script can be saved (Apply) and run.  Running this script will install your plugin (DLQuery in this case) into the Protege distribution that we have been making.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=CompileProtege4InEclipseFromSvn&amp;diff=9729</id>
		<title>CompileProtege4InEclipseFromSvn</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=CompileProtege4InEclipseFromSvn&amp;diff=9729"/>
				<updated>2011-04-20T13:20:18Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Removed an extra &amp;quot;and&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Instructions for Compiling and Running Protege 4.1 in Eclipse using the sources from SVN =&lt;br /&gt;
&lt;br /&gt;
These instructions will help you set up the Eclipse environment for Protege 4.1. In the first part, we will check out from SVN a Eclipse workspace already configured for Protege 4.1 and its plugins, then in the second part, we will show how to add your own plugin in Eclipse.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Prerequisites == &lt;br /&gt;
&lt;br /&gt;
To follow these directions you will need the following tools:&lt;br /&gt;
* Eclipse (of course) with &lt;br /&gt;
** the Plugin Development tools included.  As indicated [http://www.eclipse.org/downloads/packages/compare-packages here], the plugin development environment comes with the Java EE or the RCP/Plugin versions of eclipse.&lt;br /&gt;
** the [http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/install.php Eclipse Subversive] plugin, though this is only required if you want to do svn updates using eclipse.   Note that there is another similar but different plugin (from Tigris I believe).  I don't know if these plugins interfere with one another if they are both loaded.&lt;br /&gt;
* A tool for extracting a zip file into a directory.&lt;br /&gt;
* A tool for checking out a repository from subversion (e.g. tortoise or the svn command line client). &lt;br /&gt;
These directions are based on a preconfigured workspace which you can use for the build.&lt;br /&gt;
&lt;br /&gt;
== Configuring Eclipse ==&lt;br /&gt;
&lt;br /&gt;
'''Step 1: Checking out the workspace''' Use subversion to checkout the following workspace:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    http://smi-protege.stanford.edu/repos/protege/protege4/ide/eclipse/protege4.1/trunk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you are using command line tools you can do this with the svn command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/ide/eclipse/protege4.1/trunk protege4.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This creates an eclipse workspace but some of the metadata is still missing.  &lt;br /&gt;
&lt;br /&gt;
''Tortoise svn Users:'' Note that when using Tortoise svn, you need to do a full recursive  checkout.  It may appear that there is only one file in the repository but the svn checkout needs to also checkout the external references.&lt;br /&gt;
&lt;br /&gt;
''Using Eclipse svn:'' It is possible to checkout this directory using eclipse but eclipse developers need to understand that they are checking out a workspace and not a project.  If the developer has an alternative method of checking out the directory that method would probably be less confusing.&lt;br /&gt;
&lt;br /&gt;
'''Step 2: Install the Eclipse metadata''' Inside the directory that you just checked out is a file called metadata.zip.  Extract this file into the created directory.  Now the eclipse workspace is ready for eclipse.  Note that on the mac, double-clicking the metadata.zip file does not do the right thing; it does not simple extract the files into the current directory.  So on the mac the command line unzip is probably recommended:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      unzip metadata.zip&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Step 3: Load the Workspace'''  Start eclipse and choose the newly created directory as the workspace.  Since this is a new workspace, eclipse comes up with a welcome screen which you can dismiss.  We now import the projects.  Go to the file menu and click &amp;quot;File-&amp;gt;Import&amp;quot;.  You should get a window as shown below and can open the &amp;quot;General&amp;quot; tree to see and select the &amp;quot;Existing Projects into workspace&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Once &amp;quot;Existing Projects into Workspace&amp;quot; has been selected click next.  This should give you the window shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects02.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Click the browse button to select the workspace directory.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects03.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Once you have selected the workspace you should see the window below that includes the projects that you want to import.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseImportProjects04.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Click finish and the files should be imported.&lt;br /&gt;
&lt;br /&gt;
[[File:EasyP4EclipseProjectsImported.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
Now all the projects have been loaded into eclipse.&lt;br /&gt;
&lt;br /&gt;
'''Step 4a: Run Protege (The easy and better way)'''  This step can be a bit problematic on the mac but works for linux and windows machines.  Just recently this method seems to have started working with Snow Leopard and the latest eclipse (Helios).  &lt;br /&gt;
&lt;br /&gt;
Click on the down arrow just to the right of the little bug (near the top of the eclipse window perhaps just under the Refactor menu).  Select ''Protege'' (not ''Protege.From.Build'').  This should start Protege.  &lt;br /&gt;
&lt;br /&gt;
Note that when starting Protege in this way, the mechanism by which the plugins are found is different than the mechanism that Protege uses when it is distributed.  When Protege is distributed, it scans the plugin directory and find the plugins there.  When Protege is started in this manner, eclipse is loading the plugins for Protege.  In fact, Protege will report &amp;quot;No Plugins Found&amp;quot; because it does not find a plugin directory and thus did not find any plugins to load.  But if you enter &amp;quot;status&amp;quot; in the console you will see a detailed description of the state of the run including a description of what plugins have been found.&lt;br /&gt;
&lt;br /&gt;
'''Step 4b: Run Protege the Harder Way (use only if the easy way 4a did not work)'''  The second icon to the right of the little bug is a run icon with a suitcase.  Click the little down arrow beside this icon and run the following scripts in this order:&lt;br /&gt;
# Build.Protege.Infrastructure&lt;br /&gt;
# Build.Common&lt;br /&gt;
# Build.Core&lt;br /&gt;
# Build.Jaxb.Lib&lt;br /&gt;
# Build.Owlapi.Lib&lt;br /&gt;
# Build.Owl.Editor&lt;br /&gt;
# Build.OwlViz&lt;br /&gt;
&lt;br /&gt;
If the projects are marked with red in the left project tree view, refresh them all.&lt;br /&gt;
&lt;br /&gt;
Now we have built a Protege distribution.  This distribution is in the Protege directory in the eclipse workspace.  Having created this distribution, we can run the other runnable in the bug menu.  Click the down arrow beside the little bug and select run ''Protege from build''.&lt;br /&gt;
&lt;br /&gt;
== Add your own plugin ==&lt;br /&gt;
&lt;br /&gt;
Just make your plugin into a plugin development project. &lt;br /&gt;
&lt;br /&gt;
'''Easy way'''.  If you are able to run protege the easy way (4a) then your plugin will be included. Hotspot replace works (some of the time as always).&lt;br /&gt;
&lt;br /&gt;
'''Harder way'''. If you run protege the harder way (4b) then you will need to install your plugin into the protege distribution that we have created.  To do this you will need an ant build file.  We have provided a [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-plugin-build.xml template build file] that can easily be filled in.  We will now describe how this script is added as an eclipse build script.  We will turn the fact that I forgot to install the dlquery build script in eclipse into an advantage by showing how this is added here.&lt;br /&gt;
&lt;br /&gt;
To create this new eclipse build script, click on the down arrow to the right of the suitcase runnable and click on &amp;quot;External Tool Configurations&amp;quot;.  Select &amp;quot;Ant Build&amp;quot; and click the &amp;quot;New Launch Configuration&amp;quot; just above the selected &amp;quot;Ant Build&amp;quot; option.  In the resulting window, set the name to &amp;quot;Build.DlQuery&amp;quot; and browse the workspace for the DLQuery build.xml file.  The result should look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Protege4.1InEclipseWIthSvnExternalTools.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Now go to the targets tab and make sure that the install target is chosen.&lt;br /&gt;
&lt;br /&gt;
[[File:Protege4.1InEclipseWIthSvnAntSetTarget.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Finally go to the Environment tab and make sure that PROTEGE_HOME is set to ${workspace_loc}/Protege.&lt;br /&gt;
&lt;br /&gt;
[[File:Protege4.1InEclipseWIthSvnAntEnvironment.png|frame|none|]]&lt;br /&gt;
&lt;br /&gt;
Now the new build script can be saved (Apply) and run.  Running this script will install your plugin (DLQuery in this case) into the Protege distribution that we have been making.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=PluginAnatomy&amp;diff=9627</id>
		<title>PluginAnatomy</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=PluginAnatomy&amp;diff=9627"/>
				<updated>2011-04-06T15:14:47Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Removed spurious &amp;quot;.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this web page is to describe some of the key ingredients of  a plugin.  The page will be directed by &lt;br /&gt;
the quick development of a plugin and can indeed be used as a quick start guide.  In order to focus attention on the core  plugin&lt;br /&gt;
concepts we will use the lowest common denominator of Java development tools and this tutorial will not use a Java IDE.&lt;br /&gt;
We will assume that the &lt;br /&gt;
reader has an understanding of Java development and knows how to follow along in his favorite IDE.  For more information about&lt;br /&gt;
how to work with protege 4 in an IDE I will  direct the reader to [[Protege4DevDocs#Using_an_Integrated_Development_Environment|this page]].  It is possible for an experienced developer to skip the ant scripts simply follow  along in an IDE but we would still recommend a build file for the final version.&lt;br /&gt;
&lt;br /&gt;
The sources for the first plugin (the example tab) can be found [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab here].  You can either check these out from svn and use this as a guide for reading the text or build this project in a series of step by step stages as described below.  If you start from the checked out version then you can build the project by following the directions [[#Compile and Run|here]].&lt;br /&gt;
&lt;br /&gt;
==The vacuous plugin in five minutes==&lt;br /&gt;
&lt;br /&gt;
I created a (vacuous) plugin from scratch, installed it and ran it in just under [[Protege4 Plugin In Four Minutes|four minutes]].&lt;br /&gt;
&lt;br /&gt;
The simplest (trivial) plugin can be built from sources in the following layout:&amp;lt;pre&amp;gt;&lt;br /&gt;
   build.xml&lt;br /&gt;
   META-INF&lt;br /&gt;
      MANIFEST.MF&lt;br /&gt;
   lib&lt;br /&gt;
   resources&lt;br /&gt;
   src&lt;br /&gt;
&amp;lt;/pre&amp;gt;  As we will see - even without any java sources - this is a sufficient basis for building a plugin that is recognized by Protege 4.  There are only two files in this source tree - the build.xml file and the MANIFEST.MF.  These files can be quickly put together from templates.&lt;br /&gt;
&lt;br /&gt;
===Build.xml===&lt;br /&gt;
&lt;br /&gt;
The template for the build.xml file can be downloaded from [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-plugin-build.xml here].  Only two things need to be changed in this build file.  They can be found by searching for the string &amp;quot;CHANGE ME&amp;quot; in the file.  The first thing to change is the name of the project.  I will call the project the plugin tutoiral project:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;project name = &amp;quot;plugin tutorial&amp;quot; default = &amp;quot;install&amp;quot; basedir = &amp;quot;.&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The next setting that must almost always be changed is the name of the plugin.  In this case, the build.xml already has the right name for the plugin but this is the only plugin for which this will be true:&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;property name = &amp;quot;plugin&amp;quot;          value = &amp;quot;org.protege.editor.owl.examples.tab&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
With these adjustments the build.xml file is ready.&lt;br /&gt;
&lt;br /&gt;
===MANIFEST.MF===&lt;br /&gt;
&lt;br /&gt;
The template for the MANIFEST.MF file can be downloaded from [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-manifest.mf here].  Only five things need to be changed in this file to make it useable and two are optional.  These  can be found by searching for the string &amp;quot;CHANGE ME&amp;quot; in the file.  The first change is to set the display name for the plugin:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-Name: Tutorial Plugin&lt;br /&gt;
&amp;lt;/pre&amp;gt; This is the name that is seen when Protege 4 starts up and in several plugin configuration screens.  &lt;br /&gt;
The seccond thing to change is the symbolic name of the plugin. The usual default is to uses the same name as the plugin name in the build.xml file:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-SymbolicName: org.protege.editor.owl.examples.tab;singleton:=true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the &amp;quot;singleton:=true&amp;quot; line - this is important since most Protege 4 plugins will only work if they are instantiated exactly once.  The next things to change are the bundle description, the vendor and the documentation url:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-Description: A simple plugin for a plugin development tutorial&lt;br /&gt;
Bundle-Vendor: The Protege Development Team&lt;br /&gt;
Bundle-DocURL: www.perhaps.i.donthaveoneyet.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Actually the vendor and the docurl are optional and can be deleted.  The MANIFEST.MF file is now ready.&lt;br /&gt;
&lt;br /&gt;
===Compile and Run===&lt;br /&gt;
&lt;br /&gt;
Before  we can start, we must set the PROTEGE_HOME environment variable to point to a Protege 4 distribution.  [[ConfiguringAntBuildFiles|This page]] has directions on how to do this in different operating systems but for now I will assume that we are on a unix (or os x) system.  In that case, the system variable can be set with a simple command &amp;lt;pre&amp;gt;&lt;br /&gt;
   export PROTEGE_HOME=/Users/tredmond/Desktop/Protege_4.1_beta&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This vacuous plugin is now ready to compile and run.  Assuming that the PROTEGE_HOME environment variable is set correctly, this plugin can be compiled with the simple command &amp;lt;pre&amp;gt;&lt;br /&gt;
  ant install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The full text of the build session is as follows:&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@Andromeda org.protege.editor.owl.examples.tab]$ ant install&lt;br /&gt;
Buildfile: build.xml&lt;br /&gt;
&lt;br /&gt;
init:&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes/lib&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/lib&lt;br /&gt;
&lt;br /&gt;
checkProtegeLibs:&lt;br /&gt;
     [echo] Using Protege Home = /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox to find protege jars&lt;br /&gt;
&lt;br /&gt;
checkProtegeLibsAndReport:&lt;br /&gt;
&lt;br /&gt;
buildlibs:&lt;br /&gt;
    [unjar] Expanding: /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/bundles/org.protege.common.jar into /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
&lt;br /&gt;
compile:&lt;br /&gt;
&lt;br /&gt;
build.manifest:&lt;br /&gt;
     [copy] Copying 1 file to /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
&lt;br /&gt;
copy.resources:&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes/META-INF&lt;br /&gt;
     [copy] Copying 1 file to /private/tmp/org.protege.editor.owl.examples.tab/build/classes/META-INF&lt;br /&gt;
&lt;br /&gt;
jar:&lt;br /&gt;
      [jar] Building jar: /private/tmp/org.protege.editor.owl.examples.tab/build/org.protege.editor.owl.examples.tab.jar&lt;br /&gt;
&lt;br /&gt;
install:&lt;br /&gt;
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/configuration/org.eclipse.core.runtime&lt;br /&gt;
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/configuration/org.eclipse.osgi&lt;br /&gt;
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/plugins&lt;br /&gt;
&lt;br /&gt;
BUILD SUCCESSFUL&lt;br /&gt;
Total time: 2 seconds&lt;br /&gt;
[tredmond@Andromeda org.protege.editor.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the PROTEGE_HOME environment variable is not set correctly the user will instead see the following:&amp;lt;pre&amp;gt;&lt;br /&gt;
BUILD FAILED&lt;br /&gt;
/private/tmp/org.protege.editor.owl.examples.tab/build.xml:74: missing protege libraries&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now look at  what the build has done by exploring the project directory tree.&lt;br /&gt;
[[File:AnatomyBuildTreeAnnotated.png]]&lt;br /&gt;
&lt;br /&gt;
We see the following elements:&lt;br /&gt;
* '''The Class Tree''' is (approximately) a flattened view of the plugin (the jar file).  Generally this  largely consists of the .class files that have been compiled from the java.  But since we have not written any java yet this is not found.  In addition, this will contain resources needed by the plugin and libraries that the plugin needs but which cannot be found in other Protege plugins.&lt;br /&gt;
* '''The Generated Libraries''' which are extracted from Protege plugins.  This is needed because of a difference between how Java and OSGi get resources  out of Jar files.  OSGi allows a [[PluginAnatomy#Some_Nomenclature|bundle]] (which is a implemented as a jar file) to contain other jar files.  If the bundle classpath is configured correctly, OSGi will load classes from those jars in jars.  But Java does not have this capability.  So the build script extracts the jar files out of the OSGi bundles that will be needed to compile the bundle.  Note that these jar files are not copied to the class tree because the Protege 4/OSGi environment will  make the classes and resources of these  jar files available.&lt;br /&gt;
* '''The Protege 4 Plugin''' this is the final artifact of the build process.  Because  we have run &amp;quot;ant install&amp;quot; it has also been installed in the Protege distribution.&lt;br /&gt;
&lt;br /&gt;
If the developer is still with me then he is now ready to run the plugin.  Go to the Protege distribution (the one pointed to by the PROTEGE_HOME environment variable) and run it.  We are particularly interested in the console output because this is going to be the only indication that this plugin is recognized at all.  The console output should look like this:&amp;lt;pre&amp;gt;&lt;br /&gt;
Starting Protege 4 OWL Editor (Version 4.1.111)&lt;br /&gt;
Platform:&lt;br /&gt;
    Java: JVM 1.5.0_16-b06-284 Memory: 207M&lt;br /&gt;
    Language: en, Country: US&lt;br /&gt;
    Framework: Eclipse (1.4.0)&lt;br /&gt;
    OS: MacOSX (10.5.6)&lt;br /&gt;
    Processor: ppc&lt;br /&gt;
Installed plugin Pellet Reasoner&lt;br /&gt;
Installed plugin DL Query Tab&lt;br /&gt;
Installed plugin Owlviz Plug-in&lt;br /&gt;
Installed plugin owleditor&lt;br /&gt;
Installed plugin Tutorial Plugin&lt;br /&gt;
Installed plugin The OWL API&lt;br /&gt;
Installed plugin Factplusplus Plug-in&lt;br /&gt;
	Tutorial Plugin Plugin has no plugin.xml resource&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this output we see that the Tutorial Plugin has been recognized and installed.  In addition there is a informational message that the plugin.xml file has not been found.  This is  almost always indicates a problem because most Protege 4 plugins depend on a plugin.xml resource.  We will describe how the plugin.xml file is generated in the next sections.&lt;br /&gt;
&lt;br /&gt;
== Writing View and Tab Plugins ==&lt;br /&gt;
&lt;br /&gt;
The previous plugin added no functionality to Protege 4.  We are now going to describe how to remedy this situtaion.  So far we have not missed the Java IDE but it is now when we start writing a bit of Java code that the Java IDE would really shine.  But to illustrate the main concepts, we will continue to show how to build the plugin without any development environment other than  that provided by the core Java tools.&lt;br /&gt;
&lt;br /&gt;
===Adding a View Plugin to the Plugin.xml file===&lt;br /&gt;
&lt;br /&gt;
Recall that previously when we ran our plugin, Protege 4 complained that there was no plugin.xml file.   The plugin.xml file contains a declaration of the ways in which the plugin will extend the Protege 4 capabilities and (more advanced) the ways in which the plugin capabilities can be extended by other plugins.  We will start by adding a declaration that this plugin will implement a Protege View.  &lt;br /&gt;
&lt;br /&gt;
So first we will give a definition of a Protege view.  The purpose of a Protege view is to provide a view of some aspect of an ontology.  In the Protege interface, a Protege view is easily recognized.  It has a clearly defined border.  At the top of a Protege view is a title bar and a collection of buttons allowing the user to&lt;br /&gt;
* split the protege view into two copies of the same view one above the other,&lt;br /&gt;
* split the protege view into two copies of the same view one beside the other,&lt;br /&gt;
* float the view above the Protege client so that it is visible in any context,&lt;br /&gt;
* close the view removing it from the tab that contains it.&lt;br /&gt;
An example of a typical Protege view is shown below.&lt;br /&gt;
[[File:AnatomyView.png]]&lt;br /&gt;
&lt;br /&gt;
In order to declare our intent that this plugin implement a Protege view, we add the following pluxin.xml file to the root of the project tree:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;?eclipse version=&amp;quot;3.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;plugin&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleViewComponent&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example View Component&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.editor.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;category value=&amp;quot;@org.protege.ontologycategory&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/plugin&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This plugin.xml file states that this plugin is making a single extension to the Protege 4 capabilities.   We will cover the meaning of the parts of this extension declaration line by line.  The first line defines the id of the extension.  This particular extension is called the ExampleViewComponent.  The second decleration,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
states what the extension is trying to do.  This extension is attempting to implement the functionality represented by the extension point with the name &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       org.protege.editor.core.application.ViewComponent.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The label declaration tells Protege what to put in the title bar of the view.  The class declaration indicates which class implements the functionality needed by this view.  We will go into the implementation of that class shortly.  Finally the category declaration tells Protege which menu under the View menu should contain this view.&lt;br /&gt;
&lt;br /&gt;
A very simple view can be written by extending the class AbstractOWLViewComponent and implementing the methods initialiseOWLView and disposeOWLView.  A very simple such implementation can be found &lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab/src/org/protege/editor/owl/examples/tab/ExampleViewComponent.java here].&lt;br /&gt;
Now this plugin depends on a library that can be found &lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab/lib/examplelib.jar here].  This library should be deposited in the lib directory of the project.  This library is trivial and its only purpose is to show how to use a library in a plugin.  The directory tree of the project should now look like this:&lt;br /&gt;
[[File:AnatomyTreeDoesView.png]]&lt;br /&gt;
&lt;br /&gt;
At this point the ant install operation will compile, build and install the new plugin with the &amp;quot;ant install&amp;quot; command.&lt;br /&gt;
But the installed plugin won't run correctly and we will show how to fix this below.&lt;br /&gt;
&lt;br /&gt;
===Libraries and the Bundle Classpath===&lt;br /&gt;
&lt;br /&gt;
After we install the plugin, we can start Protege to try to use the &amp;quot;Example View Component&amp;quot;.  If you click on the View menu and then select &amp;quot;Ontology Views&amp;quot; you will see the &amp;quot;Example View Component&amp;quot; listed there.  However on selecting this view and trying to place on the Protege screen, the following error will arise:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error logged&lt;br /&gt;
java.lang.NoClassDefFoundError: org/protege/owl/example/Metrics&lt;br /&gt;
	at java.lang.Class.getDeclaredConstructors0(Native Method)&lt;br /&gt;
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)&lt;br /&gt;
	at java.lang.Class.getConstructor0(Class.java:2671)&lt;br /&gt;
	at java.lang.Class.newInstance0(Class.java:321)&lt;br /&gt;
	at java.lang.Class.newInstance(Class.java:303)&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If we look at the plugin contents with the &amp;quot;jar -tf &amp;quot; command then we will see that the build file correctly put the examplelib.jar into the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@BlackHole org.protege.editor.owl.examples.tab]$ jar -tf build/org.protege.editor.owl.examples.tab.jar &lt;br /&gt;
META-INF/&lt;br /&gt;
META-INF/MANIFEST.MF&lt;br /&gt;
lib/&lt;br /&gt;
org/&lt;br /&gt;
org/protege/&lt;br /&gt;
org/protege/owl/&lt;br /&gt;
org/protege/owl/examples/&lt;br /&gt;
org/protege/owl/examples/tab/&lt;br /&gt;
lib/examplelib.jar&lt;br /&gt;
org/protege/owl/examples/tab/ExampleViewComponent.class&lt;br /&gt;
plugin.xml&lt;br /&gt;
[tredmond@BlackHole org.protege.editor.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem at this point is in the MANIFEST.MF file.  The Bundle-Classpath line is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-ClassPath: .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To include the examplelib.jar in the jar file, the Bundle-Classpath line must be modified to include  this library:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-ClassPath: .,lib/examplelib.jar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that using a colon or a semi-colon instead of the comma does not work.  Also entering ./lib/examplib.jar does not work either.  This is the osgi mechanism for making this library available to this plugin.  Note that since the MANIFEST.MF file does not have an Export-Package declaration, these classes will only be visible within the plugin and will not be exported to any other plugin in the Protege 4 environmeht.  This is part of the plugin isolation provided by OSGi that allows different plugins to use different libraries without conflicts.&lt;br /&gt;
&lt;br /&gt;
Now the plugin works correctly and I can install the view into the Active Ontology Tab:&lt;br /&gt;
[[File:AnoyomyViewSuccessful.png]].&lt;br /&gt;
&lt;br /&gt;
===Tab Plugins and the Viewconfig.xml File===&lt;br /&gt;
&lt;br /&gt;
The other most common plugin type is the Protege tab.  In order to make a Protege tab, the developer needs to generate and use a viewconfig.xml file for the project.  In this section we will show how to do this.  It turns out that a tab can usually be put together without writing any Java code.  The steps for writing a tab plugin are&lt;br /&gt;
# add a declaration of the tab plugin in the plugin.xml file.&lt;br /&gt;
# start Protege and graphically configure the tab in question.&lt;br /&gt;
# save the configuration and include it with the source files for the tab.&lt;br /&gt;
# test by restarting Protege and running the tab with the default configuration.&lt;br /&gt;
These steps are described in more detail below.&lt;br /&gt;
&lt;br /&gt;
==== Step 1: Declare the plugin ====&lt;br /&gt;
&lt;br /&gt;
The first thing that that needs to be done is to declare the tab in the plugin.xml file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;?eclipse version=&amp;quot;3.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;plugin&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleViewComponent&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example View Component&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.editor.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;category value=&amp;quot;@org.protege.ontologycategory&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleWorkspaceTab&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.WorkspaceTab&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example Tab&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.OWLWorkspaceViewsTab&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;index value=&amp;quot;X&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;defaultViewConfigFileName value=&amp;quot;viewconfig-exampleTab.xml&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/plugin&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important line in the above declaration of the tab is the defaultViewConfigFileName.  This names a resource that the protege plugin will look for to create the default layout of the tab.&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Layout the views in the plugin ====&lt;br /&gt;
&lt;br /&gt;
We can now compile this plugin and install it as before.  Now when we run Protege 4, we will see a new tab called the &amp;quot;Example Tab&amp;quot; in the tabs menu (Window-&amp;gt;Tabs).  Enable this tab.  Since we have not yet created the viewconfig-exampleTab.xml file, you will see that the tab is empty.&lt;br /&gt;
&lt;br /&gt;
Now install and layout some views into this tab.  In my case I made the views look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:AnatomyViewLayout.png]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Save a configuration file ====&lt;br /&gt;
&lt;br /&gt;
Now in the Window menu select &amp;quot;Export Current Tab&amp;quot; and save the file as &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   viewconfig-exampleTab.xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in the project directory.  In my case the viewconfig-exampleTab file looked like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
    &amp;lt;VSNode splits=&amp;quot;0.5 0.5&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;CNode&amp;gt;&lt;br /&gt;
            &amp;lt;Component label=&amp;quot;Asserted class hierarchy&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;Property id=&amp;quot;pluginId&amp;quot; value=&amp;quot;org.protege.editor.owl.OWLAssertedClassHierarchy&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Component&amp;gt;&lt;br /&gt;
        &amp;lt;/CNode&amp;gt;&lt;br /&gt;
        &amp;lt;CNode&amp;gt;&lt;br /&gt;
            &amp;lt;Component label=&amp;quot;Example View Component&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;Property id=&amp;quot;pluginId&amp;quot; value=&amp;quot;org.protege.editor.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Component&amp;gt;&lt;br /&gt;
        &amp;lt;/CNode&amp;gt;&lt;br /&gt;
    &amp;lt;/VSNode&amp;gt;&lt;br /&gt;
&amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now before we complete this Protege session, go to the Window menu and click &amp;quot;Reset selected tab to default state&amp;quot;.  You will see that the tab is now empty again.  Now exit Protege.&lt;br /&gt;
&lt;br /&gt;
The directory tree of the project should now look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:AnatomyTreeDoesViewWithConfig.png]]&lt;br /&gt;
&lt;br /&gt;
==== Step 4: Test the results ====&lt;br /&gt;
&lt;br /&gt;
Install the plugin again.  Note that the build script automatically found the viewconfig-exampleTab.xml file and put it into the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@BlackHole org.protege.editor.owl.examples.tab]$ jar -tf build/org.protege.editor.owl.examples.tab.jar &lt;br /&gt;
META-INF/&lt;br /&gt;
META-INF/MANIFEST.MF&lt;br /&gt;
lib/&lt;br /&gt;
org/&lt;br /&gt;
org/protege/&lt;br /&gt;
org/protege/owl/&lt;br /&gt;
org/protege/owl/examples/&lt;br /&gt;
org/protege/owl/examples/tab/&lt;br /&gt;
lib/examplelib.jar&lt;br /&gt;
org/protege/owl/examples/tab/ExampleViewComponent.class&lt;br /&gt;
plugin.xml&lt;br /&gt;
viewconfig-exampleTab.xml&lt;br /&gt;
[tredmond@BlackHole org.protege.editor.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run Protege and go to the Example Tab.  It is empty?  The reason for this is that the tab has been customized to have nothing in it from the last session.  Click on the tabs menu and click on &amp;quot;Reset selected tab to default state&amp;quot;.  Now you will see the views that we configured in the tab before.  This is now the default state for the tab and it will be what other users see when they use this plugin for the first time.&lt;br /&gt;
&lt;br /&gt;
== Adding Menu Plugins ==&lt;br /&gt;
&lt;br /&gt;
I have created a small menu project [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/org.protege.example.menu/trunk here] that shows how to create several different menu types.  Later we will use this project as the example that drives this wiki page.&lt;br /&gt;
&lt;br /&gt;
Adding a new menu to Protege 4.1 is very easy.  The two things that the developer needs to accomplish are  to &lt;br /&gt;
write the code for the menu action and to add an entry to the plugin.xml.  I will take a real world example to illustrate the process.  In this example, I am writing a plugin that causes Protege to display an ontology that is stored in a database format.  I want to put this in the file menu of Protege 4.1 just under other items such as &amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Open Recent&amp;quot; and &amp;quot;Open from URL&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To write the code for the menu plugin, the developer merely needs to extend ProtegeOWLAction.  The three methods that the developer needs to write are initialise, dispose and actionPerformed. I think that the meaning of these three methods is pretty clear and this can be a very easy task.&lt;br /&gt;
&lt;br /&gt;
Now the developer needs to add an entry to the [http://smi-protege/repos/protege/protege4/incubator/v3/org.protege.owlapi.bridge/trunk/plugin.xml plugin.xml] file.  In my case the entry looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;loadDatabase&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Load Database Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Loads ontologies from a database into Protege&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;id&amp;quot; attribute of loadDatabase is simply a short identifier for the plugin that is not seen by the user.  The &amp;quot;point&amp;quot; attribute indicates that the plugin being declared here is a menu plugin.  The &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
line indicates the class that implements the action that this menu performs and the &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
line indicates that the menu is to be used in the context of the owl editor.  The only other line in this [http://smi-protege/repos/protege/protege4/incubator/v3/org.protege.owlapi.bridge/trunk/plugin.xml plugin.xml] that is a bit mysterious is the line that says:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The purpose of this line is to indicate exactly where the menu should be placed.  The first part of the value,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
indicates that the parent of my &amp;quot;Load Database Ontology&amp;quot; menu is the file menu.  The string is making a reference to the file menu declaration&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension&lt;br /&gt;
         id=&amp;quot;menu.FileMenu&amp;quot;&lt;br /&gt;
         name=&amp;quot;FileMenu&amp;quot;&lt;br /&gt;
         point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;name value=&amp;quot;File&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;toolTip value=&amp;quot;File menu tool tip!&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;path value=&amp;quot;/SlotA-A&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
from the [http://smi-protege/repos/protege/protege4/plugins/org.protege.editor.core.application/trunk/plugin.xml plugin.xml] file for the org.protege.editor.core.application plugin.   The  first part of the string&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   org.protege.editor.core.application&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which is the identifier  of the plugin declaring the menu and &amp;quot;menu.FileMenu&amp;quot; is the id of the plugin from the plugin.xml file.&lt;br /&gt;
&lt;br /&gt;
But now I need to explain the meaning of the SlotAA-Z portion of the path in my original menu declaration:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;loadDatabase&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Load Database Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Loads ontologies from a database into Protege&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The SlotAA-Z string indicates exactly where the &amp;quot;Load Database Ontology&amp;quot; should appear in the File menu.  This string (SlotAA-Z) is parsed as a group (Slot-AA) and an index (Z).  First the group and the index are used to sort the children of the File menu.  The  children are sorted first by group but  when two children have  the same group they are then sorted by group index.  In addition to this, children with the same group are grouped together in the menu.&lt;br /&gt;
&lt;br /&gt;
In particular, if I track down the declarations of the &amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Open Recent&amp;quot; and &amp;quot;Open from URL&amp;quot; menus I find that  they all have a group identifier of SlotAA.  This is why they appear in the file menu together followed by a separator bar.  By specifying that my menu should have a group of SlotAA, I am telling Protege that I want my menu to be grouped with these menus.  By giving my menu an index of Z I am telling Protege that I want my menu to go at the end of the list.&lt;br /&gt;
&lt;br /&gt;
The algorithm used by Protege to determine the location of the plugin can be observed by turning on logging for the menu builder.  This can easily be done by editing the log4j.xml in the Protege installation directory.  First  modify the section that says&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;appender name=&amp;quot;console&amp;quot; class=&amp;quot;org.apache.log4j.ConsoleAppender&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;param name=&amp;quot;Threshold&amp;quot; value=&amp;quot;INFO&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%m%n&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;/layout&amp;gt;&lt;br /&gt;
        &amp;lt;/appender&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to say&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;appender name=&amp;quot;console&amp;quot; class=&amp;quot;org.apache.log4j.ConsoleAppender&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;param name=&amp;quot;Threshold&amp;quot; value=&amp;quot;INFO&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%m%n&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;/layout&amp;gt;&lt;br /&gt;
        &amp;lt;/appender&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This allows the console to show debug messages.  Then add the lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;category name=&amp;quot;org.protege.editor.core.ui.menu&amp;quot;&amp;gt;&lt;br /&gt;
        	&amp;lt;priority value=&amp;quot;debug&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/category&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will cause Protege to generate somewhat verbose logs to the console (these logs also show up in a log file in ${home directory}/.Protege/logs/protege-###.log).  The relevant lines for my menu plugin are as follows.  First&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   Parsed: [Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;] parentId = org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
indicates that Protege was able to parse the path for my menu plugin and determine that the id of the parent is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
the group is SlotAA and the group index is Z.  Next we see the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   [Menu: File -- &amp;lt;SlotA, A&amp;gt;] parent of [Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which indicates that Protege was successfully able to find a declared menu with the right id to be  the parent of my menu.  This line also indicates that Protege successfully deciphered the group (SlotAA) and the index (Z).  Finally there are the lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding [Menu: File -- &amp;lt;SlotA, A&amp;gt;] to menu bar&lt;br /&gt;
Giving File the child[Menu: New... -- &amp;lt;SlotAA, E&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open... -- &amp;lt;SlotAA, F&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open recent -- &amp;lt;SlotAA, G&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open from URL... -- &amp;lt;SlotAA, G&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Save -- &amp;lt;SlotAB, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Save as... -- &amp;lt;SlotAB, B&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Gather ontologies... -- &amp;lt;SlotAB, C&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Export inferred axioms as ontology... -- &amp;lt;SlotAB, D&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Ontology libraries... -- &amp;lt;SlotD, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Loaded ontology sources... -- &amp;lt;SlotD, B&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Check for plugins... -- &amp;lt;SlotP, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Close -- &amp;lt;SlotY, M&amp;gt;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
that indicate that the File menu was successfully populated.&lt;br /&gt;
&lt;br /&gt;
== Advanced Topics ==&lt;br /&gt;
=== Adding New Plugin Types ===&lt;br /&gt;
&lt;br /&gt;
'''Work in Progress'''&lt;br /&gt;
&lt;br /&gt;
One of the advantages of using the OSGi/Eclipse framework is that it naturally allows developers to&lt;br /&gt;
define their own plugin types.. For example, the SWRL tab, being written by &lt;br /&gt;
Martin O'Connor, delegates the work of executing the SWRL rules to a rule engine plugin.  It is anticipated that &lt;br /&gt;
there will be two rule engine plugins that are are compatible with the SWRL tab.  One of these plugins will &lt;br /&gt;
be based on the Jess rule engine and the other plugin will be based on the DROOLS rule engine.&lt;br /&gt;
&lt;br /&gt;
We will illustrate how this is done with two Protege bundles.  The sources for these bundles can be found &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/producer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Both bundles can be quickly installed through the included [[ConfiguringAntBuildFiles|ant scripts]].&lt;br /&gt;
&lt;br /&gt;
The consumer bundle behaves as follows.  It adds a menu item to a running Protege environment. This menu is found at the bottom of the edit menu.  When the user clicks on this menu item, the consumer bundle performs the following actions:&lt;br /&gt;
# it looks for all custom_extension_point plugins in the running Protege environment,&lt;br /&gt;
# it instantiates each plugin found and finally&lt;br /&gt;
# it calls the doSomething() method on that plugin instance.&lt;br /&gt;
&lt;br /&gt;
This behavior is provided through the interaction of four components:&lt;br /&gt;
* the '''consumer code''' that is  responsible for looping through a set of plugins and invoking them.&lt;br /&gt;
* the '''plugin loader''' that is responsible for calculating and returning a  set  of plugins that match a  specifiction.&lt;br /&gt;
* the '''plugin''' that is a java encoding of data encoded in plugin.xml files provided by the bundles.&lt;br /&gt;
* the '''plugin instance''' that is an instantiation of a plugin that does  the actual work of the plugin.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Consumer ====&lt;br /&gt;
&lt;br /&gt;
The Plugin consumer essentially uses the plugin loader (described  below) to loop through a series of plugins  and instantiate and invoke them.&lt;br /&gt;
The code that does this work can be found in the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPluginConsumer.java MyPluginConsumer] class and looks like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public void actionPerformed(ActionEvent e) {&lt;br /&gt;
        MyPluginLoader loader = new MyPluginLoader(getOWLModelManager());&lt;br /&gt;
        for (MyPlugin plugin : loader.getPlugins()) {&lt;br /&gt;
            try {&lt;br /&gt;
                MyPluginInstance i = plugin.newInstance();&lt;br /&gt;
                i.doSomething();&lt;br /&gt;
            }&lt;br /&gt;
            catch (Exception ex) {&lt;br /&gt;
                ProtegeApplication.getErrorLog().logError(ex);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a typical example of how a plugin consumer will work.  It uses a plugin loader to find a set of plugins that are then instantiated (plugin.newInstance()) and then invoked (i.doSomething()).  For the most part, the plugin consumer does not have to worry too much about the details of the Protege plugin infrastructure.  The logic of the Plugin consumer is defined by  the task at hand.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Loader ====&lt;br /&gt;
&lt;br /&gt;
The [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPluginLoader.java plugin loader] is responsible for searching for plugins of the custom_extension_point type.  The plugin loader extends  the AbstractPluginLoader  class which handles most of the logic of creating and  finding plugins.  Minimally, all the developer needs to do to implement the plugin loader is to implement a constructor and a create instance method.  The constructor looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public MyPluginLoader(OWLModelManager owlModelManager) {&lt;br /&gt;
        super(MyPlugin.CONSUMER_ID, MyPlugin.ID);&lt;br /&gt;
        this.owlModelManager = owlModelManager;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this is typical.  The significance of the two arguments to the super constructor will be explained when I describe the Plugin implementation.  Essentially they define which type of plugin is being searched for by this loader.  In addition, the constructor for this plugin loader takes an owlModelManager argument so that he can pass this argument to the constructor for the plugins.  The createInstance method then is responsible for constructing the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    protected MyPlugin createInstance(IExtension extension) {&lt;br /&gt;
        return new MyPlugin(owlModelManager, extension);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In addition there is a getExtensionMatcher method that can be used to restrict the set of plugins that are returned by this plugin loader.  Generally it is not necessary to implement the getExtensionMatcher interface.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin ====&lt;br /&gt;
&lt;br /&gt;
Essentially the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPlugin.java plugin] is a POJO representing a declaration of a plugin in a plugin.xml file.  To understand this we need to look at the two declarations in two separate plugin.xml files.  The first declaration is found in the bundle for the consumer plugin.  This declaration represents a request for a particular type of service.  In our case the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/plugin.xml declaration] looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension-point id=&amp;quot;custom_extension_point&amp;quot; &lt;br /&gt;
                    name=&amp;quot;Custom Extension Point&amp;quot;&lt;br /&gt;
                    schema=&amp;quot;schema/custom_extension_point.exsd&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This declaration defines &lt;br /&gt;
* the identifier of the plugin type, custom_extension_point, which is the name by which plugin developers refer to this plugin type,  This string corresponds to the MyPlugin.ID that we passed to the AbstractPluginLoader constructor above.  Note that it is possible for different bundles to declare an extension point &lt;br /&gt;
* the user friendly name of the plugin type and &lt;br /&gt;
* a pointer to the xml schema for the plugin type.&lt;br /&gt;
I believe that the last item, [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/schema/custom_extension_point.exsd the schema], is not mandatory but it is extremely useful for developers and it is created naturally when plugins are developed using the eclipse IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The plugin producer provided a [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/producer/plugin.xml declaration] for his extension that matches the extension point declaration above.  In our example the extension declaration looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;SimpleImplementation&amp;quot;&lt;br /&gt;
         	  point=&amp;quot;org.protege.example.extension.point.custom_extension_point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.example.extension.PluginImplementation&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;type value=&amp;quot;Logger Type&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The plugin class, [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPlugin.java MyPlugin], extends the AbstractProtegePlugin class. The AbstractProtegePlugin class provides many utilities that make it easy to write the plugin class.  In particular, to get the &amp;quot;type&amp;quot; field the MyPlugin class provides an accessor:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * gets the declared type field for the plugin&lt;br /&gt;
     */&lt;br /&gt;
    public String getType() {&lt;br /&gt;
        return getPluginProperty(TYPE_PARAM, &amp;quot;null type&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the AbstractProtegePlugin class does the tricky aspects of instantiating the plugin leaving only the task of initializing the instantiated  plugin to the MyPlugin class:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * Creates an instance of the plugin.  It is expected that&lt;br /&gt;
     * this instance will be &amp;quot;setup&amp;quot;, but the instance's&lt;br /&gt;
     * initialise method will not have been called in the instantiation&lt;br /&gt;
     * process.&lt;br /&gt;
     */&lt;br /&gt;
    public MyPluginInstance newInstance() throws ClassNotFoundException, IllegalAccessException,&lt;br /&gt;
                                                          InstantiationException {&lt;br /&gt;
    	MyPluginInstance mpi = super.newInstance();&lt;br /&gt;
        mpi.setup(modelManager, getType());&lt;br /&gt;
        return mpi;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Instance ====&lt;br /&gt;
&lt;br /&gt;
The [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/api/MyPluginInstance.java plugin instance  class] is responsible for performing whatever task it is  that the plugin is supposed to perform.  In our case the plugin instance will implement the doSomething() method.  This class  must implement the ProtegePluginInstance interface  though it is not clear that this is really needed anymore.  The ProtegePluginInstance interface has only one method, initialise(), but many plugins, such as the one in this example, have their own initailization methods that are called by the Plugin Loader.&lt;br /&gt;
&lt;br /&gt;
=== Frames, Frame Sections, and Rows ===&lt;br /&gt;
&lt;br /&gt;
'''In Progress'''&lt;br /&gt;
&lt;br /&gt;
It is not  clear that this needs to be here but this is an  extremely central Protege concept.  In general plugin developers will not need to build custom Frame lists and can simply use  the top level OWL Frame List concepts.&lt;br /&gt;
&lt;br /&gt;
Most of the discussion will focus on a smaller and smaller section of the the following Protege 4.1 screen.  This diagram shows the standard Protege 4.1 classes tab as it displays some information about the selected class which is the Country class in the pizza ontology.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameInClassesTab.png||A Classes Tab showing a standard frame in the right bottom]]&lt;br /&gt;
&lt;br /&gt;
==== FrameLists and Frames ====&lt;br /&gt;
&lt;br /&gt;
The diagram below shows a FrameList showing a description of the Country class.   The OWLFrameList is the swing object that is responsible for displaying some object called the root object for the OWLFrameList.  In this case, the root object for this frame list is the Country OWL class.  Frequently the root object of the for a frame list is an OWL entity but this is not required.  The constructor for the OWLFrameList object takes an OWLFrame object which manages the content model of the OWLFrameList.  The associated OWLFrame object also has a root object and in this case the root object is the Country class.&lt;br /&gt;
&lt;br /&gt;
While it may not be visually immediately apparent, the information being displayed is actually a rendition of a list of axioms.  Thus for instance, the class expression represented in the section underneath ''Equivalent Classes'' represents the axiom&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Country SubClassOf DomainConcept and {America, England, France, Germany, Italy}.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Similarly the first individual displayed under ''Members'' represents the axiom&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    America Type Country.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fact that these are not displayed simply as the associated axioms is an key part of the purpose of the OWLFrameList.  The task of the OWLFrameList below is to describe the Country class. For a user it makes sense that in the Members section of that  OWLFrameList he would see a list of the individuals in that class.  It would make less sense to the user if a set of axioms was displayed there.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameList.png||Frame List]]&lt;br /&gt;
&lt;br /&gt;
==== Frame Sections ====&lt;br /&gt;
&lt;br /&gt;
OWLFrames are grouped into a series of sections each of which shows a particular type of axioms.  In the diagram below we have a frame section that is rendering a list of class assertion axioms.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSection.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
==== Frame Section Rows ====&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSectionRow.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSectionRowAlt.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
== Glossary == &lt;br /&gt;
&lt;br /&gt;
There are some terms that come up naturally in the discussion of Protege 4 plugin development that require a bit of explanation.  The Protege 4 plugin mechanism has three layers and the terms used to describe plugins is slightly different at each of these layers:&lt;br /&gt;
* '''Extension Point''' is the eclipse term for what Protege folk often call a plugin.&lt;br /&gt;
* '''[http://www.osgi.org/Main/HomePage OSGi]''' is the bottom layer of  the Protege plugin architecture.  It is a powerful industry standard framework which provides modularity and services beyond that provided by the Java specifications.   In OSGi, the term OSGi bundle is used to represent a self-contained unit of code that can be introduced into the OSGi framework and which will import and export classes and resources in a controlled way.  &lt;br /&gt;
* '''An OSGi Bundle''' is collection of software grouped into a single jar file.  When this software runs in the OSGi environment, it runs in a protected space where it can define exactly what java classes from the surrounding environment are needed and what java classes are incompatible with its operation.  Bundles have names, version numbers, developer contact information and activation entry points.&lt;br /&gt;
* '''A Plugin''' is a declared service that implements some functionality of use to the Protege platform.  The Protege Plugin mechanism is based on the Eclipse plugin mechanism where plugins are declared in a file called plugin.xml.&lt;br /&gt;
* '''[http://wiki.eclipse.org/index.php/Rich_Client_Platform The Eclipse Rich Client Platform]''' is an environment built on top of OSGi which provides additional features to ease the building of a &amp;quot;Rich&amp;quot; client.  Protege 4 only uses some of the features of this rich client platform.  In particular, Protege 4 does not use SWT and many of the graphical related capabilities.  But Protege 4 does use the declarative plugin capabilities provided by eclipse.  It is here that some of the power of the OSGi platform becomes manifest, because we have been able to use only those bundles from the eclipse Rich Client platform that we need.  In this setting, OSGi bundles created  according to certain conventions become Eclipse Plugins.&lt;br /&gt;
* '''The Protege 4 Plugin layer''' provides some additional convenience methods over the Eclipse Plugin framework.  Certain eclipse plugins that extend Protege 4 capabilities are called Protege 4 plugins.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=PluginTypes&amp;diff=9620</id>
		<title>PluginTypes</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=PluginTypes&amp;diff=9620"/>
				<updated>2011-04-04T20:11:43Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Fixed reference to wrong class&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;orangeBox&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;orangeBoxTitle&amp;quot;&amp;gt;Protege 4 Plugin types&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
This page summarises the default types of plugin that can be implemented for Protege 4.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to [[Protege4DevDocs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Existing Plugin Types ==&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of the existing types of plugins that can be added to Protege4.0.&lt;br /&gt;
The current set of plugin types can always be found in the code by looking at the plugin.xml file for the core.application and the owl bundles.&lt;br /&gt;
Just look for the extension-points in these files – these point to the schemas that are used for describing each type of plugin.&lt;br /&gt;
Plenty of examples can be found in the plugin.xml files themselves.&lt;br /&gt;
&lt;br /&gt;
=== Core Plugins ===&lt;br /&gt;
&lt;br /&gt;
==== ViewComponent ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most common plugin type – implements views (the building blocks of workspace tabs).&lt;br /&gt;
&lt;br /&gt;
Implementation of this plugin is demonstrated in the [http://www.co-ode.org/downloads/protege-x/plugin-code-example.php '''TabbedHierarchyView''' example].&lt;br /&gt;
&lt;br /&gt;
There are many abstract implementations of this plugin to use as a base, for example each entity type (Class, Property and Individual) has an abstract base.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.ui.view.ViewComponent'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.clshierarchy.ToldOWLClassHierarchyViewComponent'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== EditorKitMenuAction ====&lt;br /&gt;
&lt;br /&gt;
Create an entry in a [[#menu.window|menu]] (and supply a mnemonic) and its associated action.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.ui.action.ProtegeAction'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.action.RemoveAllDisjointAxiomsAction'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;menu.RemoveAllDisjointAxioms&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Remove all disjoint axioms...&amp;quot;/&amp;gt; &lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Removes all of the disjoint axioms.&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.action.RemoveAllDisjointAxiomsAction&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.EditMenu/SlotM-H&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''id'' = an ID for this plugin&lt;br /&gt;
&lt;br /&gt;
''point'' = the type of plugin&lt;br /&gt;
&lt;br /&gt;
''name'' = the name as it appears in the menu&lt;br /&gt;
&lt;br /&gt;
''toolTip'' = a description of the action shown in a tooltip&lt;br /&gt;
&lt;br /&gt;
''class'' = the implementing class (full package name)&lt;br /&gt;
&lt;br /&gt;
''path'' = the relative position in the menu (section pos, subsection pos)&lt;br /&gt;
&lt;br /&gt;
''editorKitId'' = the type of editor kit this plugin works with&lt;br /&gt;
&lt;br /&gt;
===== Open URL in browser action =====&lt;br /&gt;
&lt;br /&gt;
An addition has been made to the EditorKitMenuAction that allows a menu item that opens a specified page in a web browser.&lt;br /&gt;
This has been used to implement help items, but could be useful for lots of different reasons.&lt;br /&gt;
&lt;br /&gt;
The best thing is '''this requires no coding whatsoever'''.&lt;br /&gt;
* ''url'' should be specified in the action descriptor instead of ''class''.&lt;br /&gt;
* The value should be the full URL of the webpage you wish to open.&lt;br /&gt;
&lt;br /&gt;
Specifying a ''class'' element will cause the ''url'' to be ignored.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;extension id=&amp;quot;menu.PluginsMenuItem&amp;quot; point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Protege-OWL plugins&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Protege 4.0 OWL plugins&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;url value=&amp;quot;http://protegewiki.stanford.edu/index.php/Protege-OWL_4.0&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.HelpMenu/SlotF-B&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== preferencespanel ====&lt;br /&gt;
&lt;br /&gt;
Create a panel that will be loaded into the preferences dialog.&lt;br /&gt;
&lt;br /&gt;
This should be for controlling a particular aspect of Protege4.0 in general or can be used as part of a bundle to control the behaviour of other plugins.&lt;br /&gt;
&lt;br /&gt;
Preferences should be used to persist over sessions.&lt;br /&gt;
&lt;br /&gt;
The '''applyChanges()''' method should be used to update the appropriate values in Protege's '''PreferencesManager'''.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.owl.ui.preferences.OWLPreferencesPanel'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.tree.OWLTreePreferencesPanel'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== WorkspaceTab ====&lt;br /&gt;
&lt;br /&gt;
Unless your tab requires some special handling for events or non-standard layout you will probably not need to implement a class for this plugin.&lt;br /&gt;
You can just point the plugin.xml configuration to WorkspaceViewsTab (or OWLWorkspaceViewsTab) implementation and the rest of the plugin description&lt;br /&gt;
should be enough to customise the tab – i.e., give it a name and point to a default layout (see below).&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.ui.workspace.WorkspaceTab'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.OWLClassesTab'''&lt;br /&gt;
&lt;br /&gt;
===== Creating a tabbed view layout =====&lt;br /&gt;
* First, create or decide on which views you wish to have on your tab - make sure these are all implemented&lt;br /&gt;
* Open Protege 4.0&lt;br /&gt;
* Create a new tab ('''Window | Create new tab...''')&lt;br /&gt;
* Select your new tab and start customising it by adding views (see [[Protege4GettingStarted#Reconfigure_the_User_Interface|Reconfigure the user interface]])&lt;br /&gt;
* Select '''Window | Save current layout''' or quit Protege&lt;br /&gt;
* Find the new layout in the Protege installation directory ''Data/ViewConfigurations/viewconfig-custom-YOUR_TAB_NAME.xml''&lt;br /&gt;
* Rename this without the ''custom'' and copy to somewhere in your plugin source like a ''resources/'' folder&lt;br /&gt;
* Make sure this folder is on your classpath and that it gets added to you compiler output path&lt;br /&gt;
* Add the layout ('''defaultViewConfigFileName''') to the plugin description in plugin.xml&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;OWLOntologyTab&amp;quot;&lt;br /&gt;
                point=&amp;quot;org.protege.editor.core.application.WorkspaceTab&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;label value=&amp;quot;Active Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.core.ui.workspace.WorkspaceViewsTab&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;defaultViewConfigFileName value=&amp;quot;viewconfig-ontologytab.xml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;index value=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== EditorKitFactory ====&lt;br /&gt;
&lt;br /&gt;
An EditorKit is the access point for a particular type of model (or ontology) and a GUI to handle that model.&lt;br /&gt;
&lt;br /&gt;
Currently, there is just one implementation - the OWLEditorKit&lt;br /&gt;
&lt;br /&gt;
Implement this type of plugin if you require a new type of model to be supported (eg a Frames-based model).&lt;br /&gt;
&lt;br /&gt;
There is obviously considerable work needed to implement a new editor kit (along with its model manager and workspace).&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.editorkit.EditorKitFactory'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.OWLEditorKitFactory'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== menu.window ====&lt;br /&gt;
&lt;br /&gt;
Create a new menu into which [[#EditorKitMenuAction|EditorKitMenuActions]] can be added.&lt;br /&gt;
No need for any implementation. The plugin description gives enough detail for full customisation.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;menu.EditMenu&amp;quot;&lt;br /&gt;
                point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Edit&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;/SlotB-A&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== OntologyRepositoryFactory ====&lt;br /&gt;
&lt;br /&gt;
Create a source from which ontologies can be loaded. This plugin will create an entry on the welcome screen that allows the user to get ontologies from any number of places (a repository, a web service etc).&lt;br /&gt;
&lt;br /&gt;
* Implement '''org.protege.editor.core.OntologyRepositoryFactory'''&lt;br /&gt;
* Example '''org.protege.editor.owl.model.repository.TONESRepositoryFactory'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;TONESRepository&amp;quot; point=&amp;quot;org.protege.editor.core.application.OntologyRepositoryFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.model.repository.TONESRepositoryFactory&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== EditorKitHook ====&lt;br /&gt;
&lt;br /&gt;
Perform some actions when an editing session is started.&lt;br /&gt;
The initialise() method gets called when the EditorKit has been initialised.&lt;br /&gt;
This can be used to perform some special configuration or replace default behaviour.&lt;br /&gt;
&lt;br /&gt;
* Implement '''org.protege.editor.core.editorkit.plugin.EditorKitHook''' (or org.protege.editor.owl.model.OWLEditorKitHook)&lt;br /&gt;
* Extension point '''org.protege.editor.core.application.EditorKitHook'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ToolBarAction ====&lt;br /&gt;
&lt;br /&gt;
Not currently used - will be implemented to allow view actions to be customised&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ViewAction ====&lt;br /&gt;
&lt;br /&gt;
Not currently used - will be implemented to allow view actions to be customised&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== OWL Plugins ===&lt;br /&gt;
&lt;br /&gt;
==== inference.reasonerfactory ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ui.renderer.entitycolorprovider ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== model.libraryfactory ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== moveaxiomskit ====&lt;br /&gt;
&lt;br /&gt;
Methods of selecting axioms for copying, moving or deleting (see [[P4MoveAxioms|Refactor | Copy/move/delete axioms]]) are pluggable.&lt;br /&gt;
&lt;br /&gt;
You can choose to implement pages to add to the wizard to control how your kit works.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.owl.ui.ontology.wizard.move.MoveAxiomsKit'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.ontology.wizard.move.byreference.MoveAxiomsByReferenceKit'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;MoveAxiomsByReference&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.owl.moveaxiomskit&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Axioms by reference (select entities from the ontology)&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.ontology.wizard.move.byreference.MoveAxiomsByReferenceKit&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ui.editor.description (from build 109) ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Class-expression-editor.png|400px|right]]&lt;br /&gt;
&lt;br /&gt;
When adding/editing superclasses, equivalent classes, property domains, individual types etc a class description editor is brought up.&lt;br /&gt;
&lt;br /&gt;
Each tab on the editor is a plugin capable of creating/editing (possibly a subset) OWL class descriptions&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.owl.ui.editor.AbstractOWLDescriptionEditor'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.editor.OWLClassSelectorWrapper'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;OWLClassSelectorWrapper&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.owl.ui.editor.description&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;label value=&amp;quot;Asserted class hierarchy&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.editor.OWLClassSelectorWrapper&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;index value=&amp;quot;B&amp;quot;/&amp;gt;&amp;lt;!-- from build 110 --&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=Protege4DevDocs&amp;diff=9607</id>
		<title>Protege4DevDocs</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=Protege4DevDocs&amp;diff=9607"/>
				<updated>2011-03-25T15:33:05Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Spelling correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;orangeBox&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;orangeBoxTitle&amp;quot;&amp;gt;Protege 4 Developer Documentation&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Pointers for developers of plugins and understanding the core APIs of Protege 4.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Guidelines ==&lt;br /&gt;
&lt;br /&gt;
Protege 4.1 will be compatible with both Java 5 and Java 6.  Unfortunately we need to continue supporting Java 5 because of problems with Java on the older Apple platforms (the PowerPC and 32 bit Macs).  If you are writing a plugin and you want to be available on all OS X platforms, then you must use Java 5.  Otherwise Java 6 works as long  as you understand that you are  excluding a  subset of the Apple  platforms.&lt;br /&gt;
&lt;br /&gt;
'''Please consider writing any P4 code as a plugin'''.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you cannot do this for various reasons, please let us&lt;br /&gt;
know as we may be able to improve the core design in order to support you.&amp;lt;br /&amp;gt;&lt;br /&gt;
Protege 4.0 has been written specifically to be modular. It uses the [http://www.osgi.org/About/Technology '''OSGi framework'''] as a plugin infrastructure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Please share.'''&amp;lt;br /&amp;gt;&lt;br /&gt;
It is surprising how many people have written plugins for P4 that we just don't hear about.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you wish to publish to the community, please see our notes on [[Protege4Contributing#Code_submissions|code contributions]].&lt;br /&gt;
&lt;br /&gt;
== Using an Integrated Development Environment ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Protege 4 OWL editor in Eclipse or IntelliJ  ===&lt;br /&gt;
&lt;br /&gt;
* [[CompileProtege4InEclipseFromSvn|Setting up eclipse with Protege 4.1]] '''(Recommended for Protege 4.1)'''&amp;lt;br/&amp;gt;This page gives directions for compiling and running Protege  4.1 using Eclipse's plugin development framework.  It includes the OS X workaround  as well.&lt;br /&gt;
* [[CompileProtege4InIntelliJFromSvn|Setting up IntelliJ IDEA with Protege 4.1]] '''(Recommended for Protege 4.1)'''&amp;lt;br/&amp;gt;This page gives directions for compiling and running Protege  4.1 using IDEA's Osmorc plug-in.&lt;br /&gt;
&lt;br /&gt;
=== Protege 4 OWL editor in a Other IDEs ===&lt;br /&gt;
&lt;br /&gt;
There is no longer a page that describes how to set up an IDE other than eclipse or IntelliJ.  We welcome contributions from the community for directions on how to set up other developement environments.  In particular NetBeans  seems to have a following and it would be useful to have a page describing how to set up for that IDE.&lt;br /&gt;
For an experienced Java developer, the [[#Building_Protege4.1_from_scratch_using_ant|ant build steps]] will probably provide enough hints to put together an arbitrary ide environment for Protege 4.1.&lt;br /&gt;
&lt;br /&gt;
== Writing A Plugin ==&lt;br /&gt;
&lt;br /&gt;
The following links are focussed on the problems of writing a plugin and are not focused on how your build environment should be configured.  For information about configuring your build environment go to [[Protege4DevDocs#Using_an_Integrated_Development_Environment|Using an IDE]].&lt;br /&gt;
&lt;br /&gt;
[[PluginAnatomy|This page]] gives a quick start to writing a plugin for Protege 4.  It starts with a guide to writing the empty (trivial) plugin in five minutes.   Then it describes how some additional content can be added to the plugin.  &lt;br /&gt;
&lt;br /&gt;
=== Additional Information ===&lt;br /&gt;
&lt;br /&gt;
In addition to this there are some other useful sources on plugin development:&lt;br /&gt;
* [[PluginTypes|plugin types]] provides a list of plugin types that you can implement in Protege 4.&lt;br /&gt;
* Once you have written a plugin you want people to use it. Some very simple steps allow you to advertise your plugin and [[EnablePluginAutoUpdate|enable auto-update]].&lt;br /&gt;
* A short guide to [http://www.co-ode.org/downloads/protege-x/plugin-code-example.php writing a plug-in] to show the class hierarchy.  This page is not supported by the Protege team and may indeed not be actively updated any more.  It has some very useful information but will quite likely slowly go out of date.&lt;br /&gt;
&lt;br /&gt;
== Misc == &lt;br /&gt;
&lt;br /&gt;
=== Protege APIs ===&lt;br /&gt;
&lt;br /&gt;
Here is a summary of the main parts of the [[P4APIOverview|Protege 4 API]] for gaining access to the model and various utilities. &lt;br /&gt;
&lt;br /&gt;
Also see the [http://protege.stanford.edu/protege/4.0/docs/api/ javadoc for Protege 4.0 code].&lt;br /&gt;
&lt;br /&gt;
=== UI components ===&lt;br /&gt;
&lt;br /&gt;
The Protege core and the OWL editor kit both provide a large number of [[P4UiComponentSummary|reuseable components]] and utilities for generating user interfaces for ontologies.&lt;br /&gt;
&lt;br /&gt;
=== Updating to Protege 4.1 ===&lt;br /&gt;
&lt;br /&gt;
A short [[P4_1PortingGuide|guide]] to migrating plugins from Protege4.0 to Protege4.1 (in progress).&lt;br /&gt;
&lt;br /&gt;
=== Building Protege4.1 from scratch using ant ===&lt;br /&gt;
&lt;br /&gt;
The Protege 4.1 build process has been refactored since Protege 4.0.  This means that the locations of the various Protege 4.1 plugins is different than the corresponding locations in Protege 4.0.  There are several advantages of the new scheme:&lt;br /&gt;
* the build files are independent so that changes to one plugin can be propagated to the distribution by compiling just the plugin rather than the redoing an entire Protege build.&lt;br /&gt;
* the build files autodetect the format of the protege distribution.  This means that a single build file for the os x application bundle (Protege.app) and a felix based distribution.&lt;br /&gt;
* the new build process is much simpler allowing us to more easily update the various components.&lt;br /&gt;
Although many readers of this section will not be planning on doing an ant build, these directions clarify the location of the various Protege 4.1 plugins in svn.&lt;br /&gt;
&lt;br /&gt;
A very quick build (40 seconds) can be done with the following steps:&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/misc/society/protege4/trunk protege4''&lt;br /&gt;
# cd protege4&lt;br /&gt;
# ant install&lt;br /&gt;
# cd build/Protege&lt;br /&gt;
# run protege (e.g. sh run.sh)&lt;br /&gt;
&lt;br /&gt;
The manual steps are as follows.&lt;br /&gt;
First  you must set the PROTEGE_HOME environment variable which is described [[ConfiguringAntBuildFiles|here]].  Then you can build Protege 4.1 by  following the following steps.&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk protege-base''&lt;br /&gt;
# ''cd protege-base'' and ''ant install'' and ''cd ..''.  '''Warning:''' this step deletes the existing contents of ${PROTEGE_HOME}.&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/plugins/org.protege.common/trunk org.protege.common''&lt;br /&gt;
# ''cd org.protege.common'' and ''ant install' and ''cd ..'''&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/plugins/org.protege.jaxb/trunk org.protege.jaxb''&lt;br /&gt;
# ''cd org.protege.jaxb'' and ''ant install'' and ''cd ..''&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/plugins/org.protege.editor.core.application/trunk org.protege.editor.core.application''&lt;br /&gt;
# ''cd org.protege.editor.core.application'' and ''ant install'' and ''cd ..''&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/plugins/org.semanticweb.owl.owlapi/trunk org.semanticweb.owl.owlapi''&lt;br /&gt;
# ''cd org.semanticweb.owl.owlapi'' and ''ant install'' and ''cd ..''&lt;br /&gt;
# ''svn checkout http://smi-protege.stanford.edu/repos/protege/protege4/plugins/org.protege.editor.owl/trunk org.protege.editor.owl''&lt;br /&gt;
# ''cd org.protege.editor.owl'' and ''ant install'' and ''cd ..''&lt;br /&gt;
This will give a minimal installation and other  plugins can be added as desired.  In addition, protege-base comes with a run target that can be  used to run Protege and a debug target that can be used to debug Protege using java's remote debugging support.  Source plugins can be created by adding ''ant add.source'' before the ''ant install'' step.  A full run on an extremely slow machine is shown [[Protege41FullBuild|here]].&lt;br /&gt;
&lt;br /&gt;
===Embedded OSGi===&lt;br /&gt;
&lt;br /&gt;
For people embedding Protege 4 services inside a non-OSGi based applications [[Embedding OSGi|here]] is a short example showing how this can work.&lt;br /&gt;
&lt;br /&gt;
===Database Backends===&lt;br /&gt;
&lt;br /&gt;
There are now two database backends for the OWL API.  Very soon we expect to have a Protege plugin that enables both backend mechanisms.  We have put together a [[Loading A DatabaseProject|document]] describing how both database backends can be used with the owl api.&lt;br /&gt;
&lt;br /&gt;
===Client-Server===&lt;br /&gt;
&lt;br /&gt;
You will only find extreme bleeding edge stuff here.  I am writing a new [[Protege 4 Development Environment|page]] describing how to setup a development environment for the client server.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
* [[SolvingClassLoaderProblems|Troubleshooting class loader issues]]&lt;br /&gt;
* [[DealingWithJava5CompilerIssues|Troubleshooting and fixing problems with the Java 5 compiler]]&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=PluginAnatomy&amp;diff=9521</id>
		<title>PluginAnatomy</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=PluginAnatomy&amp;diff=9521"/>
				<updated>2011-03-09T21:14:15Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Typo: Further correction to last change: the Java class hierarchy shouldn't contain &amp;quot;editor&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this web page is to describe some of the key ingredients of  a plugin.  The page will be directed by &lt;br /&gt;
the quick development of a plugin and can indeed be used as a quick start guide.  In order to focus attention on the core  plugin&lt;br /&gt;
concepts we will use the lowest common denominator of Java development tools and this tutorial will not use a Java IDE.&lt;br /&gt;
We will assume that the &lt;br /&gt;
reader has an understanding of Java development and knows how to follow along in his favorite IDE.  For more information about&lt;br /&gt;
how to work with protege 4 in an IDE I will  direct the reader to [[Protege4DevDocs#Using_an_Integrated_Development_Environment|this page]].  It is possible for an experienced developer to skip the ant scripts simply follow  along in an IDE but we would still recommend a build file for the final version.&lt;br /&gt;
&lt;br /&gt;
==The vacuous plugin in five minutes==&lt;br /&gt;
&lt;br /&gt;
I just did it in just over [[Protege4 Plugin In Four Minutes|four minutes]].&lt;br /&gt;
&lt;br /&gt;
The simplest (trivial) plugin can be built from sources in the following layout:&amp;lt;pre&amp;gt;&lt;br /&gt;
   build.xml&lt;br /&gt;
   META-INF&lt;br /&gt;
      MANIFEST.MF&lt;br /&gt;
   lib&lt;br /&gt;
   resources&lt;br /&gt;
   src&lt;br /&gt;
&amp;lt;/pre&amp;gt;  As we will see - even without any java sources - this is a sufficient basis for building a plugin that is recognized by Protege 4.  There are only two files in this source tree - the build.xml file and the MANIFEST.MF.  These files can be quickly put together from templates.&lt;br /&gt;
&lt;br /&gt;
===Build.xml===&lt;br /&gt;
&lt;br /&gt;
The template for the build.xml file can be downloaded from [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-plugin-build.xml here].  Only two things need to be changed in this build file.  They can be found by searching for the string &amp;quot;CHANGE ME&amp;quot; in the file.  The first thing to change is the name of the project.  I will call the project the plugin tutoiral project:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;project name = &amp;quot;plugin tutorial&amp;quot; default = &amp;quot;install&amp;quot; basedir = &amp;quot;.&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The next setting that must almost always be changed is the name of the plugin.  In this case, the build.xml already has the right name for the plugin but this is the only plugin for which this will be true:&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;property name = &amp;quot;plugin&amp;quot;          value = &amp;quot;org.protege.owl.examples.tab&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
With these adjustments the build.xml file is ready.&lt;br /&gt;
&lt;br /&gt;
===MANIFEST.MF===&lt;br /&gt;
&lt;br /&gt;
The template for the MANIFEST.MF file can be downloaded from [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-manifest.mf here].  Only five things need to be changed in this file to make it useable and two are optional.  These  can be found by searching for the string &amp;quot;CHANGE ME&amp;quot; in the file.  The first change is to set the display name for the plugin:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-Name: Tutorial Plugin&lt;br /&gt;
&amp;lt;/pre&amp;gt; This is the name that is seen when Protege 4 starts up and in several plugin configuration screens.  &lt;br /&gt;
The seccond thing to change is the symbolic name of the plugin. The usual default is to uses the same name as the plugin name in the build.xml file:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-SymbolicName: org.protege.owl.examples.tab;singleton:=true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the &amp;quot;singleton:=true&amp;quot; line - this is important since most Protege 4 plugins will only work if they are instantiated exactly once.  The next things to change are the bundle description, the vendor and the documentation url:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-Description: A simple plugin for a plugin development tutorial&lt;br /&gt;
Bundle-Vendor: The Protege Development Team&lt;br /&gt;
Bundle-DocURL: www.perhaps.i.donthaveoneyet.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Actually the vendor and the docurl are optional and can be deleted.  The MANIFEST.MF file is now ready.&lt;br /&gt;
&lt;br /&gt;
===Compile and Run===&lt;br /&gt;
&lt;br /&gt;
Before  we can start, we must set the PROTEGE_HOME environment variable to point to a Protege 4 distribution.  [[ConfiguringAntBuildFiles|This page]] has directions on how to do this in different operating systems but for now I will assume that we are on a unix (or os x) system.  In that case, the system variable can be set with a simple command &amp;lt;pre&amp;gt;&lt;br /&gt;
   export PROTEGE_HOME=/Users/tredmond/Desktop/Protege_4.0_beta&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If for any reason,  using a environment variable is difficult, one can also achieve the same effect by creating a local.properties file with the single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   protege.home=/Users/tredmond/Desktop/Protege_4.0_beta&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This vacuous plugin is now ready to compile and run.  Assuming that the PROTEGE_HOME environment variable is set correctly, this plugin can be compiled with the simple command &amp;lt;pre&amp;gt;&lt;br /&gt;
  ant install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The full text of the build session is as follows:&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@Andromeda org.protege.editor.owl.examples.tab]$ ant install&lt;br /&gt;
Buildfile: build.xml&lt;br /&gt;
&lt;br /&gt;
init:&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes/lib&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/lib&lt;br /&gt;
&lt;br /&gt;
checkProtegeLibs:&lt;br /&gt;
     [echo] Using Protege Home = /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox to find protege jars&lt;br /&gt;
&lt;br /&gt;
checkProtegeLibsAndReport:&lt;br /&gt;
&lt;br /&gt;
buildlibs:&lt;br /&gt;
    [unjar] Expanding: /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/bundles/org.protege.common.jar into /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
&lt;br /&gt;
compile:&lt;br /&gt;
&lt;br /&gt;
build.manifest:&lt;br /&gt;
     [copy] Copying 1 file to /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
&lt;br /&gt;
copy.resources:&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes/META-INF&lt;br /&gt;
     [copy] Copying 1 file to /private/tmp/org.protege.editor.owl.examples.tab/build/classes/META-INF&lt;br /&gt;
&lt;br /&gt;
jar:&lt;br /&gt;
      [jar] Building jar: /private/tmp/org.protege.editor.owl.examples.tab/build/org.protege.owl.examples.tab.jar&lt;br /&gt;
&lt;br /&gt;
install:&lt;br /&gt;
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/configuration/org.eclipse.core.runtime&lt;br /&gt;
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/configuration/org.eclipse.osgi&lt;br /&gt;
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/plugins&lt;br /&gt;
&lt;br /&gt;
BUILD SUCCESSFUL&lt;br /&gt;
Total time: 2 seconds&lt;br /&gt;
[tredmond@Andromeda org.protege.editor.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the PROTEGE_HOME environment variable is not set correctly the user will instead see the following:&amp;lt;pre&amp;gt;&lt;br /&gt;
BUILD FAILED&lt;br /&gt;
/private/tmp/org.protege.editor.owl.examples.tab/build.xml:74: missing protege libraries&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now look at  what the build has done by exploring the project directory tree.&lt;br /&gt;
[[File:AnatomyBuildTreeAnnotated.png]]&lt;br /&gt;
&lt;br /&gt;
We see the following elements:&lt;br /&gt;
* '''The Class Tree''' is (approximately) a flattened view of the plugin (the jar file).  Generally this  largely consists of the .class files that have been compiled from the java.  But since we have not written any java yet this is not found.  In addition, this will contain resources needed by the plugin and libraries that the plugin needs but which cannot be found in other Protege plugins.&lt;br /&gt;
* '''The Generated Libraries''' which are extracted from Protege plugins.  This is needed because of a difference between how Java and OSGi get resources  out of Jar files.  OSGi allows a [[PluginAnatomy#Some_Nomenclature|bundle]] (which is a implemented as a jar file) to contain other jar files.  If the bundle classpath is configured correctly, OSGi will load classes from those jars in jars.  But Java does not have this capability.  So the build script extracts the jar files out of the OSGi bundles that will be needed to compile the bundle.  Note that these jar files are not copied to the class tree because the Protege 4/OSGi environment will  make the classes and resources of these  jar files available.&lt;br /&gt;
* '''The Protege 4 Plugin''' this is the final artifact of the build process.  Because  we have run &amp;quot;ant install&amp;quot; it has also been installed in the Protege distribution.&lt;br /&gt;
&lt;br /&gt;
If the developer is still with me then he is now ready to run the plugin.  Go to the Protege distribution (the one pointed to by the PROTEGE_HOME environment variable) and run it.  We are particularly interested in the console output because this is going to be the only indication that this plugin is recognized at all.  The console output should look like this:&amp;lt;pre&amp;gt;&lt;br /&gt;
Starting Protege 4 OWL Editor (Version 4.0.111)&lt;br /&gt;
Platform:&lt;br /&gt;
    Java: JVM 1.5.0_16-b06-284 Memory: 207M&lt;br /&gt;
    Language: en, Country: US&lt;br /&gt;
    Framework: Eclipse (1.4.0)&lt;br /&gt;
    OS: MacOSX (10.5.6)&lt;br /&gt;
    Processor: ppc&lt;br /&gt;
Installed plugin Pellet Reasoner&lt;br /&gt;
Installed plugin DL Query Tab&lt;br /&gt;
Installed plugin Owlviz Plug-in&lt;br /&gt;
Installed plugin owleditor&lt;br /&gt;
Installed plugin Tutorial Plugin&lt;br /&gt;
Installed plugin The OWL API&lt;br /&gt;
Installed plugin Factplusplus Plug-in&lt;br /&gt;
	Tutorial Plugin Plugin has no plugin.xml resource&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this output we see that the Tutorial Plugin has been recognized and installed.  In addition there is a informational message that the plugin.xml file has not been found.  This is  almost always indicates a problem because most Protege 4 plugins depend on a plugin.xml resource.  We will describe how the plugin.xml file is generated in the next sections.&lt;br /&gt;
&lt;br /&gt;
== Writing View and Tab Plugins ==&lt;br /&gt;
&lt;br /&gt;
The previous plugin added no functionality to Protege 4.  We are now going to describe how to remedy this situtaion.  So far we have not missed the Java IDE but it is now when we start writing a bit of Java code that the Java IDE would really shine.  But to illustrate the main concepts, we will continue to show how to build the plugin without any development environment other than  that provided by the core Java tools.&lt;br /&gt;
&lt;br /&gt;
===Adding a View Plugin to the Plugin.xml file===&lt;br /&gt;
&lt;br /&gt;
Recall that previously when we ran our plugin, Protege 4 complained that there was no plugin.xml file.   The plugin.xml file contains a declaration of the ways in which the plugin will extend the Protege 4 capabilities and (more advanced) the ways in which the plugin capabilities can be extended by other plugins.  We will start by adding a declaration that this plugin will implement a Protege View.  &lt;br /&gt;
&lt;br /&gt;
So first we will give a definition of a Protege view.  The purpose of a Protege view is to provide a view of some aspect of an ontology.  In the Protege interface, a Protege view is easily recognized.  It has a clearly defined border.  At the top of a Protege view is a title bar and a collection of buttons allowing the user to&lt;br /&gt;
* split the protege view into two copies of the same view one above the other,&lt;br /&gt;
* split the protege view into two copies of the same view one beside the other,&lt;br /&gt;
* float the view above the Protege client so that it is visible in any context,&lt;br /&gt;
* close the view removing it from the tab that contains it.&lt;br /&gt;
An example of a typical Protege view is shown below.&lt;br /&gt;
[[File:AnatomyView.png]]&lt;br /&gt;
&lt;br /&gt;
In order to declare our intent that this plugin implement a Protege view, we add the following pluxin.xml file to the root of the project tree:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;?eclipse version=&amp;quot;3.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;plugin&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleViewComponent&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example View Component&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;category value=&amp;quot;@org.protege.ontologycategory&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/plugin&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This plugin.xml file states that this plugin is making a single extension to the Protege 4 capabilities.   We will cover the meaning of the parts of this extension declaration line by line.  The first line defines the id of the extension.  This particular extension is called the ExampleViewComponent.  The second decleration,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
states what the extension is trying to do.  This extension is attempting to implement the functionality represented by the extension point with the name &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       org.protege.editor.core.application.ViewComponent.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The label declaration tells Protege what to put in the title bar of the view.  The class declaration indicates which class implements the functionality needed by this view.  We will go into the implementation of that class shortly.  Finally the category declaration tells Protege which menu under the View menu should contain this view.&lt;br /&gt;
&lt;br /&gt;
A very simple view can be written by extending the class AbstractOWLViewComponent and implementing the methods initialiseOWLView and disposeOWLView.  A very simple such implementation can be found &lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/tags/protege.4.0-2009-12-02/org.protege.editor.owl.examples.tab/src/org/protege/owl/examples/tab/ExampleViewComponent.java here for Protege 4.0.*] or&lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab/src/org/protege/owl/examples/tab/ExampleViewComponent.java here for Protege 4.1].&lt;br /&gt;
Now this plugin depends on a library that can be found &lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/tags/protege.4.0-2009-12-02/org.protege.editor.owl.examples.tab/lib/examplelib.jar here for Protege 4.0]&lt;br /&gt;
or&lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab/lib/examplelib.jar here for Protege 4.1].  This library should be deposited in the lib directory of the project.  This library is trivial and its only purpose is to show how to use a library in a plugin.  The directory tree of the project should now look like this:&lt;br /&gt;
[[File:AnatomyTreeDoesView.png]]&lt;br /&gt;
&lt;br /&gt;
At this point the ant install operation will compile, build and install the new plugin with the &amp;quot;ant install&amp;quot; command.&lt;br /&gt;
But the installed plugin won't run correctly and we will show how to fix this below.&lt;br /&gt;
&lt;br /&gt;
===Libraries and the Bundle Classpath===&lt;br /&gt;
&lt;br /&gt;
After we install the plugin, we can start Protege to try to use the &amp;quot;Example View Component&amp;quot;.  If you click on the View menu and then select &amp;quot;Ontology Views&amp;quot; you will see the &amp;quot;Example View Component&amp;quot; listed there.  However on selecting this view and trying to place on the Protege screen, the following error will arise:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error logged&lt;br /&gt;
java.lang.NoClassDefFoundError: org/protege/owl/example/Metrics&lt;br /&gt;
	at java.lang.Class.getDeclaredConstructors0(Native Method)&lt;br /&gt;
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)&lt;br /&gt;
	at java.lang.Class.getConstructor0(Class.java:2671)&lt;br /&gt;
	at java.lang.Class.newInstance0(Class.java:321)&lt;br /&gt;
	at java.lang.Class.newInstance(Class.java:303)&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If we look at the plugin contents with the &amp;quot;jar -tf &amp;quot; command then we will see that the build file correctly put the examplelib.jar into the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ jar -tf build/org.protege.owl.examples.tab.jar &lt;br /&gt;
META-INF/&lt;br /&gt;
META-INF/MANIFEST.MF&lt;br /&gt;
lib/&lt;br /&gt;
org/&lt;br /&gt;
org/protege/&lt;br /&gt;
org/protege/owl/&lt;br /&gt;
org/protege/owl/examples/&lt;br /&gt;
org/protege/owl/examples/tab/&lt;br /&gt;
lib/examplelib.jar&lt;br /&gt;
org/protege/owl/examples/tab/ExampleViewComponent.class&lt;br /&gt;
plugin.xml&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem at this point is in the MANIFEST.MF file.  The Bundle-Classpath line is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-ClassPath: .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To include the examplelib.jar in the jar file, the Bundle-Classpath line must be modified to include  this library:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-ClassPath: .,lib/examplelib.jar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that using a colon or a semi-colon instead of the comma does not work.  Also entering ./lib/examplib.jar does not work either.  This is the osgi mechanism for making this library available to this plugin.  Note that since the MANIFEST.MF file does not have an Export-Package declaration, these classes will only be visible within the plugin and will not be exported to any other plugin in the Protege 4 environmeht.  This is part of the plugin isolation provided by OSGi that allows different plugins to use different libraries without conflicts.&lt;br /&gt;
&lt;br /&gt;
Now the plugin works correctly and I can install the view into the Active Ontology Tab:&lt;br /&gt;
[[File:AnoyomyViewSuccessful.png]].&lt;br /&gt;
&lt;br /&gt;
===Tab Plugins and the Viewconfig.xml File===&lt;br /&gt;
&lt;br /&gt;
The other most common plugin type is the Protege tab.  In order to make a Protege tab, the developer needs to generate and use a viewconfig.xml file for the project.  In this section we will show how to do this.  It turns out that a tab can usually be put together without writing any Java code.  The steps for writing a tab plugin are&lt;br /&gt;
# add a declaration of the tab plugin in the plugin.xml file.&lt;br /&gt;
# start Protege and graphically configure the tab in question.&lt;br /&gt;
# save the configuration and include it with the source files for the tab.&lt;br /&gt;
# test by restarting Protege and running the tab with the default configuration.&lt;br /&gt;
These steps are described in more detail below.&lt;br /&gt;
&lt;br /&gt;
==== Step 1: Declare the plugin ====&lt;br /&gt;
&lt;br /&gt;
The first thing that that needs to be done is to declare the tab in the plugin.xml file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;?eclipse version=&amp;quot;3.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;plugin&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleViewComponent&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example View Component&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;category value=&amp;quot;@org.protege.ontologycategory&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleWorkspaceTab&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.WorkspaceTab&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example Tab&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.OWLWorkspaceViewsTab&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;index value=&amp;quot;X&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;defaultViewConfigFileName value=&amp;quot;viewconfig-exampleTab.xml&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/plugin&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important line in the above declaration of the tab is the defaultViewConfigFileName.  This names a resource that the protege plugin will look for to create the default layout of the tab.&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Layout the views in the plugin ====&lt;br /&gt;
&lt;br /&gt;
We can now compile this plugin and install it as before.  Now when we run Protege 4, we will see a new tab called the &amp;quot;Example Tab&amp;quot; in the tabs menu.  Enable this tab.  Since we have not yet created the viewconfig-exampleTab.xml file, you will see that the tab is empty.&lt;br /&gt;
&lt;br /&gt;
Now install and layout some views into this tab.  In my case I made the views look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:AnatomyViewLayout.png]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Save a configuration file ====&lt;br /&gt;
&lt;br /&gt;
Now in the tabs menu select &amp;quot;Export Current Tab&amp;quot; and save the file as &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   viewconfig-exampleTab.xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in the project directory.  In my case the viewconfig-exampleTab file looked like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
    &amp;lt;VSNode splits=&amp;quot;0.5 0.5&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;CNode&amp;gt;&lt;br /&gt;
            &amp;lt;Component label=&amp;quot;Asserted class hierarchy&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;Property id=&amp;quot;pluginId&amp;quot; value=&amp;quot;org.protege.editor.owl.OWLAssertedClassHierarchy&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Component&amp;gt;&lt;br /&gt;
        &amp;lt;/CNode&amp;gt;&lt;br /&gt;
        &amp;lt;CNode&amp;gt;&lt;br /&gt;
            &amp;lt;Component label=&amp;quot;Example View Component&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;Property id=&amp;quot;pluginId&amp;quot; value=&amp;quot;org.protege.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Component&amp;gt;&lt;br /&gt;
        &amp;lt;/CNode&amp;gt;&lt;br /&gt;
    &amp;lt;/VSNode&amp;gt;&lt;br /&gt;
&amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now before we complete this Protege session, go to the tabs menu and click &amp;quot;Reset selected tab to default state&amp;quot;.  You will see that the tab is now empty again.  Now exit Protege.&lt;br /&gt;
&lt;br /&gt;
The directory tree of the project should now look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:AnatomyTreeDoesViewWithConfig.png]]&lt;br /&gt;
&lt;br /&gt;
==== Step 4: Test the results ====&lt;br /&gt;
&lt;br /&gt;
Install the plugin again.  Note that the build script automatically found the viewconfig-exampleTab.xml file and put it into the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ jar -tf build/org.protege.owl.examples.tab.jar &lt;br /&gt;
META-INF/&lt;br /&gt;
META-INF/MANIFEST.MF&lt;br /&gt;
lib/&lt;br /&gt;
org/&lt;br /&gt;
org/protege/&lt;br /&gt;
org/protege/owl/&lt;br /&gt;
org/protege/owl/examples/&lt;br /&gt;
org/protege/owl/examples/tab/&lt;br /&gt;
lib/examplelib.jar&lt;br /&gt;
org/protege/owl/examples/tab/ExampleViewComponent.class&lt;br /&gt;
plugin.xml&lt;br /&gt;
viewconfig-exampleTab.xml&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run Protege and go to the Example Tab.  It is empty?  The reason for this is that the tab has been customized to have nothing in it from the last session.  Click on the tabs menu and click on &amp;quot;Reset selected tab to default state&amp;quot;.  Now you will see the views that we configured in the tab before.  This is now the default state for the tab and it will be what other users see when they use this plugin for the first time.&lt;br /&gt;
&lt;br /&gt;
== Adding Menu Plugins ==&lt;br /&gt;
&lt;br /&gt;
I have created a small menu project [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/org.protege.example.menu/trunk here] that shows how to create several different menu types.  Later we will use this project as the example that drives this wiki page.&lt;br /&gt;
&lt;br /&gt;
Adding a new menu to Protege 4.1 is very easy.  The two things that the developer needs to accomplish are  to &lt;br /&gt;
write the code for the menu action and to add an entry to the plugin.xml.  I will take a real world example to illustrate the process.  In this example, I am writing a plugin that causes Protege to display an ontology that is stored in a database format.  I want to put this in the file menu of Protege 4.1 just under other items such as &amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Open Recent&amp;quot; and &amp;quot;Open from URL&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To write the code for the menu plugin, the developer merely needs to extend ProtegeOWLAction.  The three methods that the developer needs to write are initialise, dispose and actionPerformed. I think that the meaning of these three methods is pretty clear and this can be a very easy task.&lt;br /&gt;
&lt;br /&gt;
Now the developer needs to add an entry to the [http://smi-protege/repos/protege/protege4/incubator/v3/org.protege.owlapi.bridge/trunk/plugin.xml plugin.xml] file.  In my case the entry looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;loadDatabase&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Load Database Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Loads ontologies from a database into Protege&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;id&amp;quot; attribute of loadDatabase is simply a short identifier for the plugin that is not seen by the user.  The &amp;quot;point&amp;quot; attribute indicates that the plugin being declared here is a menu plugin.  The &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
line indicates the class that implements the action that this menu performs and the &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
line indicates that the menu is to be used in the context of the owl editor.  The only other line in this [http://smi-protege/repos/protege/protege4/incubator/v3/org.protege.owlapi.bridge/trunk/plugin.xml plugin.xml] that is a bit mysterious is the line that says:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The purpose of this line is to indicate exactly where the menu should be placed.  The first part of the value,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
indicates that the parent of my &amp;quot;Load Database Ontology&amp;quot; menu is the file menu.  The string is making a reference to the file menu declaration&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension&lt;br /&gt;
         id=&amp;quot;menu.FileMenu&amp;quot;&lt;br /&gt;
         name=&amp;quot;FileMenu&amp;quot;&lt;br /&gt;
         point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;name value=&amp;quot;File&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;toolTip value=&amp;quot;File menu tool tip!&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;path value=&amp;quot;/SlotA-A&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
from the [http://smi-protege/repos/protege/protege4/plugins/org.protege.editor.core.application/trunk/plugin.xml plugin.xml] file for the org.protege.editor.core.application plugin.   The  first part of the string&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   org.protege.editor.core.application&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which is the identifier  of the plugin declaring the menu and &amp;quot;menu.FileMenu&amp;quot; is the id of the plugin from the plugin.xml file.&lt;br /&gt;
&lt;br /&gt;
But now I need to explain the meaning of the SlotAA-Z portion of the path in my original menu declaration:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;loadDatabase&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Load Database Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Loads ontologies from a database into Protege&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The SlotAA-Z string indicates exactly where the &amp;quot;Load Database Ontology&amp;quot; should appear in the File menu.  This string (SlotAA-Z) is parsed as a group (Slot-AA) and an index (Z).  First the group and the index are used to sort the children of the File menu.  The  children are sorted first by group but  when two children have  the same group they are then sorted by group index.  In addition to this, children with the same group are grouped together in the menu.&lt;br /&gt;
&lt;br /&gt;
In particular, if I track down the declarations of the &amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Open Recent&amp;quot; and &amp;quot;Open from URL&amp;quot; menus I find that  they all have a group identifier of SlotAA.  This is why they appear in the file menu together followed by a separator bar.  By specifying that my menu should have a group of SlotAA, I am telling Protege that I want my menu to be grouped with these menus.  By giving my menu an index of Z I am telling Protege that I want my menu to go at the end of the list.&lt;br /&gt;
&lt;br /&gt;
The algorithm used by Protege to determine the location of the plugin can be observed by turning on logging for the menu builder.  This can easily be done by editing the log4j.xml in the Protege installation directory.  First  modify the section that says&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;appender name=&amp;quot;console&amp;quot; class=&amp;quot;org.apache.log4j.ConsoleAppender&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;param name=&amp;quot;Threshold&amp;quot; value=&amp;quot;INFO&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%m%n&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;/layout&amp;gt;&lt;br /&gt;
        &amp;lt;/appender&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to say&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;appender name=&amp;quot;console&amp;quot; class=&amp;quot;org.apache.log4j.ConsoleAppender&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;param name=&amp;quot;Threshold&amp;quot; value=&amp;quot;INFO&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%m%n&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;/layout&amp;gt;&lt;br /&gt;
        &amp;lt;/appender&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This allows the console to show debug messages.  Then add the lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;category name=&amp;quot;org.protege.editor.core.ui.menu&amp;quot;&amp;gt;&lt;br /&gt;
        	&amp;lt;priority value=&amp;quot;debug&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/category&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will cause Protege to generate somewhat verbose logs to the console (these logs also show up in a log file in ${home directory}/.Protege/logs/protege-###.log).  The relevant lines for my menu plugin are as follows.  First&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   Parsed: [Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;] parentId = org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
indicates that Protege was able to parse the path for my menu plugin and determine that the id of the parent is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
the group is SlotAA and the group index is Z.  Next we see the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   [Menu: File -- &amp;lt;SlotA, A&amp;gt;] parent of [Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which indicates that Protege was successfully able to find a declared menu with the right id to be  the parent of my menu.  This line also indicates that Protege successfully deciphered the group (SlotAA) and the index (Z).  Finally there are the lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding [Menu: File -- &amp;lt;SlotA, A&amp;gt;] to menu bar&lt;br /&gt;
Giving File the child[Menu: New... -- &amp;lt;SlotAA, E&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open... -- &amp;lt;SlotAA, F&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open recent -- &amp;lt;SlotAA, G&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open from URL... -- &amp;lt;SlotAA, G&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Save -- &amp;lt;SlotAB, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Save as... -- &amp;lt;SlotAB, B&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Gather ontologies... -- &amp;lt;SlotAB, C&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Export inferred axioms as ontology... -- &amp;lt;SlotAB, D&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Ontology libraries... -- &amp;lt;SlotD, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Loaded ontology sources... -- &amp;lt;SlotD, B&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Check for plugins... -- &amp;lt;SlotP, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Close -- &amp;lt;SlotY, M&amp;gt;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
that indicate that the File menu was successfully populated.&lt;br /&gt;
&lt;br /&gt;
== Advanced Topics ==&lt;br /&gt;
=== Adding New Plugin Types ===&lt;br /&gt;
&lt;br /&gt;
'''Work in Progress'''&lt;br /&gt;
&lt;br /&gt;
One of the advantages of using the OSGi/Eclipse framework is that it naturally allows developers to&lt;br /&gt;
define their own plugin types.. For example, the SWRL tab, being written by &lt;br /&gt;
Martin O'Connor, delegates the work of executing the SWRL rules to a rule engine plugin.  It is anticipated that &lt;br /&gt;
there will be two rule engine plugins that are are compatible with the SWRL tab.  One of these plugins will &lt;br /&gt;
be based on the Jess rule engine and the other plugin will be based on the DROOLS rule engine.&lt;br /&gt;
&lt;br /&gt;
We will illustrate how this is done with two Protege bundles.  The sources for these bundles can be found &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/producer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
These two examples will only work with Protege 4.1 though it would not be too difficult to adapt them to work with&lt;br /&gt;
Protege 4.0 as well.  Both bundles can be quickly installed through the included [[ConfiguringAntBuildFiles|ant scripts]].&lt;br /&gt;
&lt;br /&gt;
The consumer bundle behaves as follows.  It adds a menu item to a running Protege environment. This menu is found at the bottom of the edit menu.  When the user clicks on this menu item, the consumer bundle performs the following actions:&lt;br /&gt;
# it looks for all custom_extension_point plugins in the running Protege environment,&lt;br /&gt;
# it instantiates each plugin found and finally&lt;br /&gt;
# it calls the doSomething() method on that plugin instance.&lt;br /&gt;
&lt;br /&gt;
This behavior is provided through the interaction of four components:&lt;br /&gt;
* the '''consumer code''' that is  responsible for looping through a set of plugins and invoking them.&lt;br /&gt;
* the '''plugin loader''' that is responsible for calculating and returning a  set  of plugins that match a  specifiction.&lt;br /&gt;
* the '''plugin''' that is a java encoding of data encoded in plugin.xml files provided by the bundles.&lt;br /&gt;
* the '''plugin instance''' that is an instantiation of a plugin that does  the actual work of the plugin.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Consumer ====&lt;br /&gt;
&lt;br /&gt;
The Plugin consumer essentially uses the plugin loader (described  below) to loop through a series of plugins  and instantiate and invoke them.&lt;br /&gt;
The code that does this work can be found in the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPluginConsumer.java MyPluginConsumer] class and looks like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public void actionPerformed(ActionEvent e) {&lt;br /&gt;
        MyPluginLoader loader = new MyPluginLoader(getOWLModelManager());&lt;br /&gt;
        for (MyPlugin plugin : loader.getPlugins()) {&lt;br /&gt;
            try {&lt;br /&gt;
                MyPluginInstance i = plugin.newInstance();&lt;br /&gt;
                i.doSomething();&lt;br /&gt;
            }&lt;br /&gt;
            catch (Exception ex) {&lt;br /&gt;
                ProtegeApplication.getErrorLog().logError(ex);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a typical example of how a plugin consumer will work.  It uses a plugin loader to find a set of plugins that are then instantiated (plugin.newInstance()) and then invoked (i.doSomething()).  For the most part, the plugin consumer does not have to worry too much about the details of the Protege plugin infrastructure.  The logic of the Plugin consumer is defined by  the task at hand.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Loader ====&lt;br /&gt;
&lt;br /&gt;
The [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPluginLoader.java plugin loader] is responsible for searching for plugins of the custom_extension_point type.  The plugin loader extends  the AbstractPluginLoader  class which handles most of the logic of creating and  finding plugins.  Minimally, all the developer needs to do to implement the plugin loader is to implement a constructor and a create instance method.  The constructor looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public MyPluginLoader(OWLModelManager owlModelManager) {&lt;br /&gt;
        super(MyPlugin.CONSUMER_ID, MyPlugin.ID);&lt;br /&gt;
        this.owlModelManager = owlModelManager;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this is typical.  The significance of the two arguments to the super constructor will be explained when I describe the Plugin implementation.  Essentially they define which type of plugin is being searched for by this loader.  In addition, the constructor for this plugin loader takes an owlModelManager argument so that he can pass this argument to the constructor for the plugins.  The createInstance method then is responsible for constructing the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    protected MyPlugin createInstance(IExtension extension) {&lt;br /&gt;
        return new MyPlugin(owlModelManager, extension);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In addition there is a getExtensionMatcher method that can be used to restrict the set of plugins that are returned by this plugin loader.  Generally it is not necessary to implement the getExtensionMatcher interface.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin ====&lt;br /&gt;
&lt;br /&gt;
Essentially the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPlugin.java plugin] is a POJO representing a declaration of a plugin in a plugin.xml file.  To understand this we need to look at the two declarations in two separate plugin.xml files.  The first declaration is found in the bundle for the consumer plugin.  This declaration represents a request for a particular type of service.  In our case the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/plugin.xml declaration] looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension-point id=&amp;quot;custom_extension_point&amp;quot; &lt;br /&gt;
                    name=&amp;quot;Custom Extension Point&amp;quot;&lt;br /&gt;
                    schema=&amp;quot;schema/custom_extension_point.exsd&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This declaration defines &lt;br /&gt;
* the identifier of the plugin type, custom_extension_point, which is the name by which plugin developers refer to this plugin type,  This string corresponds to the MyPlugin.ID that we passed to the AbstractPluginLoader constructor above.  Note that it is possible for different bundles to declare an extension point &lt;br /&gt;
* the user friendly name of the plugin type and &lt;br /&gt;
* a pointer to the xml schema for the plugin type.&lt;br /&gt;
I believe that the last item, [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/schema/custom_extension_point.exsd the schema], is not mandatory but it is extremely useful for developers and it is created naturally when plugins are developed using the eclipse IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The plugin producer provided a [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/producer/plugin.xml declaration] for his extension that matches the extension point declaration above.  In our example the extension declaration looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;SimpleImplementation&amp;quot;&lt;br /&gt;
         	  point=&amp;quot;org.protege.example.extension.point.custom_extension_point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.example.extension.PluginImplementation&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;type value=&amp;quot;Logger Type&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The plugin class, [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPlugin.java MyPlugin], extends the AbstractProtegePlugin class. The AbstractProtegePlugin class provides many utilities that make it easy to write the plugin class.  In particular, to get the &amp;quot;type&amp;quot; field the MyPlugin class provides an accessor:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * gets the declared type field for the plugin&lt;br /&gt;
     */&lt;br /&gt;
    public String getType() {&lt;br /&gt;
        return getPluginProperty(TYPE_PARAM, &amp;quot;null type&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the AbstractProtegePlugin class does the tricky aspects of instantiating the plugin leaving only the task of initializing the instantiated  plugin to the MyPlugin class:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * Creates an instance of the plugin.  It is expected that&lt;br /&gt;
     * this instance will be &amp;quot;setup&amp;quot;, but the instance's&lt;br /&gt;
     * initialise method will not have been called in the instantiation&lt;br /&gt;
     * process.&lt;br /&gt;
     */&lt;br /&gt;
    public MyPluginInstance newInstance() throws ClassNotFoundException, IllegalAccessException,&lt;br /&gt;
                                                          InstantiationException {&lt;br /&gt;
    	MyPluginInstance mpi = super.newInstance();&lt;br /&gt;
        mpi.setup(modelManager, getType());&lt;br /&gt;
        return mpi;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Instance ====&lt;br /&gt;
&lt;br /&gt;
The [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/api/MyPluginInstance.java plugin instance  class] is responsible for performing whatever task it is  that the plugin is supposed to perform.  In our case the plugin instance will implement the doSomething() method.  This class  must implement the ProtegePluginInstance interface  though it is not clear that this is really needed anymore.  The ProtegePluginInstance interface has only one method, initialise(), but many plugins, such as the one in this example, have their own initailization methods that are called by the Plugin Loader.&lt;br /&gt;
&lt;br /&gt;
=== Frames, Frame Sections, and Rows ===&lt;br /&gt;
&lt;br /&gt;
'''In Progress'''&lt;br /&gt;
&lt;br /&gt;
It is not  clear that this needs to be here but this is an  extremely central Protege concept.  In general plugin developers will not need to build custom Frame lists and can simply use  the top level OWL Frame List concepts.&lt;br /&gt;
&lt;br /&gt;
Most of the discussion will focus on a smaller and smaller section of the the following Protege 4.1 screen.  This diagram shows the standard Protege 4.1 classes tab as it displays some information about the selected class which is the Country class in the pizza ontology.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameInClassesTab.png||A Classes Tab showing a standard frame in the right bottom]]&lt;br /&gt;
&lt;br /&gt;
==== FrameLists and Frames ====&lt;br /&gt;
&lt;br /&gt;
The diagram below shows a FrameList showing a description of the Country class.   The OWLFrameList is the swing object that is responsible for displaying some object called the root object for the OWLFrameList.  In this case, the root object for this frame list is the Country OWL class.  Frequently the root object of the for a frame list is an OWL entity but this is not required.  The constructor for the OWLFrameList object takes an OWLFrame object which manages the content model of the OWLFrameList.  The associated OWLFrame object also has a root object and in this case the root object is the Country class.&lt;br /&gt;
&lt;br /&gt;
While it may not be visually immediately apparent, the information being displayed is actually a rendition of a list of axioms.  Thus for instance, the class expression represented in the section underneath ''Equivalent Classes'' represents the axiom&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Country SubClassOf DomainConcept and {America, England, France, Germany, Italy}.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Similarly the first individual displayed under ''Members'' represents the axiom&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    America Type Country.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fact that these are not displayed simply as the associated axioms is an key part of the purpose of the OWLFrameList.  The task of the OWLFrameList below is to describe the Country class. For a user it makes sense that in the Members section of that  OWLFrameList he would see a list of the individuals in that class.  It would make less sense to the user if a set of axioms was displayed there.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameList.png||Frame List]]&lt;br /&gt;
&lt;br /&gt;
==== Frame Sections ====&lt;br /&gt;
&lt;br /&gt;
OWLFrames are grouped into a series of sections each of which shows a particular type of axioms.  In the diagram below we have a frame section that is rendering a list of class assertion axioms.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSection.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
==== Frame Section Rows ====&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSectionRow.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSectionRowAlt.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
== Glossary == &lt;br /&gt;
&lt;br /&gt;
There are some terms that come up naturally in the discussion of Protege 4 plugin development that require a bit of explanation.  The Protege 4 plugin mechanism has three layers and the terms used to describe plugins is slightly different at each of these layers:&lt;br /&gt;
* '''Extension Point''' is the eclipse term for what Protege folk often call a plugin.&lt;br /&gt;
* '''[http://www.osgi.org/Main/HomePage OSGi]''' is the bottom layer of  the Protege plugin architecture.  It is a powerful industry standard framework which provides modularity and services beyond that provided by the Java specifications.   In OSGi, the term OSGi bundle is used to represent a self-contained unit of code that can be introduced into the OSGi framework and which will import and export classes and resources in a controlled way.  &lt;br /&gt;
* '''An OSGi Bundle''' is collection of software grouped into a single jar file.  When this software runs in the OSGi environment, it runs in a protected space where it can define exactly what java classes from the surrounding environment are needed and what java classes are incompatible with its operation.  Bundles have names, version numbers, developer contact information and activation entry points.&lt;br /&gt;
* '''A Plugin''' is a declared service that implements some functionality of use to the Protege platform.  The Protege Plugin mechanism is based on the Eclipse plugin mechanism where plugins are declared in a file called plugin.xml.&lt;br /&gt;
* '''[http://wiki.eclipse.org/index.php/Rich_Client_Platform The Eclipse Rich Client Platform]''' is an environment built on top of OSGi which provides additional features to ease the building of a &amp;quot;Rich&amp;quot; client.  Protege 4 only uses some of the features of this rich client platform.  In particular, Protege 4 does not use SWT and many of the graphical related capabilities.  But Protege 4 does use the declarative plugin capabilities provided by eclipse.  It is here that some of the power of the OSGi platform becomes manifest, because we have been able to use only those bundles from the eclipse Rich Client platform that we need.  In this setting, OSGi bundles created  according to certain conventions become Eclipse Plugins.&lt;br /&gt;
* '''The Protege 4 Plugin layer''' provides some additional convenience methods over the Eclipse Plugin framework.  Certain eclipse plugins that extend Protege 4 capabilities are called Protege 4 plugins.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=PluginAnatomy&amp;diff=9520</id>
		<title>PluginAnatomy</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=PluginAnatomy&amp;diff=9520"/>
				<updated>2011-03-09T21:01:50Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Typo: Changed &amp;quot;example&amp;quot; to &amp;quot;examples&amp;quot; in the Bundle-Symbolic-Name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this web page is to describe some of the key ingredients of  a plugin.  The page will be directed by &lt;br /&gt;
the quick development of a plugin and can indeed be used as a quick start guide.  In order to focus attention on the core  plugin&lt;br /&gt;
concepts we will use the lowest common denominator of Java development tools and this tutorial will not use a Java IDE.&lt;br /&gt;
We will assume that the &lt;br /&gt;
reader has an understanding of Java development and knows how to follow along in his favorite IDE.  For more information about&lt;br /&gt;
how to work with protege 4 in an IDE I will  direct the reader to [[Protege4DevDocs#Using_an_Integrated_Development_Environment|this page]].  It is possible for an experienced developer to skip the ant scripts simply follow  along in an IDE but we would still recommend a build file for the final version.&lt;br /&gt;
&lt;br /&gt;
==The vacuous plugin in five minutes==&lt;br /&gt;
&lt;br /&gt;
I just did it in just over [[Protege4 Plugin In Four Minutes|four minutes]].&lt;br /&gt;
&lt;br /&gt;
The simplest (trivial) plugin can be built from sources in the following layout:&amp;lt;pre&amp;gt;&lt;br /&gt;
   build.xml&lt;br /&gt;
   META-INF&lt;br /&gt;
      MANIFEST.MF&lt;br /&gt;
   lib&lt;br /&gt;
   resources&lt;br /&gt;
   src&lt;br /&gt;
&amp;lt;/pre&amp;gt;  As we will see - even without any java sources - this is a sufficient basis for building a plugin that is recognized by Protege 4.  There are only two files in this source tree - the build.xml file and the MANIFEST.MF.  These files can be quickly put together from templates.&lt;br /&gt;
&lt;br /&gt;
===Build.xml===&lt;br /&gt;
&lt;br /&gt;
The template for the build.xml file can be downloaded from [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-plugin-build.xml here].  Only two things need to be changed in this build file.  They can be found by searching for the string &amp;quot;CHANGE ME&amp;quot; in the file.  The first thing to change is the name of the project.  I will call the project the plugin tutoiral project:&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;project name = &amp;quot;plugin tutorial&amp;quot; default = &amp;quot;install&amp;quot; basedir = &amp;quot;.&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The next setting that must almost always be changed is the name of the plugin.  In this case, the build.xml already has the right name for the plugin but this is the only plugin for which this will be true:&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;property name = &amp;quot;plugin&amp;quot;          value = &amp;quot;org.protege.owl.examples.tab&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
With these adjustments the build.xml file is ready.&lt;br /&gt;
&lt;br /&gt;
===MANIFEST.MF===&lt;br /&gt;
&lt;br /&gt;
The template for the MANIFEST.MF file can be downloaded from [http://smi-protege.stanford.edu/repos/protege/protege4/protege-base/trunk/etc/template-manifest.mf here].  Only five things need to be changed in this file to make it useable and two are optional.  These  can be found by searching for the string &amp;quot;CHANGE ME&amp;quot; in the file.  The first change is to set the display name for the plugin:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-Name: Tutorial Plugin&lt;br /&gt;
&amp;lt;/pre&amp;gt; This is the name that is seen when Protege 4 starts up and in several plugin configuration screens.  &lt;br /&gt;
The seccond thing to change is the symbolic name of the plugin. The usual default is to uses the same name as the plugin name in the build.xml file:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-SymbolicName: org.protege.editor.owl.examples.tab;singleton:=true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the &amp;quot;singleton:=true&amp;quot; line - this is important since most Protege 4 plugins will only work if they are instantiated exactly once.  The next things to change are the bundle description, the vendor and the documentation url:&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-Description: A simple plugin for a plugin development tutorial&lt;br /&gt;
Bundle-Vendor: The Protege Development Team&lt;br /&gt;
Bundle-DocURL: www.perhaps.i.donthaveoneyet.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Actually the vendor and the docurl are optional and can be deleted.  The MANIFEST.MF file is now ready.&lt;br /&gt;
&lt;br /&gt;
===Compile and Run===&lt;br /&gt;
&lt;br /&gt;
Before  we can start, we must set the PROTEGE_HOME environment variable to point to a Protege 4 distribution.  [[ConfiguringAntBuildFiles|This page]] has directions on how to do this in different operating systems but for now I will assume that we are on a unix (or os x) system.  In that case, the system variable can be set with a simple command &amp;lt;pre&amp;gt;&lt;br /&gt;
   export PROTEGE_HOME=/Users/tredmond/Desktop/Protege_4.0_beta&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If for any reason,  using a environment variable is difficult, one can also achieve the same effect by creating a local.properties file with the single line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   protege.home=/Users/tredmond/Desktop/Protege_4.0_beta&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This vacuous plugin is now ready to compile and run.  Assuming that the PROTEGE_HOME environment variable is set correctly, this plugin can be compiled with the simple command &amp;lt;pre&amp;gt;&lt;br /&gt;
  ant install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The full text of the build session is as follows:&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@Andromeda org.protege.editor.owl.examples.tab]$ ant install&lt;br /&gt;
Buildfile: build.xml&lt;br /&gt;
&lt;br /&gt;
init:&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes/lib&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/lib&lt;br /&gt;
&lt;br /&gt;
checkProtegeLibs:&lt;br /&gt;
     [echo] Using Protege Home = /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox to find protege jars&lt;br /&gt;
&lt;br /&gt;
checkProtegeLibsAndReport:&lt;br /&gt;
&lt;br /&gt;
buildlibs:&lt;br /&gt;
    [unjar] Expanding: /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/bundles/org.protege.common.jar into /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
&lt;br /&gt;
compile:&lt;br /&gt;
&lt;br /&gt;
build.manifest:&lt;br /&gt;
     [copy] Copying 1 file to /private/tmp/org.protege.editor.owl.examples.tab/build&lt;br /&gt;
&lt;br /&gt;
copy.resources:&lt;br /&gt;
    [mkdir] Created dir: /private/tmp/org.protege.editor.owl.examples.tab/build/classes/META-INF&lt;br /&gt;
     [copy] Copying 1 file to /private/tmp/org.protege.editor.owl.examples.tab/build/classes/META-INF&lt;br /&gt;
&lt;br /&gt;
jar:&lt;br /&gt;
      [jar] Building jar: /private/tmp/org.protege.editor.owl.examples.tab/build/org.protege.owl.examples.tab.jar&lt;br /&gt;
&lt;br /&gt;
install:&lt;br /&gt;
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/configuration/org.eclipse.core.runtime&lt;br /&gt;
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/configuration/org.eclipse.osgi&lt;br /&gt;
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege4/owleditor/build/dist/equinox/plugins&lt;br /&gt;
&lt;br /&gt;
BUILD SUCCESSFUL&lt;br /&gt;
Total time: 2 seconds&lt;br /&gt;
[tredmond@Andromeda org.protege.editor.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the PROTEGE_HOME environment variable is not set correctly the user will instead see the following:&amp;lt;pre&amp;gt;&lt;br /&gt;
BUILD FAILED&lt;br /&gt;
/private/tmp/org.protege.editor.owl.examples.tab/build.xml:74: missing protege libraries&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now look at  what the build has done by exploring the project directory tree.&lt;br /&gt;
[[File:AnatomyBuildTreeAnnotated.png]]&lt;br /&gt;
&lt;br /&gt;
We see the following elements:&lt;br /&gt;
* '''The Class Tree''' is (approximately) a flattened view of the plugin (the jar file).  Generally this  largely consists of the .class files that have been compiled from the java.  But since we have not written any java yet this is not found.  In addition, this will contain resources needed by the plugin and libraries that the plugin needs but which cannot be found in other Protege plugins.&lt;br /&gt;
* '''The Generated Libraries''' which are extracted from Protege plugins.  This is needed because of a difference between how Java and OSGi get resources  out of Jar files.  OSGi allows a [[PluginAnatomy#Some_Nomenclature|bundle]] (which is a implemented as a jar file) to contain other jar files.  If the bundle classpath is configured correctly, OSGi will load classes from those jars in jars.  But Java does not have this capability.  So the build script extracts the jar files out of the OSGi bundles that will be needed to compile the bundle.  Note that these jar files are not copied to the class tree because the Protege 4/OSGi environment will  make the classes and resources of these  jar files available.&lt;br /&gt;
* '''The Protege 4 Plugin''' this is the final artifact of the build process.  Because  we have run &amp;quot;ant install&amp;quot; it has also been installed in the Protege distribution.&lt;br /&gt;
&lt;br /&gt;
If the developer is still with me then he is now ready to run the plugin.  Go to the Protege distribution (the one pointed to by the PROTEGE_HOME environment variable) and run it.  We are particularly interested in the console output because this is going to be the only indication that this plugin is recognized at all.  The console output should look like this:&amp;lt;pre&amp;gt;&lt;br /&gt;
Starting Protege 4 OWL Editor (Version 4.0.111)&lt;br /&gt;
Platform:&lt;br /&gt;
    Java: JVM 1.5.0_16-b06-284 Memory: 207M&lt;br /&gt;
    Language: en, Country: US&lt;br /&gt;
    Framework: Eclipse (1.4.0)&lt;br /&gt;
    OS: MacOSX (10.5.6)&lt;br /&gt;
    Processor: ppc&lt;br /&gt;
Installed plugin Pellet Reasoner&lt;br /&gt;
Installed plugin DL Query Tab&lt;br /&gt;
Installed plugin Owlviz Plug-in&lt;br /&gt;
Installed plugin owleditor&lt;br /&gt;
Installed plugin Tutorial Plugin&lt;br /&gt;
Installed plugin The OWL API&lt;br /&gt;
Installed plugin Factplusplus Plug-in&lt;br /&gt;
	Tutorial Plugin Plugin has no plugin.xml resource&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this output we see that the Tutorial Plugin has been recognized and installed.  In addition there is a informational message that the plugin.xml file has not been found.  This is  almost always indicates a problem because most Protege 4 plugins depend on a plugin.xml resource.  We will describe how the plugin.xml file is generated in the next sections.&lt;br /&gt;
&lt;br /&gt;
== Writing View and Tab Plugins ==&lt;br /&gt;
&lt;br /&gt;
The previous plugin added no functionality to Protege 4.  We are now going to describe how to remedy this situtaion.  So far we have not missed the Java IDE but it is now when we start writing a bit of Java code that the Java IDE would really shine.  But to illustrate the main concepts, we will continue to show how to build the plugin without any development environment other than  that provided by the core Java tools.&lt;br /&gt;
&lt;br /&gt;
===Adding a View Plugin to the Plugin.xml file===&lt;br /&gt;
&lt;br /&gt;
Recall that previously when we ran our plugin, Protege 4 complained that there was no plugin.xml file.   The plugin.xml file contains a declaration of the ways in which the plugin will extend the Protege 4 capabilities and (more advanced) the ways in which the plugin capabilities can be extended by other plugins.  We will start by adding a declaration that this plugin will implement a Protege View.  &lt;br /&gt;
&lt;br /&gt;
So first we will give a definition of a Protege view.  The purpose of a Protege view is to provide a view of some aspect of an ontology.  In the Protege interface, a Protege view is easily recognized.  It has a clearly defined border.  At the top of a Protege view is a title bar and a collection of buttons allowing the user to&lt;br /&gt;
* split the protege view into two copies of the same view one above the other,&lt;br /&gt;
* split the protege view into two copies of the same view one beside the other,&lt;br /&gt;
* float the view above the Protege client so that it is visible in any context,&lt;br /&gt;
* close the view removing it from the tab that contains it.&lt;br /&gt;
An example of a typical Protege view is shown below.&lt;br /&gt;
[[File:AnatomyView.png]]&lt;br /&gt;
&lt;br /&gt;
In order to declare our intent that this plugin implement a Protege view, we add the following pluxin.xml file to the root of the project tree:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;?eclipse version=&amp;quot;3.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;plugin&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleViewComponent&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example View Component&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;category value=&amp;quot;@org.protege.ontologycategory&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/plugin&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This plugin.xml file states that this plugin is making a single extension to the Protege 4 capabilities.   We will cover the meaning of the parts of this extension declaration line by line.  The first line defines the id of the extension.  This particular extension is called the ExampleViewComponent.  The second decleration,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
states what the extension is trying to do.  This extension is attempting to implement the functionality represented by the extension point with the name &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       org.protege.editor.core.application.ViewComponent.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The label declaration tells Protege what to put in the title bar of the view.  The class declaration indicates which class implements the functionality needed by this view.  We will go into the implementation of that class shortly.  Finally the category declaration tells Protege which menu under the View menu should contain this view.&lt;br /&gt;
&lt;br /&gt;
A very simple view can be written by extending the class AbstractOWLViewComponent and implementing the methods initialiseOWLView and disposeOWLView.  A very simple such implementation can be found &lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/tags/protege.4.0-2009-12-02/org.protege.editor.owl.examples.tab/src/org/protege/owl/examples/tab/ExampleViewComponent.java here for Protege 4.0.*] or&lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab/src/org/protege/owl/examples/tab/ExampleViewComponent.java here for Protege 4.1].&lt;br /&gt;
Now this plugin depends on a library that can be found &lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/tags/protege.4.0-2009-12-02/org.protege.editor.owl.examples.tab/lib/examplelib.jar here for Protege 4.0]&lt;br /&gt;
or&lt;br /&gt;
[http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/plugin/trunk/org.protege.editor.owl.examples.tab/lib/examplelib.jar here for Protege 4.1].  This library should be deposited in the lib directory of the project.  This library is trivial and its only purpose is to show how to use a library in a plugin.  The directory tree of the project should now look like this:&lt;br /&gt;
[[File:AnatomyTreeDoesView.png]]&lt;br /&gt;
&lt;br /&gt;
At this point the ant install operation will compile, build and install the new plugin with the &amp;quot;ant install&amp;quot; command.&lt;br /&gt;
But the installed plugin won't run correctly and we will show how to fix this below.&lt;br /&gt;
&lt;br /&gt;
===Libraries and the Bundle Classpath===&lt;br /&gt;
&lt;br /&gt;
After we install the plugin, we can start Protege to try to use the &amp;quot;Example View Component&amp;quot;.  If you click on the View menu and then select &amp;quot;Ontology Views&amp;quot; you will see the &amp;quot;Example View Component&amp;quot; listed there.  However on selecting this view and trying to place on the Protege screen, the following error will arise:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error logged&lt;br /&gt;
java.lang.NoClassDefFoundError: org/protege/owl/example/Metrics&lt;br /&gt;
	at java.lang.Class.getDeclaredConstructors0(Native Method)&lt;br /&gt;
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)&lt;br /&gt;
	at java.lang.Class.getConstructor0(Class.java:2671)&lt;br /&gt;
	at java.lang.Class.newInstance0(Class.java:321)&lt;br /&gt;
	at java.lang.Class.newInstance(Class.java:303)&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If we look at the plugin contents with the &amp;quot;jar -tf &amp;quot; command then we will see that the build file correctly put the examplelib.jar into the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ jar -tf build/org.protege.owl.examples.tab.jar &lt;br /&gt;
META-INF/&lt;br /&gt;
META-INF/MANIFEST.MF&lt;br /&gt;
lib/&lt;br /&gt;
org/&lt;br /&gt;
org/protege/&lt;br /&gt;
org/protege/owl/&lt;br /&gt;
org/protege/owl/examples/&lt;br /&gt;
org/protege/owl/examples/tab/&lt;br /&gt;
lib/examplelib.jar&lt;br /&gt;
org/protege/owl/examples/tab/ExampleViewComponent.class&lt;br /&gt;
plugin.xml&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem at this point is in the MANIFEST.MF file.  The Bundle-Classpath line is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-ClassPath: .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To include the examplelib.jar in the jar file, the Bundle-Classpath line must be modified to include  this library:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Bundle-ClassPath: .,lib/examplelib.jar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that using a colon or a semi-colon instead of the comma does not work.  Also entering ./lib/examplib.jar does not work either.  This is the osgi mechanism for making this library available to this plugin.  Note that since the MANIFEST.MF file does not have an Export-Package declaration, these classes will only be visible within the plugin and will not be exported to any other plugin in the Protege 4 environmeht.  This is part of the plugin isolation provided by OSGi that allows different plugins to use different libraries without conflicts.&lt;br /&gt;
&lt;br /&gt;
Now the plugin works correctly and I can install the view into the Active Ontology Tab:&lt;br /&gt;
[[File:AnoyomyViewSuccessful.png]].&lt;br /&gt;
&lt;br /&gt;
===Tab Plugins and the Viewconfig.xml File===&lt;br /&gt;
&lt;br /&gt;
The other most common plugin type is the Protege tab.  In order to make a Protege tab, the developer needs to generate and use a viewconfig.xml file for the project.  In this section we will show how to do this.  It turns out that a tab can usually be put together without writing any Java code.  The steps for writing a tab plugin are&lt;br /&gt;
# add a declaration of the tab plugin in the plugin.xml file.&lt;br /&gt;
# start Protege and graphically configure the tab in question.&lt;br /&gt;
# save the configuration and include it with the source files for the tab.&lt;br /&gt;
# test by restarting Protege and running the tab with the default configuration.&lt;br /&gt;
These steps are described in more detail below.&lt;br /&gt;
&lt;br /&gt;
==== Step 1: Declare the plugin ====&lt;br /&gt;
&lt;br /&gt;
The first thing that that needs to be done is to declare the tab in the plugin.xml file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;?eclipse version=&amp;quot;3.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;plugin&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleViewComponent&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.ViewComponent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example View Component&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;category value=&amp;quot;@org.protege.ontologycategory&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;ExampleWorkspaceTab&amp;quot;&lt;br /&gt;
              point=&amp;quot;org.protege.editor.core.application.WorkspaceTab&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;label value=&amp;quot;Example Tab&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.OWLWorkspaceViewsTab&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;index value=&amp;quot;X&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;defaultViewConfigFileName value=&amp;quot;viewconfig-exampleTab.xml&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/plugin&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important line in the above declaration of the tab is the defaultViewConfigFileName.  This names a resource that the protege plugin will look for to create the default layout of the tab.&lt;br /&gt;
&lt;br /&gt;
==== Step 2: Layout the views in the plugin ====&lt;br /&gt;
&lt;br /&gt;
We can now compile this plugin and install it as before.  Now when we run Protege 4, we will see a new tab called the &amp;quot;Example Tab&amp;quot; in the tabs menu.  Enable this tab.  Since we have not yet created the viewconfig-exampleTab.xml file, you will see that the tab is empty.&lt;br /&gt;
&lt;br /&gt;
Now install and layout some views into this tab.  In my case I made the views look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:AnatomyViewLayout.png]]&lt;br /&gt;
&lt;br /&gt;
==== Step 3: Save a configuration file ====&lt;br /&gt;
&lt;br /&gt;
Now in the tabs menu select &amp;quot;Export Current Tab&amp;quot; and save the file as &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   viewconfig-exampleTab.xml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in the project directory.  In my case the viewconfig-exampleTab file looked like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
    &amp;lt;VSNode splits=&amp;quot;0.5 0.5&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;CNode&amp;gt;&lt;br /&gt;
            &amp;lt;Component label=&amp;quot;Asserted class hierarchy&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;Property id=&amp;quot;pluginId&amp;quot; value=&amp;quot;org.protege.editor.owl.OWLAssertedClassHierarchy&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Component&amp;gt;&lt;br /&gt;
        &amp;lt;/CNode&amp;gt;&lt;br /&gt;
        &amp;lt;CNode&amp;gt;&lt;br /&gt;
            &amp;lt;Component label=&amp;quot;Example View Component&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;Property id=&amp;quot;pluginId&amp;quot; value=&amp;quot;org.protege.owl.examples.tab.ExampleViewComponent&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;/Component&amp;gt;&lt;br /&gt;
        &amp;lt;/CNode&amp;gt;&lt;br /&gt;
    &amp;lt;/VSNode&amp;gt;&lt;br /&gt;
&amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now before we complete this Protege session, go to the tabs menu and click &amp;quot;Reset selected tab to default state&amp;quot;.  You will see that the tab is now empty again.  Now exit Protege.&lt;br /&gt;
&lt;br /&gt;
The directory tree of the project should now look like this:&lt;br /&gt;
&lt;br /&gt;
[[File:AnatomyTreeDoesViewWithConfig.png]]&lt;br /&gt;
&lt;br /&gt;
==== Step 4: Test the results ====&lt;br /&gt;
&lt;br /&gt;
Install the plugin again.  Note that the build script automatically found the viewconfig-exampleTab.xml file and put it into the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ jar -tf build/org.protege.owl.examples.tab.jar &lt;br /&gt;
META-INF/&lt;br /&gt;
META-INF/MANIFEST.MF&lt;br /&gt;
lib/&lt;br /&gt;
org/&lt;br /&gt;
org/protege/&lt;br /&gt;
org/protege/owl/&lt;br /&gt;
org/protege/owl/examples/&lt;br /&gt;
org/protege/owl/examples/tab/&lt;br /&gt;
lib/examplelib.jar&lt;br /&gt;
org/protege/owl/examples/tab/ExampleViewComponent.class&lt;br /&gt;
plugin.xml&lt;br /&gt;
viewconfig-exampleTab.xml&lt;br /&gt;
[tredmond@BlackHole org.protege.owl.examples.tab]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run Protege and go to the Example Tab.  It is empty?  The reason for this is that the tab has been customized to have nothing in it from the last session.  Click on the tabs menu and click on &amp;quot;Reset selected tab to default state&amp;quot;.  Now you will see the views that we configured in the tab before.  This is now the default state for the tab and it will be what other users see when they use this plugin for the first time.&lt;br /&gt;
&lt;br /&gt;
== Adding Menu Plugins ==&lt;br /&gt;
&lt;br /&gt;
I have created a small menu project [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/org.protege.example.menu/trunk here] that shows how to create several different menu types.  Later we will use this project as the example that drives this wiki page.&lt;br /&gt;
&lt;br /&gt;
Adding a new menu to Protege 4.1 is very easy.  The two things that the developer needs to accomplish are  to &lt;br /&gt;
write the code for the menu action and to add an entry to the plugin.xml.  I will take a real world example to illustrate the process.  In this example, I am writing a plugin that causes Protege to display an ontology that is stored in a database format.  I want to put this in the file menu of Protege 4.1 just under other items such as &amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Open Recent&amp;quot; and &amp;quot;Open from URL&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To write the code for the menu plugin, the developer merely needs to extend ProtegeOWLAction.  The three methods that the developer needs to write are initialise, dispose and actionPerformed. I think that the meaning of these three methods is pretty clear and this can be a very easy task.&lt;br /&gt;
&lt;br /&gt;
Now the developer needs to add an entry to the [http://smi-protege/repos/protege/protege4/incubator/v3/org.protege.owlapi.bridge/trunk/plugin.xml plugin.xml] file.  In my case the entry looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;loadDatabase&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Load Database Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Loads ontologies from a database into Protege&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;id&amp;quot; attribute of loadDatabase is simply a short identifier for the plugin that is not seen by the user.  The &amp;quot;point&amp;quot; attribute indicates that the plugin being declared here is a menu plugin.  The &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
line indicates the class that implements the action that this menu performs and the &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
line indicates that the menu is to be used in the context of the owl editor.  The only other line in this [http://smi-protege/repos/protege/protege4/incubator/v3/org.protege.owlapi.bridge/trunk/plugin.xml plugin.xml] that is a bit mysterious is the line that says:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The purpose of this line is to indicate exactly where the menu should be placed.  The first part of the value,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
indicates that the parent of my &amp;quot;Load Database Ontology&amp;quot; menu is the file menu.  The string is making a reference to the file menu declaration&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension&lt;br /&gt;
         id=&amp;quot;menu.FileMenu&amp;quot;&lt;br /&gt;
         name=&amp;quot;FileMenu&amp;quot;&lt;br /&gt;
         point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;name value=&amp;quot;File&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;toolTip value=&amp;quot;File menu tool tip!&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;path value=&amp;quot;/SlotA-A&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
from the [http://smi-protege/repos/protege/protege4/plugins/org.protege.editor.core.application/trunk/plugin.xml plugin.xml] file for the org.protege.editor.core.application plugin.   The  first part of the string&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   org.protege.editor.core.application&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which is the identifier  of the plugin declaring the menu and &amp;quot;menu.FileMenu&amp;quot; is the id of the plugin from the plugin.xml file.&lt;br /&gt;
&lt;br /&gt;
But now I need to explain the meaning of the SlotAA-Z portion of the path in my original menu declaration:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;loadDatabase&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Load Database Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.owlapi.bridge.LoadDatabaseProjectMenu&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Loads ontologies from a database into Protege&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.FileMenu/SlotAA-Z&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The SlotAA-Z string indicates exactly where the &amp;quot;Load Database Ontology&amp;quot; should appear in the File menu.  This string (SlotAA-Z) is parsed as a group (Slot-AA) and an index (Z).  First the group and the index are used to sort the children of the File menu.  The  children are sorted first by group but  when two children have  the same group they are then sorted by group index.  In addition to this, children with the same group are grouped together in the menu.&lt;br /&gt;
&lt;br /&gt;
In particular, if I track down the declarations of the &amp;quot;New&amp;quot;, &amp;quot;Open&amp;quot;, &amp;quot;Open Recent&amp;quot; and &amp;quot;Open from URL&amp;quot; menus I find that  they all have a group identifier of SlotAA.  This is why they appear in the file menu together followed by a separator bar.  By specifying that my menu should have a group of SlotAA, I am telling Protege that I want my menu to be grouped with these menus.  By giving my menu an index of Z I am telling Protege that I want my menu to go at the end of the list.&lt;br /&gt;
&lt;br /&gt;
The algorithm used by Protege to determine the location of the plugin can be observed by turning on logging for the menu builder.  This can easily be done by editing the log4j.xml in the Protege installation directory.  First  modify the section that says&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;appender name=&amp;quot;console&amp;quot; class=&amp;quot;org.apache.log4j.ConsoleAppender&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;param name=&amp;quot;Threshold&amp;quot; value=&amp;quot;INFO&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%m%n&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;/layout&amp;gt;&lt;br /&gt;
        &amp;lt;/appender&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to say&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;appender name=&amp;quot;console&amp;quot; class=&amp;quot;org.apache.log4j.ConsoleAppender&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;param name=&amp;quot;Threshold&amp;quot; value=&amp;quot;INFO&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%m%n&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;/layout&amp;gt;&lt;br /&gt;
        &amp;lt;/appender&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This allows the console to show debug messages.  Then add the lines&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;category name=&amp;quot;org.protege.editor.core.ui.menu&amp;quot;&amp;gt;&lt;br /&gt;
        	&amp;lt;priority value=&amp;quot;debug&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/category&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will cause Protege to generate somewhat verbose logs to the console (these logs also show up in a log file in ${home directory}/.Protege/logs/protege-###.log).  The relevant lines for my menu plugin are as follows.  First&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   Parsed: [Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;] parentId = org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
indicates that Protege was able to parse the path for my menu plugin and determine that the id of the parent is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     org.protege.editor.core.application.menu.FileMenu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
the group is SlotAA and the group index is Z.  Next we see the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   [Menu: File -- &amp;lt;SlotA, A&amp;gt;] parent of [Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which indicates that Protege was successfully able to find a declared menu with the right id to be  the parent of my menu.  This line also indicates that Protege successfully deciphered the group (SlotAA) and the index (Z).  Finally there are the lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adding [Menu: File -- &amp;lt;SlotA, A&amp;gt;] to menu bar&lt;br /&gt;
Giving File the child[Menu: New... -- &amp;lt;SlotAA, E&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open... -- &amp;lt;SlotAA, F&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open recent -- &amp;lt;SlotAA, G&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Open from URL... -- &amp;lt;SlotAA, G&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Load Database Ontology -- &amp;lt;SlotAA, Z&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Save -- &amp;lt;SlotAB, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Save as... -- &amp;lt;SlotAB, B&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Gather ontologies... -- &amp;lt;SlotAB, C&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Export inferred axioms as ontology... -- &amp;lt;SlotAB, D&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Ontology libraries... -- &amp;lt;SlotD, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Loaded ontology sources... -- &amp;lt;SlotD, B&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Check for plugins... -- &amp;lt;SlotP, A&amp;gt;]&lt;br /&gt;
Giving File the child[Menu: Close -- &amp;lt;SlotY, M&amp;gt;]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
that indicate that the File menu was successfully populated.&lt;br /&gt;
&lt;br /&gt;
== Advanced Topics ==&lt;br /&gt;
=== Adding New Plugin Types ===&lt;br /&gt;
&lt;br /&gt;
'''Work in Progress'''&lt;br /&gt;
&lt;br /&gt;
One of the advantages of using the OSGi/Eclipse framework is that it naturally allows developers to&lt;br /&gt;
define their own plugin types.. For example, the SWRL tab, being written by &lt;br /&gt;
Martin O'Connor, delegates the work of executing the SWRL rules to a rule engine plugin.  It is anticipated that &lt;br /&gt;
there will be two rule engine plugins that are are compatible with the SWRL tab.  One of these plugins will &lt;br /&gt;
be based on the Jess rule engine and the other plugin will be based on the DROOLS rule engine.&lt;br /&gt;
&lt;br /&gt;
We will illustrate how this is done with two Protege bundles.  The sources for these bundles can be found &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/producer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
These two examples will only work with Protege 4.1 though it would not be too difficult to adapt them to work with&lt;br /&gt;
Protege 4.0 as well.  Both bundles can be quickly installed through the included [[ConfiguringAntBuildFiles|ant scripts]].&lt;br /&gt;
&lt;br /&gt;
The consumer bundle behaves as follows.  It adds a menu item to a running Protege environment. This menu is found at the bottom of the edit menu.  When the user clicks on this menu item, the consumer bundle performs the following actions:&lt;br /&gt;
# it looks for all custom_extension_point plugins in the running Protege environment,&lt;br /&gt;
# it instantiates each plugin found and finally&lt;br /&gt;
# it calls the doSomething() method on that plugin instance.&lt;br /&gt;
&lt;br /&gt;
This behavior is provided through the interaction of four components:&lt;br /&gt;
* the '''consumer code''' that is  responsible for looping through a set of plugins and invoking them.&lt;br /&gt;
* the '''plugin loader''' that is responsible for calculating and returning a  set  of plugins that match a  specifiction.&lt;br /&gt;
* the '''plugin''' that is a java encoding of data encoded in plugin.xml files provided by the bundles.&lt;br /&gt;
* the '''plugin instance''' that is an instantiation of a plugin that does  the actual work of the plugin.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Consumer ====&lt;br /&gt;
&lt;br /&gt;
The Plugin consumer essentially uses the plugin loader (described  below) to loop through a series of plugins  and instantiate and invoke them.&lt;br /&gt;
The code that does this work can be found in the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPluginConsumer.java MyPluginConsumer] class and looks like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public void actionPerformed(ActionEvent e) {&lt;br /&gt;
        MyPluginLoader loader = new MyPluginLoader(getOWLModelManager());&lt;br /&gt;
        for (MyPlugin plugin : loader.getPlugins()) {&lt;br /&gt;
            try {&lt;br /&gt;
                MyPluginInstance i = plugin.newInstance();&lt;br /&gt;
                i.doSomething();&lt;br /&gt;
            }&lt;br /&gt;
            catch (Exception ex) {&lt;br /&gt;
                ProtegeApplication.getErrorLog().logError(ex);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a typical example of how a plugin consumer will work.  It uses a plugin loader to find a set of plugins that are then instantiated (plugin.newInstance()) and then invoked (i.doSomething()).  For the most part, the plugin consumer does not have to worry too much about the details of the Protege plugin infrastructure.  The logic of the Plugin consumer is defined by  the task at hand.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Loader ====&lt;br /&gt;
&lt;br /&gt;
The [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPluginLoader.java plugin loader] is responsible for searching for plugins of the custom_extension_point type.  The plugin loader extends  the AbstractPluginLoader  class which handles most of the logic of creating and  finding plugins.  Minimally, all the developer needs to do to implement the plugin loader is to implement a constructor and a create instance method.  The constructor looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public MyPluginLoader(OWLModelManager owlModelManager) {&lt;br /&gt;
        super(MyPlugin.CONSUMER_ID, MyPlugin.ID);&lt;br /&gt;
        this.owlModelManager = owlModelManager;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this is typical.  The significance of the two arguments to the super constructor will be explained when I describe the Plugin implementation.  Essentially they define which type of plugin is being searched for by this loader.  In addition, the constructor for this plugin loader takes an owlModelManager argument so that he can pass this argument to the constructor for the plugins.  The createInstance method then is responsible for constructing the plugin:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    protected MyPlugin createInstance(IExtension extension) {&lt;br /&gt;
        return new MyPlugin(owlModelManager, extension);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In addition there is a getExtensionMatcher method that can be used to restrict the set of plugins that are returned by this plugin loader.  Generally it is not necessary to implement the getExtensionMatcher interface.&lt;br /&gt;
&lt;br /&gt;
==== The Plugin ====&lt;br /&gt;
&lt;br /&gt;
Essentially the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPlugin.java plugin] is a POJO representing a declaration of a plugin in a plugin.xml file.  To understand this we need to look at the two declarations in two separate plugin.xml files.  The first declaration is found in the bundle for the consumer plugin.  This declaration represents a request for a particular type of service.  In our case the [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/plugin.xml declaration] looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension-point id=&amp;quot;custom_extension_point&amp;quot; &lt;br /&gt;
                    name=&amp;quot;Custom Extension Point&amp;quot;&lt;br /&gt;
                    schema=&amp;quot;schema/custom_extension_point.exsd&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This declaration defines &lt;br /&gt;
* the identifier of the plugin type, custom_extension_point, which is the name by which plugin developers refer to this plugin type,  This string corresponds to the MyPlugin.ID that we passed to the AbstractPluginLoader constructor above.  Note that it is possible for different bundles to declare an extension point &lt;br /&gt;
* the user friendly name of the plugin type and &lt;br /&gt;
* a pointer to the xml schema for the plugin type.&lt;br /&gt;
I believe that the last item, [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/schema/custom_extension_point.exsd the schema], is not mandatory but it is extremely useful for developers and it is created naturally when plugins are developed using the eclipse IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The plugin producer provided a [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/producer/plugin.xml declaration] for his extension that matches the extension point declaration above.  In our example the extension declaration looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   &amp;lt;extension id=&amp;quot;SimpleImplementation&amp;quot;&lt;br /&gt;
         	  point=&amp;quot;org.protege.example.extension.point.custom_extension_point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;class value=&amp;quot;org.protege.example.extension.PluginImplementation&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;type value=&amp;quot;Logger Type&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The plugin class, [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/MyPlugin.java MyPlugin], extends the AbstractProtegePlugin class. The AbstractProtegePlugin class provides many utilities that make it easy to write the plugin class.  In particular, to get the &amp;quot;type&amp;quot; field the MyPlugin class provides an accessor:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * gets the declared type field for the plugin&lt;br /&gt;
     */&lt;br /&gt;
    public String getType() {&lt;br /&gt;
        return getPluginProperty(TYPE_PARAM, &amp;quot;null type&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the AbstractProtegePlugin class does the tricky aspects of instantiating the plugin leaving only the task of initializing the instantiated  plugin to the MyPlugin class:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * Creates an instance of the plugin.  It is expected that&lt;br /&gt;
     * this instance will be &amp;quot;setup&amp;quot;, but the instance's&lt;br /&gt;
     * initialise method will not have been called in the instantiation&lt;br /&gt;
     * process.&lt;br /&gt;
     */&lt;br /&gt;
    public MyPluginInstance newInstance() throws ClassNotFoundException, IllegalAccessException,&lt;br /&gt;
                                                          InstantiationException {&lt;br /&gt;
    	MyPluginInstance mpi = super.newInstance();&lt;br /&gt;
        mpi.setup(modelManager, getType());&lt;br /&gt;
        return mpi;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Plugin Instance ====&lt;br /&gt;
&lt;br /&gt;
The [http://smi-protege.stanford.edu/repos/protege/protege4/misc/examples/custom.extension/trunk/consumer/src/org/protege/example/extension/point/api/MyPluginInstance.java plugin instance  class] is responsible for performing whatever task it is  that the plugin is supposed to perform.  In our case the plugin instance will implement the doSomething() method.  This class  must implement the ProtegePluginInstance interface  though it is not clear that this is really needed anymore.  The ProtegePluginInstance interface has only one method, initialise(), but many plugins, such as the one in this example, have their own initailization methods that are called by the Plugin Loader.&lt;br /&gt;
&lt;br /&gt;
=== Frames, Frame Sections, and Rows ===&lt;br /&gt;
&lt;br /&gt;
'''In Progress'''&lt;br /&gt;
&lt;br /&gt;
It is not  clear that this needs to be here but this is an  extremely central Protege concept.  In general plugin developers will not need to build custom Frame lists and can simply use  the top level OWL Frame List concepts.&lt;br /&gt;
&lt;br /&gt;
Most of the discussion will focus on a smaller and smaller section of the the following Protege 4.1 screen.  This diagram shows the standard Protege 4.1 classes tab as it displays some information about the selected class which is the Country class in the pizza ontology.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameInClassesTab.png||A Classes Tab showing a standard frame in the right bottom]]&lt;br /&gt;
&lt;br /&gt;
==== FrameLists and Frames ====&lt;br /&gt;
&lt;br /&gt;
The diagram below shows a FrameList showing a description of the Country class.   The OWLFrameList is the swing object that is responsible for displaying some object called the root object for the OWLFrameList.  In this case, the root object for this frame list is the Country OWL class.  Frequently the root object of the for a frame list is an OWL entity but this is not required.  The constructor for the OWLFrameList object takes an OWLFrame object which manages the content model of the OWLFrameList.  The associated OWLFrame object also has a root object and in this case the root object is the Country class.&lt;br /&gt;
&lt;br /&gt;
While it may not be visually immediately apparent, the information being displayed is actually a rendition of a list of axioms.  Thus for instance, the class expression represented in the section underneath ''Equivalent Classes'' represents the axiom&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Country SubClassOf DomainConcept and {America, England, France, Germany, Italy}.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Similarly the first individual displayed under ''Members'' represents the axiom&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    America Type Country.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fact that these are not displayed simply as the associated axioms is an key part of the purpose of the OWLFrameList.  The task of the OWLFrameList below is to describe the Country class. For a user it makes sense that in the Members section of that  OWLFrameList he would see a list of the individuals in that class.  It would make less sense to the user if a set of axioms was displayed there.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameList.png||Frame List]]&lt;br /&gt;
&lt;br /&gt;
==== Frame Sections ====&lt;br /&gt;
&lt;br /&gt;
OWLFrames are grouped into a series of sections each of which shows a particular type of axioms.  In the diagram below we have a frame section that is rendering a list of class assertion axioms.&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSection.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
==== Frame Section Rows ====&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSectionRow.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
[[File:FrameSectionRowAlt.png|Frame Section]]&lt;br /&gt;
&lt;br /&gt;
== Glossary == &lt;br /&gt;
&lt;br /&gt;
There are some terms that come up naturally in the discussion of Protege 4 plugin development that require a bit of explanation.  The Protege 4 plugin mechanism has three layers and the terms used to describe plugins is slightly different at each of these layers:&lt;br /&gt;
* '''Extension Point''' is the eclipse term for what Protege folk often call a plugin.&lt;br /&gt;
* '''[http://www.osgi.org/Main/HomePage OSGi]''' is the bottom layer of  the Protege plugin architecture.  It is a powerful industry standard framework which provides modularity and services beyond that provided by the Java specifications.   In OSGi, the term OSGi bundle is used to represent a self-contained unit of code that can be introduced into the OSGi framework and which will import and export classes and resources in a controlled way.  &lt;br /&gt;
* '''An OSGi Bundle''' is collection of software grouped into a single jar file.  When this software runs in the OSGi environment, it runs in a protected space where it can define exactly what java classes from the surrounding environment are needed and what java classes are incompatible with its operation.  Bundles have names, version numbers, developer contact information and activation entry points.&lt;br /&gt;
* '''A Plugin''' is a declared service that implements some functionality of use to the Protege platform.  The Protege Plugin mechanism is based on the Eclipse plugin mechanism where plugins are declared in a file called plugin.xml.&lt;br /&gt;
* '''[http://wiki.eclipse.org/index.php/Rich_Client_Platform The Eclipse Rich Client Platform]''' is an environment built on top of OSGi which provides additional features to ease the building of a &amp;quot;Rich&amp;quot; client.  Protege 4 only uses some of the features of this rich client platform.  In particular, Protege 4 does not use SWT and many of the graphical related capabilities.  But Protege 4 does use the declarative plugin capabilities provided by eclipse.  It is here that some of the power of the OSGi platform becomes manifest, because we have been able to use only those bundles from the eclipse Rich Client platform that we need.  In this setting, OSGi bundles created  according to certain conventions become Eclipse Plugins.&lt;br /&gt;
* '''The Protege 4 Plugin layer''' provides some additional convenience methods over the Eclipse Plugin framework.  Certain eclipse plugins that extend Protege 4 capabilities are called Protege 4 plugins.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=Protege-OWL_4_FAQ&amp;diff=9501</id>
		<title>Protege-OWL 4 FAQ</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=Protege-OWL_4_FAQ&amp;diff=9501"/>
				<updated>2011-02-28T19:08:19Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Added a link to the Error Classes page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-weight:bold; font-size:20px;&amp;quot;&amp;gt;Protege-OWL 4.x Frequently Asked Questions&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page is the FAQ for the '''4.x version of the Protege-OWL editor'''.  We provide the following alternative FAQ pages for other Protege versions and Protege-related topics:&lt;br /&gt;
&lt;br /&gt;
* [http://protege.stanford.edu/doc/owl-faq.html Protege-OWL 3.x FAQ]&lt;br /&gt;
* [http://protege.stanford.edu/doc/faq.html Protege-Frames FAQ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How do I install Protege-OWL? ===&lt;br /&gt;
Protege-OWL is [http://protege.stanford.edu/download/download.html available for download] from the main Protege website.  If you are new to Protege-OWL, we ask that you read about the three different installation options currently available to determine which best suits your needs:&lt;br /&gt;
&lt;br /&gt;
* '''InstallyAnywhere platform independent installer program''' - this is the recommended method of installation for beginners and also for users that want a &amp;quot;double-clickable&amp;quot; executable file.  The primary reason we recommend this method for beginners is that Protege-OWL requires a 1.5 version of the Java Virtual Machine to be present.  The installer makes it very easy for you to install the correct version of the Java VM - or - if you already have Java installed, you can indicate the location during the install process.  The installer also provides an executable file that you can double-click to launch Protege-OWL, e.g., &amp;quot;Protege.exe&amp;quot; on Windows, etc.&lt;br /&gt;
&lt;br /&gt;
* '''ZIP file''' - we provide a ZIP file for more advanced users that are familiar with how to make sure the proper version of Java is present.  This is also a convenient installation for users that do not require an executable file to launch Protege-OWL.&lt;br /&gt;
&lt;br /&gt;
* '''Application bundle file''' - this is a new offering in Protege 4.1 that we hope will be an improvement for OS X users.&lt;br /&gt;
&lt;br /&gt;
Note that if you are new user, we ask that you register before downloading Protege-OWL.  If you have already registered, simply click on the [http://protege.stanford.edu/download/registered.html download link] and navigate to the [http://protege.stanford.edu/download/registered.html#p4.1 Protege 4 section] of the download page.&lt;br /&gt;
&lt;br /&gt;
=== Where can I find user documentation for the Protege-OWL editor? ===&lt;br /&gt;
Please refer to the [[Protege4UserDocs#Protege-OWL_Editor|Protege 4 documentation page]] on this wiki for a list of available documentation.&lt;br /&gt;
&lt;br /&gt;
=== Where do I ask questions and report bugs? ===&lt;br /&gt;
Please post comments, questions, and bug reports about Protege-OWL on the [http://mailman.stanford.edu/mailman/listinfo/p4-feedback p4-feedback mailing list].  Note that you must be subscribed to this list in order to post messages.  Instructions for subscribing to Protege mailing lists are [http://protege.stanford.edu/doc/faq.html#01a.02 available on the main Protege website].  If you have difficulties subscribing or unsubscribing from p4-feedback, please contact the [mailto:p4-feedback-owner@lists.stanford.edu list owners].&lt;br /&gt;
&lt;br /&gt;
=== Where can I look at a list known bugs and feature requests? ===&lt;br /&gt;
* View [https://bmir-gforge.stanford.edu/gf/project/owleditor/tracker/?action=TrackerItemBrowse&amp;amp;tracker_id=118 bug database]&lt;br /&gt;
* View [https://bmir-gforge.stanford.edu/gf/project/owleditor/tracker/?action=TrackerItemBrowse&amp;amp;tracker_id=121 feature request list]&lt;br /&gt;
&lt;br /&gt;
=== Why am I getting &amp;quot;An error related to DOT has occurred&amp;quot; when trying to use the OWLViz plug-in? ===&lt;br /&gt;
If you see this error when trying to use OWLViz, it means that you have not completed some of the necessary steps to configure this plug-in.  Complete documentation for fixing this error is available in the [http://protegewiki.stanford.edu/index.php/OWLViz#Troubleshooting troubleshooting section] of the OWLViz documentation.&lt;br /&gt;
&lt;br /&gt;
=== How do I change the name of an entity (class, property, individual) in my ontology? ===&lt;br /&gt;
Select the Refactor | Change entity URI... menu item.  In the resulting Change entity URI dialog box, enter the new name in the text box, and click the OK button.&lt;br /&gt;
&lt;br /&gt;
=== Why does my ontology contain classes named Error1, Error2, ...? ===&lt;br /&gt;
See the [[Protege4ErrorClasses|Error Classes]] page for a description of this new OWL API feature.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=Protege4ErrorClasses&amp;diff=9500</id>
		<title>Protege4ErrorClasses</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=Protege4ErrorClasses&amp;diff=9500"/>
				<updated>2011-02-28T19:04:30Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Description of Error classes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Error Classes ==&lt;br /&gt;
&lt;br /&gt;
You may open an ontology and find subclasses of owl:Thing named Error1, Error2, etc.&lt;br /&gt;
These classes are created by [http://owlapi.sourceforge.net/ the OWL API] as of version 3.2.2.&lt;br /&gt;
Your document is a valid RDF document,&lt;br /&gt;
but it is ''not'' a valid OWL document.&lt;br /&gt;
Your document will be parsed and loaded,&lt;br /&gt;
and Prot&amp;amp;eacute;g&amp;amp;eacute; 4 still displays your asserted class hierarchy&lt;br /&gt;
(subclass assertions are part of RDFS, not OWL).&lt;br /&gt;
However, you will probably encounter errors if you use a reasoner.&lt;br /&gt;
&lt;br /&gt;
As of version 4.1 beta (build 218),&lt;br /&gt;
Prot&amp;amp;eacute;g&amp;amp;eacute; 4 reports the error only through its GUI.&lt;br /&gt;
No diagnostic message is displayed in the console.&lt;br /&gt;
If you save your ontology,&lt;br /&gt;
it will contain references to the Error classes.&lt;br /&gt;
&lt;br /&gt;
When the OWL API detects an error,&lt;br /&gt;
it provides some clue about the cause by asserting an equivalence between&lt;br /&gt;
an Error&amp;lt;sub&amp;gt;''i''&amp;lt;/sub&amp;gt; class and an expression involving offending entities.&lt;br /&gt;
In other words, you can diagnose an error by selecting one of the Error&amp;lt;sub&amp;gt;''i''&amp;lt;/sub&amp;gt; classes&lt;br /&gt;
in a class hierarchy window and clicking the Class Usage display.&lt;br /&gt;
Examining the displayed usages will help you understand your error.&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	<entry>
		<id>https://protegewiki.stanford.edu/index.php?title=PluginTypes&amp;diff=9483</id>
		<title>PluginTypes</title>
		<link rel="alternate" type="text/html" href="https://protegewiki.stanford.edu/index.php?title=PluginTypes&amp;diff=9483"/>
				<updated>2011-02-25T21:06:34Z</updated>
		
		<summary type="html">&lt;p&gt;Swartik: Grammar and typography fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;orangeBox&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;orangeBoxTitle&amp;quot;&amp;gt;Protege 4 Plugin types&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
This page summarises the default types of plugin that can be implemented for Protege 4.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back to [[Protege4DevDocs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Existing Plugin Types ==&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of the existing types of plugins that can be added to Protege4.0.&lt;br /&gt;
The current set of plugin types can always be found in the code by looking at the plugin.xml file for the core.application and the owl bundles.&lt;br /&gt;
Just look for the extension-points in these files – these point to the schemas that are used for describing each type of plugin.&lt;br /&gt;
Plenty of examples can be found in the plugin.xml files themselves.&lt;br /&gt;
&lt;br /&gt;
=== Core Plugins ===&lt;br /&gt;
&lt;br /&gt;
==== ViewComponent ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most common plugin type – implements views (the building blocks of workspace tabs).&lt;br /&gt;
&lt;br /&gt;
Implementation of this plugin is demonstrated in the [http://www.co-ode.org/downloads/protege-x/plugin-code-example.php '''TabbedHierarchyView''' example].&lt;br /&gt;
&lt;br /&gt;
There are many abstract implementations of this plugin to use as a base, for example each entity type (Class, Property and Individual) has an abstract base.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.ui.view.ViewComponent'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.clshierarchy.ToldOWLClassHierarchyViewComponent'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== EditorKitMenuAction ====&lt;br /&gt;
&lt;br /&gt;
Create an entry in a [[#menu.window|menu]] (and supply a mnemonic) and its associated action.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.ui.action.ProtegeAction'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.action.RemoveAllDisjointAxiomsAction'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;menu.RemoveAllDisjointAxioms&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Remove all disjoint axioms...&amp;quot;/&amp;gt; &lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Removes all of the disjoint axioms.&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.action.RemoveAllDisjointAxiomsAction&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.EditMenu/SlotM-H&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''id'' = an ID for this plugin&lt;br /&gt;
&lt;br /&gt;
''point'' = the type of plugin&lt;br /&gt;
&lt;br /&gt;
''name'' = the name as it appears in the menu&lt;br /&gt;
&lt;br /&gt;
''toolTip'' = a description of the action shown in a tooltip&lt;br /&gt;
&lt;br /&gt;
''class'' = the implementing class (full package name)&lt;br /&gt;
&lt;br /&gt;
''path'' = the relative position in the menu (section pos, subsection pos)&lt;br /&gt;
&lt;br /&gt;
''editorKitId'' = the type of editor kit this plugin works with&lt;br /&gt;
&lt;br /&gt;
===== Open URL in browser action =====&lt;br /&gt;
&lt;br /&gt;
An addition has been made to the EditorKitMenuAction that allows a menu item that opens a specified page in a web browser.&lt;br /&gt;
This has been used to implement help items, but could be useful for lots of different reasons.&lt;br /&gt;
&lt;br /&gt;
The best thing is '''this requires no coding whatsoever'''.&lt;br /&gt;
* ''url'' should be specified in the action descriptor instead of ''class''.&lt;br /&gt;
* The value should be the full URL of the webpage you wish to open.&lt;br /&gt;
&lt;br /&gt;
Specifying a ''class'' element will cause the ''url'' to be ignored.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;extension id=&amp;quot;menu.PluginsMenuItem&amp;quot; point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Protege-OWL plugins&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;Protege 4.0 OWL plugins&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;url value=&amp;quot;http://protegewiki.stanford.edu/index.php/Protege-OWL_4.0&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;org.protege.editor.core.application.menu.HelpMenu/SlotF-B&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== preferencespanel ====&lt;br /&gt;
&lt;br /&gt;
Create a panel that will be loaded into the preferences dialog.&lt;br /&gt;
&lt;br /&gt;
This should be for controlling a particular aspect of Protege4.0 in general or can be used as part of a bundle to control the behaviour of other plugins.&lt;br /&gt;
&lt;br /&gt;
Preferences should be used to persist over sessions.&lt;br /&gt;
&lt;br /&gt;
The '''applyChanges()''' method should be used to update the appropriate values in Protege's '''PreferencesManager'''.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.owl.ui.preferences.PreferencesPanel'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.tree.OWLTreePreferencesPanel'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== WorkspaceTab ====&lt;br /&gt;
&lt;br /&gt;
Unless your tab requires some special handling for events or non-standard layout you will probably not need to implement a class for this plugin.&lt;br /&gt;
You can just point the plugin.xml configuration to WorkspaceViewsTab (or OWLWorkspaceViewsTab) implementation and the rest of the plugin description&lt;br /&gt;
should be enough to customise the tab – i.e., give it a name and point to a default layout (see below).&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.ui.workspace.WorkspaceTab'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.OWLClassesTab'''&lt;br /&gt;
&lt;br /&gt;
===== Creating a tabbed view layout =====&lt;br /&gt;
* First, create or decide on which views you wish to have on your tab - make sure these are all implemented&lt;br /&gt;
* Open Protege 4.0&lt;br /&gt;
* Create a new tab ('''Window | Create new tab...''')&lt;br /&gt;
* Select your new tab and start customising it by adding views (see [[Protege4GettingStarted#Reconfigure_the_User_Interface|Reconfigure the user interface]])&lt;br /&gt;
* Select '''Window | Save current layout''' or quit Protege&lt;br /&gt;
* Find the new layout in the Protege installation directory ''Data/ViewConfigurations/viewconfig-custom-YOUR_TAB_NAME.xml''&lt;br /&gt;
* Rename this without the ''custom'' and copy to somewhere in your plugin source like a ''resources/'' folder&lt;br /&gt;
* Make sure this folder is on your classpath and that it gets added to you compiler output path&lt;br /&gt;
* Add the layout ('''defaultViewConfigFileName''') to the plugin description in plugin.xml&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;OWLOntologyTab&amp;quot;&lt;br /&gt;
                point=&amp;quot;org.protege.editor.core.application.WorkspaceTab&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;label value=&amp;quot;Active Ontology&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.core.ui.workspace.WorkspaceViewsTab&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;defaultViewConfigFileName value=&amp;quot;viewconfig-ontologytab.xml&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;index value=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;OWLEditorKit&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== EditorKitFactory ====&lt;br /&gt;
&lt;br /&gt;
An EditorKit is the access point for a particular type of model (or ontology) and a GUI to handle that model.&lt;br /&gt;
&lt;br /&gt;
Currently, there is just one implementation - the OWLEditorKit&lt;br /&gt;
&lt;br /&gt;
Implement this type of plugin if you require a new type of model to be supported (eg a Frames-based model).&lt;br /&gt;
&lt;br /&gt;
There is obviously considerable work needed to implement a new editor kit (along with its model manager and workspace).&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.core.editorkit.EditorKitFactory'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.OWLEditorKitFactory'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== menu.window ====&lt;br /&gt;
&lt;br /&gt;
Create a new menu into which [[#EditorKitMenuAction|EditorKitMenuActions]] can be added.&lt;br /&gt;
No need for any implementation. The plugin description gives enough detail for full customisation.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;menu.EditMenu&amp;quot;&lt;br /&gt;
                point=&amp;quot;org.protege.editor.core.application.EditorKitMenuAction&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Edit&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;toolTip value=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;path value=&amp;quot;/SlotB-A&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;editorKitId value=&amp;quot;any&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== OntologyRepositoryFactory ====&lt;br /&gt;
&lt;br /&gt;
Create a source from which ontologies can be loaded. This plugin will create an entry on the welcome screen that allows the user to get ontologies from any number of places (a repository, a web service etc).&lt;br /&gt;
&lt;br /&gt;
* Implement '''org.protege.editor.core.OntologyRepositoryFactory'''&lt;br /&gt;
* Example '''org.protege.editor.owl.model.repository.TONESRepositoryFactory'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;TONESRepository&amp;quot; point=&amp;quot;org.protege.editor.core.application.OntologyRepositoryFactory&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.model.repository.TONESRepositoryFactory&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== EditorKitHook ====&lt;br /&gt;
&lt;br /&gt;
Perform some actions when an editing session is started.&lt;br /&gt;
The initialise() method gets called when the EditorKit has been initialised.&lt;br /&gt;
This can be used to perform some special configuration or replace default behaviour.&lt;br /&gt;
&lt;br /&gt;
* Implement '''org.protege.editor.core.editorkit.plugin.EditorKitHook''' (or org.protege.editor.owl.model.OWLEditorKitHook)&lt;br /&gt;
* Extension point '''org.protege.editor.core.application.EditorKitHook'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ToolBarAction ====&lt;br /&gt;
&lt;br /&gt;
Not currently used - will be implemented to allow view actions to be customised&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ViewAction ====&lt;br /&gt;
&lt;br /&gt;
Not currently used - will be implemented to allow view actions to be customised&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== OWL Plugins ===&lt;br /&gt;
&lt;br /&gt;
==== inference.reasonerfactory ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ui.renderer.entitycolorprovider ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== model.libraryfactory ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== moveaxiomskit ====&lt;br /&gt;
&lt;br /&gt;
Methods of selecting axioms for copying, moving or deleting (see [[P4MoveAxioms|Refactor | Copy/move/delete axioms]]) are pluggable.&lt;br /&gt;
&lt;br /&gt;
You can choose to implement pages to add to the wizard to control how your kit works.&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.owl.ui.ontology.wizard.move.MoveAxiomsKit'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.ontology.wizard.move.byreference.MoveAxiomsByReferenceKit'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;MoveAxiomsByReference&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.owl.moveaxiomskit&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;name value=&amp;quot;Axioms by reference (select entities from the ontology)&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.ontology.wizard.move.byreference.MoveAxiomsByReferenceKit&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ui.editor.description (from build 109) ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Class-expression-editor.png|400px|right]]&lt;br /&gt;
&lt;br /&gt;
When adding/editing superclasses, equivalent classes, property domains, individual types etc a class description editor is brought up.&lt;br /&gt;
&lt;br /&gt;
Each tab on the editor is a plugin capable of creating/editing (possibly a subset) OWL class descriptions&lt;br /&gt;
&lt;br /&gt;
* Implement: '''org.protege.editor.owl.ui.editor.AbstractOWLDescriptionEditor'''&lt;br /&gt;
* Example: '''org.protege.editor.owl.ui.editor.OWLClassSelectorWrapper'''&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;extension id=&amp;quot;OWLClassSelectorWrapper&amp;quot;&lt;br /&gt;
               point=&amp;quot;org.protege.editor.owl.ui.editor.description&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;label value=&amp;quot;Asserted class hierarchy&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;class value=&amp;quot;org.protege.editor.owl.ui.editor.OWLClassSelectorWrapper&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;index value=&amp;quot;B&amp;quot;/&amp;gt;&amp;lt;!-- from build 110 --&amp;gt;&lt;br /&gt;
    &amp;lt;/extension&amp;gt;&lt;/div&gt;</summary>
		<author><name>Swartik</name></author>	</entry>

	</feed>