question about plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

question about plugin

Cui Tao
Hi, everyone,

I implemented a tool where I can read data from a database and represent it in Manchester OWL API representation. Basically what I did is I loaded the data directly from a database and then using the Manchester OWL API to generate an OWLOntology object. I know protege 4 uses Manchester OWL API as the backend. Now I want to add my tool as a plugin to Protege. So that through Protege, I can load an ontology from my database, browse it and editing it. Since everything is represent in the Manchester OWL API representation, I assume it should be straightforward. But I am not very familiar with Protege 4. Can any one give me any suggestion how to do it?

Thanks,

Cui

_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: question about plugin

Timothy Redmond

So there are two types of information that you might want.  First some  
general  information about building plugins.  Both [1] and [2] have  
some information about what is  involved in a Protege  plugin and how  
you can build one.  There is also some documentation about how to set  
up an development environment on the page [3].  We only have eclipse  
documentation at the moment but I think that it will  work for
other  development environments also.

To get Protege to display an ontology that you have created in the  
owlapi, this is pretty easy.   Protege 4 has an OWLModelManager class  
[4].   This class handles several aspects of managing ontologies in  
the Protege 4 setting.  The simplest way to let Protege know about an  
ontology that you are creating is to  use the owl manager to create  
the initial empty version of the ontology using the owll model manager:

           OWLOntology ontology =  
getOWLModelManager().createNewOntology(ontologyUri, ontologyUri);

The owl model manager will be available to most types of plugins.    
Then fill the owl ontology class with your existing code.

There is an early example showing how to get this all to work in a  
menu plugin in svn at the location [5].  It includes a  build file  
that works with the latest Protege 4 build (set the PROTEGE_HOME  
environment variable to the installation location and run "ant  
install").

-Timothy


[1] http://www.co-ode.org/downloads/protege-x/plugin-code-example.php
[2] http://protegewiki.stanford.edu/index.php/CompileProtege4PluginInEclipseOneProject
[3] http://protegewiki.stanford.edu/index.php/Protege4DevDocs
[4] http://smi-protege.stanford.edu/repos/protege/protege4/protege-standalone/trunk/plugins/org.protege.editor.owl/src/org/protege/editor/owl/model/OWLModelManager.java
[5] http://smi-protege.stanford.edu/repos/protege/protege4/examples/trunk/org.protege.owl.attach


On Aug 5, 2008, at 9:32 AM, Cui Tao wrote:

> Hi, everyone,
>
> I implemented a tool where I can read data from a database and  
> represent it in Manchester OWL API representation. Basically what I  
> did is I loaded the data directly from a database and then using the  
> Manchester OWL API to generate an OWLOntology object. I know protege  
> 4 uses Manchester OWL API as the backend. Now I want to add my tool  
> as a plugin to Protege. So that through Protege, I can load an  
> ontology from my database, browse it and editing it. Since  
> everything is represent in the Manchester OWL API representation, I  
> assume it should be straightforward. But I am not very familiar with  
> Protege 4. Can any one give me any suggestion how to do it?
>
> Thanks,
>
> Cui
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback

_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: question about plugin

Cui Tao
In reply to this post by Cui Tao
Hi, Timothy,
 
Thanks for you reply. Now I am trying to modify the OWLOntologyManager as you suggested and also modified the welcome screen to add my code there. But I always got java.lang.NoClassDefFoundError. I set the class path in the build.xml and I also set the java build path and included the needed jar files through Eclipse. I am able to build the file and get Protege runing. But after I clicked the part I modified, it gave me that error. Could you give me some advice how to fix that?
 
Thanks,
 
Cui

 




----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Aug 2008 22:14:23 -0700
From: Timothy Redmond <[hidden email]>
Subject: Re: [p4-feedback] question about plugin
To: "Submit feedback for Protege 4.0 alpha"
       <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


So there are two types of information that you might want.  First some
general  information about building plugins.  Both [1] and [2] have
some information about what is  involved in a Protege  plugin and how
you can build one.  There is also some documentation about how to set
up an development environment on the page [3].  We only have eclipse
documentation at the moment but I think that it will  work for
other  development environments also.

To get Protege to display an ontology that you have created in the
owlapi, this is pretty easy.   Protege 4 has an OWLModelManager class
[4].   This class handles several aspects of managing ontologies in
the Protege 4 setting.  The simplest way to let Protege know about an
ontology that you are creating is to  use the owl manager to create
the initial empty version of the ontology using the owll model manager:

          OWLOntology ontology =
getOWLModelManager().createNewOntology(ontologyUri, ontologyUri);

The owl model manager will be available to most types of plugins.
Then fill the owl ontology class with your existing code.

There is an early example showing how to get this all to work in a
menu plugin in svn at the location [5].  It includes a  build file
that works with the latest Protege 4 build (set the PROTEGE_HOME
environment variable to the installation location and run "ant
install").

-Timothy


[1] http://www.co-ode.org/downloads/protege-x/plugin-code-example.php
[2] http://protegewiki.stanford.edu/index.php/CompileProtege4PluginInEclipseOneProject
[3] http://protegewiki.stanford.edu/index.php/Protege4DevDocs
[4] http://smi-protege.stanford.edu/repos/protege/protege4/protege-standalone/trunk/plugins/org.protege.editor.owl/src/org/protege/editor/owl/model/OWLModelManager.java
[5] http://smi-protege.stanford.edu/repos/protege/protege4/examples/trunk/org.protege.owl.attach


On Aug 5, 2008, at 9:32 AM, Cui Tao wrote:

> Hi, everyone,
>
> I implemented a tool where I can read data from a database and
> represent it in Manchester OWL API representation. Basically what I
> did is I loaded the data directly from a database and then using the
> Manchester OWL API to generate an OWLOntology object. I know protege
> 4 uses Manchester OWL API as the backend. Now I want to add my tool
> as a plugin to Protege. So that through Protege, I can load an
> ontology from my database, browse it and editing it. Since
> everything is represent in the Manchester OWL API representation, I
> assume it should be straightforward. But I am not very familiar with
> Protege 4. Can any one give me any suggestion how to do it?
>
> Thanks,
>
> Cui
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback



------------------------------

_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback


End of p4-feedback Digest, Vol 23, Issue 7
******************************************


_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: question about plugin

Timothy Redmond

My first question is what class is not being found.  If you send me  
your MANIFEST.MF and the name  of the class that is not being found I  
can probably come pretty close to telling what is wrong.

The thing to understand is that OSGi (protege 4's runtime plugin  
model) controls the class loading and the visibility of loaded  
classes.  Much of the class loading is controlled through the  
manifest.  So for example the example [1] describes some of this  (but  
needs more detail).  The plugin for this example can be checked out  
from the svn location [2].  In that project the manifest lines

Require-Bundle: org.eclipse.equinox.registry,
  org.eclipse.equinox.common,
  org.protege.editor.core.application,
  org.protege.editor.owl,
  org.semanticweb.owl.owlapi

ensure that the owl api and most of the classes supplied by the main  
protege 4 plugins are available to your plugin.  The lines

Import-Package: org.osgi.framework,
  org.apache.log4j,
  org.apache.commons.lang,
  ...

also ensures that classes are loaded from the surrounding  
infrastructure.  In  particular the org.apache.log4j line ensures that  
the org.apache.log4j.Logger is found by the plugin.  Finally there may  
be classes that are loaded internally by the plugin described in [1].  
The  MANIFEST.MF line

    Bundle-ClassPath: .,lib/examplelib.jar

ensures that the classes  in examplelib.jar are loaded.

If this is a bit much to swallow  - send  me the MANIFEST and the name  
of the class that is not being found.


-Timothy

[1] http://protegewiki.stanford.edu/index.php/CompileProtege4PluginInEclipseOneProject
[2] http://smi-protege/repos/protege/protege4/examples/trunk/ 
org.protege.editor.owl.examples.tab
[3] http://smi-protege/repos/protege/protege4/examples/trunk/ 
org.protege.editor.owl.examples.tab/META-INF/MANIFEST.MF

On Aug 7, 2008, at 2:53 PM, Cui Tao wrote:

> Hi, Timothy,
>
> Thanks for you reply. Now I am trying to modify the  
> OWLOntologyManager as you suggested and also modified the welcome  
> screen to add my code there. But I always got  
> java.lang.NoClassDefFoundError. I set the class path in the  
> build.xml and I also set the java build path and included the needed  
> jar files through Eclipse. I am able to build the file and get  
> Protege runing. But after I clicked the part I modified, it gave me  
> that error. Could you give me some advice how to fix that?
>
> Thanks,
>
> Cui
>
>
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 5 Aug 2008 22:14:23 -0700
> From: Timothy Redmond <[hidden email]>
> Subject: Re: [p4-feedback] question about plugin
> To: "Submit feedback for Protege 4.0 alpha"
>        <[hidden email]>
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
> So there are two types of information that you might want.  First some
> general  information about building plugins.  Both [1] and [2] have
> some information about what is  involved in a Protege  plugin and how
> you can build one.  There is also some documentation about how to set
> up an development environment on the page [3].  We only have eclipse
> documentation at the moment but I think that it will  work for
> other  development environments also.
>
> To get Protege to display an ontology that you have created in the
> owlapi, this is pretty easy.   Protege 4 has an OWLModelManager class
> [4].   This class handles several aspects of managing ontologies in
> the Protege 4 setting.  The simplest way to let Protege know about an
> ontology that you are creating is to  use the owl manager to create
> the initial empty version of the ontology using the owll model  
> manager:
>
>           OWLOntology ontology =
> getOWLModelManager().createNewOntology(ontologyUri, ontologyUri);
>
> The owl model manager will be available to most types of plugins.
> Then fill the owl ontology class with your existing code.
>
> There is an early example showing how to get this all to work in a
> menu plugin in svn at the location [5].  It includes a  build file
> that works with the latest Protege 4 build (set the PROTEGE_HOME
> environment variable to the installation location and run "ant
> install").
>
> -Timothy
>
>
> [1] http://www.co-ode.org/downloads/protege-x/plugin-code-example.php
> [2] http://protegewiki.stanford.edu/index.php/CompileProtege4PluginInEclipseOneProject
> [3] http://protegewiki.stanford.edu/index.php/Protege4DevDocs
> [4] http://smi-protege.stanford.edu/repos/protege/protege4/protege-standalone/trunk/plugins/org.protege.editor.owl/src/org/protege/editor/owl/model/OWLModelManager.java
> [5] http://smi-protege.stanford.edu/repos/protege/protege4/examples/trunk/org.protege.owl.attach
>
>
> On Aug 5, 2008, at 9:32 AM, Cui Tao wrote:
>
> > Hi, everyone,
> >
> > I implemented a tool where I can read data from a database and
> > represent it in Manchester OWL API representation. Basically what I
> > did is I loaded the data directly from a database and then using the
> > Manchester OWL API to generate an OWLOntology object. I know protege
> > 4 uses Manchester OWL API as the backend. Now I want to add my tool
> > as a plugin to Protege. So that through Protege, I can load an
> > ontology from my database, browse it and editing it. Since
> > everything is represent in the Manchester OWL API representation, I
> > assume it should be straightforward. But I am not very familiar with
> > Protege 4. Can any one give me any suggestion how to do it?
> >
> > Thanks,
> >
> > Cui
> > _______________________________________________
> > p4-feedback mailing list
> > [hidden email]
> > https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>
>
>
> ------------------------------
>
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
>
>
> End of p4-feedback Digest, Vol 23, Issue 7
> ******************************************
>
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback

_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback