Extracting Owl file elements using java application eclipse.

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

Extracting Owl file elements using java application eclipse.

Gayathri
I am trying to extract the owl file elements. But i am getting the output
with object and data properties and then classes. But i want only classes to
display. I don't know how to achieve this. Following is my code
*OWLOntologyManager man = OWLManager.createOWLOntologyManager();
           IRI IOR = IRI.create("http://ipaddress/AlloyOnto/steels2.owl");
           OWLOntology o;
           StringDocumentTarget target = new StringDocumentTarget();
           try {
                   o=man.loadOntologyFromOntologyDocument(IOR);
                   o.axioms();
                   target = new StringDocumentTarget();
                          o.saveOntology(new FunctionalSyntaxDocumentFormat(), target);
                     } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
               }* I have written code to remove uri's and display the elements
alone.



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Extracting Owl file elements using java application eclipse.

Lorenz Buehmann

unclear what you're asking ...

some comments/questions:

1.) wrong mailing list, this is not the OWL API mailing list ...

2.) you're the same user, right: https://stackoverflow.com/questions/58746073/how-to-load-owl-file-from-server-achine?noredirect=1#comment103784678_58746073

3.) you want to output what how? Just the classes or the class axioms ( If so, which class axioms?)

4.) what is the intended output format? another OWL file? Then you need axioms, but again which axioms? Please be more specific: show the expected output data.


As I don't know what exactly you want, here the code to get just the subclass axioms of an ontology

o.axioms(AxiomType.SUBCLASS_OF)

which returns a stream of axioms which you have to further process or wrap into a new ontology which you could for example save to disk then.


All is shown in the Java doc: https://owlcs.github.io/owlapi/apidocs_5/org/semanticweb/owlapi/model/OWLOntology.html


If this is not what you were asking for, please explain what you really want.



On 07.11.19 13:08, Gayathri wrote:
I am trying to extract the owl file elements. But i am getting the output
with object and data properties and then classes. But i want only classes to
display. I don't know how to achieve this. Following is my code
*OWLOntologyManager man = OWLManager.createOWLOntologyManager();
	   IRI IOR = IRI.create("http://ipaddress/AlloyOnto/steels2.owl");
	   OWLOntology o;
	   StringDocumentTarget target = new StringDocumentTarget();
	   try {
		   o=man.loadOntologyFromOntologyDocument(IOR);
		   o.axioms();
		   target = new StringDocumentTarget();
			  o.saveOntology(new FunctionalSyntaxDocumentFormat(), target);
	             } catch (Exception e) {
	           // TODO Auto-generated catch block
	           e.printStackTrace();
	       }* I have written code to remove uri's and display the elements
alone.



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-Developer-f4659816.html
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev

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