From Protege Wiki
Jump to: navigation, search

This page refers to an older version of WebProtege (release 1.0). Please follow the links from the main WebProtege wiki page to get to documentation for the latest WebProtege.

Jennifer & Tania's selp-help page for developing WebProtege :)

Please note that WebProtege uses:

1). Google Web Toolkit, a.k.a., GWT (http://code.google.com/webtoolkit/)

2). GWT-Ext (http://code.google.com/p/gwt-ext/)

... and these instructions assume that you have already downloaded both items.

Checkout, compile, and run WebProtege using Eclipse

Checkout the source code

  1. Open Eclipse and go to the SVN Respository Exploring perspective.
  2. Navigate to the top-level "web-protege" directory in the Protege Subversion repository (URL for Protege's SVN is: http://smi-protege.stanford.edu/repos/protege).
  3. Right-click on web-protege and choose Checkout...
  4. Choose the following options in the Checkout from SVN dialog:


  5. Click the Finish button.
  6. In the New Project dialog, select Java Project, and click Next.
  7. In the resulting New Java Project dialog:
    • Give the project a name (like "web-protege" for example).
    • In the Contents pane, select "Create project from existing source" (there is no existing source at the moment - this is just part of the process to make GWT and Eclipse work together for WebProtege).
    • Select an empty directory for the "existing source".
    • The New Project dialog should now look something like the following:


  8. Click the Finish button. At this point, Eclipse will check out the source code and create a new Java project for WebProtege. Once the checkout is complete, you will notice that there are many compilation errors. We will fix these later.
  9. In the Java perspective, go to the Package Explorer and right-click on the newly created project. Select Delete in the context menu and in the resulting Confirm Project Delete dialog, choose the "Do not delete contents" option, and click the Yes button.
  10. Close the Eclipse development environment and proceed with the next steps.

Rename the src directory

  1. Open Windows Explorer (or equivalent on other platforms) and navigate to the directory where Eclipse created the "web-protege" project.
  2. Rename the "src" directory to something else, like "src1" for example. This is a temporary measure that will prevent the source code from getting overwritten when we generate the necessary GWT project and application files. Your file structure should now look something like the following:


Run the GWT projectCreator script

  1. Open a Command Prompt (or equivalent on other platforms) and change to the root directory of the "web-protege" Eclipse project.
  2. Run the GWT projectCreator script using the syntax projectCreator -eclipse <your-project-name> -overwrite. More documentation about the projectCreator tool can be found on the GWT Web site. You should see something like the following after running the script:


Run the GWT applicationCreator script

  1. In the same directory in the Command Prompt, run the GWT applicationCreator script using the syntax applicationCreator -eclipse <your-project-name> edu.stanford.bmir.protege.web.client.WebProtege. More documentation about the applicationCreator tool can be found on the GWT Web site. You should see something like the following after running the script:


  2. If you successfully executed both the projectCreator and applicationCreator scripts, your file structure should now look something like the following:


Restore the original src directory

  1. In Windows Explorer (or equivalent on other platforms), navigate to your project directory and delete the "src" directory that was generated by GWT's applicationCreator script.
  2. Rename "src1" back to "src".

Import your project into Eclipse

  1. Reopen the Eclipse development environment.
  2. Select File | Import...
  3. In the Import dialog, choose General -> Existing Projects into Workspace and click Next.
  4. Select the root directory of the "web-protege" project:


  5. Click the Finish button.

Configure project to fix compilation errors

  1. Right-click on the "web-protege" project and choose Properties from the context menu.
  2. In the Properties dialog, select Java Build Path on the left, and click the Libraries tab on the right.
  3. Remove gwt-user.jar from the classpath (this was added by GWT scripts).
  4. Click the Add JARs... button and add gwtext.jar and gwt-user.jar from the web-protege/lib directory.
  5. Please note that WebProtege depends on the sources from the Protege application and several Protege plug-ins. These items are listed below, with the directory names where you can find the corresponding JAR files in your Protege installation folder:
    • Core Protege application (root directory of your Protege installation - need protege.jar, unicode_panel.jar, and looks-2.1.3.jar)
    • Protege-OWL editor (plugins/edu.stanford.smi.protegex.owl - need all JARS)
    • Changes Tab (plugins/edu.stanford.smi.protegex.changes - need all JARS)
    • Chat Plug-in (plugins/edu.stanford.smi.protegex.chatPlugin - need all JARS)
    • Collaborative Protege (plugins/edu.stanford.smi.protege.collab - need all JARS)
    • RDF Backend (plugins/edu.stanford.smi.protegex.rdf_backend - need all JARS)
    • Standard Extensions Library (plugins/edu.stanford.smi.protegex.standard_extensions - need all JARS)
  6. Once all of the needed JAR files are on the classpath, click OK and the "web-protege" project should now compile successfully.

Modify launch configuration

  1. Bring up the Run dialog and select the WebProtege launch configuration under Java Application on the left-hand side.
  2. Select the Arguments tab and pass a VM argument to give WebProtege more memory:


  3. Click Apply and Close.

Copy Metaproject to tomcat directory

TODO: Add some documentation here about how WebProtege detects user names, passwords, and lists of available projects via an ontology (the Protege Metaproject).

In Eclipse, make a copy of the projects directory located in src/edu/stanford/bmir/protege/web/public/projects. Paste the entire directory to tomcat/webapps/ROOT (you may have to run WebProtege once in order for the tomcat directory to be created).

Your directory structure should now look something like the following:


There is a little bit of documentation about the Metaproject in the Protege Client-Server tutorial that may be helpful: Protege_Client-Server_Tutorial#The_Metaproject.

Run WebProtege in hosted mode

Click the Run button and choose WebProtege to launch the WebProtege application:


How to get rid of "Classpath variable JUNIT_HOME in project..." compiler warning

I noticed this warning when compiling a WebProtege project right after project creation:

Classpath variable JUNIT_HOME in project 'web-protege' is deprecated: Use the JUnit library instead.

I found some instructions on the Web for getting rid of the warning:

  • Go to Java Build Path -> Libraries in the Project Properties dialog.
  • Remove the JUNIT_HOME node.
  • Click the Add Library... button, select JUnit, and click Next.
  • Select JUnit 3 and click Finish.

Warning goes away...

Important tips when coding with GWT-Ext

GWT-Ext home page: http://gwt-ext.com/
GWT-Ext Google code page: http://code.google.com/p/gwt-ext/


Nice step-by-step guide for configuring Eclipse to develop GWT projects: http://toolkit.itmill.com/demo/doc/manual/ch08s07.html.


Must be careful to use the version of GWT-Ext that corresponds to GWT releases, e.g., GWT-Ext 2.0.5 supports GWT 1.5.2. If these two libraries get out of sync, WebProtege throws obtuse exceptions that make it hard to know what is going on...


  • Need to set IDs for columns that you plan to designate in setAutoExpandColumn method. No ID results in runtime errors w/obtuse error messages.
  • Make sure that you use the same consistent column IDs (e.g., in RecordDef, setAutoExpandColumn, col.setId(), etc.). Otherwise you get funny errors (e.g., main.body not set, or grid has no properties).