Skip to content

Remove duplicate OBO relationship annotations (keep treeView) - #39

Merged
jvendetti merged 2 commits into
ncbo:masterfrom
matthewhorridge:feature/dedup-obo-relationship-annotations
Aug 17, 2026
Merged

Remove duplicate OBO relationship annotations (keep treeView)#39
jvendetti merged 2 commits into
ncbo:masterfrom
matthewhorridge:feature/dedup-obo-relationship-annotations

Conversation

@matthewhorridge

Copy link
Copy Markdown

Follow-up to #37. Please review/merge #37 first — this branch is stacked on it (its base is #37's branch, so the diff here is only the de-duplication change).

What

Removes the duplicate OBO relationship annotations left over now that #37 emits every relationship under the property's own IRI.

Before #37, generateGroundTriplesForAxioms emitted, for the whitelisted OBO properties, a metadata/obo/part_of | obo/contains | obo/develops_from annotation plus a treeView edge, and a generic annotation (under the property's own IRI) for any other obo-namespace property. With #37, the relationship is already emitted under the property's own IRI for every property, so those metadata/obo/* annotations and the generic branch are redundant — a part_of relationship appeared twice in a class's property listing (once as obo/part_of, once as BFO_0000050).

Change

Keep only the treeView edges (which drive the OBO class hierarchy, OntologyFormat#tree_property), with their existing per-property direction:

  • part_of / develops_from (and IRIs): treeView subclass → filler
  • contains (and IRI): treeView filler → subclass

The relationships themselves are now emitted once, uniformly, by generateRelationshipTriples. Since the method now only produces treeView edges, it is renamed generateGroundTriplesForAxiomsgenerateTreeViewEdges.

Verified on ENVO: treeView edges unchanged, metadata/obo/part_of annotations drop to 0, and each part_of relationship still present once under its own IRI (BFO_0000050). Full wrapper test suite green (48 tests).

Coordinated change required (separate PR)

The metadata/obo/* relationship predicates have no production consumer in ontologies_linked_data, ontologies_api, or bioportal_web_ui. The only reference is the ontologies_linked_data test test_obo_part_of (test/models/test_ontology_submission.rb), which asserts metadata/obo/part_of for TAO_0001044 → TAO_0000732. That test must be updated to assert the relationship under the property's own IRI instead; the treeView assertion in the same test is unchanged. This will be done as a separate PR against ontologies_linked_data, verified against its (triplestore-backed) test environment.

generateGroundTriplesForAxioms only recognised the flat shape
SubClassOf(A, someValuesFrom(p, B)) and only for a hard-coded set of OBO
properties (part_of, contains, develops_from and their IRIs), gated on the
property IRI containing "obo". Relationships on any other property — e.g.
EDAM's has_topic/has_output/has_input — were silently dropped, which is why
some relationships appear in the class Details view and others do not.

Add generateRelationshipTriples, which visits the class expression of every
SubClassOf and EquivalentClasses axiom of a named class (RelationshipVisitor,
an OWLClassExpressionVisitorAdapter) and emits a relationship triple
(subject --p--> filler, under the property's own IRI) for every
someValuesFrom, hasValue, and min/exact cardinality (n >= 1). Intersection
operands are traversed, both in the superclass expression and in a
restriction's filler, so SubClassOf(A, p some (B and C)) yields A p B and
A p C, and relationships stated via equivalences are extracted too. Unions,
complements and allValuesFrom are not traversed/emitted (not entailed for
every instance).

This is additive: the existing OBO treeView/hierarchy emission is left
unchanged, so the class tree is unaffected; the Details view now shows the
full set of relationships. Verified on EDAM and UBERON, and with a fixture
covering each shape.
generateGroundTriplesForAxioms emitted, for the whitelisted OBO properties,
a metadata/obo/part_of|contains|develops_from annotation and a treeView edge,
plus a generic annotation (under the property's own IRI) for any other
obo-namespace property. Now that generateRelationshipTriples emits every
relationship under the property's own IRI, the metadata/obo/* annotations and
the generic branch are redundant: a part_of relationship appeared twice in a
class's property listing (once as obo/part_of, once as its own IRI).

Keep only the treeView edges, which drive the OBO class hierarchy
(OntologyFormat#tree_property), with their existing per-property direction
(part_of/develops_from: subclass -> filler; contains: filler -> subclass).
The relationships themselves are now emitted once, uniformly, by
generateRelationshipTriples. Since the method now only produces treeView
edges, rename it generateGroundTriplesForAxioms -> generateTreeViewEdges.

The metadata/obo/* relationship predicates have no production consumer in
ontologies_linked_data, ontologies_api or bioportal_web_ui; the only reference
is the ontologies_linked_data test test_obo_part_of, which asserts obo/part_of
and must be updated to match (assert the relationship under the property's own
IRI; the treeView assertion is unchanged).
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.69231% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.81%. Comparing base (5c970cd) to head (2bd55c8).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
...g/stanford/ncbo/owlapi/wrapper/OntologyParser.java 87.69% 2 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #39      +/-   ##
============================================
+ Coverage     72.64%   74.81%   +2.16%     
- Complexity      167      174       +7     
============================================
  Files            16       16              
  Lines           753      790      +37     
  Branches        117      128      +11     
============================================
+ Hits            547      591      +44     
+ Misses          158      152       -6     
+ Partials         48       47       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jvendetti
jvendetti merged commit 428d6f9 into ncbo:master Aug 17, 2026
1 check passed
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.

3 participants