Commit ece07d8
committed
fix(owlgen): skip covering axiom for abstract class with single child
The covering axiom code emits AbstractClass rdfs:subClassOf unionOf(children)
for abstract classes. When there is exactly one child, _union_of([C]) returns
the child URI directly (single-element optimisation in _boolean_expression),
producing the bare triple AbstractClass rdfs:subClassOf Child.
Combined with the already-present Child rdfs:subClassOf AbstractClass (from
the is_a declaration), this creates a bidirectional rdfs:subClassOf -- which
per W3C OWL 2 Primer section 4.2 is semantically identical to owl:equivalentClass.
This unintended equivalence causes any class later added as a second child of
the abstract parent to inherit all constraints of the first child via RDFS
transitivity.
Fix: change 'if children:' to 'if len(children) > 1:' so the covering axiom
is only emitted when the union is meaningful (>= 2 members). Also update the
field docstring and CLI help text to reflect the new >= 2 threshold, add
regression tests to the existing test_owlgen.py module, and update OWL
snapshots (meta.owl, biolink.owl.ttl).
Refs:
- W3C OWL 2 Primer section 4.2 (bidirectional SubClassOf = EquivalentClasses)
- W3C OWL 2 Syntax section 9.1.4 (DisjointUnion as proper covering construct)
Signed-off-by: jdsika <carlo.van-driesten@bmw.de>1 parent 8b7bfa4 commit ece07d8
4 files changed
Lines changed: 82 additions & 8 deletions
File tree
- packages/linkml/src/linkml/generators
- tests/linkml
- test_base/__snapshots__
- test_biolink_model/__snapshots__
- test_generators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
469 | 470 | | |
470 | 471 | | |
471 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
472 | 478 | | |
473 | 479 | | |
474 | | - | |
| 480 | + | |
475 | 481 | | |
476 | 482 | | |
477 | 483 | | |
| |||
1569 | 1575 | | |
1570 | 1576 | | |
1571 | 1577 | | |
1572 | | - | |
| 1578 | + | |
1573 | 1579 | | |
1574 | 1580 | | |
1575 | 1581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1729 | 1729 | | |
1730 | 1730 | | |
1731 | 1731 | | |
1732 | | - | |
1733 | 1732 | | |
1734 | 1733 | | |
1735 | 1734 | | |
| |||
7903 | 7902 | | |
7904 | 7903 | | |
7905 | 7904 | | |
7906 | | - | |
7907 | | - | |
| 7905 | + | |
7908 | 7906 | | |
7909 | 7907 | | |
7910 | 7908 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
463 | 534 | | |
464 | 535 | | |
465 | 536 | | |
| |||
0 commit comments