Compile and run Protege-OWL from Eclipse    (96S)

To follow is some documentation on how one would go about compiling and running Protege-OWL from the Eclipse development environment.    (96Y)

Important notes:    (96T)

  1. Protege-OWL is dependent on Core Protege. These instructions assume that you have already created a project and successfully compiled the source code for Core Protege in Eclipse. We provide detailed instructions for doing this on the Wiki: http://protege.cim3.net/cgi-bin/wiki.pl?CompileProtegeCoreInEclipse.    (96U)
  2. There is more than one way to compile and run Protege-OWL from Eclipse. This page documents one possibility, but is not meant to be exhaustive.    (96V)
  3. These instructions are valid for the 3.x series of Protege-OWL. They are not applicable to Protege 4.0 alpha.    (96W)
  4. If you don't like development environments, we provide an Ant build script called "build.xml" for Protege-OWL that is located in our Subversion repository: http://smi-protege.stanford.edu/repos/protege/owl/trunk/build.xml.    (96X)

Quick Links    (984)


Checkout the source code for Protege-OWL    (96Z)

Launch Eclipse and go to the SVN Repository Exploring perspective. (This step assumes that you have already installed an Eclipse plug-in called Subclipse that adds Subversion integration to the Eclipse IDE). Click the "Add SVN Repository" button to bring up the "Add SVN Repository" dialog. In the "Url" text box, type the following URL:    (970)

http://smi-protege.stanford.edu/repos/protege/    (971)

... and click Finish. Eclipse should look like the following screenshot at this point:    (972)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/svn-repos-perspective.jpg    (973)

Once you have successfully connected to the Protege Subversion repository, navigate to the folder owl/trunk and right click to bring up the context menu. Choose the "Checkout..." option to bring up the "Checkout from SVN" dialog. Choose the options indicated in the screenshot below and click Finish.    (974)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/checkout-dialog.jpg    (975)

In the resulting "New Project" wizard, select "Java Project" and click Next. In the "New Java Project" dialog, type a project name (for this documentation, we will use "protege-owl"). In the JRE section of this dialog, it is important to pick a version of Java that Protege supports (as of the writing of this documentation on April 4, 2007, the necessary version of Java is 1.5). Choose the options indicated in the screenshot below and click Next.    (976)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/new-project-dialog-owl.jpg    (977)

In the "Java Settings" portion of the wizard, change the default output folder to protege-owl/plugins/edu.stanford.smi.protegex.owl as indicated in the screenshot below and click Finish.    (978)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/java-settings-owl.jpg    (979)

At this point, Eclipse will begin checking out the source code for Protege-OWL. When the process is completed, switch to the Java perspective and Eclipse should look something like the following:    (97A)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/java-perspective-owl.jpg    (97B)

Configure the Protege-OWL Project    (97C)

Right-click on protege-owl in the Package Explorer and choose Properties. In the "Properties for protege-owl" dialog, click "Java Build Path" on the left, and click the Projects tab. On the Projects tab, click the "Add..." button to bring up the "Required Project Selection" dialog. Put a check next to the protege-core project and click OK. The Projects tab should look like the following screenshot:    (97D)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/projects-tab.jpg    (97E)

Next, click on the Libraries tab and click the "Add JARs..." button. In the JAR Selection dialog, select all of the JAR file in the protege-owl/lib directory and click OK. The Libraries tab should look like the following screenshot:    (97F)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/libraries-tab-owl.jpg    (97G)

Click OK to dismiss the Properties dialog. Note that after specifying the necessary JAR files and linking the protege-owl and protege-core projects, there are no longer any compiler errors displayed in the Problems view of the Java perspective.    (97H)

Run Protege-OWL    (97I)

There are two more steps that we need to perform before we can run Protege-OWL from Eclipse.    (989)

Step 1: Protege-OWL expects certain files to be present in the output directory at runtime. You need to copy the entire contents of the protege-owl/etc directory to the output directory of protege-owl/plugins/edu.stanford.smi.protegex.owl. On a Windows machine, the directory structure should resemble the following (after doing the copy):    (97J)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/directory-structure-owl.jpg    (97K)

Step 2: Protege expects a logging.properties file to be present in the directory where it is being executed from. You can make a copy of the logging.properties file that is located in the protege-core directory and place it in the protege-owl directory. If you skip this step, you can still run Protege but important logging information will not be displayed in the Console view. To follow is a screenshot of the contents of the protege-owl directory after adding the logging.properties file to the proper location:    (98A)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/directory-structure-owl2.jpg    (98B)

To create a run configuration for Protege-OWL, click the small down arrow next to the Run button on the Eclipse toolbar and choose "Run..." to bring up the "Run" dialog. Choose Java Application from the list on the left and click the "New launch configuration" button. In the Name text box, type "protege-owl" and fill in the rest of the fields as indicated by the screenshot below:    (97L)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/run-config-owl.jpg    (97M)

Click the Apply button and then click the Close button. When running Protege-OWL, it is a good idea to enable the Console view in Eclipse because Protege-OWL outputs helpful logging information to the console. To enable the Console view, choose Window -> Show View -> Console.    (97N)

To run Protege-OWL, click on the small down arrow again next to the Run button and choose the newly created protege-owl run configuration. Protege-OWL should launch from Eclipse and you should be able to see the Welcome to Protege dialog. Click the "Open Other..." button, navigate to the protege-owl/examples directory, and select the pizza.owl.pprj project file:    (97O)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/open-project.jpg    (97P)

Click the OK button and note that Protege will open the example "pizza" project that is distributed with the standard Protege installation:    (97Q)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/protege-owl.jpg    (97R)

To follow is a screenshot of the Eclipse environment with Protege-OWL logging information visible in the Console view:    (97S)

http://protege.cim3.net/file/work/images/compile-protege-eclipse/console-output3.jpg    (97T)

Warning Messages in the Console    (97U)

In the above screenshot you can see that there are two warning messages displayed when you run Protege-OWL.    (97V)

The first warning:    (97W)

WARNING: missing bundle: protege_text -- BundleHelper.<init>()    (97X)

... is displayed because Protege is expecting a particular Java properties file in the directory from where it is executed. To fix this warning, copy the file protege-core/src/edu/stanford/smi/protege/resource/files/protege_text.properties to the root directory of your protege-owl Eclipse project.    (97Y)

The second warning:    (97Z)

WARNING: [Repository Manager] Could not find repository file: file:/C:/eclipse-workspace/protege-owl/examples/pizza.owl.repository -- RepositoryFileManager.loadRepositoriesFromURI()    (980)

... is benign and can be ignored. To learn more about repository files and how they are used by Protege-OWL, please see the tutorial on managing imports in Protege-OWL on the Protege website: http://protege.stanford.edu/doc/owl/owl-imports.html.    (981)

It is also helpful to note that Protege prints the version number, build number, and version of Java it is using to the console. This information can be very helpful when trying to debug problems.    (982)

Author: Jennifer Vendetti    (983)