0

I am trying to read an RDF/XML model from an .owl file using Apache Jena, but an exception I don't understand is being thrown. For some reason, the exception is occurring on my associate's mac computer, but the model reads fine with no exceptions on my windows computer. I'm wondering if it has something to do with the firewall on the mac? Here is the code snippet:

File selected_file = fc.getSelectedFile(); // fc is a swing JFileChooser
if(selected_file.exists()) {
    OntModel model = ModelFactory.createOntologyModel(modelSpec);
    OntDocumentManager model_dm = model.getDocumentManager();                               
    model_dm.addAltEntry("http://infoneer.txstate.edu/ontology/MSDL.owl",
        "file:information/MSDL.owl");
    model.read(selected_file.getAbsolutePath(), "RDF/XML");

    ...
}

The error message is shown in the screenshot below. Note that "Window.java:1911" refers to the "model.read(sel..." line in the above code.

enter image description here

Here are the contents of the "selected_file" in question: https://pastebin.com/raw/fvV96d6L

rye045
  • 93
  • 9

1 Answers1

1

The problem is likely with the absolute path. You can pinpoint the error by calling directly

IRI iri = IRIResolver.resolve(selected_file.getAbsolutePath(), null);

which should list all violations encountered while resolving the IRI.

Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • Another place to look is the "file:" -- use the full path for the "file:" URI. "file:///fullpathname". – AndyS Apr 07 '18 at 13:28