fix(owlgen): warn on single-child covering axiom equivalence#5
Open
fix(owlgen): warn on single-child covering axiom equivalence#5
Conversation
ece07d8 to
c2b7088
Compare
13beee4 to
8841b3d
Compare
Emit warnings for abstract class covering axiom edge cases: - Zero children: warn that no covering axiom will be generated - One child: warn that the covering axiom degenerates to an equivalence (Parent = Child), recommending --skip-abstract-class-as-unionof-subclasses Both axioms are still emitted when applicable (semantically correct per OWL 2), but warnings alert users who extend the ontology downstream. Tests verify warnings are logged, flag suppression works, and the single-child covering axiom triple is correctly asserted. Refs: linkml#3309, linkml#3219 Signed-off-by: jdsika <carlo.van-driesten@bmw.de>
8841b3d to
2b9e4e9
Compare
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
Emit a warning when an abstract class has only one direct
is_achild, since the covering axiom degenerates to an equivalence (Parent ≡ Child). The warning recommends--skip-abstract-class-as-unionof-subclassesto suppress covering axioms if the equivalence is undesired.Motivation
The covering axiom feature (linkml#3219) correctly expresses that every instance of an abstract class must belong to one of its subclasses. With a single child, this is semantically equivalent to
Parent ≡ Childper OWL 2 Primer §4.2. While OWL-correct, this may surprise users building extensible ontologies where more children are added downstream — the equivalence causes new siblings to inherit constraints from the first child via RDFS transitivity.Rather than silently skipping the axiom (which would change the OWL semantics), a warning alerts users to the implication and points them to the existing escape hatch.
Changes
owlgen.py: Addlogger.warning()when an abstract class has exactly 1 child before the covering axiom is emitted. Update field docstring and CLI help text to document the warning.test_owlgen.py: Addtest_abstract_class_with_single_child_emits_warning(validates warning is logged with flag recommendation) andtest_single_child_warning_suppressed_by_skip_flag(validates no warning when skip flag is set).Design Decision
Per review feedback from @mgskjaeveland (linkml#3309): the single-child equivalence is not a generator error — it is the expected OWL semantics. The proper response is a warning, not a silent skip. Users who need to avoid the equivalence should use
--skip-abstract-class-as-unionof-subclasses.References
rdfs:subClassOf=owl:equivalentClassDisjointUnionas proper covering construct