PluginAnatomy

From Protege Wiki
Revision as of 23:16, May 20, 2009 by Tredmond (talk | contribs) (Build.xml)

Jump to: navigation, search

In Progress!

Introduction

The purpose of this web page is to describe some of the key ingredients of a plugin. The page will be directed by the quick development of a plugin and can indeed be used as a quick start guide. However, we will assume that the reader has an understanding of Java development and knows how to follow along in his favorite IDE. For more information about how to work with protege 4 in an IDE I will direct the reader to this page.

The vacuous plugin in one minute

Before we can start, we must set the PROTEGE_HOME environment variable to point to a Protege 4 distribution. 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
   export PROTEGE_HOME=/Users/tredmond/Desktop/Protege_4.0_beta
The simplest (trivial) plugin can be built from sources in the following layout:
   build.xml
   META-INF
      MANIFEST.MF
   lib
   resources
   src
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.

Build.xml

The template for the build.xml file can be downloaded from here. Only two things need to be changed in this build file. They can be found by searching for the string "CHANGE ME" in the file. The first thing to change is the name of the project. I will call the project the plugin tutoiral project:
<project name = "plugin tutorial" default = "install" basedir = ".">
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:
   <property name = "plugin"          value = "org.protege.owl.examples.tab"/>

With these adjustments the build.xml file is ready.

MANIFEST.MF

The template for the MANIFEST.MF file can be downloaded from here.

Compile and Run

Adding content to the plugin

Plugin.xml

Viewconfig.xml