Skip to content

Filter negated evidence from Aragorn creative results#127

Open
cbizon wants to merge 2 commits into
BioPack-team:mainfrom
cbizon:codex/edge-negations
Open

Filter negated evidence from Aragorn creative results#127
cbizon wants to merge 2 commits into
BioPack-team:mainfrom
cbizon:codex/edge-negations

Conversation

@cbizon

@cbizon cbizon commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Filter Aragorn creative-mode bindings when the bound edge or any recursively nested support edge has biolink:negated=true.
  • Exit after one cheap knowledge-edge scan when the message contains no negated assertions; no results or support graphs are traversed in the common case.
  • For affected messages, build reverse edge and auxiliary-graph dependencies once, propagate negated and incomplete-support status, and check each binding with constant-time set membership.
  • Preserve an analysis when a query edge still has another valid parallel binding; remove the analysis only when a required query edge has no valid bindings left.
  • Scope the behavior to Aragorn single-edge inferred queries so other Shepherd targets are unchanged.

Testing

  • uv run --no-sync pytest tests/unit/test_merge_message_helpers.py tests/unit/test_merge_message.py tests/unit/test_merge_message_batch.py -q (45 passed).
  • uv run --no-sync pytest tests/unit --ignore=tests/unit/test_cpu.py -q (447 passed).
  • uv run --no-sync black --check workers/merge_message/worker.py tests/unit/test_merge_message_helpers.py.
  • git diff --check.

- Traverse bound edges and recursive support graphs before synthesizing inferred answers.
- Prune negated parallel bindings while preserving analyses that retain valid support.
- Drop analyses with unresolved or wholly invalid query-edge evidence and add regression coverage.
@cbizon

cbizon commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

I worry that this approach will be slow for large queries. @maximusunc what do you think?

- Exit after a single edge scan when no negated assertions are present.
- Build reverse edge and auxiliary-graph dependencies only for affected messages.
- Propagate negated and incomplete support status once, then filter bindings with constant-time lookups.
- Add coverage proving the common no-negation path skips index construction.
@cbizon

cbizon commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up optimization in b259d9f:

  • The common no-negation path now scans knowledge-graph edges once and exits before traversing any results or support graphs.
  • Messages containing negated assertions build one reverse edge/auxiliary-graph dependency index and propagate affected support chains once.
  • Result filtering then uses constant-time set membership instead of recursively walking each binding.
  • Parallel bindings remain independent: a negated binding is removed while a valid binding for the same query edge keeps the analysis alive.
  • Verification: 45 merge tests and 447 applicable unit tests pass.

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.

1 participant