Skip to content

Extract & persist IAO:0000700 as hasOntologyRootTerm - #316

Open
matthewhorridge wants to merge 1 commit into
ncbo:developfrom
matthewhorridge:feature/iao700-root-terms
Open

Extract & persist IAO:0000700 as hasOntologyRootTerm#316
matthewhorridge wants to merge 1 commit into
ncbo:developfrom
matthewhorridge:feature/iao700-root-terms

Conversation

@matthewhorridge

Copy link
Copy Markdown

Closes #315. Part of the ontology-root-terms feature tracked in ncbo/bioportal-project#218.

Read an ontology's declared root terms (IAO:0000700, "has ontology root term") at submission-processing time and store them as a submission attribute hasOntologyRootTerm, so consumers can start the class hierarchy at the declared roots instead of owl:Thing. This exposes the metadata only — it does not change the roots computation.

Changes

  • config/schemes/ontology_submission.yml — declare hasOntologyRootTerm as an extractable attribute mapped to obo_purl:IAO_0000700. The obo_purl prefix (http://purl.obolibrary.org/obo/) is already registered in Goo.namespaces, so no namespace is added.
  • lib/ontologies_linked_data/models/ontology_submission.rbattribute :hasOntologyRootTerm, type: %i[list uri]. No namespace: the source property has a numeric local name (IAO_0000700), so it is stored under the default :metadata namespace and read from the source IRI via metadataMappings — the same pattern as obsoleteParent.
  • Tests + fixture (custom_root_terms.owl) — extraction of one or more declared roots, and the absent case (empty value, not an error).

The existing submission_extract_metadata operation queries with the ontology IRI as subject and handles list/uri attributes, so no new extraction code was needed. The attribute is kept out of the content_metadata_attributes reject list so it appears in the API catalog and the (data-driven) submission edit form; the user_provided_value guard preserves a manually set value across re-processing.

Testing

Tests pass against the 4store backend: 2 runs, 15 assertions, 0 failures, 0 errors, 0 skips.

Notes

Read an ontology's declared root terms (IAO:0000700, "has ontology root
term") at submission-processing time and store them as a submission
attribute, so consumers can start the class hierarchy at the declared roots
instead of owl:Thing. This exposes the metadata only; it does not change the
roots computation. Part of ncbo/bioportal-project#218.

- config/schemes/ontology_submission.yml: declare hasOntologyRootTerm as an
  extractable attribute mapped to obo_purl:IAO_0000700. The obo_purl prefix
  (http://purl.obolibrary.org/obo/) is already registered in Goo.namespaces.
- models/ontology_submission.rb: attribute :hasOntologyRootTerm, type
  %i[list uri]. No namespace — the source property has a numeric local name
  (IAO_0000700), so it is stored under the default :metadata namespace and
  read from the source IRI via metadataMappings, the same pattern as
  obsoleteParent.
- Tests + a small fixture (custom_root_terms.owl) covering extraction of one
  or more declared roots and the absent case (empty, not an error).

The existing submission_extract_metadata operation queries with the ontology
IRI as subject and handles list/uri attributes, so no new extraction code is
needed. The attribute is kept out of the content_metadata_attributes reject
list so it appears in the API catalog and the (data-driven) submission edit
form; the user_provided_value guard preserves a manually set value across
re-processing.

Tests pass against the 4store backend (2 runs, 15 assertions, 0 failures).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.03%. Comparing base (8f85ce9) to head (5ba0e65).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #316   +/-   ##
========================================
  Coverage    82.03%   82.03%           
========================================
  Files          101      101           
  Lines         6853     6854    +1     
========================================
+ Hits          5622     5623    +1     
  Misses        1231     1231           
Flag Coverage Δ
ag 81.96% <100.00%> (+0.04%) ⬆️
fs 82.02% <100.00%> (+0.04%) ⬆️
gd 81.96% <100.00%> (+0.04%) ⬆️
unittests 82.03% <100.00%> (+<0.01%) ⬆️
vo 81.92% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor note for ncbo/bioportal_web_ui#548 that's built on top of this:

As a list + extractedMetadata attribute, hasOntologyRootTerm inherits send_value's union-on-reprocess semantics (submission_extract_metadata.rb:151-163). New submissions are unaffected, and reprocessing the same file re-extracts the same values, so in practice this only shows up if someone curates the value by hand and a later reprocess merges the declared roots back in — the user_provided_value guard doesn't catch that, since it only fires when the key is in user_params and a plain reprocess passes none.

Not worth addressing now. Just putting the comment here as a reminder if a curated root list ever comes back with extra entries.


#Ontology root term(s)
hasOntologyRootTerm:
display: "relations"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be display: "content"? "relations" is otherwise ontology→ontology (hasPriorVersion, ontologyRelatedTo, isAlignedTo), while the other class-valued attributes — obsoleteParent, keyClasses — are under content, as is the root-resources entry at line 1523. Affects grouping in the
metadata catalog and the submission edit form, so easier to change now than once something is rendering it.

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