Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] How to Open an ontology using my plugin

Tania Tudorache tudorache at stanford.edu
Wed Mar 18 14:08:32 PDT 2009


OK, before I give you a solution, I must emphasize that this is not the 
way Protege plugins are supposed to work. So, this setup is stretching 
the protege plugin infrastructure and there are hacks to make it work, 
but this is definitely not the way protege plugins are intended to work.

You must also understand, that a plugin is not meant to reload the 
underlying owl model that Protege has loaded through "official" ways. In 
this solution, you will reload the owl model of Protege, by first 
closing the existing project (which is probably empty anyway), and then 
reloading the new owl file. When this happens, your existing tab plugin 
instance will be destroyed, so all state you had in it will not be 
available anymore.

Below are the calls you need to make:

ProjectManager.getProjectManager().closeCurrentProject();
ProjectManager.getProjectManager().loadProject(URIUtilities.createURI("file:/tmp/pizza.pprj"));    


Make sure that the URi you specify is to a pprj file, not OWL file. You 
can create an empty pprj file that will point to the owl file name that 
you want to open. Even if the owl file changes, the pprj file should 
still work for most cases.

Tania


Waqas Ahmed wrote:
> let me be more specific. i have written a plugin (i didnt wanted to 
> write it as a plugin but for some reasons now i have to) that connects 
> to a database server and transforms a relational database into an owl 
> file. i have used jena api at back end for all transformations. now 
> once ontology is generated, i can check to see if there is change in 
> database, addition of deletion of new tables. if there is a change, 
> that change is made in the owl file we generated in step1. now i have 
> to implement it as a tabwidget. every thing is working fine but when i 
> generate an owl file (using jena, not protege apis) i only have to 
> open this file file in same protege instance on click of a button in 
> my plugin. hope you understand. ... it does not matter if existing 
> ontology drops off.
>
> On Thu, Mar 19, 2009 at 1:15 AM, Tania Tudorache 
> <tudorache at stanford.edu <mailto:tudorache at stanford.edu>> wrote:
>
>     OK, so when you start protege programmatically, you must load an OWL
>     file. What does your plugin do with that initial OWL file? Does it
>     just
>     drop it?
>
>     If so, then you should generate the OWL content in that initial
>     OWL file
>     that you opened. To get the owl model in your plugin, you can call:
>
>     OWLModel owlModel = (OWLModel)getKnowledgeBase();
>
>     Then, you add all the content in this owlModel.
>
>     If you are using this approach, then whatever changes you do to this
>     ontology, it will be automatically reflected in the UI.
>
>     Tania
>
>
>     Waqas Ahmed wrote:
>     > actually i am making changes to an owl file, or suppose my plugin
>     > generates an OWL file. now i want to open that OWL file in protege
>     > automatically. i dont want to click on File and open menu
>     buttons. but
>     > want to open it in same instance of protege. any help???
>     >
>     > On Thu, Mar 19, 2009 at 12:02 AM, Tania Tudorache
>     > <tudorache at stanford.edu <mailto:tudorache at stanford.edu>
>     <mailto:tudorache at stanford.edu <mailto:tudorache at stanford.edu>>>
>     wrote:
>     >
>     >     The model that you have seems quite complicated, and it is
>     not clear
>     >     that this is the best way of doing it.
>     >
>     >     If you load an ontology in Protege, and modify it in your
>     plugin, then
>     >     the changes will be automatically shown in all the Protege UI,
>     >     including
>     >     the class hierarchy.
>     >
>     >     You can find more information about the Protege-OWL API on
>     this page:
>     >
>     >     http://protege.stanford.edu/plugins/owl/api/guide.html
>     >
>     >     Tania
>     >
>     >
>     >     Waqas Ahmed wrote:
>     >     >
>     >     > Hi all, i have written an plugin that makes some changes
>     to an owl
>     >     > file and saves these changes back to that file. now i want
>     to open
>     >     > that same onlogy file and display class hierarchy in
>     classes tab. i
>     >     > want to open that file from my plugin means whenever there
>     is a
>     >     change
>     >     > after saving file the class hierarchy automatically get
>     updated.
>     >     > please tell me how can i do this? what call i should make
>     to load an
>     >     > ontology ?
>     >     >
>     >     > --
>     >     > Regards
>     >     > Waqas Ahmed
>     >     >
>     >    
>     ------------------------------------------------------------------------
>     >     >
>     >     > _______________________________________________
>     >     > protege-owl mailing list
>     >     > protege-owl at lists.stanford.edu
>     <mailto:protege-owl at lists.stanford.edu>
>     >     <mailto:protege-owl at lists.stanford.edu
>     <mailto:protege-owl at lists.stanford.edu>>
>     >     > https://mailman.stanford.edu/mailman/listinfo/protege-owl
>     >     >
>     >     > Instructions for unsubscribing:
>     >     http://protege.stanford.edu/doc/faq.html#01a.03
>     >     >
>     >
>     >     _______________________________________________
>     >     protege-owl mailing list
>     >     protege-owl at lists.stanford.edu
>     <mailto:protege-owl at lists.stanford.edu>
>     <mailto:protege-owl at lists.stanford.edu
>     <mailto:protege-owl at lists.stanford.edu>>
>     >     https://mailman.stanford.edu/mailman/listinfo/protege-owl
>     >
>     >     Instructions for unsubscribing:
>     >     http://protege.stanford.edu/doc/faq.html#01a.03
>     >
>     >
>     >
>     >
>     > --
>     > Regards
>     > Waqas Ahmed
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > protege-owl mailing list
>     > protege-owl at lists.stanford.edu
>     <mailto:protege-owl at lists.stanford.edu>
>     > https://mailman.stanford.edu/mailman/listinfo/protege-owl
>     >
>     > Instructions for unsubscribing:
>     http://protege.stanford.edu/doc/faq.html#01a.03
>     >
>
>     _______________________________________________
>     protege-owl mailing list
>     protege-owl at lists.stanford.edu <mailto:protege-owl at lists.stanford.edu>
>     https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
>     Instructions for unsubscribing:
>     http://protege.stanford.edu/doc/faq.html#01a.03
>
>
>
>
> -- 
> Regards
> Waqas Ahmed
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>   




More information about the protege-owl mailing list