Two Hop Semantic Link Discoverer
A deterministic, structural SemanticLinkDiscoverer that surfaces two-hop indirect links.
Two entities A and B are linked when they are never directly co-mentioned but both are directly co-mentioned with some shared intermediary entity X (so A-X and X-B are direct edges). The link records X as a connecting entity and the propositions backing the A-X and X-B edges as evidence.
Discovery is fully deterministic: it traverses only the resolved entity ids (EntityMention.resolvedId) of ACTIVE propositions and uses no LLM, vector store, or Neo4j.
Dedupe and ordering. Each unordered entity pair is emitted at most once with sourceEntityId < targetEntityId lexicographically (mirroring the canonical ordering convention used elsewhere in the codebase for cluster dedupe). When multiple intermediaries connect the same pair, their ids are merged into a single link's SemanticLink.connectingEntityIds (sorted) rather than emitting one link per intermediary. The result list is sorted by source id, then target id, then the connecting-id list.
The path length is fixed at two hops (a single shared intermediary); multi-hop discovery is intentionally out of scope for this implementation.
Functions
Discover indirect links among the entities referenced by propositions.