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] reading owl in java application

Cedric Peeters cedric.peeters at fundp.ac.be
Mon Feb 16 04:37:33 PST 2009


Hello,

To read an ontology in a Java application with Jena, you can do this:

OntModel ontologyModel =  
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
ontologyModel.read(owlBaseFile, "RDF/XML-ABBREV"); //where owlBaseFile  
is a string containing the path to your pizza.owl file

The you can interact with your ontology. For instance you can get a  
class like this:

OntClass pizzaClass =  
ontologyModel.getOntClass(nameSpace+className);//where namespace is  
the namespace of your ontology (for instance  
http://www.semanticweb.org/2009/1/pizza.owl# (do not forget the #  
after the soruce)" and the className is a string containing the name  
of the class you want (for instance "Pizza").

When you have finish with your ontology, you can close it:
ontologyModel.close();

You can learn more here:
http://jena.sourceforge.net/tutorial/RDF_API/index.html
and here is a small tutorial : http://kill.devc.at/node/84

Hope it helps;

Cedric


Quratulain Rajput <quratulain.rajput at gmail.com> a écrit :

>  I have to read owl file in my java application. I am trying to read
>   pizza.owl a popular example comes along with protege. I do'nt know how
>   to do it.
>   please tell me any tutorial, if available. I am working with eclipse
>   and created RDF using Jena.
>   Now I have to read OWL file. Please give me any sample code.
>   waiting of your response.
>   Quratulain
> _______________________________________________
> 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