Fixed
CO_OCCURS_WITH and RELATES_AS had the same weight-doubling idempotency bug fixed for CONTAINS in v0.5.4, but couldn't use the same fix directly — these edges deliberately aggregate weight across multiple different documents sharing entities, and there was no per-document contribution tracking to subtract just one document's share on re-upsert.
Added
Two new internal node types, PairWeight and RelationWeight, track each document's contribution separately. On each upsert_document() call, a document's own prior contributions are deleted and rewritten, then the affected shared edge's weight is recomputed as the sum across all contributing documents. If a pair/relation's total contribution drops to zero, the edge is deleted rather than left stale.
Verified — three distinct behaviors, not one
- Identical re-upsert no longer doubles weight
- A genuinely different document sharing the same pair/relation correctly aggregates (proves the fix doesn't break legitimate cross-document aggregation)
- Removing a document's contribution correctly drops the aggregate weight
CO_OCCURS_WITH tested with deterministic Cypher-seeded data. RELATES_AS tested with a real Ollama call (qwen2.5:0.5b, no API key needed) since relation extraction requires a real LLM completion.
Full suite: 80 passed, 1 skipped (unrelated), zero regressions.
PyPI: https://pypi.org/project/ragleap-graph/0.6.0/
Full CHANGELOG: https://github.com/antonyrag/ragleap-core/blob/main/packages/ragleap-graph/CHANGELOG.md