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-discussion] Import customized instance forms with ontology import

Jonathan Carter jonathan.carter at e-asolutions.com
Wed Sep 30 02:59:00 PDT 2009


Hi,

Following up on a post back to Girish I've uploaded the Python script  
that I've been using to manage this sort of situation.
As a little background, I've been using a script-based approach for  
importing instances and making repeatable updates to the class  
structure for some time. This has been very useful for bringing in  
instances from non-Protege sources.

Again, for repeatability, I've used a script-based approach for  
'importing' form layouts and another, more complex script for  
importing a whole class configuration including slot widget setup and  
form layout.

I've included some instructions on how to use these scripts but to  
give you an idea of how they work, it is based on a two-step process.

1) Discover the configuration of the source class and write a Python  
script to replicate it in any target Protege project.
2) Execute the generated script fragments to a target Protege project  
to import the class and it's form configuration.

To do the discovery, you call key functions in the script for each  
Class in the source project/ontology that you wish to import.
There is an all-in-one function, FindClassDetails() that will discover  
and generate everything about the class and will generate script to  
create the class, all its slots, the slot widget configuration and the  
form layout. However, for this thread, I think this is beyond what you  
need.

So, if you just need the layout of the form, use the function:  
FindFormLayout(), e.g.

 >> FindFormLayout("MyNewClassName")

If you want the slot widget setup (tooltips, slot widgets to use  
etc.), use the function: CreateClassFormDefinition(), e.g.:

 >> CreateClassFormDefinition("MyNewClassName")

and if you want both, call both functions:

 >> CreateClassFormDefinition("MyNewClassName")
 >> FindFormLayout("MyNewClassName")

These will generate a bunch of Python script statements for the  
specified class, e.g. MyNewClassName. Copy this script code
into a new file. You can call the functions, copy the class fragments  
into file, for as many classes as you like. However, make sure
to keep your overall script file below 64KB (there's a constraint in  
the Bean Scripting Framework).

Once you've got the fragments for all the classes that you need, save  
your script and execute it in the Script tab on your TARGET
Protege project/ontology and the classes, forms etc. will be imported  
into your target project. Existing classes will be updated, not over- 
written.

A couple of things to take note of:
Before applying the import, save your target Protege project. If  
something goes wrong, just exit Protege without saving and you will  
not lose your work!
I've only recently finished this script and although it builds on  
scripts that I've been using for a year or so, I haven't had the  
chance to extensively test it. Please let me know if you have any  
problems.

You can download the script files here:
http://www.enterprise-architecture.org/community/share-extensions/essential-tools/Generate-Class-Construction/

Hope this helps

Regards

Jonathan


_______________________________________

Jonathan Carter - Head of Technical Architecture
Enterprise Architecture Solutions Ltd
_______________________________________


Proud sponsors of The Essential Project.
The free open-source Enterprise Architecture Management Platform
www.enterprise-architecture.org
_______________________________________

On 30 Sep 2009, at 07:24, Hanno Wunderlich wrote:

> Hi,
> I want to reactivate this thread since nobody has replied to the  
> question of Girish. I would also like to know how to separate the  
> forms from the project using a .form-file. I have build an ontology  
> in a protege-project (e.g A.pprj) as a template for all my protege- 
> projects (e.g B.pprj). To use the ontology of A.pprj in B.pprj  I  
> included the project via "manage included projects". But  
> unfortunately the forms defined in A are not used in B. If the forms- 
> information of A is stored in a separate forms-file, it would be  
> easier to include it in B.
>
> So i hope, that somebody could give me and Girish a hint how to  
> store the forms in a .forms file (btw. I'm using Protege 3.4).
>
> Regards
> Hanno
>
>
> On Fri, Sep 25, 2009 at 6:11 PM, Girish Joglekar  
> <gjogleka at purdue.edu> wrote:
> Creating a .forms file certainly looks promising. However, I could  
> find
> the "option" you refer to in the reply. Could you tell me how to  
> create
> a .forms file?
>
> Best,
>
> Girish Joglekar
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20090930/78b7ed57/attachment.html>


More information about the protege-discussion mailing list