Skip to content

fix: follow SKOS direction for broadMatch/narrowMatch - #27

Open
cmungall wants to merge 1 commit into
fix/splitter-fact-entitiesfrom
fix/skos-direction
Open

fix: follow SKOS direction for broadMatch/narrowMatch#27
cmungall wants to merge 1 commit into
fix/splitter-fact-entitiesfrom
fix/skos-direction

Conversation

@cmungall

@cmungall cmungall commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #17.

  • _make_fact in sssom_converter.py treated A skos:broadMatch B as "A is broader" and emitted ProperSubClassOf(sub=B, sup=A), with narrowMatch handled the opposite way. The SKOS Reference says the object of skos:broader is the broader concept, and broadMatch/narrowMatch are sub-properties of broader/narrower. So A broadMatch B now yields ProperSubClassOf(sub=A, sup=B) and A narrowMatch B yields ProperSubClassOf(sub=B, sup=A).
  • sssom_renderer.py emitted ProperSubClassOf(sub, sup) as sub skos:narrowMatch sup, which per SKOS says sup is narrower. It now emits skos:broadMatch.
  • The OBO and OWL converters route SKOS annotations through _make_fact, so they pick up the fix.
  • Tests in test_sssom_converter.py, test_sssom_renderer.py, and test_ontology_converter.py asserted the inverted reading and are updated. docs/formats.md and docs/ontology-conversion.md now state the direction explicitly; the worked OBO example in the latter already described the correct direction and contradicted the code.

Round-tripping boomer → SSSOM → boomer was self-consistent before, so existing internal results are unaffected. KBs built from third-party SSSOM broadMatch/narrowMatch rows, and any SSSOM exported from boomer for other tools, should be regenerated.

Stacked on #14.

Test plan

  • uv run pytest
  • make doctest (the _make_fact doctests encode the new direction)

🤖 Generated with Claude Code

@claude

claude Bot commented Sep 5, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Per the SKOS Reference, "A skos:broadMatch B" asserts that the object B
is the broader concept, so A is a proper subclass of B; narrowMatch is
the inverse. The SSSOM converter had both reversed, and the SSSOM
renderer emitted ProperSubClassOf(sub, sup) as "sub narrowMatch sup",
which reads as sup being narrower. Round-tripping was self-consistent,
so this only surfaced when exchanging SSSOM with other tools, where
every hierarchical mapping came out reversed. The docs already described
the correct direction for the OBO example.

Fixes #17

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cmungall
cmungall force-pushed the fix/splitter-fact-entities branch from fc3d97b to f1809a2 Compare September 5, 2026 21:18
@claude

claude Bot commented Sep 5, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

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.

2 participants