tags:

views:

144

answers:

2

Hello, I have a problem reading OWL/XML files from Java using Jena.

I have no problem reading RDF/XML files, but whenever I create a OWL/XML file from Protege and try to read it, Java gives this error below : WARN [main] (RDFDefaultErrorHandler.java:36) Exception in thread "main" java.lang.NullPointerException at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.endElement(XMLHandler.java:143)

The code that I use to retrieve RDF/XML is below :

OntModel ontModel = ModelFactory.createOntologyModel();
InputStream in = FileManager.get().open(inputFileName);
    if (in == null) {
        throw new IllegalArgumentException( "File: " + inputFileName + " not found");
    }
    ontModel.read(in, "");

This code works with RDF/XML perfectly. However, I cannot read an OWL/XML. I looked at Internet and I couldn't find anything. I would really appreciate, if someone shows me a way. Many thanks

+1  A: 

Jena does not support OWL/XML. It ships with readers for RDF/XML, Turtle (a.k.a. N3) and N-Triples. See for example here for the list of supported formats.

cygri
What should I use to read OWL/XML files ? Is there a library like Jena to read this kind of files ? Or, is it meaningful to convert OWL/XML to RDF/XML ?
Mikae Combarado
Just use RDF/XML. I'm pretty sure that it can express everything that OWL/XML can express.
cygri
+2  A: 

For OWL/XML use the OWL-API.

Kaarel
Yes, I have used OWL-API and it works perfectly. Thanks for your precious advices, Kaarel and cygi.
Mikae Combarado