[Sorry to be slow to respond, missed this one.]
On Tue, 2011-10-11 at 16:37 -0400, Alison Callahan wrote:
> Hello all,
>
> I am using the Jena API version 2.6.4, in Ubuntu 11.04.
>
> I am trying to load an OWL ontology that imports other N3 files. Here
> is the method I have written to do this:
>
> public static OntModel loadModelWithImports(String file, String uri,
> String lang) {
> Model baseModel =
> ModelFactory.createDefaultModel(ReificationStyle.Minimal);
> InputStream input = FileManager.get().open(file);
> baseModel.read(input, uri, lang);
> return ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM,
> baseModel);
> }
>
> I call the method as follows:
>
> OntModel infModel =
> ModelLoader.loadModelWithImports("/home/ontologies/my_ontology.n3",
> null, "N3");
>
> When I try to use this method, however, I get errors such as the
> following, for each file imported in my_ontology.n3 :
[snip]
> This makes me think that Jena is expecting the imported files to be in
> RDF/XML format. Is there any way I can specify otherwise? I had
> thought that passing "N3" as the language when calling the
> loadModelWithImports() method would be all that was needed, but it
> seems not.
No, there's no reason an imported ontology will be in the same syntax as
the importing one. Typically one imports ontologies from across the web.
In your case you seem to be loading from:
http://localhost/tmp/import.n3
is that right?
Does whatever web server you have running on localhost respond with the
right Mime type?
In the worst case you might have to explicitly load the import yourself
and use OntDocumentModel.addModel to register it, but that shouldn't
normally be needed.
Dave