Background
When an ontology is marked as flat in BioPortal, hierarchy-related metrics are handled inconsistently. The flat flag is a UI/browsing flag set manually for ontologies where tree display wasn't performant — it's not a statement that the ontology has no hierarchy.
Current behavior
For flat ontologies, some hierarchy metrics report real values while others are zeroed out:
| Metric |
Value |
Why |
maxDepth |
real value (e.g., 7) |
Read from metrics.csv generated by owlapi_wrapper, which has no knowledge of the flat flag |
classesWithOneChild |
0 |
Skipped by unless is_flat guard in class_metrics |
maxChildCount |
0 |
Same |
classesWithMoreThan25Children |
0 |
Same |
averageChildCount |
0 |
Same |
History
Before the owlapi integration (commit 61ee7059), all hierarchy metrics including maxDepth were set to 0 for flat ontologies. The owlapi commit introduced CSV-based maxDepth calculation that bypasses the is_flat check, creating the inconsistency. The test was updated from assert_equal 0 to assert_equal 7 to match.
Options
-
Report real values for all metrics — remove the unless is_flat guard from the groupby_children loop so child metrics also reflect reality. Consistent with maxDepth behavior and with the view that flat is a UI flag.
-
Zero out all hierarchy metrics — add is_flat check to max_depth_fn so maxDepth is also 0. Consistent with pre-owlapi behavior and with the view that flat means "no hierarchy metrics."
Either approach is valid, but the current mixed state should be resolved.
Related
Background
When an ontology is marked as
flatin BioPortal, hierarchy-related metrics are handled inconsistently. Theflatflag is a UI/browsing flag set manually for ontologies where tree display wasn't performant — it's not a statement that the ontology has no hierarchy.Current behavior
For flat ontologies, some hierarchy metrics report real values while others are zeroed out:
maxDepthmetrics.csvgenerated byowlapi_wrapper, which has no knowledge of theflatflagclassesWithOneChildunless is_flatguard inclass_metricsmaxChildCountclassesWithMoreThan25ChildrenaverageChildCountHistory
Before the owlapi integration (commit
61ee7059), all hierarchy metrics includingmaxDepthwere set to 0 for flat ontologies. The owlapi commit introduced CSV-basedmaxDepthcalculation that bypasses theis_flatcheck, creating the inconsistency. The test was updated fromassert_equal 0toassert_equal 7to match.Options
Report real values for all metrics — remove the
unless is_flatguard from thegroupby_childrenloop so child metrics also reflect reality. Consistent withmaxDepthbehavior and with the view thatflatis a UI flag.Zero out all hierarchy metrics — add
is_flatcheck tomax_depth_fnsomaxDepthis also 0. Consistent with pre-owlapi behavior and with the view that flat means "no hierarchy metrics."Either approach is valid, but the current mixed state should be resolved.
Related