rye045
rye045

Reputation: 93

Apache Jena exception when reading a model from a file (only on mac?)

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

Upvotes: 0

Views: 183

Answers (1)

Henriette Harmse
Henriette Harmse

Reputation: 4762

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.

Upvotes: 1

Related Questions