Skip to content
Advertisement

Fix OWLOntologyStorageException

I’m developing a Java application using owl-api. For testing I want to use a TestDataProvider to provide test data for unit-testing.

I’m using version 5.0.0 because the tutorial I read is using this version too. I plan to update later.

JavaScript

But I run in following exception

JavaScript

at the last line of addOWLIndividualToOWLOntology()

JavaScript

I already read that I have to retrieve an new OWLOntologyManager from the ontology everytime and changed my code accordingly but that didn’t do the trick. I hope you can give me a hint.

Advertisement

Answer

By default, an ontology is saved in the same place it was loaded from – in this case it was loaded from a remote IRI, and there’s currently no support for saving an ontology directly to a remote URL.

You can work around this by specifying a target for your saveOntology() call, e.g.,

JavaScript

a StringDocumentTarget writes the data to memory and you can check its contents, e.g., for testing purposes (same thing happens in the OWLAPI unit tests, for example).

Note that the methods shown in the tutorial are unlikely to have changed in the whole 5.x.x series, so you can probably move to the latest OWLAPI version right away without this affecting what you’re doing.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement