Search Mailing List Archives
[protege-discussion] jess,jesstab and protege-frame in applet.
Tania Tudorache
tudorache at stanford.edu
Wed Apr 30 13:24:31 PDT 2008
Hi Anne,
Protege is "applet-ready" so to say :) You can run Protege as an applet
and it will work. However, I am not sure whether Jess and Jess-Tab can
be run in an applet. I didn't try that. The problem with the applet is
that the running environment is much more restricted than in a desktop
Java application. The applet does not have access to your environment
variables, file system, etc. If you debug your applet, you will see that
you get many access and security exceptions. We had to go through a lot
of trouble to make Protege catch all these exception, so that it can
work as an applet.
Jess and JessTab are plugins that have been developed outside of
Stanford and we don't have control over them. You could contact the
author of the plugin and ask if it can be run as an applet.
We have some sample applet for running Protege. The applet tag in the
HTML file looks like:
<applet code="edu.stanford.smi.protege.Applet.class"
codebase="http://smi-protege.stanford.edu/collab-protege/"
archive="protege.jar,
looks-2.1.3.jar,
unicode_panel.jar,
plugins/edu.stanford.smi.protegex.changes/change-model.jar,
plugins/edu.stanford.smi.protegex.changes/icu4j.jar,
plugins/edu.stanford.smi.protegex.rdf_backend/rdf-backend.jar,
plugins/edu.stanford.smi.protegex.changes/change-management.jar,
plugins/edu.stanford.smi.protege.collab/protege-collab.jar,
plugins/edu.stanford.smi.protege.collab/jcalendar.jar,
plugins/edu.stanford.smi.protegex.chatPlugin/chat.jar,
plugins/edu.stanford.smi.protegex.owl/protege-owl.jar"
height="45" width="120">
Your browser doesn't support the <code>applet</code> tag!
</applet>
You can try out the applet and look at the rest of the HTML source here:
http://smi-protege.stanford.edu/collab-protege/runAsApplet.html
You will need in any case to add the looks and the unicode panel jars in
the classpath of the applet.
You can also see what the problem is with your applet, by typing in a
console:
appletviewer
http://smi-protege.stanford.edu/collab-protege/runAsApplet.html
(replace URL with the URL of your applet).
Hope this helps.
Tania
anne neldel wrote:
> hello everybody,
>
> I work with Protege-frame, Jess, JessTab and Eclipse, and my goal is to
> build an applet using these tools. this is what I can not achieve.
>
> The ontology that I used to represent you my problem consists of a single
> class called person represented by two slots name and age and having 5
> instances.
> To try to achieve this applet I used the codes below:
>
> JAVA Code :
>
> import java.awt.Container;
>
> import javax.swing.JApplet;
> import javax.swing.JComboBox;
> import javax.swing.JPanel;
>
> import jess.JessException;
> import jess.QueryResult;
> import jess.Rete;
> import jess.ValueVector;
> import JessTab.JessTabFunctions;
>
> public class app extends JApplet
> {
> public void init ()
> {
> pan = new JPanel ();
> contenu = getContentPane() ;
> contenu.add(pan) ;
> combo = new JComboBox() ;
> pan.add(combo) ;
>
> Rete moteur = new Rete();
> moteur.addUserpackage(new JessTabFunctions());
>
> try {moteur.executeCommand("(load-project onto.pprj)");}
> catch (JessException e) {e.printStackTrace();}
>
> try {moteur.batch("exp.clp");}
> catch (JessException e) {e.printStackTrace();}
>
> try {moteur.executeCommand("(run)");}
> catch (JessException e) {e.printStackTrace();}
>
> try {moteur.eval("(defquery quer (object (is-a person)(name ?n) (age
> ?a)))");}
> catch (JessException e) {e.printStackTrace();}
>
> QueryResult champ = null;
>
> try {champ = moteur.runQueryStar("quer",new ValueVector() );}
> catch (JessException e) {e.printStackTrace();}
>
> while(champ.next())
> try {combo.addItem(champ.getString("n")+" "+champ.getInt("a"));}
> catch (JessException e) {e.printStackTrace();}
>
>
> }
> private JComboBox combo;
> private JPanel pan;
> private Container contenu;
>
> }
>
> JESS Code : exp.clp
>
> (reset)
>
> (mapclass person)
>
> While viewing the applet with Eclipse, it works without problem. But when I
> try to include it in an HTML page using the code below, it does not
>
> HTML Code
>
> <applet
> code= "app.class"
> name="app"
> width="125"
> height="125"
> archive="jess.jar,JessTab12.jar,protege.jar"
>
> </applet>
>
> Knowing that I put in a single file the following elements:
>
> - app.class
> - the Jess program
> - the ontology (onto.pprj, ontp.pins, onto.pont)
> - the jars : protege.jar, JessTab12.jar, jess.jar
> - the HTML page
>
>
> thank you in advance.
>
>
More information about the protege-discussion
mailing list