Skip to content

Inconsistent hierarchy metrics for flat ontologies #281

@alexskr

Description

@alexskr

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

  1. 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.

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions