protegeproject / protege-distribution

Build files for the protege distribution that includes 3rd party plugins
BSD 2-Clause "Simplified" License
125 stars 39 forks source link

Protege 5.6.3 writes but cannot read an empty Manchester ontology #52

Open dlutz2 opened 6 months ago

dlutz2 commented 6 months ago

Saving a empty ontology (no axioms, ontology-level annotations or imports) in Manchester format produces what appears to be a valid (?) Manchester ontology file, consisting of a set of prefixes and a single statement of the form Ontology: <IRI> When attempting to read this back, Protege throws: java.net.URISyntaxException: Illegal character in path at index 72: http://www.semanticweb.org/zzz/ontologies/2024/4/untitled-ontology-66/|EOF| and nothing is read in. The exception originates in OntologyIRIShortFormProvider:

at java.base/java.net.URI.create(URI.java:883) ~[na:na]
    at org.semanticweb.owlapi.model.IRI.toURI(IRI.java:60) ~[na:na]
    at org.semanticweb.owlapi.util.OntologyIRIShortFormProvider.getShortForm(OntologyIRIShortFormProvider.java:87) ~[na:na]
    at org.protege.editor.owl.ui.renderer.OWLObjectRendererImpl.renderOntology(OWLObjectRendererImpl.java:79) ~[na:na]
       ...

but is presumably caused by the Manchester parser passing a malformed IRI. Similarly, a Manchester ontology containing only an import statement, produces:

java.lang.NullPointerException: null
    at java.base/java.util.concurrent.ConcurrentHashMap.containsValue(ConcurrentHashMap.java:979) ~[na:na]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.contains(OWLOntologyManagerImpl.java:311) ~[na:na]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.getOntologyDocumentIRI(OWLOntologyManagerImpl.java:1426) ~[na:na]
    at org.protege.editor.owl.model.OWLModelManagerImpl.getOntologyPhysicalURI(OWLModelManagerImpl.java:423) ~[na:na]
    at org.protege.editor.owl.model.idrange.ActiveOntologyIdRangesPolicyManager.reload(ActiveOntologyIdRangesPolicyManager.java:64) ~[na:na]
...

An ontology containing just an ontology-level annotation works as expected.

Admittedly not a main stream issue. It occurred during a test of a pipeline that creates Manchester content offline which might include empty ontologies.