Setting the name of an OWLOntology

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

Setting the name of an OWLOntology

Daniel Elenius
I am trying to programmatically create a new JenaOWLModel, and I need to
set its ontology URI. How do I do it?

I looked at the source code for OntologyURIWidget, and it seems like it
just calls rename() on the OWLOntology. If I do this, the uri is not
changed until I save and reload the ontology.

Of course, the reason I have to do this in the first place is because
the JenaOWLModel is created using ProtegeOWL.createJenaOWLModel(), which
(strangely) doesn't take a name as a parameter. It just creates an
ontology with the default randomized uri.

Is there any way to avoid the reloading?

Daniel
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Reply | Threaded
Open this post in threaded view
|

Re: Setting the name of an OWLOntology

Timothy Redmond

You can use the NewOwlProjectCreator.  It is part of a family of such  
classes (see the AbstractOwlProjectCreator class hierarchy).  The code  
would look something like this

     Collection errors = new ArrayList();
     NewOwlProjectCreator creator = new NewOwlProjectCreator();
     creator.setOntologyName(uri);
     creator.create(errors);
     OWLModel model = creator.getOwlModel();

It is also possible to change the name of an ontology.  It is also  
possible to change the name of an ontology but you will need to make  
an additional call to

     owlModel.resetOntologyCache().

-Timothy



On Nov 19, 2008, at 2:23 PM, Daniel Elenius wrote:

> I am trying to programmatically create a new JenaOWLModel, and I  
> need to
> set its ontology URI. How do I do it?
>
> I looked at the source code for OntologyURIWidget, and it seems like  
> it
> just calls rename() on the OWLOntology. If I do this, the uri is not
> changed until I save and reload the ontology.
>
> Of course, the reason I have to do this in the first place is because
> the JenaOWLModel is created using ProtegeOWL.createJenaOWLModel(),  
> which
> (strangely) doesn't take a name as a parameter. It just creates an
> ontology with the default randomized uri.
>
> Is there any way to avoid the reloading?
>
> Daniel
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

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

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03