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] Import ontologies and Visibility

Carmen Martinez carmenmtezcruz at yahoo.es
Fri Jan 4 11:42:46 PST 2008


With regard to the Second problem I exposed in my last mail,

The solutions you proposed to the problem neither work . I resume the problem following:

My code was
(My tableClass is a metaclass, is subclass of owl:Class)
 OWLNamedClass tableClass = owlModel.getOWLNamedClass("Table");
 OWLIndividual individual =  tableClass.createOWLIndividual("Table1");
I wanted that Table1 where an Instance and a Class at the same time programatically (because it works fine in the enviroment).

The first solution you proposed:

1. You add owl:Thing as an explicit superclass, by calling:

    individual.addSuperclass(owlModel.getOWLThingClass())

It is not correct, because I can only do that with a OWLClass, not with OWLIndividual, so I have to do 
tableClass.addSuperclass(owlModel.getOWLThingClass());
OWLIndividual individual = tableClass.createOWLIndividual("Tabla1");

but it is erroneous because, I can not modify any of the classes Imported.

Your second solution:

2. Or better, create a class and then add as rdf:type the metaclass:

OWLClass table1 = owlModel.createOWLNamedClass("Table1");
table1.setRDFType(tableClass);

Works better (even perfect!), until I visualice my imported ontology (you  know, using the *Display Hidden Frames* checkbox). When I do that, my tab dissapear (the red icon appear) and in the command prompt screen appears the following error: 
WARNING: java.lang.IllegalArgumentException:Table1 not unique:DefaultOWLNamedClass(Table1,FrameID(7:12265 1)) at edu.stanford.smi.protege.model.framestore.SimpleFrameStore.UniqueName(Unknown Source) 
at edu.stanford.smi.protege.model.framestore.SimpleFrameStore.addCls(Unknown Source)
edu.stanford.smi.protege.model.framestore.SimpleFrameStore.createCls(Unknown Source) ....

Do you know why it doesn't work?

Thanks again.

Carmen.

Tania Tudorache <tudorache at stanford.edu> escribió: Hi Carmen,

Carmen Martinez wrote:
> Hello!,
>
> I have imported an ontology programmatically when I load my new tab 
> plugin. And it works!, because I see the ontology in the metadata tab, 
> but, I do not see the classes in the classes explorer. I only see them 
> when I check the *Display Hidden Frames* checkbox. Then I can uncheck 
> the same checkbox, but my imported ontology is still there (in grey). 
> I have used the function 
> owlModel.getProject().setDisplayHiddenClasses(true) in order to do the 
> same; but it doesn't work, because it doesn't refresh the explorer. 
> Only when I uncheck the checkbox the window is refreshed.
>
> My question is; how can I put visible my imported ontology (in grey is 
> perfect) without doing this check/uncheck action? Is there any 
> function that let me refresh the classes explorer?.
>

After you do the import, call the method:

ProjectManager.getProjectManager().reloadUI(true)

which will reload the whole UI and you will see the imported classes.

> And the last question is related to this problem because: My imported 
> ontology is read only because  I have imported using a real URI. Using 
> Protege I can instantiate my imported ontology, and save the instances 
> very well, but, programmatically, I can not instantiate the classes in 
> the same way. For example, when I do:
>           (My tableClass is a metaclass, is subclass of owl:Class)
>          OWLNamedClass tableClass = owlModel.getOWLNamedClass("Table");
>          OWLIndividual individual = 
> tableClass.createOWLIndividual("Table1");
>  As you know, Table1 must be a class too, because, is an instance of a 
> metaclass. But, when I execute these instructions, Table1, is created 
> (I can not see it due to the previous problem I have commented), but 
> not as a class!!. When I make visible the imported ontology, I can see 
> this instance, but only as an instance!!. However, it works perfect, 
> if I do it manually. Can anyone explain that?
> Isn´t protege interpreting the Table1 instance as  a class?

It is a class, and probably you see it in the Individuals Tab with the 
class icon, not with the individuals icon. What happenend, is that 
Table1 was created as a class, but it does not have owl:Thing as its 
superclass. There are two possible solutions:

1. You add owl:Thing as an explicit superclass, by calling:

    individual.addSuperclass(owlModel.getOWLThingClass())

2. Or better, create a class and then add as rdf:type the metaclass:

OWLClass table1 = owlModel.createOWLNamedClass("Table1");
table1.setRDFType(tableClass);

I recommend solution 2.

Tania

>
> Thanks a lot,
>
> Carmen.
>
> ------------------------------------------------------------------------
>
> ¿Chef por primera vez? - Sé un mejor Cocinillas.
> Entra en Yahoo! Respuestas 
> .
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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 
>   

_______________________________________________
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 


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

Web Revelación Yahoo! 2007:
 Premio Favorita del Público - ¡Vota tu preferida!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20080104/94da661b/attachment.html>


More information about the protege-owl mailing list