Integrate Processing with Protege4


#1

Hi ! I’m really stuck on the problem for several days. I need to develop a plugin for visualization of ontologies and my idea was to embed / integrate Processing in Protege4 as a view component. I’ve searched a lot and also tried Processing 3 and Processing 2 but neither worked for me.
The error when working with Processing 2:
RuntimeException: You need to use “Import Library” to add processing.core.PGraphicsJava2D to your sketch.
processing.core.PApplet.makeGraphics(PApplet.java:1952)
processing.core.PApplet.init(PApplet.java:981)
processing.core.PApplet.runSketch(PApplet.java:10840)

I tried to do it with the solution here: https://stackoverflow.com/questions/36565159/adding-processing-3-to-a-jpanel but got an error in eclipse:
“ProcessingTest.initSurface() is not visible”. Then I added the initSurface() in the ProcessingTest but still wrong:
processing.awt.PGraphicsJava2D.class is not in the classpath (But I’m really sure that I have added it to the build path)

So is it possible to integrate Protege with Processing?
Really need help! Thanks in advance!


#2

I’ve never used Protege before, but I can talk about the Processing side of things:

Before Processing 3, each sketch could be treated as a component, because the PApplet class extended Java’s Applet class. That allowed you to do things like add a sketch to a Swing window, just like you would add any other Applet class.

But since Processing 3, PApplet no longer extends Applet. This means you can no longer treat a Processing sketch as a component.

It sounds like this is more a Protege question than it is a Processing question. If you can embed a Applet inside Protege, then Processing 2 should work for you. If you can use arbitrary Java classes and library (and are okay with your Processing sketch being in a different window than the Protege window), then Processing 3 should work for you.

So if I were you, I’d try asking in a Protege forum about those two options. If you have an example that does either one (uses an Applet or uses an arbitrary Java class and library), then I’ll be able to help with the Processing half of things.

Sounds like an interesting project. Good luck!