I'm trying to create a new ontology and after some actions save it. It's been created well and I have no problem in dealing with classes and other things but when I try to save it to a local file gives me an error! My code is:
//create a new ontology
SOURCE = "http://www.w3.org/2002/07/owl#";
NS = SOURCE + "#";
ontology = ModelFactory.createOntologyModel();
ontology.read( SOURCE, "RDF/XML" );
///////some actions
//save the ontology
try {
File file= new File("Log.owl");
ontology.write(new FileOutputStream(file));
}
catch (IOException e) {
e.printStackTrace();
}
And the error is:
Exception in thread "main" com.hp.hpl.jena.shared.BadURIException: Only well-formed absolute URIrefs can be included in RDF/XML output: <d> Code: 57/REQUIRED_COMPONENT_MISSING in SCHEME: A component that is required by the scheme is missing.
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.checkURI(BaseXMLWriter.java:829)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.xmlnsDecl(BaseXMLWriter.java:348)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFHeader(Basic.java:56)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeBody(Basic.java:39)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.writeXMLBody(BaseXMLWriter.java:500)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:472)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:458)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.write(ModelCom.java:271)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.write(OntModelImpl.java:2552)
I know that the format of "http://www.w3.org/2002/07/owl#" is TURTLE but I'd like to have the ontology in RDF/XML and I don't know what to write instead of that link.I tried different links but each time it gave me another error. Should SOURCE be a real link?
Thaks for any reply !