Skip to content

fix(owlgen): warn on single-child covering axiom equivalence#5

Open
jdsika wants to merge 1 commit intomainfrom
fix/owlgen-single-child-covering-axiom-upstream
Open

fix(owlgen): warn on single-child covering axiom equivalence#5
jdsika wants to merge 1 commit intomainfrom
fix/owlgen-single-child-covering-axiom-upstream

Conversation

@jdsika
Copy link
Copy Markdown

@jdsika jdsika commented Mar 26, 2026

Summary

Emit a warning when an abstract class has only one direct is_a child, since the covering axiom degenerates to an equivalence (Parent ≡ Child). The warning recommends --skip-abstract-class-as-unionof-subclasses to 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 ≡ Child per 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: Add logger.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: Add test_abstract_class_with_single_child_emits_warning (validates warning is logged with flag recommendation) and test_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

@jdsika jdsika force-pushed the fix/owlgen-single-child-covering-axiom-upstream branch from ece07d8 to c2b7088 Compare March 26, 2026 19:47
@jdsika jdsika changed the title fix(owlgen): skip covering axiom for abstract class with single child fix(owlgen): warn on single-child covering axiom equivalence Mar 26, 2026
@jdsika jdsika force-pushed the fix/owlgen-single-child-covering-axiom-upstream branch 2 times, most recently from 13beee4 to 8841b3d Compare March 27, 2026 13:28
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>
@jdsika jdsika force-pushed the fix/owlgen-single-child-covering-axiom-upstream branch from 8841b3d to 2b9e4e9 Compare March 30, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant