1
votes

Jena cannot process OWL format files, so I used Protégé to create an ontology, saved it as RDF/XML, but the file ended with .owl. The following code will read the ontology using owl-full language.

OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
model.read(fileInputStream, null); // sometimes it could be read(fileInputStream, "RDF/XML")

Shouldn't I use RDFS somewhere?

1
Have you tried it? (the extension does not matter is you also tell the system the synatx - RDF/XML).AndyS
it can work. what I want to figure out is I saved the ontology in the format of RDF/XML but appeared ending with .owl and was processed as owl in JENA? or it doesn't matter what kind the format is Jena can parse both of them, and some other format like trig or n3 or elseSarotti

1 Answers

2
votes

Protege is meant to work mostly with OWL, that's why you have a .owl extension to the file. Nonethless, if you saved it as "RDF/XML" in Protege, it generates a valid RDF document that you should then be able to open with tools capable of processing plain RDF (like Jena). A small hack is to replace the .owl by a .rdf extension.

What I suggest for you to understand your issue:

  • Open your .owl file with a text editor. You should see some RDF/XML inside.

  • Validate the content of the file in order for you to see that the content is really serialised in really RDF. You can for instance use an online tool like http://www.w3.org/RDF/Validator/ to do that.

  • If you don't like the RDF/XML format, you can convert it into turtle, with a tool such as http://www.rdfabout.com/demo/validator/ for instance (I think Jena provides some methods to do that too).

  • Save the triples in a file with the .rdf extension, it should be readable by RDF tools now.