JESS,Protege,Applet : Help me please

View: New views
4 Messages — Rating Filter:   Alert me  

JESS,Protege,Applet : Help me please

by Daniella Touvet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Re: JESS: JESS,Protege,Applet : Help me please

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 4, 2008, at 11:27 AM, Daniella Touvet wrote:

> 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


Well, presumably the "does not work" takes the form of an exception,  
and so your browser's "Java Console" should be showing some kind of a  
stack trace. That will tell you (or us) where things are going wrong.  
The stack trace should make it clear to you; perhaps there are more  
jar files you need to include, so you'll see ClassNotFoundExceptions.  
If you can't tell from the stack trace, though, then most likely  
someone here would be able to, so please paste that into a message and  
send it along.



---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: exceptions: JESS,Protege,Applet : Help me please

by Daniella Touvet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello
I apologize, maybe I was not precise enough in my first message: the version of protege that I use is protege3.1.1 the JessTab12 and Jess70p2.
when I run my applet in HTML,the applet is loaded but with an empty combobox and I get the following exceptions

Jess reported an error in routine import
                while executing (import java.lang.Boolean).
  Message: Error during execution.
  Program text: ( import java.lang.Boolean )  at line 88.
                at jess.Funcall.execute(Unknown Source)
                at jess.Jesp.a(Unknown Source)
                at jess.Jesp.parseExpression(Unknown Source)
                at jess.Jesp.promptAndParseOneExpression(Unknown Source)
                at jess.Jesp.parse(Unknown Source)
                at jess.Batch.batch(Unknown Source)
                at jess.Batch.batch(Unknown Source)
                at jess.Batch.batch(Unknown Source)
                at jess.Rete.batch(Unknown Source)
                at jess.Rete.goto(Unknown Source)
                at jess.Rete.<init>(Unknown Source)
                at jess.Rete.<init>(Unknown Source)
                at jess.Rete.<init>(Unknown Source)
                at app.init(app.java:29)
                at sun.applet.AppletPanel.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
                at java.security.AccessControlContext.checkPermission(Unknown Source)
                at java.security.AccessController.checkPermission(Unknown Source)
                at java.lang.SecurityManager.checkPermission(Unknown Source)
                at java.lang.reflect.AccessibleObject.setAccessible(Unknown Source)
                at jess.bg.<init>(Unknown Source)
                at jess.ap.<init>(Unknown Source)
                at jess.am.a(Unknown Source)
                at jess.am.a(Unknown Source)
                at jess.dd.new(Unknown Source)
                at jess.Rete.importClass(Unknown Source)
                at jess.di.call(Unknown Source)
                at jess.ab.a(Unknown Source)
                ... 16 more
JGoodies Looks: Can't read the System property netbeans.buildnumber.
JGoodies Looks: Can't read the System property Plastic.tabStyle.
JGoodies Looks: Can't read the System property Plastic.highContrastFocus.
JGoodies Looks: Can't read the System property Plastic.defaultTheme.
4 mai 2008 19:18:29 edu.stanford.smi.protege.plugin.PluginUtilities findPluginsDirectory
WARNING: Application directory not specified
4 mai 2008 19:18:30 edu.stanford.smi.protege.resource.BundleHelper <init>
WARNING: missing bundle: protege_text
JessTab: Note that the PAL engine is not currently installed in Protege.
(The JessTab PAL-integration functions are not available.)
4 mai 2008 19:18:31 edu.stanford.smi.protege.util.URIUtilities createURIFromFileString
SEVERE: java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
                at java.security.AccessControlContext.checkPermission(Unknown Source)
                at java.security.AccessController.checkPermission(Unknown Source)
                at java.lang.SecurityManager.checkPermission(Unknown Source)
                at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
                at java.lang.System.getProperty(Unknown Source)
                at java.io.Win32FileSystem.getUserPath(Unknown Source)
                at java.io.Win32FileSystem.resolve(Unknown Source)
                at java.io.File.getAbsolutePath(Unknown Source)
                at java.io.File.getAbsoluteFile(Unknown Source)
                at java.io.File.toURI(Unknown Source)
                at edu.stanford.smi.protege.util.URIUtilities.createURIFromFileString(Unknown Source)
                at edu.stanford.smi.protege.util.URIUtilities.createURI(Unknown Source)
                at edu.stanford.smi.protege.model.Project.<init>(Unknown Source)
                at JessTab.ProtegeLoadProject.call(JessTabFunctions.java:2985)
                at jess.ab.a(Unknown Source)
                at jess.Funcall.execute(Unknown Source)
                at jess.Jesp.a(Unknown Source)
                at jess.Jesp.parseExpression(Unknown Source)
                at jess.Jesp.promptAndParseOneExpression(Unknown Source)
                at jess.Jesp.parse(Unknown Source)
                at jess.Rete.eval(Unknown Source)
                at jess.Rete.executeCommand(Unknown Source)
                at app.init(app.java:31)
                at sun.applet.AppletPanel.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
 
Jess reported an error in routine mapclass
                while executing (mapclass person).
  Message: Protege class not found: person.
  Program text: ( mapclass person )  at line 4.
                at JessTab.JessTabFunctions.valueToCls(JessTabFunctions.java:543)
                at JessTab.ProtegeMapClass.call(JessTabFunctions.java:1523)
                at jess.ab.a(Unknown Source)
                at jess.Funcall.execute(Unknown Source)
                at jess.Jesp.a(Unknown Source)
                at jess.Jesp.parseExpression(Unknown Source)
                at jess.Jesp.promptAndParseOneExpression(Unknown Source)
                at jess.Jesp.parse(Unknown Source)
                at jess.Batch.batch(Unknown Source)
                at jess.Batch.batch(Unknown Source)
                at jess.Batch.batch(Unknown Source)
                at jess.Rete.batch(Unknown Source)
                at app.init(app.java:32)
                at sun.applet.AppletPanel.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
JGoodies Looks: Can't read the System property ClearLook.mode.
JGoodies Looks: Can't read the System property ClearLook.policy.

thank you in advance


Parent Message unknown Re: JESS: Re: JESS,Protege,Applet : Help me please

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, you can see both Jess and Protege struggling with Applet  
security restrictions; Jess is being disallowed from using reflection,  
and Protege is failing to check various system properties. Looks like  
the last straw is

>> SEVERE: java.security.AccessControlException: access denied  
>> (java.util.PropertyPermission user.dir read)
>>                at  
>> java.security.AccessControlContext.checkPermission(Unknown Source)
>>                at  
>> java.security.AccessController.checkPermission(Unknown Source)
>>                at java.lang.SecurityManager.checkPermission(Unknown  
>> Source)
>>                at  
>> java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
>>                at java.lang.System.getProperty(Unknown Source)
>>                at java.io.Win32FileSystem.getUserPath(Unknown Source)
>>                at java.io.Win32FileSystem.resolve(Unknown Source)
>>                at java.io.File.getAbsolutePath(Unknown Source)
>>                at java.io.File.getAbsoluteFile(Unknown Source)
>>                at java.io.File.toURI(Unknown Source)
>>                at  
>> edu
>> .stanford
>> .smi.protege.util.URIUtilities.createURIFromFileString(Unknown  
>> Source)
>>                at  
>> edu.stanford.smi.protege.util.URIUtilities.createURI(Unknown Source)
>>                at  
>> edu.stanford.smi.protege.model.Project.<init>(Unknown Source)
>>                at  
>> JessTab.ProtegeLoadProject.call(JessTabFunctions.java:2985)
>>                at jess.ab.a(Unknown Source)
>>                at jess.Funcall.execute(Unknown Source)
>>                at jess.Jesp.a(Unknown Source)
>>                at jess.Jesp.parseExpression(Unknown Source)
>>                at jess.Jesp.promptAndParseOneExpression(Unknown  
>> Source)


Clearly all of Jess, JessTab and Protege are loaded and running. If  
you look carefully at the stack trace info, you can see that your Jess  
code has called a JessTab function which is trying to load the Protege  
project from a file on disk, and the Applet sandbox is stopping it  
from getting the necessary access.

So what you need to figure out is whether that JessTab function has  
any provision for loading the Protege project file(s) from a URL --  
i.e., from the network. If it does, then use a URL instead of a  
filename to load the project. If it doesn't, well, then it doesn't,  
and your choices include modifying the Protege code, making the user  
install the files locally and using the Java Plugin security policy to  
allow it (both of those alternatives are hard) or simply DON'T TRY TO  
USE ALL THIS STUFF IN AN APPLET, which is the advice we gave earlier.  
Do everything on the server, or do everything as a downloadable  
application -- even as a Java Web Start application. But IMO an applet  
is really ill suited for your project.


On May 5, 2008, at 3:59 AM, Daniella_Touvet@... wrote:

> Hello
> I apologize, maybe I was not precise enough in my first message: the  
> version of protege that I use is protege3.1.1 the JessTab12 and  
> Jess70p2.
> when I run my applet in HTML,the applet is loaded but with an empty  
> combobox and I get the following exceptions
>
> Jess reported an error in routine import
>                while executing (import java.lang.Boolean).
>  Message: Error during execution.
>  Program text: ( import java.lang.Boolean )  at line 88.
>                at jess.Funcall.execute(Unknown Source)
>                at jess.Jesp.a(Unknown Source)
>                at jess.Jesp.parseExpression(Unknown Source)
>                at jess.Jesp.promptAndParseOneExpression(Unknown  
> Source)
>                at jess.Jesp.parse(Unknown Source)
>                at jess.Batch.batch(Unknown Source)
>                at jess.Batch.batch(Unknown Source)
>                at jess.Batch.batch(Unknown Source)
>                at jess.Rete.batch(Unknown Source)
>                at jess.Rete.goto(Unknown Source)
>                at jess.Rete.<init>(Unknown Source)
>                at jess.Rete.<init>(Unknown Source)
>                at jess.Rete.<init>(Unknown Source)
>                at app.init(app.java:29)
>                at sun.applet.AppletPanel.run(Unknown Source)
>                at java.lang.Thread.run(Unknown Source)
> Caused by: java.security.AccessControlException: access denied  
> (java.lang.reflect.ReflectPermission suppressAccessChecks)
>                at  
> java.security.AccessControlContext.checkPermission(Unknown Source)
>                at  
> java.security.AccessController.checkPermission(Unknown Source)
>                at java.lang.SecurityManager.checkPermission(Unknown  
> Source)
>                at  
> java.lang.reflect.AccessibleObject.setAccessible(Unknown Source)
>                at jess.bg.<init>(Unknown Source)
>                at jess.ap.<init>(Unknown Source)
>                at jess.am.a(Unknown Source)
>                at jess.am.a(Unknown Source)
>                at jess.dd.new(Unknown Source)
>                at jess.Rete.importClass(Unknown Source)
>                at jess.di.call(Unknown Source)
>                at jess.ab.a(Unknown Source)
>                ... 16 more
> JGoodies Looks: Can't read the System property netbeans.buildnumber.
> JGoodies Looks: Can't read the System property Plastic.tabStyle.
> JGoodies Looks: Can't read the System property  
> Plastic.highContrastFocus.
> JGoodies Looks: Can't read the System property Plastic.defaultTheme.
> 4 mai 2008 19:18:29 edu.stanford.smi.protege.plugin.PluginUtilities  
> findPluginsDirectory
> WARNING: Application directory not specified
> 4 mai 2008 19:18:30 edu.stanford.smi.protege.resource.BundleHelper  
> <init>
> WARNING: missing bundle: protege_text
> JessTab: Note that the PAL engine is not currently installed in  
> Protege.
> (The JessTab PAL-integration functions are not available.)
> 4 mai 2008 19:18:31 edu.stanford.smi.protege.util.URIUtilities  
> createURIFromFileString
> SEVERE: java.security.AccessControlException: access denied  
> (java.util.PropertyPermission user.dir read)
>                at  
> java.security.AccessControlContext.checkPermission(Unknown Source)
>                at  
> java.security.AccessController.checkPermission(Unknown Source)
>                at java.lang.SecurityManager.checkPermission(Unknown  
> Source)
>                at  
> java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
>                at java.lang.System.getProperty(Unknown Source)
>                at java.io.Win32FileSystem.getUserPath(Unknown Source)
>                at java.io.Win32FileSystem.resolve(Unknown Source)
>                at java.io.File.getAbsolutePath(Unknown Source)
>                at java.io.File.getAbsoluteFile(Unknown Source)
>                at java.io.File.toURI(Unknown Source)
>                at  
> edu
> .stanford
> .smi.protege.util.URIUtilities.createURIFromFileString(Unknown Source)
>                at  
> edu.stanford.smi.protege.util.URIUtilities.createURI(Unknown Source)
>                at  
> edu.stanford.smi.protege.model.Project.<init>(Unknown Source)
>                at  
> JessTab.ProtegeLoadProject.call(JessTabFunctions.java:2985)
>                at jess.ab.a(Unknown Source)
>                at jess.Funcall.execute(Unknown Source)
>                at jess.Jesp.a(Unknown Source)
>                at jess.Jesp.parseExpression(Unknown Source)
>                at jess.Jesp.promptAndParseOneExpression(Unknown  
> Source)
>                at jess.Jesp.parse(Unknown Source)
>                at jess.Rete.eval(Unknown Source)
>                at jess.Rete.executeCommand(Unknown Source)
>                at app.init(app.java:31)
>                at sun.applet.AppletPanel.run(Unknown Source)
>                at java.lang.Thread.run(Unknown Source)
>
> Jess reported an error in routine mapclass
>                while executing (mapclass person).
>  Message: Protege class not found: person.
>  Program text: ( mapclass person )  at line 4.
>                at  
> JessTab.JessTabFunctions.valueToCls(JessTabFunctions.java:543)
>                at JessTab.ProtegeMapClass.call(JessTabFunctions.java:
> 1523)
>                at jess.ab.a(Unknown Source)
>                at jess.Funcall.execute(Unknown Source)
>                at jess.Jesp.a(Unknown Source)
>                at jess.Jesp.parseExpression(Unknown Source)
>                at jess.Jesp.promptAndParseOneExpression(Unknown  
> Source)
>                at jess.Jesp.parse(Unknown Source)
>                at jess.Batch.batch(Unknown Source)
>                at jess.Batch.batch(Unknown Source)
>                at jess.Batch.batch(Unknown Source)
>                at jess.Rete.batch(Unknown Source)
>                at app.init(app.java:32)
>                at sun.applet.AppletPanel.run(Unknown Source)
>                at java.lang.Thread.run(Unknown Source)
> JGoodies Looks: Can't read the System property ClearLook.mode.
> JGoodies Looks: Can't read the System property ClearLook.policy.
>
> thank you in advance
>
> Ernest Friedman-Hill wrote:
>>
>>
>> On May 4, 2008, at 11:27 AM, Daniella Touvet wrote:
>>
>>> 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
>>
>>
>> Well, presumably the "does not work" takes the form of an exception,
>> and so your browser's "Java Console" should be showing some kind of a
>> stack trace. That will tell you (or us) where things are going wrong.
>> The stack trace should make it clear to you; perhaps there are more
>> jar files you need to include, so you'll see ClassNotFoundExceptions.
>> If you can't tell from the stack trace, though, then most likely
>> someone here would be able to, so please paste that into a message  
>> and
>> send it along.
>>
>>
>>
>> ---------------------------------------------------------
>> Ernest Friedman-Hill
>> Informatics & Decision Sciences          Phone: (925) 294-2154
>> Sandia National Labs                FAX:   (925) 294-2234
>> PO Box 969, MS 9012                 ejfried@...
>> Livermore, CA 94550                 http://www.jessrules.com
>>
>>
>>
>>
>> --------------------------------------------------------------------
>> To unsubscribe, send the words 'unsubscribe jess-users you@...
>> '
>> in the BODY of a message to majordomo@..., NOT to the list
>> (use your own address!) List problems? Notify owner-jess-users@...
>> .
>> --------------------------------------------------------------------
>>
>>
>>
> Quoted from:
> http://www.nabble.com/JESS%2CProtege%2CApplet-%3A-Help-me-please-tp17047693p17047955.html
>
>

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------