Hide practically-redundant edges from the entity tree browser (with "Show redundant" toggle)#1253
Open
Copilot wants to merge 3 commits into
Open
Hide practically-redundant edges from the entity tree browser (with "Show redundant" toggle)#1253Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/EBISPOT/ols4/sessions/0230412b-1fde-44df-a8ba-5d8d4628de79 Co-authored-by: jamesamcl <454895+jamesamcl@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix tree browser to show correct structural edges
Hide practically-redundant edges from the entity tree browser
May 19, 2026
Member
|
@copilot Can you put this under a toggle "Show redundant" with the other checkboxes. Unticked by default (the new behaviour). But you can tick it to go back to the old behaviour. |
Agent-Logs-Url: https://github.com/EBISPOT/ols4/sessions/265e618c-9fc2-4e1a-b84d-f0a23f33db14 Co-authored-by: jamesamcl <454895+jamesamcl@users.noreply.github.com>
Contributor
Author
Added a "Show redundant" checkbox alongside the existing tree-view toggles, unticked by default (new reduced behaviour); ticking it restores the previous behaviour. The flag is held in the Redux slice as |
Copilot
AI
changed the title
Hide practically-redundant edges from the entity tree browser
Hide practically-redundant edges from the entity tree browser (with "Show redundant" toggle)
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tree browser renders a child directly under a high-level ancestor even when it is already reachable via a more specific term, producing huge flat lists (e.g. ~1,974 direct children under GO:
anatomical structure development). The redundant edges are OWL-valid (adenohypophysis development is_a anatomical structure developmentis not entailment-redundant), so the fix belongs at the display layer, not in the data.Where the fix lives
frontend/src/pages/ontologies/entities/extractEntityHierarchy.ts, which already operates on the in-memory entity subgraph loaded for the tree.rdf2json/HierarchicalParentsAnnotator: that would silently strip edges from the documentedhierarchicalParents/hierarchicalAncestorsAPI responses and from every other consumer ofHIERARCHICAL_PARENT(HierarchyMetricsAnnotator, V1TermRepository, McpClass, …), and would require a full re-ingest to reconfigure."Show redundant" toggle
A new "Show redundant" checkbox is added in
EntityTree.tsxalongside the existing tree-view checkboxes (Show counts / Show obsolete terms / Show all siblings). Unticked by default → new (reduced) behaviour. Tick to restore the pre-fix behaviour where every hierarchical edge is shown.State lives in the Redux
ontologiesslice asdisplayRedundant(defaultfalse);showRedundant/hideRedundantactions wire the checkbox to the slice; the flag is plumbed throughcreateTreeFromEntities→extractEntityHierarchy, where the reduction pass is skipped entirely whenshowRedundant === true. The tree refetches when the toggle changes, and the setting resets along with the other tree settings on ontology / entity changes.Algorithm
Transitive reduction on the child→parent multimap, run after the existing cycle breaker (skipped entirely when "Show redundant" is ticked):
cwith ≥ 2 parents, compute each parent's strict ancestor closure by walkingchildToParentRelationsupward (memoised across children).pᵢredundant iff some other parentpⱼreachespᵢ, andpᵢdoes not also reachpⱼ— the asymmetry guard keeps both endpoints of a hierarchical cycle.(c → pᵢ)relation in place;parentToChildRelationsand root detection downstream automatically reflect the trim.Behaviour on the canonical example
With "Show redundant" unticked (default), parents of
cgo from{a, b}→{b}.cstill appears underain the tree, just transitively viab. With "Show redundant" ticked, both edges remain (pre-fix behaviour).Edge cases handled
a ↔ bcycles — both kept.