Skip to content
Guohui Xiao edited this page Jun 12, 2015 · 7 revisions

Table of Contents

Run/Debug Protege Plugin from Eclipse or IntelliJ

This page describe how to debug Protege Plugin of Ontop from Eclipse or IntelliJ.

If you just want to test the plugin (without debugging), you only need to follow the first two steps to build the protege plugin and run protege as usual.

Build the protege plugin

1. Download the protege bundle

Download Protege bundle from the ontop website (http://ontop.inf.unibz.it/?page_id=11) and unzip it to e.g. `~/Downloads/Protege_5`

2. cd to the directory of ontop and compile the ontop project

$ cd ontop
$ mvn install -DskipTests
3. Be sure to set the JAVA_HOME environment variable. For Mac:
$ vim .bash_profile 
Add this line:  export JAVA_HOME=$(/usr/libexec/java_home)
$ source .bash_profile
4. create the protege plugin
$ cd obdalib-protege41
$ mvn bundle:bundle -DskipTests
5. copy the generated plugin into the Protege
$ cp target/it.unibz.inf.obda.p4plugin-1.11.0.jar ~/Downloads/Protege_5/plugins/

Be sure that there is only one Protege plugin in the plugins directory of Protege

Note that every time you modify the code, you need to recompile the ontop project and re-generate the plugin

Debug in Eclipse

The version of Eclipse used in this document is Kepler. Create new run configuration in Eclipse, call it "run protege" or similar.

Set the following arguments:

Project: ontop-protege4

Main Class: org.protege.osgi.framework.Launcher

Set the VM args to

-Dosgi.clean=true
-Dlog4j.configuration=file:log4j.xml
-Dorg.protege.allow.directory.bundles=true
-Dorg.protege.plugin.extra="${workspace_loc:ontop-protege4}\target\classes"
-Xmx3072m

Add two jars from Protege to the classpath

Now you can debug/run the protege plugin. If you see the following warning, simply ignore it.

You can set the breakpoint in Eclipse like in the following screen shot.

Debug in IntelliJ

Module Setting

Run Configuration

  • Main Class: org.protege.osgi.framework.Launcher
  • VM Options
-Dosgi.clean=true
-Dlog4j.configuration=file:log4j.xml
-Dorg.protege.allow.directory.bundles=true
-Dorg.protege.plugin.extra="${workspace_loc:ontop-protege4}\target\classes"
-Xmx3072m
  • Working Directory: directory of Protege
  • Use classpath of module: ontop-protege4

Run / Debug

Troubleshooting

  • Problem: Protege doesn't load ontop
 * Possible solution: Check that you there are no other ontop packages in the target directory when you build the package
Clone this wiki locally