Repository navigation
Backport fix for #1080 to 5.1.1 + unit tests - #1178
Closed
Artemis-IA wants to merge 2 commits into
Closed
Artemis-IA wants to merge 2 commits into
Artemis-IA wants to merge 2 commits into
Conversation
This fix adds a condition to check whether the parsed IRIs are used as subject for the owl#imports. This fixes owlcs#1080 for owl api version 5.
This was referenced Sep 2, 2026
Author
|
Closing this PR. We need to run more comprehensive tests across all OSO ontology versions before submitting. Will reopen once validation is complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
b1768cdf(Oct 2025) on theversion5branch, but no Maven release has been published since thenowlapi-parent-5.1.1and adds unit testsProblem
When an ontology document declares
owl:importsAND has an annotation whoserdf:resourcevalue equals the ontology's own IRI (a self-referencing annotation such asrdfs:isDefinedBy), OWL API incorrectly assigns an imported ontology's IRI as the main ontology IRI.This affects:
xml:baseSelf-referencing annotations like
rdfs:isDefinedBy → <ontology-itself>are valid and standard semantic web practice. The bug is in the RDF/XML parser, not in the ontology.Root Cause
In
OWLRDFConsumer.chooseAndSetOntologyIRI(), candidate IRIs are removed if they appear as the object of an annotation assertion. However, the subject ofowl:imports(i.e., the importing ontology itself) should never be removed from candidates, even if it also appears as an annotation object.Fix
Two files modified (same as the original commit
b1768cdf):OWLRDFConsumer.java: Track IRIs used as subject ofowl:importsin a newontologySubImportIRIsset. InchooseAndSetOntologyIRI(), don't remove a candidate IRI if it's in this set.TripleHandlers.java: Callconsumer.addOntology(s, true)when handlingowl:importstriples to mark the subject as an import subject.Tests
Added
SelfReferenceAnnotationImportsTestCase.javawith 6 tests:testSelfReferenceWithImportstestMultipleSelfReferencesWithImportstestImportsWithoutSelfReferencetestSelfReferenceWithoutImportstestAnnotationWithDifferentIRItestSelfReferenceAsLiteralThe first two tests fail without the fix and pass with it. The other four are regression tests.
Motivation
OWL API 5.1.1 is still widely used (e.g., WebVOWL/OWL2VOWL pins this version). A Maven release (5.1.2) containing this fix would allow downstream projects to upgrade without API changes.
Test plan
https://w3id.org/earthsemantics/OSOinstead ofhttp://www.w3.org/ns/prov-o