Difference between revisions of "CompileProtege4InEclipse"

From Protege Wiki
Jump to: navigation, search
m (Creating a Runnable for Windows or Linux)
Line 8: Line 8:
 
[[Protege4DevDocs#Protege-OWL_editor_in_a_Generic_IDE|generic ide instructions]].
 
[[Protege4DevDocs#Protege-OWL_editor_in_a_Generic_IDE|generic ide instructions]].
  
# Download the protege plug-ins with linked source. Currently these can be found [http://www.tigraworld.com/p4plugins/Protege4SourcePlugins.zip here] (version information is [http://www.tigraworld.com/p4plugins/version.txt here]).  Soon there will be a standard download page connected to each of our releases.  It is also possible to follow all of these steps by using the plugins from any installation of Protege 4 but these plugins-ins will not include the source.  The minimal set of plugins needed is
+
# Download the protege plug-ins with linked source. Currently these can be found [http://smi-protege.stanford.edu/protege4/Protege4SourcePlugins.zip here] (version information is [http://smi-protege.stanford.edu/protege4/Protege4SourcePluginsVersion.txt here]).  Soon there will be a standard download page connected to each of our releases.  It is also possible to follow all of these steps by using the plugins from any installation of Protege 4 but these plugins-ins will not include the source.  The minimal set of plugins needed is
 
## org.protege.common.jar
 
## org.protege.common.jar
 
## org.protege.editor.core.application.jar
 
## org.protege.editor.core.application.jar

Revision as of 12:25, November 18, 2009

Setup and run the Protege 4 OWL editor from Eclipse

This document is in progress. While it is not fully documented yet it does represent the recommended way to set up a protege 4 environment in eclipse. If this documentation is insufficient the fall back is to go to the generic ide instructions.

  1. Download the protege plug-ins with linked source. Currently these can be found here (version information is here). Soon there will be a standard download page connected to each of our releases. It is also possible to follow all of these steps by using the plugins from any installation of Protege 4 but these plugins-ins will not include the source. The minimal set of plugins needed is
    1. org.protege.common.jar
    2. org.protege.editor.core.application.jar
    3. org.protege.editor.owl.jar
    4. org.semanticweb.owl.owlapi.jar
  2. Create a new eclipse workspace
  3. Click "File -> Import..." This will bring up a dialog box.
  4. Choose "Plug-in Development -> Plug-ins and Fragments" and click "Next". This will bring up a dialog box.
  5. Unselect "The target platform (as specified in the Preferences)"
  6. Click the browse button and browse to the directory where you downloaded the protege plug-ins with linked source
  7. Don't worry about the warning at the top of the dialog box. The "Plug-ins and Fragments to Import" box should say "Select from all plug-ins..." and the "Import As" box should say "Binary projects".
  8. Click next bringing up a new dialog box.
  9. Click "Add All".
  10. Click "Finish"

This is a milestone. You should now see the Protege bundles as imported Plug-in projects.

Creating a Runnable for Windows or Linux

We now need to create a runnable. As far as I can tell Mac users cannot get the following steps to work. It is possible that this does work on intel macs but I have not been able to test this. There are claims made on the web saying that this issue is solved. SwingSwtProblems describes the results of my current experiments on this issue. Mac users need to use an alternative method.

User Remark: The following with Eclipse-3.5-cocoa for MacOSX10.5.8 works fine for me, just 1 problem: The placement of views always crashes protege.

Windows and Linux users now do the following to make a runnable.

  1. Click "Run -> Debug Configurations". This will bring up a dialog box.
  2. Select "OSGi Framework" and click the "New" Icon at the top.
  3. Name the "New_Configuration" something useful like "Protege".
  4. In the Bundles box, scroll down to where it says "Target Platform". Unselect all the bundles from the target platform (one click to the left of "Target Platform")
  5. Click on "Add Required Bundles".
  6. Click "Apply" to save your changes.
  7. Click "Debug" and Protege should come up.

Windows and Linux users should now be able to easily use eclipse to develop their plug-ins. To start a new bundle just create a new Eclipse Plug-in project. These projects will automatically get attached to the Protege runnable.

Creating a Runnable for OS X

Mac users who are willing to go to the bleeding edge should look at the SWT Cocoa Port. This is probably the way to go because then the Mac will work just like the other operating systems. This version will allow you to run protege 4 as an OSGi runable. When creating the runnable, remove all the program arguments except for "-console". Many thanks to Tania for finding this.

Otherwise, OS X users have to work a bit harder to get a working runnable. I have figured out the following workaround but am looking for a better way. First, checkout the ide project as a general project from svn at http://smi-protege.stanford.edu/repos/protege/protege4/small-projects/ide/trunk. In the following instructions I assume that it is checked out as the project "ide". Now the runnable can be created with the following steps:

  1. Click "Run -> Debug Configurations". A dialog box will come up.
  2. Select "Java Application" and click the "New" button at the top.
  3. Change the name of the "New_Configuration" to something more meaningful.
  4. Select the "Main" tab and
    1. Change the "Main Class" to be org.eclipse.core.runtime.adaptor.EclipseStarter.
  5. Select the "Arguments" tab and
    1. Set the working directory to ${workspace_loc:ide}.
    2. Add the following -D options to the "VM arguments" box:
      1. -Dosgi.clean=true
      2. -Dorg.protege.plugin.extra.0=${workspace_loc:com.owldl.pellet}
      3. -Dorg.protege.plugin.extra.1=${workspace_loc:org.coode.dlquery}
      4. -Dorg.protege.plugin.extra.2=${workspace_loc:org.coode.owlviz}
      5. -Dorg.protege.plugin.extra.3=${workspace_loc:org.protege.editor.owl}
      6. -Dorg.protege.plugin.extra.4=${workspace_loc:org.semanticweb.owl.owlapi}
  6. Select the "Classpath" tab and
    1. Add ide/org.eclipse.osgi.jar as a jar to the class path.
  7. Click "Apply" to save your changes
  8. Click "Debug" to run the runnable.

At this point, mac users can create Eclipse Plug-in projects to create their own plug-ins. In order to run these plugins the develoeper can add a new org.protege.plugin.extra line and create a staged location for the plugin as described in CompileProtege4PluginInEclipseOneProject#Running_the_Plugin.