Extract & persist IAO:0000700 as hasOntologyRootTerm - #316
Extract & persist IAO:0000700 as hasOntologyRootTerm#316matthewhorridge wants to merge 1 commit into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jvendetti
left a comment
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
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 attributehasOntologyRootTerm, so consumers can start the class hierarchy at the declared roots instead ofowl:Thing. This exposes the metadata only — it does not change the roots computation.Changes
config/schemes/ontology_submission.yml— declarehasOntologyRootTermas an extractable attribute mapped toobo_purl:IAO_0000700. Theobo_purlprefix (http://purl.obolibrary.org/obo/) is already registered inGoo.namespaces, so no namespace is added.lib/ontologies_linked_data/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:metadatanamespace and read from the source IRI viametadataMappings— the same pattern asobsoleteParent.custom_root_terms.owl) — extraction of one or more declared roots, and the absent case (empty value, not an error).The existing
submission_extract_metadataoperation 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 thecontent_metadata_attributesreject list so it appears in the API catalog and the (data-driven) submission edit form; theuser_provided_valueguard 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
/roots. Teaching/rootsto prefer declared roots is a separate, optional step (P4 in CSV Format Change: prefLabel Field Now Contains List Instead of String Value #218).