A
plug-in is an extension to Protégé. There are six types
of plug-ins:
- Tab widget - a user interface tab that appears in the main
Protégé window alongside system tabs such as the Classes tab. An example of a tab widget
plug-in is the "Queries" tab.
- Slot widget - appears on a form and is used to view and acquire a
value for a slot at an instance. An example of a slot-widget plug-in is the TextFieldWidget, used for acquiring
and displaying strings.
- Back-end - specifies the mechanism that Protégé will
use for storage (either as text or in a database). An example of a back-end plug-in is the
RDF back-end.
- Createproject - takes a file in a source format produced by another
program and creates the closest possible "natural" Protégé knowledge-base.
- Export - provides an extensible mechanism for exporting
Protégé knowledge-bases in a variety of formats, both file and database. This plug-in types is
related to back-end plug-ins but is much easier to develop and serves a somewhat different need.
- Project - allows manipulation of a Protégé project and
Protégé's project UI.
There are several steps that are common to the development of each of the Protégé plug-in types, which are described below.
Specific information required by the different plug-in types is described elsewhere.
The process for developing a plug-in consists of the following broad steps:
Develop a skeletal plug-in
Before you can develop the code specific to your plug-in, you need to generate a stub plug-in with the desired name
but with trivial functionality, and then get it to load into Protégé and show up in the appropriate
places. To do this:
- Subclass the appropriate class for your plug-in type
- Implement all the methods required to do something simple.
- Generate a manifest file with an appropriate entry for your plug-in. Although you need a manifest file for
Protégé to see and use your plug-in it is not necessary to package your plug-in as a JAR file while
it is being developed. Protégé can load and run a plug-in that consists only of .class files in a
directory.
Flesh out the plug-in
Once your skeletal plug-in shows up you can begin to flesh it out by developing the code specific to your plug-in.
For tab or slot-widget plug-ins, this will involve generating java swing components, assembling them, and laying them
out. For back-end plug-ins, this will mean writing or interfacing with a existing parser or database. See the documentation
for each plug-in type for more information.
Package and distribute the plug-in
Once you have developed and tested your plug-in you may wish to package it so that others can use it.
We recommend that at the point that you give your plug-in to your first "user", you package your plug-in as
a JAR file. Attempting to distribute a plug-in as a collection of .class files is an error-prone and frustrating
process for both developers and users.
To create a JAR file from your .class files and your manifest file, use the standard java "jar" command.
For your users to "install" a plug-in, they just need to place the JAR file in the "plugins"
subdirectory of the Protégé installation directory.
After you package your plug-in as a JAR file you will need to retest it before you distribute it. There are several
problems (unrelated to Protégé) that arise which can cause a plug-in packaged as a JAR file to behave
differently from a plug-in accessed as .class files.